Sliptide/drift exit cleanup

This commit is contained in:
AJ Martinez 2023-10-21 19:50:21 -07:00
parent 9c585e35de
commit 6ad7c7692c
4 changed files with 24 additions and 4 deletions

View file

@ -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
}

View file

@ -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);

View file

@ -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)

View file

@ -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;