Fix music restart when stacking Grow from item box

This commit is contained in:
AJ Martinez 2023-02-26 18:07:00 -07:00
parent 2cbc035411
commit b0ae0b55db

View file

@ -10521,16 +10521,14 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
player->mo->destscale = FixedMul(player->mo->destscale, SHRINK_SCALE); player->mo->destscale = FixedMul(player->mo->destscale, SHRINK_SCALE);
} }
player->growshrinktimer = max(0, player->growshrinktimer);
player->growshrinktimer += ((gametyperules & GTR_CLOSERPLAYERS) ? 8 : 12) * TICRATE;
if (player->invincibilitytimer > 0) if (player->invincibilitytimer > 0)
{ {
; // invincibility has priority in P_RestoreMusic, no point in starting here ; // invincibility has priority in P_RestoreMusic, no point in starting here
} }
else if (P_IsLocalPlayer(player) == true) else if (P_IsLocalPlayer(player) == true)
{ {
S_ChangeMusicSpecial("kgrow"); if (player->growshrinktimer < 1)
S_ChangeMusicSpecial("kgrow");
} }
else //used to be "if (P_IsDisplayPlayer(player) == false)" else //used to be "if (P_IsDisplayPlayer(player) == false)"
{ {
@ -10538,6 +10536,10 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
} }
P_RestoreMusic(player); P_RestoreMusic(player);
player->growshrinktimer = max(0, player->growshrinktimer);
player->growshrinktimer += ((gametyperules & GTR_CLOSERPLAYERS) ? 8 : 12) * TICRATE;
S_StartSound(player->mo, sfx_kc5a); S_StartSound(player->mo, sfx_kc5a);
player->itemamount--; player->itemamount--;