mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Fix TA amp calculation underflow
This commit is contained in:
parent
cacf470f6f
commit
6642b82793
1 changed files with 7 additions and 2 deletions
|
|
@ -2037,6 +2037,7 @@ static void K_HandleLapIncrement(player_t *player)
|
||||||
if (G_TimeAttackStart() && !linecrossed)
|
if (G_TimeAttackStart() && !linecrossed)
|
||||||
{
|
{
|
||||||
linecrossed = leveltime;
|
linecrossed = leveltime;
|
||||||
|
CONS_Printf("ta start\n");
|
||||||
if (starttime > leveltime) // Overlong starts shouldn't reset time on cross
|
if (starttime > leveltime) // Overlong starts shouldn't reset time on cross
|
||||||
{
|
{
|
||||||
// Award some Amps for a fast start, to counterbalance Obvious Rainbow Driftboost
|
// 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
|
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
|
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);
|
K_SpawnAmps(player, ampreward/FRACUNIT, player->mo);
|
||||||
|
|
||||||
// And reset our time to 0.
|
// And reset our time to 0.
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue