Fix TA amp calculation underflow

This commit is contained in:
Antonio Martinez 2025-05-18 13:41:26 -04:00
parent cacf470f6f
commit 6642b82793

View file

@ -2037,6 +2037,7 @@ static void K_HandleLapIncrement(player_t *player)
if (G_TimeAttackStart() && !linecrossed)
{
linecrossed = leveltime;
CONS_Printf("ta start\n");
if (starttime > leveltime) // Overlong starts shouldn't reset time on cross
{
// Award some Amps for a fast start, to counterbalance Obvious Rainbow Driftboost
@ -2045,9 +2046,13 @@ static void K_HandleLapIncrement(player_t *player)
starthaste = TIMEATTACK_START - starthaste; // How much time we wasted before crossing
tic_t leniency = TICRATE*2; // How long we can take to cross with no penalty to amp payout
starthaste = max(0, starthaste - leniency);
fixed_t ampreward = Easing_OutQuart(starthaste*FRACUNIT/TIMEATTACK_START, 100*FRACUNIT, 0);
if (starthaste <= leniency)
starthaste = 0;
else
starthaste -= leniency;
fixed_t ampreward = Easing_OutQuart(starthaste*FRACUNIT/TIMEATTACK_START, 100*FRACUNIT, 0);
K_SpawnAmps(player, ampreward/FRACUNIT, player->mo);
// And reset our time to 0.