From 6ad7c7692cc82607e6a929e0a6739cbf20f13368 Mon Sep 17 00:00:00 2001 From: AJ Martinez Date: Sat, 21 Oct 2023 19:50:21 -0700 Subject: [PATCH] Sliptide/drift exit cleanup --- src/k_kart.c | 8 ++++---- src/k_kart.h | 4 ++++ src/p_inter.c | 5 +++++ src/p_user.c | 11 +++++++++++ 4 files changed, 24 insertions(+), 4 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index 182e0a7cb..d8548c27d 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -4232,8 +4232,8 @@ void K_UpdateSliptideZipIndicator(player_t *player) mobj->angle = momentumAngle + ANGLE_90; P_SetScale(mobj, 3 * player->mo->scale / 2); - // No stored boost - if (player->sliptideZip == 0) + // No stored boost (or negligible enough that it might be a mistake) + if (player->sliptideZip <= HIDEWAVEDASHCHARGE) { mobj->renderflags |= RF_DONTDRAW; mobj->frame = 7; @@ -9892,7 +9892,7 @@ static void K_KartDrift(player_t *player, boolean onground) { if (!keepsliptide && K_IsLosingSliptideZip(player) && player->sliptideZip > 0) { - if (!S_SoundPlaying(player->mo, sfx_waved2)) + if (!S_SoundPlaying(player->mo, sfx_waved2) && player->sliptideZip > HIDEWAVEDASHCHARGE) S_StartSoundAtVolume(player->mo, sfx_waved2, 255); // Losing combo time, going to boost S_StopSoundByID(player->mo, sfx_waved1); S_StopSoundByID(player->mo, sfx_waved4); @@ -9954,7 +9954,7 @@ static void K_KartDrift(player_t *player, boolean onground) player->sliptideZipDelay = 0; S_StopSoundByID(player->mo, sfx_waved2); S_StopSoundByID(player->mo, sfx_waved4); - if (!S_SoundPlaying(player->mo, sfx_waved1)) + if (!S_SoundPlaying(player->mo, sfx_waved1) && player->sliptideZip > HIDEWAVEDASHCHARGE) S_StartSoundAtVolume(player->mo, sfx_waved1, 255); // Charging } diff --git a/src/k_kart.h b/src/k_kart.h index 7d0379760..56f9428bf 100644 --- a/src/k_kart.h +++ b/src/k_kart.h @@ -54,6 +54,10 @@ Make sure this matches the actual number of states #define RINGVOLUMEUSEPENALTY 15 #define RINGVOLUMEREGEN 3 +// Mispredicted turns can generate phantom sliptide inputs for a few tics. +// Delay the wavedash visuals until we're reasonably sure that it's a deliberate turn. +#define HIDEWAVEDASHCHARGE (60) + angle_t K_ReflectAngle(angle_t angle, angle_t against, fixed_t maxspeed, fixed_t yourspeed); boolean K_IsDuelItem(mobjtype_t type); diff --git a/src/p_inter.c b/src/p_inter.c index 740ecc28f..1491147fb 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -2490,6 +2490,11 @@ static boolean P_KillPlayer(player_t *player, mobj_t *inflictor, mobj_t *source, P_SetPlayerMobjState(player->mo, player->mo->info->deathstate); + if (player->sliptideZipIndicator && !P_MobjWasRemoved(player->sliptideZipIndicator)) + P_RemoveMobj(player->sliptideZipIndicator); + if (player->stumbleIndicator && !P_MobjWasRemoved(player->stumbleIndicator)) + P_RemoveMobj(player->stumbleIndicator); + if (type == DMG_TIMEOVER) { if (gametyperules & GTR_CIRCUIT) diff --git a/src/p_user.c b/src/p_user.c index 7126afb9a..5d8520cbc 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -2272,6 +2272,17 @@ static void P_UpdatePlayerAngle(player_t *player) // With a full slam on the analog stick, how far could we steer in either direction? INT16 steeringRight = K_UpdateSteeringValue(player->steering, KART_FULLTURN); INT16 steeringLeft = K_UpdateSteeringValue(player->steering, -KART_FULLTURN); + + // When entering/leaving drifts, allow all legal turns with no easing. + // This is the hardest case for the turn solver, because your handling properties on + // client side are very different than your handling properties on server side—at least, + // until your drift status makes the full round-trip and is reflected in your gamestate. + if (player->drift && abs(player->drift) < 5) + { + steeringRight = KART_FULLTURN; + steeringLeft = -KART_FULLTURN; + } + angle_t maxTurnRight = K_GetKartTurnValue(player, steeringRight) << TICCMD_REDUCE; angle_t maxTurnLeft = K_GetKartTurnValue(player, steeringLeft) << TICCMD_REDUCE;