From 1034dd7ec90407431abbe29750c660e41c4aa890 Mon Sep 17 00:00:00 2001 From: toaster Date: Tue, 9 Apr 2024 17:47:30 +0100 Subject: [PATCH] Grand Prix course preview adjustment: Show Prison Break stages too, just like on Challenges Board preview - All gametypes will be shown in the drawer, as opposed to just Race - However, don't attempt to add the preview pic for CUPCACHE_SPECIAL (the Sealed Star) --- src/g_game.c | 1 + src/k_menu.h | 2 +- src/k_menudraw.c | 9 +++++---- src/k_menufunc.c | 2 +- src/menus/main-goner.cpp | 2 +- src/menus/play-online-host.c | 2 +- src/menus/transient/cup-select.c | 4 ++-- src/menus/transient/level-select.c | 23 ++++++++++++++--------- 8 files changed, 26 insertions(+), 19 deletions(-) diff --git a/src/g_game.c b/src/g_game.c index 2518de08e..547649e62 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -3557,6 +3557,7 @@ UINT16 G_GetFirstMapOfGametype(UINT16 pgametype) templevelsearch.typeoflevel = G_TOLFlag(pgametype); templevelsearch.cupmode = (!(gametypes[pgametype]->rules & GTR_NOCUPSELECT)); templevelsearch.timeattack = false; + templevelsearch.grandprix = false; templevelsearch.tutorial = (pgametype == GT_TUTORIAL); templevelsearch.checklocked = true; diff --git a/src/k_menu.h b/src/k_menu.h index d4e214878..1cebc7cd0 100644 --- a/src/k_menu.h +++ b/src/k_menu.h @@ -863,7 +863,6 @@ extern struct cupgrid_s { size_t numpages; size_t cappages; tic_t previewanim; - boolean grandprix; // Setup grand prix server after picking boolean cache_secondrowlocked; } cupgrid; @@ -872,6 +871,7 @@ typedef struct levelsearch_s { cupheader_t *cup; boolean timeattack; boolean tutorial; + boolean grandprix; boolean cupmode; boolean checklocked; } levelsearch_t; diff --git a/src/k_menudraw.c b/src/k_menudraw.c index 68c532f60..e2cb94ed4 100644 --- a/src/k_menudraw.c +++ b/src/k_menudraw.c @@ -3222,7 +3222,7 @@ void M_DrawCupSelect(void) if (cupgrid.cache_secondrowlocked == true) y += 28; - const boolean isGP = (cupgrid.grandprix && (cv_dummygpdifficulty.value >= 0 && cv_dummygpdifficulty.value < KARTGP_MAX)); + const boolean isGP = (templevelsearch.grandprix && (cv_dummygpdifficulty.value >= 0 && cv_dummygpdifficulty.value < KARTGP_MAX)); if (isGP) { windata = &templevelsearch.cup->windata[cv_dummygpdifficulty.value]; @@ -3236,7 +3236,7 @@ void M_DrawCupSelect(void) windata ? windata->best_placement : 0 ); - if (cupgrid.grandprix == true + if (templevelsearch.grandprix == true && templevelsearch.cup == cupsavedata.cup && id != CUPMENU_CURSORID) { @@ -3284,7 +3284,7 @@ void M_DrawCupSelect(void) templevelsearch.cup = cupgrid.builtgrid[CUPMENU_CURSORID]; - if (cupgrid.grandprix == true + if (templevelsearch.grandprix == true && templevelsearch.cup != NULL && templevelsearch.cup == cupsavedata.cup) { @@ -6982,7 +6982,8 @@ static void M_DrawChallengePreview(INT32 x, INT32 y) break; templevelsearch.cup = temp; - templevelsearch.typeoflevel = G_TOLFlag(GT_RACE)|G_TOLFlag(GT_BATTLE); + templevelsearch.typeoflevel = 0; // doesn't matter... + templevelsearch.grandprix = true; // this will overwrite templevelsearch.cupmode = true; templevelsearch.timeattack = false; templevelsearch.tutorial = false; diff --git a/src/k_menufunc.c b/src/k_menufunc.c index b8155c46e..25460a6d1 100644 --- a/src/k_menufunc.c +++ b/src/k_menufunc.c @@ -639,7 +639,7 @@ menu_t *M_SpecificMenuRestore(menu_t *torestore) if (levellist.newgametype == GT_RACE) { M_SetupRaceMenu(-1); - M_SetupDifficultyOptions((cupgrid.grandprix == false)); + M_SetupDifficultyOptions((levellist.levelsearch.grandprix == false)); } } diff --git a/src/menus/main-goner.cpp b/src/menus/main-goner.cpp index 49219e00a..f3635ad55 100644 --- a/src/menus/main-goner.cpp +++ b/src/menus/main-goner.cpp @@ -1254,7 +1254,7 @@ void M_GonerTutorial(INT32 choice) // Please also see M_LevelSelectInit as called in extras-1.c levellist.netgame = false; levellist.levelsearch.checklocked = true; - cupgrid.grandprix = false; + levellist.levelsearch.grandprix = false; levellist.levelsearch.timeattack = false; if (!M_LevelListFromGametype(GT_TUTORIAL) && gamedata->gonerlevel < GDGONER_OUTRO) diff --git a/src/menus/play-online-host.c b/src/menus/play-online-host.c index 493e0c1f5..56b7c8ab2 100644 --- a/src/menus/play-online-host.c +++ b/src/menus/play-online-host.c @@ -175,7 +175,7 @@ void M_MPSetupNetgameMapSelect(INT32 choice) // Make sure we reset those levellist.levelsearch.timeattack = false; levellist.levelsearch.checklocked = true; - cupgrid.grandprix = false; + levellist.levelsearch.grandprix = false; // okay this is REALLY stupid but this fixes the host menu re-folding on itself when we go back. mpmenu.modewinextend[0][0] = 1; diff --git a/src/menus/transient/cup-select.c b/src/menus/transient/cup-select.c index 056c93036..23a7e5943 100644 --- a/src/menus/transient/cup-select.c +++ b/src/menus/transient/cup-select.c @@ -289,7 +289,7 @@ void M_CupSelectHandler(INT32 choice) if (count == 0 || ( - cupgrid.grandprix == true + levellist.levelsearch.grandprix == true && newcup->cachedlevels[0] == NEXTMAP_INVALID ) ) @@ -298,7 +298,7 @@ void M_CupSelectHandler(INT32 choice) return; } - if (cupgrid.grandprix == true) + if (levellist.levelsearch.grandprix == true) { if (newcup == cupsavedata.cup && FIL_FileExists(gpbackup)) diff --git a/src/menus/transient/level-select.c b/src/menus/transient/level-select.c index 7512f15e2..c7e9ae12d 100644 --- a/src/menus/transient/level-select.c +++ b/src/menus/transient/level-select.c @@ -76,7 +76,9 @@ boolean M_CanShowLevelInList(INT16 mapnum, levelsearch_t *levelsearch) return false; // Check for TOL (permits TEST RUN outside of time attack) - if ((levelsearch->timeattack || levelsearch->tutorial || mapheaderinfo[mapnum]->typeoflevel) + // (grand prix can contain anything, we limit in a different way) + if (levelsearch->grandprix == false + && (levelsearch->timeattack || levelsearch->tutorial || mapheaderinfo[mapnum]->typeoflevel) && !(mapheaderinfo[mapnum]->typeoflevel & levelsearch->typeoflevel)) return false; @@ -133,7 +135,8 @@ UINT16 M_CountLevelsToShowInList(levelsearch_t *levelsearch) if (levelsearch->checklocked && M_CupLocked(levelsearch->cup)) return 0; - for (i = 0; i < CUPCACHE_PODIUM; i++) + const INT16 limit = (levelsearch->grandprix ? CUPCACHE_SPECIAL : CUPCACHE_PODIUM); + for (i = 0; i < limit; i++) { if (!M_CanShowLevelInList(levelsearch->cup->cachedlevels[i], levelsearch)) continue; @@ -170,7 +173,8 @@ UINT16 M_GetFirstLevelInList(UINT8 *i, levelsearch_t *levelsearch) *i = 0; mapnum = NEXTMAP_INVALID; - for (; *i < CUPCACHE_PODIUM; (*i)++) + const INT16 limit = (levelsearch->grandprix ? CUPCACHE_SPECIAL : CUPCACHE_PODIUM); + for (; *i < limit; (*i)++) { if (!M_CanShowLevelInList(levelsearch->cup->cachedlevels[*i], levelsearch)) continue; @@ -200,7 +204,8 @@ UINT16 M_GetNextLevelInList(UINT16 mapnum, UINT8 *i, levelsearch_t *levelsearch) { mapnum = NEXTMAP_INVALID; (*i)++; - for (; *i < CUPCACHE_PODIUM; (*i)++) + const INT16 limit = (levelsearch->grandprix ? CUPCACHE_SPECIAL : CUPCACHE_PODIUM); + for (; *i < limit; (*i)++) { if (!M_CanShowLevelInList(levelsearch->cup->cachedlevels[*i], levelsearch)) continue; @@ -357,7 +362,7 @@ boolean M_LevelListFromGametype(INT16 gt) size_t deltaid = 0; G_GetBackupCupData( - cupgrid.grandprix == true + templevelsearch.grandprix == true && cv_splitplayers.value <= 1 ); @@ -436,7 +441,7 @@ boolean M_LevelListFromGametype(INT16 gt) } size_t olddelta = deltaid; - if (cupgrid.grandprix == false) + if (templevelsearch.grandprix == false) { cupheader_t *restore = templevelsearch.cup; @@ -646,15 +651,15 @@ void M_LevelSelectInit(INT32 choice) switch (currentMenu->menuitems[itemOn].mvar1) { case 0: - cupgrid.grandprix = false; + levellist.levelsearch.grandprix = false; levellist.levelsearch.timeattack = false; break; case 1: - cupgrid.grandprix = false; + levellist.levelsearch.grandprix = false; levellist.levelsearch.timeattack = true; break; case 2: - cupgrid.grandprix = true; + levellist.levelsearch.grandprix = true; levellist.levelsearch.timeattack = false; break; default: