Okay, this is way beyond the scope of the branch... but low-friction surfaces (ice, oil, etc) now:

* Actively impede your acceleration
* Make your animation speeds faster whenever you're moving (to give off that Looney Tunes effect)

The former change is something that was present in the few low-friction circumstances in the classics, and makes low-friction surfaces more of an active challenge. The latter change is just something I did for fun to more clearly communicate that things are different with the physics here.

High friction surfaces DO NOT involve any of this, since it ended up basically cheesing their existing gameplay.
This commit is contained in:
toasterbabe 2016-06-03 17:26:50 +01:00
parent 5a0432816b
commit 1e6b213d6c
3 changed files with 25 additions and 5 deletions

View File

@ -285,7 +285,8 @@ boolean P_SetPlayerMobjState(mobj_t *mobj, statenum_t state)
// Adjust the player's animation speed to match their velocity.
if (!(disableSpeedAdjust || player->charflags & SF_NOSPEEDADJUST))
{
fixed_t speed = FixedDiv(player->speed, mobj->scale);
fixed_t speed = FixedDiv(player->speed, FixedMul(mobj->scale, player->mo->movefactor));
if (player->panim == PA_ROLL)
{
if (speed > 16<<FRACBITS)
@ -1622,7 +1623,6 @@ static void P_SceneryXYFriction(mobj_t *mo, fixed_t oldx, fixed_t oldy)
{
// Stolen from P_SpawnFriction
mo->friction = FRACUNIT - 0x100;
mo->movefactor = ((0x10092 - mo->friction)*(0x70))/0x158;
}
else
mo->friction = ORIG_FRICTION;
@ -2658,7 +2658,6 @@ static boolean P_ZMovement(mobj_t *mo)
// Stolen from P_SpawnFriction
mo->friction = FRACUNIT - 0x100;
mo->movefactor = ((0x10092 - mo->friction)*(0x70))/0x158;
}
else if (mo->type == MT_FALLINGROCK)
{
@ -7799,7 +7798,7 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type)
mobj->friction = ORIG_FRICTION;
mobj->movefactor = ORIG_FRICTION_FACTOR;
mobj->movefactor = ORIG_FRICTION;
// All mobjs are created at 100% scale.
mobj->scale = FRACUNIT;

View File

@ -6998,11 +6998,19 @@ void T_Friction(friction_t *f)
if ((thing->friction == ORIG_FRICTION) // normal friction?
|| (f->friction < thing->friction))
{
thing->friction = f->friction;
if (thing->player)
thing->movefactor = f->friction;
}
}
else if (P_GetSpecialBottomZ(thing, sec, sec) == thing->floorz && (thing->friction == ORIG_FRICTION // normal friction?
|| f->friction < thing->friction))
{
thing->friction = f->friction;
if (thing->player)
thing->movefactor = f->friction;
}
}
node = node->m_snext;
}

View File

@ -4673,6 +4673,9 @@ static void P_3dMovement(player_t *player)
acceleration = player->accelstart + (FixedDiv(player->speed, player->mo->scale)>>FRACBITS) * player->acceleration;
}
// Friction-scaled acceleration...
acceleration = FixedMul(acceleration<<FRACBITS, player->mo->movefactor)>>FRACBITS;
// Forward movement
if (player->climbing)
{
@ -6327,7 +6330,8 @@ static void P_SkidStuff(player_t *player)
// If your push angle is more than this close to a full 180 degrees, trigger a skid.
if (dang > ANGLE_157h)
{
player->skidtime = TICRATE/2;
//player->skidtime = TICRATE/2;
player->skidtime = (FixedDiv(35<<(FRACBITS-1), FixedSqrt(player->mo->movefactor)))>>FRACBITS;
S_StartSound(player->mo, sfx_skid);
if (player->panim != PA_WALK)
P_SetPlayerMobjState(player->mo, S_PLAY_WALK);
@ -6364,6 +6368,14 @@ static void P_MovePlayer(player_t *player)
cmd = &player->cmd;
runspd = FixedMul(player->runspeed, player->mo->scale);
// Let's have some movement speed fun on low-friction surfaces, JUST for players... (high friction surfaces shouldn't have any adjustment, since the acceleration in this game is super high and that ends up cheesing high-friction surfaces.)
player->mo->movefactor = FixedDiv(ORIG_FRICTION, player->mo->movefactor);
if (player->mo->movefactor < FRACUNIT)
player->mo->movefactor = 8*player->mo->movefactor - 7*FRACUNIT;
else
player->mo->movefactor = FRACUNIT;
runspd = FixedMul(runspd, player->mo->movefactor);
// Control relinquishing stuff!
if (player->powers[pw_ingoop])
player->pflags |= PF_FULLSTASIS;
@ -6535,6 +6547,7 @@ static void P_MovePlayer(player_t *player)
if (!player->mo->momx && !player->mo->momy && !player->mo->momz && player->panim == PA_WALK)
P_SetPlayerMobjState(player->mo, S_PLAY_STND);
player->mo->movefactor = ORIG_FRICTION; // We're not going to do any more with this, so let's change it back for the next frame.
//////////////////
//GAMEPLAY STUFF//