Finish music in splitscreen now depends on the best player's rank

In offline splitscreen it should now always pick the win theme (the one that's timed with the signpost), and in online splitscreen it should now pick the best ranked local player (previously it'd always play the OK theme, unless if you time over'd)

Will also be extremely relevant for SMK-style cooperative grand prix!
This commit is contained in:
TehRealSalt 2018-10-02 02:10:20 -04:00
parent 506c70ce27
commit 7590153b67

View file

@ -1147,35 +1147,58 @@ boolean P_EndingMusic(player_t *player)
{ {
char buffer[9]; char buffer[9];
boolean looping = true; boolean looping = true;
INT32 bestlocalpos;
player_t *bestlocalplayer;
if (!P_IsLocalPlayer(player)) // Only applies to a local player if (!P_IsLocalPlayer(player)) // Only applies to a local player
return false; return false;
// Event - Level Finish // Event - Level Finish
if (splitscreen // Check for if this is valid or not
&& (players[displayplayer].exiting if (splitscreen)
|| players[secondarydisplayplayer].exiting
|| ((splitscreen < 2) && players[thirddisplayplayer].exiting)
|| ((splitscreen < 3) && players[fourthdisplayplayer].exiting)))
{ {
sprintf(buffer, "k*ok"); if (!((players[displayplayer].exiting || (players[displayplayer].pflags & PF_TIMEOVER))
} || (players[secondarydisplayplayer].exiting || (players[secondarydisplayplayer].pflags & PF_TIMEOVER))
else if (player->pflags & PF_TIMEOVER) // || !player->lives) -- outta lives, outta time || ((splitscreen < 2) && (players[thirddisplayplayer].exiting || (players[thirddisplayplayer].pflags & PF_TIMEOVER)))
{ || ((splitscreen < 3) && (players[fourthdisplayplayer].exiting || (players[fourthdisplayplayer].pflags & PF_TIMEOVER)))))
sprintf(buffer, "k*lose");
}
else if (player->exiting)
{
if (player->kartstuff[k_position] == 1)
sprintf(buffer, "k*win");
else if (K_IsPlayerLosing(player))
sprintf(buffer, "k*lose");
else
sprintf(buffer, "k*ok");
}
else
return false; return false;
bestlocalplayer = &players[displayplayer];
bestlocalpos = ((players[displayplayer].pflags & PF_TIMEOVER) ? MAXPLAYERS+1 : players[displayplayer].kartstuff[k_position]);
#define setbests(p) \
if (((players[p].pflags & PF_TIMEOVER) ? MAXPLAYERS+1 : players[p].kartstuff[k_position]) < bestlocalpos) \
{ \
bestlocalplayer = &players[p]; \
bestlocalpos = ((players[p].pflags & PF_TIMEOVER) ? MAXPLAYERS+1 : players[p].kartstuff[k_position]); \
}
setbests(secondarydisplayplayer);
if (splitscreen > 1)
setbests(thirddisplayplayer);
if (splitscreen > 2)
setbests(fourthdisplayplayer);
#undef setbests
}
else
{
if (!(player->exiting || (player->pflags & PF_TIMEOVER)))
return false;
bestlocalplayer = player;
bestlocalpos = ((player->pflags & PF_TIMEOVER) ? MAXPLAYERS+1 : player->kartstuff[k_position]);
}
if (G_RaceGametype() && bestlocalpos == MAXPLAYERS+1)
sprintf(buffer, "k*lose"); // krfail, for eventual F-Zero death results theme
else
{
if (bestlocalpos == 1)
sprintf(buffer, "k*win");
else if (K_IsPlayerLosing(bestlocalplayer))
sprintf(buffer, "k*lose");
else
sprintf(buffer, "k*ok");
}
S_SpeedMusic(1.0f); S_SpeedMusic(1.0f);
if (G_RaceGametype()) if (G_RaceGametype())