From fc1abdd7f8ac083f86c63722a80e7142b0f51299 Mon Sep 17 00:00:00 2001 From: toaster Date: Thu, 22 Aug 2019 16:13:00 +0100 Subject: [PATCH] Autobrake polish! * Make it actually look like a brake, so people can tell it's on instead of just having high friction. * Fix it fucking with spring chains (caused by being unwittingly active for the first tic of spring collision). --- src/p_map.c | 3 +++ src/p_user.c | 10 ++++++++++ 2 files changed, 13 insertions(+) diff --git a/src/p_map.c b/src/p_map.c index cc9209ea8..15fa97c8f 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -285,6 +285,9 @@ boolean P_DoSpring(mobj_t *spring, mobj_t *object) if (spring->info->painchance != 2) { + if (object->player) + object->player->pflags &= ~PF_APPLYAUTOBRAKE; + if ((horizspeed && vertispeed) || (object->player && object->player->homing)) // Mimic SA { object->momx = object->momy = 0; diff --git a/src/p_user.c b/src/p_user.c index fc1d97e49..74901c469 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -11233,6 +11233,16 @@ void P_PlayerThink(player_t *player) if (!currentlyonground) acceleration /= 2; + // fake skidding! see P_SkidStuff for reference on conditionals + else if (!player->skidtime && !(player->mo->eflags & MFE_GOOWATER) && !(player->pflags & (PF_JUMPED|PF_SPINNING|PF_SLIDING)) && !(player->charflags & SF_NOSKID) && P_AproxDistance(player->mo->momx, player->mo->momy) >= FixedMul(player->runspeed/2, player->mo->scale)) + { + if (player->mo->state-states != S_PLAY_SKID) + P_SetPlayerMobjState(player->mo, S_PLAY_SKID); + player->mo->tics = player->skidtime = (player->mo->movefactor == FRACUNIT) ? TICRATE/2 : (FixedDiv(35<<(FRACBITS-1), FixedSqrt(player->mo->movefactor)))>>FRACBITS; + + if (P_IsLocalPlayer(player)) // the sound happens way more frequently now, so give co-op players' ears a brake... + S_StartSound(player->mo, sfx_skid); + } if (player->mo->movefactor != FRACUNIT) // Friction-scaled acceleration... acceleration = FixedMul(acceleration<mo->movefactor)>>FRACBITS;