From af01ae7bc5f53a26ef355dad1ae72a1d819fd71e Mon Sep 17 00:00:00 2001 From: toaster Date: Wed, 17 Jan 2024 15:01:50 +0000 Subject: [PATCH 01/10] Duplicate levellist data for menu restoration - More consistent and graceful recovery from gametype change - Fix a potential bug with restoring the menu from Tutorial stages - Store the calling menu in this struct - Permits removing the Match Race restoreMenu hack --- src/k_menu.h | 8 +++++-- src/k_menufunc.c | 38 +++++++++++++----------------- src/menus/transient/level-select.c | 33 +++++++++++++++----------- 3 files changed, 42 insertions(+), 37 deletions(-) diff --git a/src/k_menu.h b/src/k_menu.h index 9ab7da97c..612cafd1e 100644 --- a/src/k_menu.h +++ b/src/k_menu.h @@ -824,7 +824,7 @@ typedef struct levelsearch_s { #define M_LEVELLIST_SLIDETIME 4 -extern struct levellist_s { +typedef struct levellist_s { SINT8 cursor; menu_anim_t slide; UINT16 y; @@ -834,7 +834,11 @@ extern struct levellist_s { UINT8 guessgt; levelsearch_t levelsearch; boolean netgame; // Start the game in an actual server -} levellist; + menu_t *backMenu; +} levellist_t; + +extern levellist_t levellist; +extern levellist_t restorelevellist; extern cupheader_t dummy_lostandfound; diff --git a/src/k_menufunc.c b/src/k_menufunc.c index 3ba20e388..a1737248e 100644 --- a/src/k_menufunc.c +++ b/src/k_menufunc.c @@ -533,26 +533,29 @@ menu_t *M_SpecificMenuRestore(menu_t *torestore) || torestore == &PLAY_TimeAttackDef) { // Handle unlock restrictions + + levellist = restorelevellist; + cupheader_t *currentcup = levellist.levelsearch.cup; - M_SetupGametypeMenu(-1); - - if (levellist.newgametype == GT_RACE) + if (levellist.levelsearch.tutorial) { - M_SetupRaceMenu(-1); - M_SetupDifficultyOptions((cupgrid.grandprix == false)); + M_InitExtras(-1); + } + else + { + M_SetupGametypeMenu(-1); + + if (levellist.newgametype == GT_RACE) + { + M_SetupRaceMenu(-1); + M_SetupDifficultyOptions((cupgrid.grandprix == false)); + } } if (!M_LevelListFromGametype(-1)) { - if (PLAY_LevelSelectDef.prevMenu == &PLAY_CupSelectDef) - { - torestore = PLAY_CupSelectDef.prevMenu; - } - else - { - torestore = PLAY_LevelSelectDef.prevMenu; - } + torestore = levellist.backMenu; } else { @@ -560,19 +563,12 @@ menu_t *M_SpecificMenuRestore(menu_t *torestore) { torestore = &PLAY_CupSelectDef; } - else if (torestore == &PLAY_TimeAttackDef) + else if (levellist.levelsearch.timeattack) { M_PrepareTimeAttack(0); } } } - else if (torestore == &PLAY_RaceDifficultyDef) - { - // Handle a much smaller subset of unlock restrictions - M_SetupGametypeMenu(-1); - M_SetupRaceMenu(-1); - M_SetupDifficultyOptions((cupgrid.grandprix == false)); - } else if (torestore == &PLAY_MP_OptSelectDef) { // Ticker init diff --git a/src/menus/transient/level-select.c b/src/menus/transient/level-select.c index 28eed536a..447fc1920 100644 --- a/src/menus/transient/level-select.c +++ b/src/menus/transient/level-select.c @@ -37,7 +37,8 @@ menu_t PLAY_LevelSelectDef = { NULL }; -struct levellist_s levellist; +levellist_t levellist; +levellist_t restorelevellist; // // M_CanShowLevelInList @@ -278,6 +279,8 @@ boolean M_LevelListFromGametype(INT16 gt) CV_SetValue(&cv_dummyspbattack, 0); } + levellist.backMenu = currentMenu; + if (gamestate == GS_MENU) { const char *music; @@ -290,8 +293,8 @@ boolean M_LevelListFromGametype(INT16 gt) } else { - music = currentMenu->music; - bgroutine = currentMenu->bgroutine; + music = levellist.backMenu->music; + bgroutine = levellist.backMenu->bgroutine; } menu_t *remap_menus[] = { @@ -548,10 +551,11 @@ boolean M_LevelListFromGametype(INT16 gt) cupgrid.pageno = 0; } + PLAY_CupSelectDef.prevMenu = levellist.backMenu; + PLAY_LevelSelectDef.prevMenu = &PLAY_CupSelectDef; + if (gt != -1) { - PLAY_CupSelectDef.prevMenu = currentMenu; - PLAY_LevelSelectDef.prevMenu = &PLAY_CupSelectDef; M_SetupNextMenu(&PLAY_CupSelectDef, false); } @@ -597,6 +601,8 @@ boolean M_LevelListFromGametype(INT16 gt) M_LevelSelectScrollDest(); levellist.slide.start = 0; + PLAY_LevelSelectDef.prevMenu = levellist.backMenu; + if (gt != -1) { if (levellist.levelsearch.tutorial && levellist.mapcount == 1) @@ -605,7 +611,6 @@ boolean M_LevelListFromGametype(INT16 gt) } else { - PLAY_LevelSelectDef.prevMenu = currentMenu; M_SetupNextMenu(&PLAY_LevelSelectDef, false); } } @@ -687,6 +692,8 @@ void M_LevelSelected(INT16 add) { S_StartSound(NULL, sfx_s3k63); + restorelevellist = levellist; + M_PrepareTimeAttack(0); PLAY_TimeAttackDef.lastOn = ta_start; @@ -744,19 +751,17 @@ void M_LevelSelected(INT16 add) D_MapChange(levellist.choosemap+1, levellist.newgametype, (cv_kartencore.value == 1), 1, 1, false, false); - if (!M_GameTrulyStarted() || - levellist.levelsearch.tutorial) - { - restoreMenu = currentMenu; - } - else if (levellist.netgame == true) + if (levellist.netgame == true) { restoreMenu = &PLAY_MP_OptSelectDef; } - else + else /*if (!M_GameTrulyStarted() || + levellist.levelsearch.tutorial)*/ { - restoreMenu = &PLAY_RaceDifficultyDef; + restoreMenu = currentMenu; } + + restorelevellist = levellist; } else { From 782732957c9fde431b548cf871a27eed50ffe27c Mon Sep 17 00:00:00 2001 From: toaster Date: Wed, 17 Jan 2024 15:46:38 +0000 Subject: [PATCH 02/10] Apply menu path specific background patch to the Time Attack submenus, too --- src/menus/transient/level-select.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/menus/transient/level-select.c b/src/menus/transient/level-select.c index 447fc1920..e96cefe46 100644 --- a/src/menus/transient/level-select.c +++ b/src/menus/transient/level-select.c @@ -307,17 +307,18 @@ boolean M_LevelListFromGametype(INT16 gt) NULL }; - size_t i; + INT16 i, j; for (i = 0; remap_menus[i]; i++) { remap_menus[i]->music = music; remap_menus[i]->bgroutine = bgroutine; - } - // Not for the time attack ones - PLAY_CupSelectDef.menuitems[0].patch = \ - PLAY_LevelSelectDef.menuitems[0].patch = \ - currentMenu->menuitems[itemOn].patch; + for (j = 0; j < remap_menus[i]->numitems; j++) + { + remap_menus[i]->menuitems[j].patch = \ + currentMenu->menuitems[itemOn].patch; + } + } } } From 748dd9080da0e17faea625df9094cf3f43389ce5 Mon Sep 17 00:00:00 2001 From: toaster Date: Wed, 17 Jan 2024 15:49:23 +0000 Subject: [PATCH 03/10] Fix tiny medals for Time Attack mode --- src/k_hud.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/k_hud.cpp b/src/k_hud.cpp index b26548122..4893fc4f3 100644 --- a/src/k_hud.cpp +++ b/src/k_hud.cpp @@ -1965,14 +1965,14 @@ void K_drawKartTimestamp(tic_t drawtime, INT32 TX, INT32 TY, INT32 splitflags, U if (gamedata->collected[(stickermedalinfo.emblems[i]-emblemlocations)]) { - V_DrawSmallMappedPatch(workx, worky, splitflags, + V_DrawMappedPatch(workx, worky, splitflags, static_cast(W_CachePatchName(M_GetEmblemPatch(stickermedalinfo.emblems[i], false), PU_CACHE)), R_GetTranslationColormap(TC_DEFAULT, M_GetEmblemColor(stickermedalinfo.emblems[i]), GTC_CACHE) ); } else { - V_DrawSmallMappedPatch(workx, worky, splitflags, + V_DrawMappedPatch(workx, worky, splitflags, static_cast(W_CachePatchName("NEEDIT", PU_CACHE)), NULL ); From 956c156e411f1b3add2ffac5b220d4dad163b1c4 Mon Sep 17 00:00:00 2001 From: toaster Date: Thu, 25 Jan 2024 03:18:38 +0000 Subject: [PATCH 04/10] Course Select QOL: Switch between cups with left and right inputs Prevents having to back out to the cupgrid view every time --- src/menus/transient/level-select.c | 84 ++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) diff --git a/src/menus/transient/level-select.c b/src/menus/transient/level-select.c index e96cefe46..b53b4bc75 100644 --- a/src/menus/transient/level-select.c +++ b/src/menus/transient/level-select.c @@ -801,6 +801,90 @@ void M_LevelSelectHandler(INT32 choice) S_StartSound(NULL, sfx_s3k5b); M_SetMenuDelay(pid); } + else if (levellist.levelsearch.cup == NULL) + ; // Mode with no cup? No left/right input for you! + else if (menucmd[pid].dpad_lr != 0) + { + levelsearch_t templevelsearch = levellist.levelsearch; + + while (1) + { + if (menucmd[pid].dpad_lr > 0) + { + // Next + if (++cupgrid.x >= CUPMENU_COLUMNS) + { + cupgrid.x = 0; + if (++cupgrid.y >= CUPMENU_ROWS) + { + cupgrid.y = 0; + if (++cupgrid.pageno >= cupgrid.numpages) + { + cupgrid.pageno = 0; + } + } + } + } + else + { + // Prev + if (cupgrid.x == 0) + { + cupgrid.x = CUPMENU_COLUMNS; + if (cupgrid.y == 0) + { + cupgrid.y = CUPMENU_ROWS; + if (cupgrid.pageno == 0) + { + cupgrid.pageno = cupgrid.numpages; + } + cupgrid.pageno--; + } + cupgrid.y--; + } + cupgrid.x--; + } + + templevelsearch.cup = cupgrid.builtgrid[CUPMENU_CURSORID]; + + if (templevelsearch.cup == levellist.levelsearch.cup) + { + break; + } + + if (!templevelsearch.cup) + { + continue; + } + + UINT16 count = M_CountLevelsToShowInList(&templevelsearch); + + if (count == 0 + // The following isn't ideal, but in addition to the + // necessary programming work being extremely annoying, + // I also just think being forced to switch between + // Time Attack single-course views and multi-course + // selections would just plain kind of look bad. + // ~toast 250124 (ON A PLANE BACK FROM MAGFEST WOOOOOOOO) + || (count == 1 && templevelsearch.timeattack == true)) + { + continue; + } + + levellist.levelsearch = templevelsearch; + + levellist.cursor = 0; + + levellist.mapcount = count; + M_LevelSelectScrollDest(); + levellist.slide.start = 0; + + S_StartSound(NULL, sfx_s3k5b); + M_SetMenuDelay(pid); + + break; + } + } M_LevelSelectScrollDest(); From 38258fc40ad9766224b6f501427346c6fdfd55ee Mon Sep 17 00:00:00 2001 From: toaster Date: Thu, 25 Jan 2024 03:19:23 +0000 Subject: [PATCH 05/10] M_CupSelectHandler: small code cleanup done while writing the previous commit --- src/menus/transient/cup-select.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/menus/transient/cup-select.c b/src/menus/transient/cup-select.c index 7882d0cc9..b9ded0482 100644 --- a/src/menus/transient/cup-select.c +++ b/src/menus/transient/cup-select.c @@ -265,12 +265,21 @@ void M_CupSelectHandler(INT32 choice) M_SetMenuDelay(pid); + if (!newcup) + { + S_StartSound(NULL, sfx_s3kb2); + return; + } + levellist.levelsearch.cup = newcup; count = M_CountLevelsToShowInList(&levellist.levelsearch); - if ((!newcup) - || (count == 0) - || (cupgrid.grandprix == true && newcup->cachedlevels[0] == NEXTMAP_INVALID)) + if (count == 0 + || ( + cupgrid.grandprix == true + && newcup->cachedlevels[0] == NEXTMAP_INVALID + ) + ) { S_StartSound(NULL, sfx_s3kb2); return; From 954d728da0440e76dbdc1f028ce2f37aa1fca259 Mon Sep 17 00:00:00 2001 From: toaster Date: Thu, 25 Jan 2024 04:35:31 +0000 Subject: [PATCH 06/10] ta_e: Remove no-longer-relevant ta_spb, which could cause out-of-bounds menu options to be selected --- src/k_menu.h | 1 - 1 file changed, 1 deletion(-) diff --git a/src/k_menu.h b/src/k_menu.h index 612cafd1e..0b256ea7c 100644 --- a/src/k_menu.h +++ b/src/k_menu.h @@ -275,7 +275,6 @@ typedef enum ta_replay = 0, ta_guest, ta_ghosts, - ta_spb, ta_spacer, ta_start, } ta_e; From 5e85de05ece3bd9f502706e30935bf69d98c86a2 Mon Sep 17 00:00:00 2001 From: toaster Date: Thu, 25 Jan 2024 04:37:34 +0000 Subject: [PATCH 07/10] QOL: Also support left/right inputs switching the Course from the top-level Time Attack view directly - Abstracts out M_LevelSelectCupSwitch - Pre-emptively supports cvars/arrow options on that menu --- src/k_menu.h | 5 +- src/k_menufunc.c | 2 +- src/menus/play-local-race-time-attack.c | 47 ++++++- src/menus/transient/cup-select.c | 2 +- src/menus/transient/level-select.c | 180 +++++++++++++----------- 5 files changed, 143 insertions(+), 93 deletions(-) diff --git a/src/k_menu.h b/src/k_menu.h index 0b256ea7c..344c43430 100644 --- a/src/k_menu.h +++ b/src/k_menu.h @@ -854,7 +854,8 @@ void M_CupSelectTick(void); void M_LevelSelectHandler(INT32 choice); void M_LevelSelectTick(void); -void M_LevelSelected(INT16 add); +void M_LevelSelected(INT16 add, boolean menuupdate); +boolean M_LevelSelectCupSwitch(boolean next, boolean skipones); // dummy consvars for GP & match race setup extern consvar_t cv_dummygpdifficulty; @@ -897,7 +898,7 @@ void M_PleaseWait(void); void M_PopupMasterServerRules(void); // Time Attack -void M_PrepareTimeAttack(INT32 choice); +void M_PrepareTimeAttack(boolean menuupdate); void M_StartTimeAttack(INT32 choice); void M_ReplayTimeAttack(INT32 choice); void M_HandleStaffReplay(INT32 choice); diff --git a/src/k_menufunc.c b/src/k_menufunc.c index a1737248e..22f3c3c0b 100644 --- a/src/k_menufunc.c +++ b/src/k_menufunc.c @@ -565,7 +565,7 @@ menu_t *M_SpecificMenuRestore(menu_t *torestore) } else if (levellist.levelsearch.timeattack) { - M_PrepareTimeAttack(0); + M_PrepareTimeAttack(true); } } } diff --git a/src/menus/play-local-race-time-attack.c b/src/menus/play-local-race-time-attack.c index 3d5225ea6..af0804101 100644 --- a/src/menus/play-local-race-time-attack.c +++ b/src/menus/play-local-race-time-attack.c @@ -52,6 +52,42 @@ boolean M_TimeAttackInputs(INT32 ch) return true; } + if (menucmd[pid].dpad_lr != 0 + && !((currentMenu->menuitems[itemOn].status & IT_TYPE) == IT_ARROWS + || (currentMenu->menuitems[itemOn].status & IT_TYPE) == IT_CVAR) + ) + { + if (menucmd[pid].dpad_lr > 0) + { + levellist.cursor++; + if (levellist.cursor >= levellist.mapcount) + { + M_LevelSelectCupSwitch(true, false); + levellist.cursor = 0; + } + } + else + { + levellist.cursor--; + if (levellist.cursor < 0) + { + M_LevelSelectCupSwitch(false, false); + levellist.cursor = levellist.mapcount-1; + } + } + + M_LevelSelectScrollDest(); + levellist.slide.start = 0; + + M_LevelSelected(levellist.cursor, false); + itemOn = ta_start; + + S_StartSound(NULL, sfx_s3k5b); + M_SetMenuDelay(pid); + + return true; + } + return false; } @@ -215,11 +251,12 @@ menu_t PLAY_TAGhostsDef = { }; // time attack stuff... -void M_PrepareTimeAttack(INT32 choice) +void M_PrepareTimeAttack(boolean menuupdate) { - (void) choice; - - timeattackmenu.ticker = 0; + if (menuupdate) + { + timeattackmenu.ticker = 0; + } // Gametype guess if (levellist.guessgt != MAXGAMETYPES) @@ -426,7 +463,7 @@ static void M_WriteGuestReplay(INT32 ch) Z_Free(rguest); Z_Free(gpath); - M_PrepareTimeAttack(0); + M_PrepareTimeAttack(false); M_SetupNextMenu(&PLAY_TimeAttackDef, false); // TODO the following isn't showing up and I'm not sure why diff --git a/src/menus/transient/cup-select.c b/src/menus/transient/cup-select.c index b9ded0482..da876b40d 100644 --- a/src/menus/transient/cup-select.c +++ b/src/menus/transient/cup-select.c @@ -309,7 +309,7 @@ void M_CupSelectHandler(INT32 choice) else if (count == 1 && levellist.levelsearch.timeattack == true) { currentMenu->transitionID = PLAY_TimeAttackDef.transitionID+1; - M_LevelSelected(0); + M_LevelSelected(0, true); } else { diff --git a/src/menus/transient/level-select.c b/src/menus/transient/level-select.c index b53b4bc75..494a9c367 100644 --- a/src/menus/transient/level-select.c +++ b/src/menus/transient/level-select.c @@ -608,7 +608,7 @@ boolean M_LevelListFromGametype(INT16 gt) { if (levellist.levelsearch.tutorial && levellist.mapcount == 1) { - M_LevelSelected(0); // Skip the list! + M_LevelSelected(0, true); // Skip the list! } else { @@ -664,7 +664,7 @@ void M_LevelSelectInit(INT32 choice) } } -void M_LevelSelected(INT16 add) +void M_LevelSelected(INT16 add, boolean menuupdate) { UINT8 i = 0; INT16 map = M_GetFirstLevelInList(&i, &levellist.levelsearch); @@ -691,15 +691,18 @@ void M_LevelSelected(INT16 add) if (levellist.levelsearch.timeattack) { - S_StartSound(NULL, sfx_s3k63); - restorelevellist = levellist; - M_PrepareTimeAttack(0); + M_PrepareTimeAttack(menuupdate); - PLAY_TimeAttackDef.lastOn = ta_start; - PLAY_TimeAttackDef.prevMenu = currentMenu; - M_SetupNextMenu(&PLAY_TimeAttackDef, false); + if (menuupdate) + { + S_StartSound(NULL, sfx_s3k63); + + PLAY_TimeAttackDef.lastOn = ta_start; + PLAY_TimeAttackDef.prevMenu = currentMenu; + M_SetupNextMenu(&PLAY_TimeAttackDef, false); + } } else { @@ -774,6 +777,86 @@ void M_LevelSelected(INT16 add) } } +boolean M_LevelSelectCupSwitch(boolean next, boolean skipones) +{ + levelsearch_t templevelsearch = levellist.levelsearch; + + while (1) + { + if (next) + { + // Next + if (++cupgrid.x >= CUPMENU_COLUMNS) + { + cupgrid.x = 0; + if (++cupgrid.y >= CUPMENU_ROWS) + { + cupgrid.y = 0; + if (++cupgrid.pageno >= cupgrid.numpages) + { + cupgrid.pageno = 0; + } + } + } + } + else + { + // Prev + if (cupgrid.x == 0) + { + cupgrid.x = CUPMENU_COLUMNS; + if (cupgrid.y == 0) + { + cupgrid.y = CUPMENU_ROWS; + if (cupgrid.pageno == 0) + { + cupgrid.pageno = cupgrid.numpages; + } + cupgrid.pageno--; + } + cupgrid.y--; + } + cupgrid.x--; + } + + templevelsearch.cup = cupgrid.builtgrid[CUPMENU_CURSORID]; + + if (templevelsearch.cup == levellist.levelsearch.cup) + { + return false; + } + + if (!templevelsearch.cup) + { + continue; + } + + UINT16 count = M_CountLevelsToShowInList(&templevelsearch); + + if (count == 0 + // The following isn't ideal, but in addition to the + // necessary programming work being extremely annoying, + // I also just think being forced to switch between + // Time Attack single-course views and multi-course + // selections would just plain kind of look bad. + // ~toast 250124 (ON A PLANE BACK FROM MAGFEST WOOOOOOOO) + || (skipones && count == 1)) + { + continue; + } + + levellist.levelsearch = templevelsearch; + + levellist.cursor = 0; + + levellist.mapcount = count; + M_LevelSelectScrollDest(); + levellist.slide.start = 0; + + return true; + } +} + void M_LevelSelectHandler(INT32 choice) { const UINT8 pid = 0; @@ -805,84 +888,13 @@ void M_LevelSelectHandler(INT32 choice) ; // Mode with no cup? No left/right input for you! else if (menucmd[pid].dpad_lr != 0) { - levelsearch_t templevelsearch = levellist.levelsearch; - - while (1) + if (M_LevelSelectCupSwitch( + (menucmd[pid].dpad_lr > 0), + levellist.levelsearch.timeattack) + ) { - if (menucmd[pid].dpad_lr > 0) - { - // Next - if (++cupgrid.x >= CUPMENU_COLUMNS) - { - cupgrid.x = 0; - if (++cupgrid.y >= CUPMENU_ROWS) - { - cupgrid.y = 0; - if (++cupgrid.pageno >= cupgrid.numpages) - { - cupgrid.pageno = 0; - } - } - } - } - else - { - // Prev - if (cupgrid.x == 0) - { - cupgrid.x = CUPMENU_COLUMNS; - if (cupgrid.y == 0) - { - cupgrid.y = CUPMENU_ROWS; - if (cupgrid.pageno == 0) - { - cupgrid.pageno = cupgrid.numpages; - } - cupgrid.pageno--; - } - cupgrid.y--; - } - cupgrid.x--; - } - - templevelsearch.cup = cupgrid.builtgrid[CUPMENU_CURSORID]; - - if (templevelsearch.cup == levellist.levelsearch.cup) - { - break; - } - - if (!templevelsearch.cup) - { - continue; - } - - UINT16 count = M_CountLevelsToShowInList(&templevelsearch); - - if (count == 0 - // The following isn't ideal, but in addition to the - // necessary programming work being extremely annoying, - // I also just think being forced to switch between - // Time Attack single-course views and multi-course - // selections would just plain kind of look bad. - // ~toast 250124 (ON A PLANE BACK FROM MAGFEST WOOOOOOOO) - || (count == 1 && templevelsearch.timeattack == true)) - { - continue; - } - - levellist.levelsearch = templevelsearch; - - levellist.cursor = 0; - - levellist.mapcount = count; - M_LevelSelectScrollDest(); - levellist.slide.start = 0; - S_StartSound(NULL, sfx_s3k5b); M_SetMenuDelay(pid); - - break; } } @@ -891,7 +903,7 @@ void M_LevelSelectHandler(INT32 choice) if (M_MenuConfirmPressed(pid) /*|| M_MenuButtonPressed(pid, MBT_START)*/) { M_SetMenuDelay(pid); - M_LevelSelected(levellist.cursor); + M_LevelSelected(levellist.cursor, true); } else if (M_MenuBackPressed(pid)) { From 037c3a2aa11ac5f5ee05195f36ff2b17124260c9 Mon Sep 17 00:00:00 2001 From: toaster Date: Thu, 25 Jan 2024 22:10:32 +0000 Subject: [PATCH 08/10] M_StartCup: Also set restorelevellist --- src/menus/transient/cup-select.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/menus/transient/cup-select.c b/src/menus/transient/cup-select.c index da876b40d..0d7c0a474 100644 --- a/src/menus/transient/cup-select.c +++ b/src/menus/transient/cup-select.c @@ -129,7 +129,9 @@ static void M_StartCup(UINT8 entry) SV_StartSinglePlayerServer(levellist.newgametype, levellist.netgame); M_ClearMenus(true); + restoreMenu = &PLAY_CupSelectDef; + restorelevellist = levellist; if (entry < roundqueue.size) { From 02ee9b476669853cdec5f3602b0d1b8f3094fad4 Mon Sep 17 00:00:00 2001 From: toaster Date: Thu, 25 Jan 2024 22:24:05 +0000 Subject: [PATCH 09/10] M_LevelSelectCupSwitch: Don't reset to the first course in every cup every left/right input --- src/menus/transient/level-select.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/menus/transient/level-select.c b/src/menus/transient/level-select.c index 494a9c367..34abf58a5 100644 --- a/src/menus/transient/level-select.c +++ b/src/menus/transient/level-select.c @@ -847,9 +847,10 @@ boolean M_LevelSelectCupSwitch(boolean next, boolean skipones) levellist.levelsearch = templevelsearch; - levellist.cursor = 0; - levellist.mapcount = count; + if (levellist.cursor >= count) + levellist.cursor = count-1; + M_LevelSelectScrollDest(); levellist.slide.start = 0; From 06c049bb7e6a1323b97f8e6e74a91c5a56a5da2a Mon Sep 17 00:00:00 2001 From: toaster Date: Sat, 27 Jan 2024 00:02:16 +0000 Subject: [PATCH 10/10] More consistent lastOn --> itemOn and BGImage setting Fixes Mari's background image bug --- src/d_clisrv.c | 1 + src/k_menufunc.c | 9 +++++---- src/menus/transient/pause-game.c | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 72478f55b..9a653368f 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -2490,6 +2490,7 @@ static void Command_connect(void) // Menu restore state. restoreMenu = &PLAY_MP_OptSelectDef; + currentMenu->lastOn = itemOn; Music_Remap("menu", "NETMD2"); diff --git a/src/k_menufunc.c b/src/k_menufunc.c index 22f3c3c0b..b54696c2b 100644 --- a/src/k_menufunc.c +++ b/src/k_menufunc.c @@ -667,8 +667,6 @@ void M_StartControlPanel(void) } } - M_PickMenuBGMap(); - if (M_GameTrulyStarted() == false) { // Are you ready for the First Boot Experience? @@ -713,14 +711,15 @@ void M_StartControlPanel(void) M_PlayMenuJam(); } + + itemOn = currentMenu->lastOn; + M_UpdateMenuBGImage(true); } else { M_OpenPauseMenu(); } - itemOn = currentMenu->lastOn; - CON_ToggleOff(); // move away console } @@ -741,6 +740,8 @@ void M_ClearMenus(boolean callexitmenufunc) COM_BufAddText(va("saveconfig \"%s\" -silent\n", configfile)); #endif //Alam: But not on the Dreamcast's VMUs + currentMenu->lastOn = itemOn; + if (gamestate == GS_MENU) // Back to title screen { int i; diff --git a/src/menus/transient/pause-game.c b/src/menus/transient/pause-game.c index 762b778cc..a04f3353c 100644 --- a/src/menus/transient/pause-game.c +++ b/src/menus/transient/pause-game.c @@ -123,7 +123,7 @@ void M_OpenPauseMenu(void) pausemenu.openoffset.dist = 0; pausemenu.closing = false; - currentMenu->lastOn = mpause_continue; // Make sure we select "RESUME GAME" by default + itemOn = currentMenu->lastOn = mpause_continue; // Make sure we select "RESUME GAME" by default // Now the hilarious balancing act of deciding what options should be enabled and which ones shouldn't be! // By default, disable anything sensitive: