From 64922460ac03a07fcaabd7ce214e4ed423507ca4 Mon Sep 17 00:00:00 2001 From: toaster Date: Sat, 23 Dec 2023 22:12:00 +0000 Subject: [PATCH] Handle Podium unlocks during mapload, not when finishing the ceremony Solves mid-podium crashes not granting second page material --- src/k_podium.cpp | 19 ++++++++++--------- src/m_cond.c | 8 ++++---- src/p_setup.c | 8 +++++++- 3 files changed, 21 insertions(+), 14 deletions(-) diff --git a/src/k_podium.cpp b/src/k_podium.cpp index 072a4e075..fab819594 100644 --- a/src/k_podium.cpp +++ b/src/k_podium.cpp @@ -864,7 +864,11 @@ void K_InitializePodiumWaypoint(player_t *const player) { if ((player != NULL) && (player->mo != NULL)) { - player->position = K_GetPodiumPosition(player); + if (player->position == 0) + { + // Just in case a netgame scenario with a late joiner ocurrs. + player->position = K_GetPodiumPosition(player); + } if (player->position > 0 && player->position <= MAXPLAYERS) { @@ -989,12 +993,6 @@ void K_FinishCeremony(void) } g_podiumData.ranking = true; - - // Play the noise now (via G_UpdateVisited's concluding challenge check) - prevmap = gamemap-1; - G_UpdateVisited(); - if (gamedata->deferredsave) - G_SaveGameData(); } /*-------------------------------------------------- @@ -1084,8 +1082,11 @@ void K_ResetCeremony(void) } } - // Save before playing the noise - G_SaveGameData(); + // Update visitation. + prevmap = gamemap-1; + G_UpdateVisited(); + + // will subsequently save in P_LoadLevel } /*-------------------------------------------------- diff --git a/src/m_cond.c b/src/m_cond.c index b9664d46e..bd5231128 100644 --- a/src/m_cond.c +++ b/src/m_cond.c @@ -1607,7 +1607,7 @@ boolean M_CheckCondition(condition_t *cn, player_t *player) return (grandprixinfo.gamespeed >= cn->requirement); case UCRP_PODIUMCUP: - if (grandprixinfo.gp == false || K_PodiumRanking() == false) + if (grandprixinfo.gp == false || K_PodiumSequence() == false) return false; if (grandprixinfo.cup == NULL || ( @@ -1625,11 +1625,11 @@ boolean M_CheckCondition(condition_t *cn, player_t *player) case UCRP_PODIUMEMERALD: case UCRP_PODIUMPRIZE: return (grandprixinfo.gp == true - && K_PodiumRanking() == true + && K_PodiumSequence() == true && grandprixinfo.rank.specialWon == true); case UCRP_PODIUMNOCONTINUES: return (grandprixinfo.gp == true - && K_PodiumRanking() == true + && K_PodiumSequence() == true && grandprixinfo.rank.continuesUsed == 0); case UCRP_FINISHCOOL: @@ -2989,7 +2989,7 @@ boolean M_UpdateUnlockablesAndExtraEmblems(boolean loud, boolean doall) } } - if (!demo.playback && Playing() && (gamestate == GS_LEVEL || K_PodiumRanking() == true)) + if (!demo.playback && Playing() && (gamestate == GS_LEVEL || K_PodiumSequence() == true)) { for (i = 0; i <= splitscreen; i++) { diff --git a/src/p_setup.c b/src/p_setup.c index 2fdb86d54..40e1d0f3c 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -7600,7 +7600,13 @@ static void P_InitLevelSettings(void) if (K_PodiumSequence() == true) { - ; // NOP + // Okay, now that everything preceding is handled, set the position. + for (i = 0; i < MAXPLAYERS; i++) + { + players[i].position = K_GetPodiumPosition(&players[i]); + } + + // We don't touch the gamespeed, though! } else if (grandprixinfo.gp == true) {