K_DoInvincibility: fix S-Monitor power-up after time gain change

This commit is contained in:
James R 2024-03-02 17:43:06 -08:00
parent 36c6af6eae
commit f3548d2ec8
2 changed files with 4 additions and 3 deletions

View file

@ -6729,7 +6729,7 @@ void K_DoInvincibility(player_t *player, tic_t time)
S_StartSound(player->mo, sfx_alarmi); S_StartSound(player->mo, sfx_alarmi);
} }
player->invincibilitytimer = max(time, player->invincibilitytimer + 5*TICRATE); player->invincibilitytimer = time;
} }
void K_KillBananaChain(mobj_t *banana, mobj_t *inflictor, mobj_t *source) void K_KillBananaChain(mobj_t *banana, mobj_t *inflictor, mobj_t *source)
@ -12079,7 +12079,8 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
UINT32 behindScaled = behind * TICRATE / 4000; UINT32 behindScaled = behind * TICRATE / 4000;
behindScaled = min(behindScaled, 10*TICRATE); behindScaled = min(behindScaled, 10*TICRATE);
K_DoInvincibility(player, 10 * TICRATE + behindScaled); K_DoInvincibility(player,
max(10u * TICRATE + behindScaled, player->invincibilitytimer + 5u*TICRATE));
K_PlayPowerGloatSound(player->mo); K_PlayPowerGloatSound(player->mo);
player->itemamount--; player->itemamount--;
player->botvars.itemconfirm = 0; player->botvars.itemconfirm = 0;

View file

@ -58,7 +58,7 @@ void K_GivePowerUp(player_t* player, kartitems_t powerup, tic_t time)
{ {
case POWERUP_SMONITOR: case POWERUP_SMONITOR:
K_AddMessageForPlayer(player, "Got S MONITOR!", true, false); K_AddMessageForPlayer(player, "Got S MONITOR!", true, false);
K_DoInvincibility(player, time); K_DoInvincibility(player, player->invincibilitytimer + time);
player->powerup.superTimer += time; player->powerup.superTimer += time;
break; break;