P_EndingMusic: Play "EMRLD" in Emerald contexts

- gametype has GTR_POWERSTONES and any one player has all 7 emeralds
- gametyperules & GTR_SPECIALSTART and any one player isn't losing
- GP after completing a GPEVENT_SPECIAL and any one player isn't losing
    - Catches custom gametypes in place of Sealed Star at the end of a GP
This commit is contained in:
toaster 2023-06-18 22:07:28 +01:00
parent 78404af6fe
commit e507a8b0ad

View file

@ -714,12 +714,50 @@ void P_PlayVictorySound(mobj_t *source)
void P_EndingMusic(void)
{
const char *jingle = NULL;
boolean nointer = false;
UINT8 bestPos = UINT8_MAX;
player_t *bestPlayer = NULL;
SINT8 i;
// See G_DoCompleted and Y_DetermineIntermissionType
boolean nointer = ((modeattacking && (players[consoleplayer].pflags & PF_NOCONTEST))
|| (grandprixinfo.gp == true && grandprixinfo.eventmode != GPEVENT_NONE));
for (i = 0; i < MAXPLAYERS; i++)
{
if (!playeringame[i]
|| players[i].spectator)
continue;
// Battle powerstone win
if ((gametyperules & GTR_POWERSTONES)
&& ALLCHAOSEMERALDS(players[i].emeralds))
break;
// Special round?
if (((gametyperules & GTR_SPECIALSTART)
|| (grandprixinfo.gp == true
&& grandprixinfo.eventmode == GPEVENT_SPECIAL)
) == false)
continue;
// Any player has completed well?
if (!players[i].exiting
|| players[i].bot
|| K_IsPlayerLosing(&players[i]))
continue;
// Special win
break;
}
// Event - Emerald Finish
if (i != MAXPLAYERS)
{
jingle = "EMRLD";
goto skippingposition;
}
// Event - Level Finish
// Check for if this is valid or not
for (i = 0; i <= r_splitscreen; i++)
@ -756,10 +794,6 @@ void P_EndingMusic(void)
}
}
// See G_DoCompleted and Y_DetermineIntermissionType
nointer = ((modeattacking && (players[consoleplayer].pflags & PF_NOCONTEST))
|| (grandprixinfo.gp == true && grandprixinfo.eventmode != GPEVENT_NONE));
if (bestPlayer == NULL)
{
// No jingle for you
@ -798,6 +832,8 @@ void P_EndingMusic(void)
}
}
skippingposition:
if (nointer == true)
{
// Do not set "racent" in G_Ticker