diff --git a/src/p_mobj.c b/src/p_mobj.c index 9e061950f..ec418fb93 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -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<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; diff --git a/src/p_spec.c b/src/p_spec.c index ddad3cde3..d2ac5b6a9 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -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; } diff --git a/src/p_user.c b/src/p_user.c index 02e3308d0..6aebbe642 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -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<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//