Dehardcode menu gametype selection, part 3

Multiplayer map select now uses the value of `menugametype` accessible just above it on the menu, instead of having to select from a hardcoded set of options
This commit is contained in:
toaster 2022-12-30 23:58:22 +00:00
parent be49e99a9e
commit b09045f657
3 changed files with 10 additions and 20 deletions

View file

@ -436,9 +436,6 @@ typedef enum
mpause_title,
} mpause_e;
extern menuitem_t PAUSE_GamemodesMenu[];
extern menu_t PAUSE_GamemodesDef;
extern menuitem_t PAUSE_PlaybackMenu[];
extern menu_t PAUSE_PlaybackMenuDef;

View file

@ -1596,8 +1596,8 @@ menuitem_t PAUSE_Main[] =
{IT_STRING | IT_KEYHANDLER, "GAMETYPE", "M_ICOGAM",
NULL, {.routine = M_HandlePauseMenuGametype}, 0, 0},
{IT_STRING | IT_SUBMENU, "CHANGE MAP", "M_ICOMAP",
NULL, {.submenu = &PAUSE_GamemodesDef}, 0, 0},
{IT_STRING | IT_CALL, "CHANGE MAP", "M_ICOMAP",
NULL, {.routine = M_LevelSelectInit}, 0, -1},
{IT_STRING | IT_CALL, "RESTART MAP", "M_ICORE",
NULL, {.routine = M_RestartMap}, 0, 0},
@ -1650,20 +1650,6 @@ menu_t PAUSE_MainDef = {
M_PauseInputs
};
// PAUSE : Map switching gametype selection (In case you want to pick from battle / race...)
menuitem_t PAUSE_GamemodesMenu[] =
{
{IT_STRING | IT_CALL, "Race", "Select which gamemode to choose a new map from.",
NULL, {.routine = M_LevelSelectInit}, 0, GT_RACE},
{IT_STRING | IT_CALL, "Battle", "Select which gamemode to choose a new map from.",
NULL, {.routine = M_LevelSelectInit}, 0, GT_BATTLE},
{IT_STRING | IT_CALL, "Back", NULL, NULL, {.routine = M_GoBack}, 0, 0},
};
menu_t PAUSE_GamemodesDef = KARTGAMEMODEMENU(PAUSE_GamemodesMenu, &PAUSE_MainDef);
// Replay popup menu
menuitem_t PAUSE_PlaybackMenu[] =
{

View file

@ -3676,6 +3676,8 @@ static void M_LevelListFromGametype(INT16 gt)
void M_LevelSelectInit(INT32 choice)
{
INT32 gt = currentMenu->menuitems[itemOn].mvar2;
(void)choice;
// Make sure this is reset as we'll only be using this function for offline games!
@ -3702,7 +3704,12 @@ void M_LevelSelectInit(INT32 choice)
return;
}
M_LevelListFromGametype(currentMenu->menuitems[itemOn].mvar2);
if (gt == -1)
{
gt = menugametype;
}
M_LevelListFromGametype(gt);
}
static void M_LevelSelected(INT16 add)