From a18cfeb58d8de0150e8c18f3b429289511f9f73e Mon Sep 17 00:00:00 2001 From: James R Date: Mon, 8 Apr 2024 22:06:55 -0700 Subject: [PATCH] Init evaluation screen at start of credits, to circumvent clobbered grandprixinfo - Credits demos will erase grandprixinfo - Call F_InitGameEvaluation (new function) at the beginning of the credits to cache the needed data from grandprixinfo - Fixes the evaluation screen not showing up for GP credits --- src/f_finale.c | 35 +++++++++++++++++++++++++---------- src/f_finale.h | 1 + src/g_game.c | 2 ++ src/k_credits.cpp | 3 +++ 4 files changed, 31 insertions(+), 10 deletions(-) diff --git a/src/f_finale.c b/src/f_finale.c index 7465edf13..5f8a996f7 100644 --- a/src/f_finale.c +++ b/src/f_finale.c @@ -1007,12 +1007,10 @@ typedef enum #define EVALLEN_PERFECT (18*TICRATE) static evaluationtype_t evaluationtype; -UINT16 finaleemeralds = 0; +static UINT16 finaleemeralds = 0; -void F_StartGameEvaluation(void) +void F_InitGameEvaluation(void) { - S_StopMusicCredit(); - // Credits option in extras menu if ( grandprixinfo.gp == false @@ -1021,15 +1019,11 @@ void F_StartGameEvaluation(void) #endif ) { - F_StartGameEnd(); + evaluationtype = EVAL_MAX; // skip + finaleemeralds = 0; return; } - G_SetGamestate(GS_EVALUATION); - - // Just in case they're open ... somehow - M_ClearMenus(true); - UINT8 difficulty = KARTSPEED_NORMAL; if (grandprixinfo.gp == true) { @@ -1054,6 +1048,24 @@ void F_StartGameEvaluation(void) evaluationtype = EVAL_SUPER; else evaluationtype = EVAL_PERFECT; +} + +void F_StartGameEvaluation(void) +{ + S_StopMusicCredit(); + + // Credits option in extras menu + // Set by F_InitGameEvaluation + if (evaluationtype == EVAL_MAX) + { + F_StartGameEnd(); + return; + } + + G_SetGamestate(GS_EVALUATION); + + // Just in case they're open ... somehow + M_ClearMenus(true); timetonext = (evaluationtype == EVAL_PERFECT) ? EVALLEN_PERFECT : EVALLEN_NORMAL; @@ -2276,7 +2288,10 @@ void F_EndCutScene(void) else { if (cutnum == g_credits_cutscene-1) + { + F_InitGameEvaluation(); // FIXME: cutscenes are probably not used, I don't know if it works -jartha F_StartGameEvaluation(); + } else if (cutnum == introtoplay-1) D_StartTitle(); else diff --git a/src/f_finale.h b/src/f_finale.h index dff0bf19c..2321748b6 100644 --- a/src/f_finale.h +++ b/src/f_finale.h @@ -49,6 +49,7 @@ void F_WaitingPlayersTicker(void); void F_WaitingPlayersDrawer(void); void F_GameEvaluationDrawer(void); +void F_InitGameEvaluation(void); // depends on grandprixinfo! void F_StartGameEvaluation(void); void F_GameEvaluationTicker(void); diff --git a/src/g_game.c b/src/g_game.c index 2518de08e..12c04d6ea 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -3193,6 +3193,7 @@ void G_FinishExitLevel(void) } else if (gamestate == GS_CREDITS) { + F_InitGameEvaluation(); F_StartGameEvaluation(); } } @@ -4860,6 +4861,7 @@ void G_EndGame(void) } if (nextmap == NEXTMAP_EVALUATION) // end game with evaluation { + F_InitGameEvaluation(); F_StartGameEvaluation(); return; } diff --git a/src/k_credits.cpp b/src/k_credits.cpp index bcd90a1bb..55c0e4b0a 100644 --- a/src/k_credits.cpp +++ b/src/k_credits.cpp @@ -391,6 +391,9 @@ void F_ConsiderCreditsMusicUpdate(void) void F_StartCredits(void) { + // Prepare evaluation screen at the end + F_InitGameEvaluation(); + G_SetGamestate(GS_CREDITS); // Just in case they're open ... somehow