Add pre-Podium intermission music

This commit is contained in:
Sally Coolatta 2024-03-10 14:08:59 -04:00
parent e43106ce00
commit 9b93f56111
18 changed files with 230 additions and 79 deletions

View file

@ -2010,7 +2010,7 @@ void G_Ticker(boolean run)
musiccountdown--;
if (musiccountdown == 1)
{
Music_PlayIntermission();
Y_PlayIntermissionMusic();
}
else if (musiccountdown == MUSIC_COUNTDOWN_MAX - K_TallyDelay())
{
@ -2596,7 +2596,7 @@ void G_MovePlayerToSpawnOrCheatcheck(INT32 playernum)
mapthing_t *G_FindTeamStart(INT32 playernum)
{
const boolean doprints = P_IsLocalPlayer(&players[playernum]);
const boolean doprints = P_IsPartyPlayer(&players[playernum]);
INT32 i,j;
if (!numredctfstarts && !numbluectfstarts) //why even bother, eh?
@ -2651,7 +2651,7 @@ mapthing_t *G_FindTeamStart(INT32 playernum)
mapthing_t *G_FindBattleStart(INT32 playernum)
{
const boolean doprints = P_IsLocalPlayer(&players[playernum]);
const boolean doprints = P_IsPartyPlayer(&players[playernum]);
INT32 i, j;
if (numdmstarts)
@ -2674,7 +2674,7 @@ mapthing_t *G_FindBattleStart(INT32 playernum)
mapthing_t *G_FindRaceStart(INT32 playernum)
{
const boolean doprints = P_IsLocalPlayer(&players[playernum]);
const boolean doprints = P_IsPartyPlayer(&players[playernum]);
if (numcoopstarts)
{
@ -2770,7 +2770,7 @@ mapthing_t *G_FindRaceStart(INT32 playernum)
mapthing_t *G_FindPodiumStart(INT32 playernum)
{
const boolean doprints = P_IsLocalPlayer(&players[playernum]);
const boolean doprints = P_IsPartyPlayer(&players[playernum]);
if (numcoopstarts)
{
@ -2893,13 +2893,13 @@ mapthing_t *G_FindMapStart(INT32 playernum)
{
if (nummapthings)
{
if (P_IsLocalPlayer(&players[playernum]))
if (P_IsPartyPlayer(&players[playernum]))
CONS_Alert(CONS_ERROR, M_GetText("No player spawns found, spawning at the first mapthing!\n"));
spawnpoint = &mapthings[0];
}
else
{
if (P_IsLocalPlayer(&players[playernum]))
if (P_IsPartyPlayer(&players[playernum]))
CONS_Alert(CONS_ERROR, M_GetText("No player spawns found, spawning at the origin!\n"));
}
}
@ -3791,7 +3791,7 @@ void G_UpdateVisited(void)
if (!playeringame[i]) // Not here.
continue;
if (!P_IsLocalPlayer(&players[i])) // Not local.
if (!P_IsPartyPlayer(&players[i])) // Not local.
continue;
if (players[i].spectator == true) // Not playing.

View file

@ -110,7 +110,7 @@ boolean K_SetFollowerByName(INT32 playernum, const char *skinname)
}
}
if (P_IsLocalPlayer(player))
if (P_IsPartyPlayer(player))
{
CONS_Alert(CONS_WARNING, M_GetText("Follower '%s' not found.\n"), skinname);
}
@ -181,7 +181,7 @@ void K_SetFollowerByNum(INT32 playernum, INT32 skinnum)
return;
}
if (P_IsLocalPlayer(player))
if (P_IsPartyPlayer(player))
{
CONS_Alert(CONS_WARNING, M_GetText("Follower %d not found\n"), skinnum);
}
@ -738,7 +738,7 @@ void K_FollowerHornTaunt(player_t *taunter, player_t *victim, boolean mysticmelo
(demo.playback == false) // No downloading somebody else's replay
&& (fl->hornsound == sfx_melody) // Must be the Mystic Melody
&& (taunter->bot == false) // No getting your puppies to do it for you
&& P_IsLocalPlayer(taunter) // Must be in your party
&& P_IsPartyPlayer(taunter) // Must be in your party
&& !(mapheaderinfo[gamemap-1]->records.mapvisited & MV_MYSTICMELODY) // Not already done
);
}

View file

@ -6762,7 +6762,7 @@ void K_DoInvincibility(player_t *player, tic_t time)
P_SetScale(overlay, player->mo->scale);
}
if (P_IsLocalPlayer(player) == false)
if (P_IsPartyPlayer(player) == false)
{
S_StartSound(player->mo, sfx_alarmi);
}
@ -7969,7 +7969,7 @@ static void K_UpdateInvincibilitySounds(player_t *player)
{
INT32 sfxnum = sfx_None;
if (player->mo->health > 0 && !P_IsLocalPlayer(player)) // used to be !P_IsDisplayPlayer(player)
if (player->mo->health > 0 && !P_IsPartyPlayer(player)) // used to be !P_IsDisplayPlayer(player)
{
if (player->invincibilitytimer > 0) // Prioritize invincibility
sfxnum = sfx_alarmi;
@ -11012,7 +11012,7 @@ void K_KartUpdatePosition(player_t *player)
}
// Special stages: fade out music near the finish line
if (P_IsLocalPlayer(player))
if (P_IsPartyPlayer(player))
{
K_FadeOutSpecialMusic(player->distancetofinish);
}
@ -12601,7 +12601,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
player->mo->destscale = FixedMul(player->mo->destscale, SHRINK_SCALE);
}
if (P_IsLocalPlayer(player) == false && player->invincibilitytimer == 0)
if (P_IsPartyPlayer(player) == false && player->invincibilitytimer == 0)
{
// don't play this if the player has invincibility -- that takes priority
S_StartSound(player->mo, sfx_alarmg);

View file

@ -1037,7 +1037,7 @@ static void Y_VoteStops(SINT8 pick, SINT8 level)
{
Y_FinalizeVote(level);
if (netgame && P_IsLocalPlayer(&players[pick]))
if (netgame && P_IsPartyPlayer(&players[pick]))
{
S_StartSound(NULL, sfx_yeeeah); // yeeeah!
}

View file

@ -586,7 +586,7 @@ boolean K_AllowNewMidVote(player_t *caller, midVoteType_e type, INT32 variable,
if (g_midVote.active == true)
{
// Don't allow another vote if one is already running.
if (P_IsLocalPlayer(caller) == true)
if (P_IsMachineLocalPlayer(caller) == true)
{
CONS_Alert(CONS_ERROR, "A vote is already in progress.\n");
}
@ -597,7 +597,7 @@ boolean K_AllowNewMidVote(player_t *caller, midVoteType_e type, INT32 variable,
if (g_midVote.delay > 0)
{
// Don't allow another vote if one has recently just ran.
if (P_IsLocalPlayer(caller) == true)
if (P_IsMachineLocalPlayer(caller) == true)
{
CONS_Alert(CONS_ERROR, "Another vote was called too recently.\n");
}
@ -608,7 +608,7 @@ boolean K_AllowNewMidVote(player_t *caller, midVoteType_e type, INT32 variable,
if (type < 0 || type >= MVT__MAX)
{
// Invalid range.
if (P_IsLocalPlayer(caller) == true)
if (P_IsMachineLocalPlayer(caller) == true)
{
CONS_Alert(CONS_ERROR, "Invalid vote type.\n");
}
@ -619,7 +619,7 @@ boolean K_AllowNewMidVote(player_t *caller, midVoteType_e type, INT32 variable,
if (g_midVoteTypeDefs[type].cv_allowed.value == 0)
{
// These types of votes aren't allowed on this server.
if (P_IsLocalPlayer(caller) == true)
if (P_IsMachineLocalPlayer(caller) == true)
{
CONS_Alert(CONS_ERROR, "Vote type is not allowed in this server.\n");
}
@ -630,7 +630,7 @@ boolean K_AllowNewMidVote(player_t *caller, midVoteType_e type, INT32 variable,
if (caller == NULL || K_PlayerIDAllowedInMidVote(caller - players) == false)
{
// Invalid calling player.
if (caller != NULL && P_IsLocalPlayer(caller) == true)
if (caller != NULL && P_IsMachineLocalPlayer(caller) == true)
{
CONS_Alert(CONS_ERROR, "Invalid calling player.\n");
}
@ -643,7 +643,7 @@ boolean K_AllowNewMidVote(player_t *caller, midVoteType_e type, INT32 variable,
if (victim == NULL)
{
// Invalid victim.
if (P_IsLocalPlayer(caller) == true)
if (P_IsMachineLocalPlayer(caller) == true)
{
CONS_Alert(CONS_ERROR, "Can't kick this player; it's invalid.\n");
}
@ -653,7 +653,7 @@ boolean K_AllowNewMidVote(player_t *caller, midVoteType_e type, INT32 variable,
if (caller == victim)
{
if (P_IsLocalPlayer(caller) == true)
if (P_IsMachineLocalPlayer(caller) == true)
{
CONS_Alert(CONS_ERROR, "Can't kick yourself.\n");
}
@ -668,7 +668,7 @@ boolean K_AllowNewMidVote(player_t *caller, midVoteType_e type, INT32 variable,
)
{
// Victim is the server or an admin.
if (P_IsLocalPlayer(caller) == true)
if (P_IsMachineLocalPlayer(caller) == true)
{
CONS_Alert(CONS_ERROR, "Can't kick this player; they are an administrator.\n");
}

View file

@ -675,7 +675,7 @@ static int lib_pSpawnLockOn(lua_State *L)
if (state >= NUMSTATES)
return luaL_error(L, "state %d out of range (0 - %d)", state, NUMSTATES-1);
#if 0
if (P_IsLocalPlayer(player)) // Only display it on your own view.
if (P_IsPartyPlayer(player)) // Only display it on your own view.
{
mobj_t *visual = P_SpawnMobj(lockon->x, lockon->y, lockon->z, MT_LOCKON); // positioning, flip handled in P_SceneryThinker
P_SetTarget(&visual->target, lockon);
@ -1639,7 +1639,7 @@ static int lib_pPlayRinglossSound(lua_State *L)
if (!player)
return LUA_ErrInvalid(L, "player_t");
}
if (!player || P_IsLocalPlayer(player))
if (!player || P_IsPartyPlayer(player))
P_PlayRinglossSound(source);
return 0;
}
@ -1658,7 +1658,7 @@ static int lib_pPlayDeathSound(lua_State *L)
if (!player)
return LUA_ErrInvalid(L, "player_t");
}
if (!player || P_IsLocalPlayer(player))
if (!player || P_IsPartyPlayer(player))
P_PlayDeathSound(source);
return 0;
}
@ -1677,7 +1677,7 @@ static int lib_pPlayVictorySound(lua_State *L)
if (!player)
return LUA_ErrInvalid(L, "player_t");
}
if (!player || P_IsLocalPlayer(player))
if (!player || P_IsPartyPlayer(player))
P_PlayVictorySound(source);
return 0;
}
@ -1880,7 +1880,7 @@ static int lib_pSwitchWeather(lua_State *L)
user = *((player_t **)luaL_checkudata(L, 2, META_PLAYER));
if (!user) // global
globalweather = weathernum;
if (!user || P_IsLocalPlayer(user))
if (!user || P_IsPartyPlayer(user))
P_SwitchWeather(weathernum);
return 0;
}
@ -1935,7 +1935,7 @@ static int lib_pSetupLevelSky(lua_State *L)
user = *((player_t **)luaL_checkudata(L, 2, META_PLAYER));
if (!user) // global
P_SetupLevelSky(skytexname, true);
else if (P_IsLocalPlayer(user))
else if (P_IsPartyPlayer(user))
P_SetupLevelSky(skytexname, false);
return 0;
}
@ -1984,7 +1984,7 @@ static int lib_pSetSkyboxMobj(lua_State *L)
return luaL_error(L, "skybox mobj index %d is out of range for P_SetSkyboxMobj argument #2 (expected 0 or 1)", w);
#if 0
if (!user || P_IsLocalPlayer(user))
if (!user || P_IsPartyPlayer(user))
skyboxmo[w] = mo;
#else
CONS_Alert(CONS_WARNING, "TODO: P_SetSkyboxMobj is unimplemented\n");
@ -2409,7 +2409,7 @@ static int lib_sStartSound(lua_State *L)
if (!lua_isnil(L, 1))
if (!GetValidSoundOrigin(L, &origin))
return 0;
if (!player || P_IsLocalPlayer(player))
if (!player || P_IsPartyPlayer(player))
{
if (hud_running || hook_cmd_running)
origin = NULL; // HUD rendering and CMD building startsound shouldn't have an origin, just remove it instead of having a retarded error.
@ -2439,7 +2439,7 @@ static int lib_sStartSoundAtVolume(lua_State *L)
if (!GetValidSoundOrigin(L, &origin))
return LUA_ErrInvalid(L, "mobj_t/sector_t");
if (!player || P_IsLocalPlayer(player))
if (!player || P_IsPartyPlayer(player))
S_StartSoundAtVolume(origin, sound_id, volume);
return 0;
}
@ -2524,7 +2524,7 @@ static int lib_sStartMusicCaption(lua_State *L)
return LUA_ErrInvalid(L, "player_t");
}
if (lifespan && (!player || P_IsLocalPlayer(player)))
if (lifespan && (!player || P_IsPartyPlayer(player)))
{
strlcpy(S_sfx[sfx_None].caption, caption, sizeof(S_sfx[sfx_None].caption));
S_StartCaption(sfx_None, -1, lifespan);
@ -2542,7 +2542,7 @@ static int lib_sShowMusicCredit(lua_State *L)
if (!player)
return LUA_ErrInvalid(L, "player_t");
}
if (!player || P_IsLocalPlayer(player))
if (!player || P_IsPartyPlayer(player))
S_ShowMusicCredit();
return 0;
}

View file

@ -218,20 +218,6 @@ void Music_Play(const char* id)
}
}
void Music_PlayIntermission(void)
{
// why aren't the ATTACK_ enums declared alongside modeattacking?
if (modeattacking != 0)
{
Music_Remap("intermission", "timent");
}
else
{
Music_Remap("intermission", "racent");
}
Music_Play("intermission");
}
void Music_DelayEnd(const char* id, tic_t duration)
{
Tune* tune = g_tunes.find(id);

View file

@ -59,10 +59,6 @@ const char *Music_CurrentId(void);
// back to the start.)
void Music_Play(const char *id);
// Same as Music_Play, but a convenience for remapping intermission
// based on game state.
void Music_PlayIntermission(void);
// Postpone the end of this tune until N tics from now. The
// tune should already be playing before calling this.
void Music_DelayEnd(const char *id, tic_t duration);

View file

@ -576,7 +576,7 @@ boolean Obj_ShrinkLaserCollide(mobj_t *gun, mobj_t *victim)
victim->destscale = FixedMul(victim->destscale, SHRINK_SCALE);
}
if (P_IsLocalPlayer(victim->player) == false && victim->player->invincibilitytimer == 0)
if (P_IsPartyPlayer(victim->player) == false && victim->player->invincibilitytimer == 0)
{
// don't play this if the player has invincibility -- that takes priority
S_StartSound(victim, sfx_alarmg);

View file

@ -695,7 +695,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
if (!P_CanPickupEmblem(player, special->health - 1))
return;
if (!P_IsLocalPlayer(player))
if (!P_IsPartyPlayer(player))
{
// Must be party.
return;
@ -733,7 +733,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
return;
}
if (!P_IsLocalPlayer(player))
if (!P_IsPartyPlayer(player))
{
// Must be party.
return;
@ -832,7 +832,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
return;
}
if (!P_IsLocalPlayer(player))
if (!P_IsPartyPlayer(player))
{
// Must be party.
return;

View file

@ -162,8 +162,8 @@ boolean P_PlayerInPain(const player_t *player);
void P_ResetPlayer(player_t *player);
boolean P_PlayerCanDamage(player_t *player, mobj_t *thing);
boolean P_IsLocalPlayer(const player_t *player);
boolean P_IsMachineLocalPlayer(const player_t *player);
boolean P_IsPartyPlayer(const player_t *player);
boolean P_IsMachineLocalPlayer(const player_t *player); // TODO: rename back to P_IsLocalPlayer?
boolean P_IsDisplayPlayer(const player_t *player);
void P_SetPlayerAngle(player_t *player, angle_t angle);

View file

@ -2197,7 +2197,7 @@ static void K_HandleLapIncrement(player_t *player)
lastLowestLap = lowestLap;
if (P_IsLocalPlayer(player))
if (P_IsPartyPlayer(player))
{
player->roundconditions.checkthisframe = true;
gamedata->deferredconditioncheck = true;
@ -3191,7 +3191,7 @@ boolean P_ProcessSpecial(activator_t *activator, INT16 special, INT32 *args, cha
break;
case 423: // Change Sky
if ((mo && mo->player && P_IsLocalPlayer(mo->player)) || args[1])
if ((mo && mo->player && P_IsPartyPlayer(mo->player)) || args[1])
P_SetupLevelSky(stringargs[0], args[1]);
break;
@ -3201,7 +3201,7 @@ boolean P_ProcessSpecial(activator_t *activator, INT16 special, INT32 *args, cha
globalweather = (UINT8)(args[0]);
P_SwitchWeather(globalweather);
}
else if (mo && mo->player && P_IsLocalPlayer(mo->player))
else if (mo && mo->player && P_IsPartyPlayer(mo->player))
P_SwitchWeather(args[0]);
break;

View file

@ -449,7 +449,7 @@ INT32 P_GivePlayerRings(player_t *player, INT32 num_rings)
if ((gametyperules & GTR_SPHERES)) // No rings in Battle Mode
return 0;
if (gamedata && num_rings > 0 && P_IsLocalPlayer(player) && gamedata->totalrings <= GDMAX_RINGS)
if (gamedata && num_rings > 0 && P_IsPartyPlayer(player) && gamedata->totalrings <= GDMAX_RINGS)
{
gamedata->totalrings += num_rings;
}
@ -747,7 +747,7 @@ void P_InvincGrowMusic(void)
{
player_t *player = &players[displayplayers[i]];
if (!P_IsLocalPlayer(player))
if (!P_IsPartyPlayer(player))
{
// Director cam on another player? Don't play
// this.
@ -1002,13 +1002,13 @@ boolean P_IsMachineLocalPlayer(const player_t *player)
}
//
// P_IsLocalPlayer
// P_IsPartyPlayer
//
// Returns true if player is
// on the local machine
// (or simulated party)
//
boolean P_IsLocalPlayer(const player_t *player)
boolean P_IsPartyPlayer(const player_t *player)
{
if (player == NULL)
{
@ -1226,7 +1226,7 @@ void P_DoPlayerExit(player_t *player, pflags_t flags)
player->pflags |= flags;
if (P_IsLocalPlayer(player) && (!player->spectator && !demo.playback))
if (P_IsPartyPlayer(player) && (!player->spectator && !demo.playback))
{
legitimateexit = true;
player->roundconditions.checkthisframe = true;
@ -1268,7 +1268,7 @@ void P_DoPlayerExit(player_t *player, pflags_t flags)
K_UpdatePowerLevelsFinalize(player, false);
if (P_IsLocalPlayer(player) && !specialout && musiccountdown == 0)
if (P_IsPartyPlayer(player) && !specialout && musiccountdown == 0)
{
Music_Play("finish_silence");
musiccountdown = MUSIC_COUNTDOWN_MAX;
@ -3802,7 +3802,7 @@ void P_DoTimeOver(player_t *player)
return;
}
if (P_IsLocalPlayer(player) && !demo.playback)
if (P_IsPartyPlayer(player) && !demo.playback)
{
legitimateexit = true; // SRB2kart: losing a race is still seeing it through to the end :p
player->roundconditions.checkthisframe = true;
@ -3828,7 +3828,7 @@ void P_DoTimeOver(player_t *player)
P_DamageMobj(player->mo, NULL, NULL, 1, DMG_TIMEOVER);
}
if (P_IsLocalPlayer(player) && musiccountdown == 0)
if (P_IsPartyPlayer(player) && musiccountdown == 0)
{
Music_Play("finish_silence");
musiccountdown = MUSIC_COUNTDOWN_MAX;
@ -4205,7 +4205,7 @@ void P_PlayerThink(player_t *player)
// SRB2Kart: despite how perfect this is, it's disabled FOR A REASON
if (racecountdown == 11*TICRATE - 1)
{
if (P_IsLocalPlayer(player))
if (P_IsPartyPlayer(player))
S_ChangeMusicInternal("drown", false);
}
#endif
@ -4733,7 +4733,7 @@ void P_CheckRaceGriefing(player_t *player, boolean dopunishment)
if (dopunishment && !player->griefWarned && player->griefValue >= (griefMax/2))
{
K_AddMessageForPlayer(player, "Get moving!", true, false);
if (P_IsLocalPlayer(player))
if (P_IsPartyPlayer(player))
S_StartSound(NULL, sfx_cftbl0);
player->griefWarned = true;
}

View file

@ -462,7 +462,7 @@ void SetPlayerSkin(INT32 playernum, const char *skinname)
return;
}
if (P_IsLocalPlayer(player))
if (P_IsPartyPlayer(player))
CONS_Alert(CONS_WARNING, M_GetText("Skin '%s' not found.\n"), skinname);
else if(server || IsPlayerAdmin(consoleplayer))
CONS_Alert(CONS_WARNING, M_GetText("Player %d (%s) skin '%s' not found\n"), playernum, player_names[playernum], skinname);
@ -482,7 +482,7 @@ void SetPlayerSkinByNum(INT32 playernum, INT32 skinnum)
return;
}
if (P_IsLocalPlayer(player))
if (P_IsPartyPlayer(player))
CONS_Alert(CONS_WARNING, M_GetText("Requested skin %d not found\n"), skinnum);
else if (server || IsPlayerAdmin(consoleplayer))
CONS_Alert(CONS_WARNING, "Player %d (%s) skin %d not found\n", playernum, player_names[playernum], skinnum);

View file

@ -37,6 +37,7 @@
#include "i_time.h"
#include "v_video.h" // V_ThinStringWidth
#include "music.h"
#include "y_inter.h" // Y_PlayIntermissionMusic
extern consvar_t cv_mastervolume;
@ -1217,7 +1218,7 @@ void S_AttemptToRestoreMusic(void)
}
// FALLTHRU
case GS_INTERMISSION:
Music_PlayIntermission();
Y_PlayIntermissionMusic();
break;
case GS_CEREMONY:
Music_Play("level");

View file

@ -1277,7 +1277,7 @@ static void ST_overlayDrawer(void)
{
if (cv_showviewpointtext.value)
{
if (!demo.attract && !P_IsLocalPlayer(stplyr) && !camera[viewnum].freecam)
if (!demo.attract && !P_IsPartyPlayer(stplyr) && !camera[viewnum].freecam)
{
if (r_splitscreen <= 1)
{

View file

@ -365,7 +365,7 @@ static void Y_CalculateMatchData(UINT8 rankingsmode, void (*comparison)(INT32))
break;
}
if (!P_IsLocalPlayer(&players[i]))
if (!P_IsPartyPlayer(&players[i]))
{
continue;
}
@ -530,7 +530,7 @@ void Y_PlayerStandingsDrawer(y_data_t *standings, INT32 xoffset)
boolean (*_isHighlightedPlayer)(const player_t *) =
(demo.playback
? P_IsDisplayPlayer
: P_IsLocalPlayer
: P_IsPartyPlayer
);
boolean doreverse = (
@ -1972,6 +1972,172 @@ void Y_DetermineIntermissionType(void)
}
}
static UINT8 Y_PlayersBestPossiblePosition(player_t *const player)
{
UINT8 bestPossiblePosition = MAXPLAYERS + 1;
UINT8 i = UINT8_MAX;
if ((player->pflags & PF_NOCONTEST) == 0)
{
if (player->exiting)
{
// They are finished, so their position is set in stone.
bestPossiblePosition = player->position;
}
else
{
// If they're NOT finished, then check what their points could be
// if they finished in the first available position.
bestPossiblePosition = 1;
for (i = 0; i < MAXPLAYERS; i++)
{
player_t *const other = &players[i];
if (!playeringame[i] || other->spectator)
{
continue;
}
if (other == player)
{
continue;
}
if (other->exiting)
{
bestPossiblePosition = std::max<UINT8>(bestPossiblePosition, other->position + 1);
}
}
}
}
return bestPossiblePosition;
}
static UINT32 Y_EstimatePodiumScore(player_t *const player, UINT8 numPlaying)
{
UINT8 pos = Y_PlayersBestPossiblePosition(player);
UINT32 ourScore = player->score;
if (pos < numPlaying)
{
ourScore += K_CalculateGPRankPoints(pos, numPlaying);
}
return ourScore;
}
static boolean Y_GuaranteedGPFirstPlace(void)
{
player_t *bestInParty = nullptr;
UINT32 bestPartyScore = 0;
UINT8 numPlaying = spectateGriefed;
UINT8 i = UINT8_MAX;
// Quick first loop to count players.
for (i = 0; i < MAXPLAYERS; i++)
{
player_t *const comparePlayer = &players[i];
if (!playeringame[i] || comparePlayer->spectator)
{
continue;
}
numPlaying++;
}
// Iterate our party, estimate the best possible exiting score out of all of them.
for (i = 0; i <= r_splitscreen; i++)
{
player_t *const comparePlayer = &players[displayplayers[i]];
if (comparePlayer->spectator)
{
continue;
}
if (!comparePlayer->exiting)
{
continue;
}
UINT32 newScore = Y_EstimatePodiumScore(comparePlayer, numPlaying);
if (bestInParty == nullptr || newScore > bestPartyScore)
{
bestInParty = comparePlayer;
bestPartyScore = newScore;
}
}
if (bestInParty == nullptr)
{
// No partied players are actually available,
// so always use the regular intermission music.
return false;
}
// Iterate through all players not belonging to our party.
// Estimate the possible scores that they could get.
// Play special music only if none of these scores beat ours!
for (i = 0; i < MAXPLAYERS; i++)
{
player_t *comparePlayer = &players[i];
if (!playeringame[i] || comparePlayer->spectator)
{
continue;
}
if (P_IsPartyPlayer(comparePlayer))
{
continue;
}
if (Y_EstimatePodiumScore(comparePlayer, numPlaying) >= bestPartyScore)
{
// NO, there is a chance that we will NOT finish first!
// You may still be able to finish first, but it is NOT guaranteed.
return false;
}
}
// There is an overwhelmingly good chance
// that we are finishing in first place.
return true;
}
void Y_PlayIntermissionMusic(void)
{
if (modeattacking != ATTACKING_NONE)
{
Music_Remap("intermission", "timent");
}
else if (grandprixinfo.gp == true
&& grandprixinfo.cup != nullptr
&& roundqueue.size > 0
&& roundqueue.roundnum >= grandprixinfo.cup->numlevels)
{
if (Y_GuaranteedGPFirstPlace())
{
Music_Remap("intermission", "gprnds");
}
else
{
Music_Remap("intermission", "gprnd5");
}
}
else
{
Music_Remap("intermission", "racent");
}
Music_Play("intermission");
}
//
// Y_StartIntermission
//
@ -2106,7 +2272,7 @@ void Y_StartIntermission(void)
if (musiccountdown == 0)
{
Music_PlayIntermission();
Y_PlayIntermissionMusic();
}
S_ShowMusicCredit(); // Always call

View file

@ -61,6 +61,8 @@ void Y_EndIntermission(void);
void Y_DetermineIntermissionType(void);
void Y_PlayIntermissionMusic(void);
typedef enum
{
int_none,