P_DoAllPlayersExit: Play finish sounds on successful execution

- If a local player is already finished, don't play any sound
- If the local players finish as a result of this, play the race finish line cross sound
- Else, play the race opponent finish line cross sound
This commit is contained in:
toaster 2023-05-02 18:14:17 +01:00
parent 12ecb1f7a4
commit 9497941ef6

View file

@ -1376,6 +1376,7 @@ void P_DoAllPlayersExit(pflags_t flags, boolean trygivelife)
{
UINT8 i;
boolean givenlife = false;
const boolean dofinishsound = (musiccountdown == 0);
for (i = 0; i < MAXPLAYERS; i++)
{
@ -1399,6 +1400,22 @@ void P_DoAllPlayersExit(pflags_t flags, boolean trygivelife)
givenlife = true;
}
if (!dofinishsound)
{
// You've already finished, don't play again
;
}
else if (musiccountdown == 0)
{
// Other people finish
S_StartSound(NULL, sfx_s253);
}
else if (musiccountdown > 1)
{
// Everyone finish sound
S_StartSound(NULL, sfx_s3k6a);
}
if (givenlife)
{
// Life sound