From 76df190de19fde7b3001ca37fb7dc8a50a3085bc Mon Sep 17 00:00:00 2001 From: Agent X <44549182+AgentXLP@users.noreply.github.com> Date: Thu, 13 Jun 2024 10:19:10 -0400 Subject: [PATCH] Restore separated staff roll option --- src/game/level_update.c | 54 +++++++++++++-------------- src/game/level_update.h | 5 +-- src/pc/configfile.c | 3 +- src/pc/configfile.h | 1 + src/pc/djui/djui_panel_menu_options.c | 28 ++++++++------ 5 files changed, 47 insertions(+), 44 deletions(-) diff --git a/src/game/level_update.c b/src/game/level_update.c index d3a613a1..5e38e70e 100644 --- a/src/game/level_update.c +++ b/src/game/level_update.c @@ -48,8 +48,8 @@ #include "engine/level_script.h" -#define MENU_LEVEL_MIN 1 -#define MENU_LEVEL_MAX 18 +#define MENU_LEVEL_MIN 0 +#define MENU_LEVEL_MAX 17 struct SavedWarpValues gReceiveWarp = { 0 }; extern s8 sReceivedLoadedActNum; @@ -1258,7 +1258,7 @@ s32 play_mode_normal(void) { } } else { if (gDjuiInMainMenu && - !gMenuStaffRoll && + !configMenuStaffRoll && gCurrDemoInput == NULL && configMenuDemos && !gInPlayerMenu && @@ -1479,30 +1479,30 @@ void update_menu_level(void) { // figure out level s32 curLevel = 0; switch (configMenuLevel) { - case 1: curLevel = LEVEL_CASTLE_GROUNDS; break; - case 2: curLevel = LEVEL_BOB; break; - case 3: curLevel = LEVEL_WF; break; - case 4: curLevel = LEVEL_WMOTR; break; - case 5: curLevel = LEVEL_JRB; break; - case 6: curLevel = LEVEL_SSL; break; - case 7: curLevel = LEVEL_TTM; break; - case 8: curLevel = LEVEL_SL; break; - case 9: curLevel = LEVEL_BBH; break; - case 10: curLevel = LEVEL_LLL; break; - case 11: curLevel = LEVEL_THI; break; - case 12: curLevel = LEVEL_HMC; break; - case 13: curLevel = LEVEL_CCM; break; - case 14: curLevel = LEVEL_RR; break; - case 15: curLevel = LEVEL_BITDW; break; - case 16: curLevel = LEVEL_PSS; break; - case 17: curLevel = LEVEL_TTC; break; - case 18: curLevel = LEVEL_WDW; break; + case 0: curLevel = LEVEL_CASTLE_GROUNDS; break; + case 1: curLevel = LEVEL_BOB; break; + case 2: curLevel = LEVEL_WF; break; + case 3: curLevel = LEVEL_WMOTR; break; + case 4: curLevel = LEVEL_JRB; break; + case 5: curLevel = LEVEL_SSL; break; + case 6: curLevel = LEVEL_TTM; break; + case 7: curLevel = LEVEL_SL; break; + case 8: curLevel = LEVEL_BBH; break; + case 9: curLevel = LEVEL_LLL; break; + case 10: curLevel = LEVEL_THI; break; + case 11: curLevel = LEVEL_HMC; break; + case 12: curLevel = LEVEL_CCM; break; + case 13: curLevel = LEVEL_RR; break; + case 14: curLevel = LEVEL_BITDW; break; + case 15: curLevel = LEVEL_PSS; break; + case 16: curLevel = LEVEL_TTC; break; + case 17: curLevel = LEVEL_WDW; break; default: curLevel = LEVEL_CASTLE_GROUNDS; break; } // figure out music stop_cap_music(); - if (!configMenuSound || gMenuStaffRoll || curLevel == LEVEL_CASTLE_GROUNDS) { + if (!configMenuSound || configMenuStaffRoll || curLevel == LEVEL_CASTLE_GROUNDS) { reset_volume(); disable_background_sound(); set_background_music(0, SEQ_MENU_FILE_SELECT, 0); @@ -1512,7 +1512,7 @@ void update_menu_level(void) { set_background_music(gCurrentArea->musicParam, gCurrentArea->musicParam2, 0); } - if (gMenuStaffRoll) { + if (configMenuStaffRoll) { return; } else { gCurrCreditsEntry = NULL; @@ -1652,9 +1652,7 @@ void update_menu_level(void) { gLakituState.skipCameraInterpolationTimestamp = gGlobalTimer; extern s32 gCamSkipInterp; gCamSkipInterp = 1; - if (gCurrentArea != NULL) { - vec3f_copy(gCurrentArea->camera->pos, gLakituState.curPos); - } + vec3f_copy(gCurrentArea->camera->pos, gLakituState.curPos); vec3f_copy(gLakituState.pos, gLakituState.curPos); vec3f_copy(gLakituState.goalPos, gLakituState.curPos); @@ -1796,13 +1794,13 @@ s32 init_level(void) { configMenuLevel = randLevel; } - if (gMenuStaffRoll) { + if (configMenuStaffRoll) { gMarioState->marioObj->header.gfx.node.flags &= ~GRAPH_RENDER_ACTIVE; warp_credits(); level_trigger_warp(gMarioState, WARP_OP_CREDITS_NEXT); sFirstCastleGroundsMenu = false; } else { - if (configMenuLevel == 1 && sFirstCastleGroundsMenu) { + if (configMenuLevel == 0 && sFirstCastleGroundsMenu) { set_mario_action(gMarioState, ACT_INTRO_CUTSCENE, 7); sFirstCastleGroundsMenu = false; } else { diff --git a/src/game/level_update.h b/src/game/level_update.h index 6db92566..2f4d16a9 100644 --- a/src/game/level_update.h +++ b/src/game/level_update.h @@ -99,9 +99,6 @@ extern s16 gChangeLevel; extern s16 gChangeActNum; extern s16 gDelayedInitSound; -extern bool gInPlayerMenu; -#define gMenuStaffRoll configMenuLevel == 0 - struct WarpDest { u8 type; s16 levelNum; @@ -148,6 +145,8 @@ extern bool gNeverEnteredCastle; extern u32 gControlTimerStartNat; extern u32 gControlTimerStopNat; +extern bool gInPlayerMenu; + enum HUDDisplayFlag { HUD_DISPLAY_FLAG_LIVES = 0x0001, HUD_DISPLAY_FLAG_COIN_COUNT = 0x0002, diff --git a/src/pc/configfile.c b/src/pc/configfile.c index 301d4feb..931c7f97 100644 --- a/src/pc/configfile.c +++ b/src/pc/configfile.c @@ -20,7 +20,6 @@ #include "debuglog.h" #include "djui/djui_hud_utils.h" #include "game/save_file.h" -#include "game/level_update.h" #define ARRAY_LEN(arr) (sizeof(arr) / sizeof(arr[0])) @@ -163,6 +162,7 @@ bool configNametags = true; unsigned int configBouncyLevelBounds = 0; bool configSkipIntro = 0; bool configPauseAnywhere = false; +bool configMenuStaffRoll = true; unsigned int configMenuLevel = 0; bool configMenuSound = false; bool configMenuRandom = false; @@ -282,6 +282,7 @@ static const struct ConfigOption options[] = { {.name = "coop_bouncy_bounds", .type = CONFIG_TYPE_UINT, .uintValue = &configBouncyLevelBounds}, {.name = "skip_intro", .type = CONFIG_TYPE_BOOL, .boolValue = &configSkipIntro}, {.name = "pause_anywhere", .type = CONFIG_TYPE_BOOL, .boolValue = &configPauseAnywhere}, + {.name = "coop_menu_staff_roll", .type = CONFIG_TYPE_BOOL, .boolValue = &configMenuStaffRoll}, {.name = "coop_menu_level", .type = CONFIG_TYPE_UINT, .uintValue = &configMenuLevel}, {.name = "coop_menu_sound", .type = CONFIG_TYPE_BOOL, .boolValue = &configMenuSound}, {.name = "coop_menu_random", .type = CONFIG_TYPE_BOOL, .boolValue = &configMenuRandom}, diff --git a/src/pc/configfile.h b/src/pc/configfile.h index f5443494..992f6990 100644 --- a/src/pc/configfile.h +++ b/src/pc/configfile.h @@ -113,6 +113,7 @@ extern bool configNametags; extern unsigned int configBouncyLevelBounds; extern bool configSkipIntro; extern bool configPauseAnywhere; +extern bool configMenuStaffRoll; extern unsigned int configMenuLevel; extern bool configMenuSound; extern bool configMenuRandom; diff --git a/src/pc/djui/djui_panel_menu_options.c b/src/pc/djui/djui_panel_menu_options.c index e175c9f9..e07b65e5 100644 --- a/src/pc/djui/djui_panel_menu_options.c +++ b/src/pc/djui/djui_panel_menu_options.c @@ -10,17 +10,19 @@ #include "pc/configfile.h" #include "game/level_update.h" +static struct DjuiSelectionbox* sLevelBox = NULL; static struct DjuiCheckbox* sUseStageMusicCheckbox = NULL; static struct DjuiCheckbox* sRandomStageCheckbox = NULL; static struct DjuiCheckbox* sVanillaDemosCheckbox = NULL; void djui_panel_main_menu_create(struct DjuiBase* caller); -static void djui_panel_menu_options_level_menu(UNUSED struct DjuiBase* caller) { - djui_base_set_enabled(&sUseStageMusicCheckbox->base, !gMenuStaffRoll); - djui_base_set_enabled(&sRandomStageCheckbox->base, !gMenuStaffRoll); - djui_base_set_enabled(&sVanillaDemosCheckbox->base, !gMenuStaffRoll); - if (gMenuStaffRoll) { +static void djui_panel_level_menu(UNUSED struct DjuiBase* caller) { + djui_base_set_enabled(&sLevelBox->base, !(configMenuRandom || configMenuStaffRoll)); + djui_base_set_enabled(&sUseStageMusicCheckbox->base, !configMenuStaffRoll); + djui_base_set_enabled(&sRandomStageCheckbox->base, !configMenuStaffRoll); + djui_base_set_enabled(&sVanillaDemosCheckbox->base, !configMenuStaffRoll); + if (configMenuStaffRoll) { warp_credits(); level_trigger_warp(gMarioState, WARP_OP_CREDITS_NEXT); } @@ -60,8 +62,7 @@ void djui_panel_main_menu_create(struct DjuiBase* caller) { djui_selectionbox_create(body, DLANG(DJUI_THEMES, DJUI_FONT), djuiFontChoices, 2, &configDjuiThemeFont, djui_panel_menu_options_djui_setting_change); if (gDjuiInMainMenu) { - char* levelChoices[] = { - DLANG(MENU_OPTIONS, STAFF_ROLL), + char* levelChoices[18] = { "CG", "BOB", "WF", @@ -82,16 +83,19 @@ void djui_panel_main_menu_create(struct DjuiBase* caller) { "WDW" }; - djui_selectionbox_create(body, DLANG(MENU_OPTIONS, LEVEL), levelChoices, 19, &configMenuLevel, djui_panel_menu_options_level_menu); + struct DjuiSelectionbox* selectionbox1 = djui_selectionbox_create(body, DLANG(MENU_OPTIONS, LEVEL), levelChoices, 18, &configMenuLevel, NULL); + djui_base_set_enabled(&selectionbox1->base, !(configMenuRandom || configMenuStaffRoll)); + sLevelBox = selectionbox1; + djui_checkbox_create(body, DLANG(MENU_OPTIONS, STAFF_ROLL), &configMenuStaffRoll, djui_panel_level_menu); struct DjuiCheckbox* checkbox1 = djui_checkbox_create(body, DLANG(MENU_OPTIONS, USE_STAGE_MUSIC), &configMenuSound, NULL); - djui_base_set_enabled(&checkbox1->base, !gMenuStaffRoll); + djui_base_set_enabled(&checkbox1->base, !configMenuStaffRoll); sUseStageMusicCheckbox = checkbox1; - struct DjuiCheckbox* checkbox2 = djui_checkbox_create(body, DLANG(MENU_OPTIONS, RANDOM_STAGE), &configMenuRandom, djui_panel_menu_options_level_menu); - djui_base_set_enabled(&checkbox2->base, !gMenuStaffRoll); + struct DjuiCheckbox* checkbox2 = djui_checkbox_create(body, DLANG(MENU_OPTIONS, RANDOM_STAGE), &configMenuRandom, djui_panel_level_menu); + djui_base_set_enabled(&checkbox2->base, !configMenuStaffRoll); sRandomStageCheckbox = checkbox2; struct DjuiCheckbox* checkbox3 = djui_checkbox_create(body, DLANG(MENU_OPTIONS, PLAY_VANILLA_DEMOS), &configMenuDemos, stop_demo); - djui_base_set_enabled(&checkbox3->base, !gMenuStaffRoll); + djui_base_set_enabled(&checkbox3->base, !configMenuStaffRoll); sVanillaDemosCheckbox = checkbox3; }