From 6e5c9555014a6ef15e963047d3d1a19efce0f127 Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Sun, 28 Aug 2022 06:08:30 -0400 Subject: [PATCH] Only allow Time Attack for 1P Battle gametype submenu no longer exists. --- src/k_menu.h | 5 ++++- src/k_menudef.c | 30 +++++++++--------------------- src/k_menudraw.c | 25 ++++++++++++++++++++++--- src/k_menufunc.c | 41 +++++++++++++++++++++++++++++++++++++++++ 4 files changed, 76 insertions(+), 25 deletions(-) diff --git a/src/k_menu.h b/src/k_menu.h index eb6e166cc..86d0d2bfe 100644 --- a/src/k_menu.h +++ b/src/k_menu.h @@ -187,7 +187,7 @@ extern menu_t PLAY_CharSelectDef; extern menuitem_t PLAY_MainMenu[]; extern menu_t PLAY_MainDef; -extern menuitem_t PLAY_Gamemodes[]; +extern menuitem_t PLAY_GamemodesMenu[]; extern menu_t PLAY_GamemodesDef; extern menuitem_t PLAY_RaceGamemodesMenu[]; @@ -617,6 +617,9 @@ boolean M_CharacterSelectHandler(INT32 choice); void M_CharacterSelectTick(void); boolean M_CharacterSelectQuit(void); +void M_SetupGametypeMenu(INT32 choice); +void M_SetupRaceMenu(INT32 choice); + #define CUPMENU_COLUMNS 7 #define CUPMENU_ROWS 2 #define CUPMENU_CURSORID (cupgrid.x + (cupgrid.y * CUPMENU_COLUMNS) + (cupgrid.pageno * (CUPMENU_COLUMNS * CUPMENU_ROWS))) diff --git a/src/k_menudef.c b/src/k_menudef.c index b0d3fe54e..e62a8c0e0 100644 --- a/src/k_menudef.c +++ b/src/k_menudef.c @@ -73,8 +73,8 @@ menu_t PLAY_CharSelectDef = { menuitem_t PLAY_MainMenu[] = { - {IT_STRING | IT_SUBMENU, "Local Play", "Play only on this computer.", - NULL, {.submenu = &PLAY_GamemodesDef}, 0, 0}, + {IT_STRING | IT_CALL, "Local Play", "Play only on this computer.", + NULL, {.routine = M_SetupGametypeMenu}, 0, 0}, {IT_STRING | IT_CALL, "Online", "Connect to other computers.", NULL, {.routine = M_MPOptSelectInit}, /*M_MPRoomSelectInit,*/ 0, 0}, @@ -86,11 +86,14 @@ menu_t PLAY_MainDef = KARTGAMEMODEMENU(PLAY_MainMenu, &PLAY_CharSelectDef); menuitem_t PLAY_GamemodesMenu[] = { - {IT_STRING | IT_SUBMENU, "Race", "A contest to see who's the fastest of them all!", - NULL, {.submenu = &PLAY_RaceGamemodesDef}, 0, 0}, + {IT_STRING | IT_CALL, "Race", "A contest to see who's the fastest of them all!", + NULL, {.routine = M_SetupRaceMenu}, 0, 0}, - {IT_STRING | IT_SUBMENU, "Battle", "Sharpen your item usage in these special Battle zones!", - NULL, {.submenu = &PLAY_BattleGamemodesDef}, 0, 0}, + {IT_STRING | IT_CALL, "Battle", "It's last hedgehog standing in this free-for-all!", + "MENIMG00", {.routine = M_LevelSelectInit}, 0, GT_BATTLE}, + + {IT_STRING | IT_CALL, "Capsules", "Bust up all of the capsules in record time!", + NULL, {.routine = M_LevelSelectInit}, 1, GT_BATTLE}, {IT_STRING | IT_CALL, "Back", NULL, NULL, {.routine = M_GoBack}, 0, 0}, }; @@ -313,21 +316,6 @@ menu_t PLAY_TAGhostsDef = { NULL }; -// BATTLE - -menuitem_t PLAY_BattleGamemodesMenu[] = -{ - {IT_STRING | IT_CALL, "Survival", "It's last hedgehog standing in this free-for-all!", - "MENIMG00", {.routine = M_LevelSelectInit}, 0, GT_BATTLE}, - - {IT_STRING | IT_CALL, "Time Attack", "Bust up all of the capsules in record time!", - NULL, {.routine = M_LevelSelectInit}, 1, GT_BATTLE}, - - {IT_STRING | IT_CALL, "Back", NULL, NULL, {.routine = M_GoBack}, 0, 0}, -}; - -menu_t PLAY_BattleGamemodesDef = KARTGAMEMODEMENU(PLAY_BattleGamemodesMenu, &PLAY_GamemodesDef); - // MULTIPLAYER OPTION SELECT menuitem_t PLAY_MP_OptSelect[] = { diff --git a/src/k_menudraw.c b/src/k_menudraw.c index ce4f93e49..f83f5a455 100644 --- a/src/k_menudraw.c +++ b/src/k_menudraw.c @@ -655,8 +655,22 @@ void M_DrawGenericMenu(void) // void M_DrawKartGamemodeMenu(void) { - UINT8 n = currentMenu->numitems-1; - INT32 i, x = GM_STARTX - ((GM_XOFFSET / 2) * (n-1)), y = GM_STARTY - ((GM_YOFFSET / 2) * (n-1)); + UINT8 n = 0; + INT32 i, x, y; + + for (i = 0; i < currentMenu->numitems; i++) + { + if (currentMenu->menuitems[i].status == IT_DISABLED) + { + continue; + } + + n++; + } + + n--; + x = GM_STARTX - ((GM_XOFFSET / 2) * (n-1)); + y = GM_STARTY - ((GM_YOFFSET / 2) * (n-1)); M_DrawMenuTooltips(); @@ -667,7 +681,12 @@ void M_DrawKartGamemodeMenu(void) for (i = 0; i < currentMenu->numitems; i++) { - if (i >= n) + if (currentMenu->menuitems[i].status == IT_DISABLED) + { + continue; + } + + if (i >= currentMenu->numitems-1) { x = GM_STARTX + (GM_XOFFSET * 5 / 2); y = GM_STARTY + (GM_YOFFSET * 5 / 2); diff --git a/src/k_menufunc.c b/src/k_menufunc.c index fe62e82b5..410f65817 100644 --- a/src/k_menufunc.c +++ b/src/k_menufunc.c @@ -3156,6 +3156,47 @@ boolean M_CharacterSelectQuit(void) return true; } +void M_SetupGametypeMenu(INT32 choice) +{ + (void)choice; + + PLAY_GamemodesDef.prevMenu = currentMenu; + + if (cv_splitplayers.value <= 1) + { + // Remove Battle, add Capsules + PLAY_GamemodesMenu[1].status = IT_DISABLED; + PLAY_GamemodesMenu[2].status = IT_STRING | IT_CALL; + } + else + { + // Add Battle, remove Capsules + PLAY_GamemodesMenu[1].status = IT_STRING | IT_CALL; + PLAY_GamemodesMenu[2].status = IT_DISABLED; + } + + M_SetupNextMenu(&PLAY_GamemodesDef, false); +} + +void M_SetupRaceMenu(INT32 choice) +{ + (void)choice; + + PLAY_RaceGamemodesDef.prevMenu = currentMenu; + + // Time Attack is 1P only + if (cv_splitplayers.value <= 1) + { + PLAY_RaceGamemodesMenu[2].status = IT_STRING | IT_CALL; + } + else + { + PLAY_RaceGamemodesMenu[2].status = IT_DISABLED; + } + + M_SetupNextMenu(&PLAY_RaceGamemodesDef, false); +} + // DIFFICULTY SELECT void M_SetupDifficultySelect(INT32 choice)