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,34 +1147,57 @@ boolean P_EndingMusic(player_t *player)
{
char buffer[9];
boolean looping = true;
INT32 bestlocalpos;
player_t *bestlocalplayer;
if (!P_IsLocalPlayer(player)) // Only applies to a local player
return false;
// Event - Level Finish
if (splitscreen
&& (players[displayplayer].exiting
|| players[secondarydisplayplayer].exiting
|| ((splitscreen < 2) && players[thirddisplayplayer].exiting)
|| ((splitscreen < 3) && players[fourthdisplayplayer].exiting)))
// Check for if this is valid or not
if (splitscreen)
{
sprintf(buffer, "k*ok");
if (!((players[displayplayer].exiting || (players[displayplayer].pflags & PF_TIMEOVER))
|| (players[secondarydisplayplayer].exiting || (players[secondarydisplayplayer].pflags & PF_TIMEOVER))
|| ((splitscreen < 2) && (players[thirddisplayplayer].exiting || (players[thirddisplayplayer].pflags & PF_TIMEOVER)))
|| ((splitscreen < 3) && (players[fourthdisplayplayer].exiting || (players[fourthdisplayplayer].pflags & PF_TIMEOVER)))))
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]); \
}
else if (player->pflags & PF_TIMEOVER) // || !player->lives) -- outta lives, outta time
{
sprintf(buffer, "k*lose");
setbests(secondarydisplayplayer);
if (splitscreen > 1)
setbests(thirddisplayplayer);
if (splitscreen > 2)
setbests(fourthdisplayplayer);
#undef setbests
}
else if (player->exiting)
else
{
if (player->kartstuff[k_position] == 1)
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(player))
else if (K_IsPlayerLosing(bestlocalplayer))
sprintf(buffer, "k*lose");
else
sprintf(buffer, "k*ok");
}
else
return false;
S_SpeedMusic(1.0f);