Add K_IsPlayingDisplayPlayer for HUD sounds

This commit is contained in:
AJ Martinez 2023-11-10 17:28:54 -07:00
parent e3fe3ed54a
commit 4997c4c0ed
3 changed files with 11 additions and 3 deletions

View file

@ -12630,4 +12630,10 @@ void K_SetTireGrease(player_t *player, tic_t tics)
player->tiregrease = tics;
}
// somewhat sensible check for HUD sounds in a post-bot-takeover world
boolean K_IsPlayingDisplayPlayer(player_t *player)
{
return P_IsDisplayPlayer(player) && (!player->exiting);
}
//}

View file

@ -243,6 +243,8 @@ boolean K_isPlayerInSpecialState(player_t *p);
void K_SetTireGrease(player_t *player, tic_t tics);
boolean K_IsPlayingDisplayPlayer(player_t *player);
#ifdef __cplusplus
} // extern "C"
#endif

View file

@ -1633,7 +1633,7 @@ void K_KartItemRoulette(player_t *const player, ticcmd_t *const cmd)
//player->karthud[khud_itemblinkmode] = 1;
//player->karthud[khud_rouletteoffset] = K_GetRouletteOffset(roulette, FRACUNIT);
if (P_IsDisplayPlayer(player))
if (K_IsPlayingDisplayPlayer(player))
{
S_StartSound(NULL, sfx_itrole);
}
@ -1680,7 +1680,7 @@ void K_KartItemRoulette(player_t *const player, ticcmd_t *const cmd)
player->karthud[khud_itemblinkmode] = 0;
player->karthud[khud_rouletteoffset] = K_GetRouletteOffset(roulette, FRACUNIT);
if (P_IsDisplayPlayer(player))
if (K_IsPlayingDisplayPlayer(player))
{
if (roulette->ringbox)
{
@ -1714,7 +1714,7 @@ void K_KartItemRoulette(player_t *const player, ticcmd_t *const cmd)
// This makes the roulette produce the random noises.
roulette->sound = (roulette->sound + 1) % 8;
if (P_IsDisplayPlayer(player))
if (K_IsPlayingDisplayPlayer(player))
{
if (roulette->ringbox)
S_StartSound(NULL, sfx_s240);