Slow down top if player's out of control

This commit is contained in:
AJ Martinez 2024-01-13 20:30:20 -07:00
parent f9c192b04d
commit a76507e17f
4 changed files with 30 additions and 2 deletions

View file

@ -953,6 +953,8 @@ struct player_t
UINT8 lastsafelap;
fixed_t topAccel; // Reduced on straight wall collisions to give players extra recovery time
mobj_t *stumbleIndicator;
mobj_t *wavedashIndicator;
mobj_t *trickIndicator;

View file

@ -2362,6 +2362,8 @@ void G_PlayerReborn(INT32 player, boolean betweenmaps)
p->ringvolume = 255;
p->topAccel = MAXTOPACCEL;
p->botvars.rubberband = FRACUNIT;
p->spectatorReentry = spectatorReentry;

View file

@ -3531,7 +3531,7 @@ fixed_t K_GetKartAccel(const player_t *player)
// Marble Garden Top gets 1200% accel
if (player->curshield == KSHIELD_TOP)
{
k_accel *= 12;
k_accel = FixedMul(k_accel, player->topAccel);
}
if (K_PodiumSequence() == true)
@ -3651,7 +3651,17 @@ SINT8 K_GetForwardMove(const player_t *player)
}
else
{
forwardmove = MAXPLMOVE;
// forwardmove = MAXPLMOVE;
UINT8 minmove = MAXPLMOVE/10;
fixed_t assistmove = (MAXPLMOVE - minmove) * FRACUNIT;
angle_t topdelta = player->mo->angle - K_MomentumAngle(player->mo);
fixed_t topmult = FINECOSINE(topdelta >> ANGLETOFINESHIFT);
topmult = (topmult/2) + (FRACUNIT/2);
assistmove = FixedMul(topmult, assistmove);
forwardmove = minmove + FixedInt(assistmove);
}
}
@ -8723,6 +8733,17 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd)
}
}
// Players that bounce far off walls get reduced Top accel, to give them some time to get their bearings.
if ((player->mo->eflags & MFE_JUSTBOUNCEDWALL) && player->curshield == KSHIELD_TOP)
{
angle_t topdelta = player->mo->angle - K_MomentumAngle(player->mo);
fixed_t topmult = FINECOSINE(topdelta >> ANGLETOFINESHIFT);
topmult = (topmult/2) + (FRACUNIT/2); // 0 to original
player->topAccel = FixedMul(topmult, player->topAccel);
}
player->topAccel = min(player->topAccel + TOPACCELREGEN, MAXTOPACCEL);
if (player->stealingtimer == 0
&& player->rocketsneakertimer
&& onground == true)

View file

@ -52,6 +52,9 @@ Make sure this matches the actual number of states
#define RINGVOLUMEUSEPENALTY 15
#define RINGVOLUMEREGEN 1
#define MAXTOPACCEL (12*FRACUNIT)
#define TOPACCELREGEN (FRACUNIT/16)
// 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)