From 2c5caf582ba4428d60a354a027e720dde894a5e9 Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Thu, 25 Apr 2024 15:18:47 -0400 Subject: [PATCH] "TutorialDone" unlockable condition Replace all instances of `MapBeaten RR_SunbeamParadiseSprings` with `TutorialDone`, for the new early exits to work. --- src/deh_soc.c | 3 ++- src/g_game.c | 41 +++++++++++++++++++++++++---------------- src/g_gamedata.cpp | 2 ++ src/g_gamedata.h | 4 +++- src/m_cond.c | 5 +++++ src/m_cond.h | 2 ++ 6 files changed, 39 insertions(+), 18 deletions(-) diff --git a/src/deh_soc.c b/src/deh_soc.c index 849d9a0ac..b7ccb9187 100644 --- a/src/deh_soc.c +++ b/src/deh_soc.c @@ -2952,7 +2952,8 @@ static void readcondition(UINT16 set, UINT32 id, char *word2) || (++offset && fastcmp(params[0], "CREDITS")) || (++offset && fastcmp(params[0], "REPLAY")) || (++offset && fastcmp(params[0], "CRASH")) - || (++offset && fastcmp(params[0], "TUTORIALSKIP"))) + || (++offset && fastcmp(params[0], "TUTORIALSKIP")) + || (++offset && fastcmp(params[0], "TUTORIALDONE"))) { //PARAMCHECK(1); ty = UC_ADDON + offset; diff --git a/src/g_game.c b/src/g_game.c index df9da2f3a..38c4ff095 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -4853,27 +4853,36 @@ void G_EndGame(void) } // Only do evaluation and credits in singleplayer contexts - if (!netgame && grandprixinfo.gp == true) + if (!netgame) { - G_HandleSaveLevel(true); - - if (nextmap == NEXTMAP_CEREMONY) // end game with ceremony + if (gametype == GT_TUTORIAL) { - if (K_StartCeremony() == true) + // Tutorial was finished + gamedata->tutorialdone = true; + } + + if (grandprixinfo.gp == true) + { + G_HandleSaveLevel(true); + + if (nextmap == NEXTMAP_CEREMONY) // end game with ceremony { + if (K_StartCeremony() == true) + { + return; + } + } + if (nextmap == NEXTMAP_CREDITS) // end game with credits + { + F_StartCredits(); + return; + } + if (nextmap == NEXTMAP_EVALUATION) // end game with evaluation + { + F_InitGameEvaluation(); + F_StartGameEvaluation(); return; } - } - if (nextmap == NEXTMAP_CREDITS) // end game with credits - { - F_StartCredits(); - return; - } - if (nextmap == NEXTMAP_EVALUATION) // end game with evaluation - { - F_InitGameEvaluation(); - F_StartGameEvaluation(); - return; } } diff --git a/src/g_gamedata.cpp b/src/g_gamedata.cpp index e080d5c5e..6fcf6e135 100644 --- a/src/g_gamedata.cpp +++ b/src/g_gamedata.cpp @@ -76,6 +76,7 @@ void srb2::save_ng_gamedata() ng.milestones.finishedtutorialchallenge = gamedata->finishedtutorialchallenge; ng.milestones.enteredtutorialchallenge = gamedata->enteredtutorialchallenge; ng.milestones.sealedswapalerted = gamedata->sealedswapalerted; + ng.milestones.tutorialdone = gamedata->tutorialdone; ng.milestones.gonerlevel = gamedata->gonerlevel; ng.prisons.thisprisoneggpickup = gamedata->thisprisoneggpickup; ng.prisons.prisoneggstothispickup = gamedata->prisoneggstothispickup; @@ -480,6 +481,7 @@ void srb2::load_ng_gamedata() gamedata->finishedtutorialchallenge = js.milestones.finishedtutorialchallenge; gamedata->enteredtutorialchallenge = js.milestones.enteredtutorialchallenge; gamedata->sealedswapalerted = js.milestones.sealedswapalerted; + gamedata->tutorialdone = js.milestones.tutorialdone; gamedata->gonerlevel = js.milestones.gonerlevel; gamedata->thisprisoneggpickup = js.prisons.thisprisoneggpickup; gamedata->prisoneggstothispickup = js.prisons.prisoneggstothispickup; diff --git a/src/g_gamedata.h b/src/g_gamedata.h index 3c21ea5c2..c8899c84f 100644 --- a/src/g_gamedata.h +++ b/src/g_gamedata.h @@ -96,6 +96,7 @@ struct GamedataMilestonesJson final bool finishedtutorialchallenge; bool enteredtutorialchallenge; bool sealedswapalerted; + bool tutorialdone; NLOHMANN_DEFINE_TYPE_INTRUSIVE_WITH_DEFAULT( GamedataMilestonesJson, @@ -108,7 +109,8 @@ struct GamedataMilestonesJson final majorkeyskipattempted, finishedtutorialchallenge, enteredtutorialchallenge, - sealedswapalerted + sealedswapalerted, + tutorialdone ) }; diff --git a/src/m_cond.c b/src/m_cond.c index a3733f899..8d7c1f3b4 100644 --- a/src/m_cond.c +++ b/src/m_cond.c @@ -676,6 +676,7 @@ void M_ClearStats(void) gamedata->enteredtutorialchallenge = false; gamedata->finishedtutorialchallenge = false; gamedata->sealedswapalerted = false; + gamedata->tutorialdone = false; gamedata->musicstate = GDMUSIC_NONE; gamedata->importprofilewins = false; @@ -1726,6 +1727,8 @@ boolean M_CheckCondition(condition_t *cn, player_t *player) return false; case UC_TUTORIALSKIP: return (gamedata->finishedtutorialchallenge == true); + case UC_TUTORIALDONE: + return (gamedata->tutorialdone == true); case UC_PASSWORD: return (cn->stringvar == NULL); @@ -2605,6 +2608,8 @@ static const char *M_GetConditionString(condition_t *cn) return NULL; case UC_TUTORIALSKIP: return "successfully skip the Tutorial"; + case UC_TUTORIALDONE: + return "complete the Tutorial"; case UC_PASSWORD: return "enter a secret password"; diff --git a/src/m_cond.h b/src/m_cond.h index 5c2142561..88905fda5 100644 --- a/src/m_cond.h +++ b/src/m_cond.h @@ -67,6 +67,7 @@ typedef enum UC_REPLAY, // Save a replay UC_CRASH, // Hee ho ! UC_TUTORIALSKIP, // Complete the Tutorial Challenge + UC_TUTORIALDONE, // Complete the Tutorial at all UC_PASSWORD, // Type in something funny @@ -393,6 +394,7 @@ struct gamedata_t boolean enteredtutorialchallenge; boolean finishedtutorialchallenge; boolean sealedswapalerted; + boolean tutorialdone; gdmusic_t musicstate; UINT8 gonerlevel;