From 6642b82793c87f1c65632c391ad0dea916db8e41 Mon Sep 17 00:00:00 2001 From: Antonio Martinez Date: Sun, 18 May 2025 13:41:26 -0400 Subject: [PATCH] Fix TA amp calculation underflow --- src/p_spec.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/p_spec.c b/src/p_spec.c index b8abed3a4..34d93f10c 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -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.