Refactor staff roll option

This commit is contained in:
Agent X 2024-06-06 18:50:20 -04:00
parent c05c2a4d0e
commit 02d214d2fd
5 changed files with 69 additions and 76 deletions

View File

@ -48,8 +48,8 @@
#include "engine/level_script.h"
#define MENU_LEVEL_MIN 0
#define MENU_LEVEL_MAX 17
#define MENU_LEVEL_MIN 1
#define MENU_LEVEL_MAX 18
struct SavedWarpValues gReceiveWarp = { 0 };
extern s8 sReceivedLoadedActNum;
@ -1258,7 +1258,7 @@ s32 play_mode_normal(void) {
}
} else {
if (gDjuiInMainMenu &&
!configMenuStaffRoll &&
!gMenuStaffRoll &&
gCurrDemoInput == NULL &&
configMenuDemos &&
!gInPlayerMenu &&
@ -1479,30 +1479,30 @@ void update_menu_level(void) {
// figure out level
s32 curLevel = 0;
switch (configMenuLevel) {
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;
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;
default: curLevel = LEVEL_CASTLE_GROUNDS; break;
}
// figure out music
stop_cap_music();
if (!configMenuSound || configMenuStaffRoll || curLevel == LEVEL_CASTLE_GROUNDS) {
if (!configMenuSound || gMenuStaffRoll || 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 (configMenuStaffRoll) {
if (gMenuStaffRoll) {
return;
} else {
gCurrCreditsEntry = NULL;
@ -1652,7 +1652,9 @@ void update_menu_level(void) {
gLakituState.skipCameraInterpolationTimestamp = gGlobalTimer;
extern s32 gCamSkipInterp;
gCamSkipInterp = 1;
vec3f_copy(gCurrentArea->camera->pos, gLakituState.curPos);
if (gCurrentArea != NULL) {
vec3f_copy(gCurrentArea->camera->pos, gLakituState.curPos);
}
vec3f_copy(gLakituState.pos, gLakituState.curPos);
vec3f_copy(gLakituState.goalPos, gLakituState.curPos);
@ -1794,13 +1796,13 @@ s32 init_level(void) {
configMenuLevel = randLevel;
}
if (configMenuStaffRoll) {
if (gMenuStaffRoll) {
gMarioState->marioObj->header.gfx.node.flags &= ~GRAPH_RENDER_ACTIVE;
warp_credits();
level_trigger_warp(gMarioState, WARP_OP_CREDITS_NEXT);
sFirstCastleGroundsMenu = false;
} else {
if (configMenuLevel == 0 && sFirstCastleGroundsMenu) {
if (configMenuLevel == 1 && sFirstCastleGroundsMenu) {
set_mario_action(gMarioState, ACT_INTRO_CUTSCENE, 7);
sFirstCastleGroundsMenu = false;
} else {

View File

@ -99,6 +99,9 @@ extern s16 gChangeLevel;
extern s16 gChangeActNum;
extern s16 gDelayedInitSound;
extern bool gInPlayerMenu;
#define gMenuStaffRoll configMenuLevel == 0
struct WarpDest {
u8 type;
s16 levelNum;
@ -145,8 +148,6 @@ 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,

View File

@ -20,6 +20,7 @@
#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]))
@ -162,7 +163,6 @@ 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,7 +282,6 @@ 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},

View File

@ -113,7 +113,6 @@ 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;

View File

@ -10,25 +10,23 @@
#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_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) {
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) {
warp_credits();
level_trigger_warp(gMarioState, WARP_OP_CREDITS_NEXT);
}
}
static void djui_panel_misc_djui_setting_change(UNUSED struct DjuiBase* caller) {
static void djui_panel_menu_options_djui_setting_change(UNUSED struct DjuiBase* caller) {
if (gDjuiInMainMenu) {
djui_panel_shutdown();
gDjuiInMainMenu = true;
@ -50,57 +48,51 @@ void djui_panel_main_menu_create(struct DjuiBase* caller) {
struct DjuiBase* body = djui_three_panel_get_body(panel);
{
char* levelChoices[18] = {
"CG",
"BOB",
"WF",
"WMOTR",
"JRB",
"SSL",
"TTM",
"SL",
"BBH",
"LLL",
"THI",
"HMC",
"CCM",
"RR",
"BITDW",
"PSS",
"TTC",
"WDW"
};
djui_checkbox_create(body, DLANG(DJUI_THEMES, CENTER), &configDjuiThemeCenter, djui_panel_menu_options_djui_setting_change);
char* themeChoices[DJUI_THEME_MAX];
for (int i = 0; i < DJUI_THEME_MAX; i++) {
themeChoices[i] = (char*)gDjuiThemes[i]->name;
}
djui_selectionbox_create(body, DLANG(DJUI_THEMES, DJUI_THEME), themeChoices, DJUI_THEME_MAX, &configDjuiTheme, djui_panel_misc_djui_setting_change);
djui_selectionbox_create(body, DLANG(DJUI_THEMES, DJUI_THEME), themeChoices, DJUI_THEME_MAX, &configDjuiTheme, djui_panel_menu_options_djui_setting_change);
char* djuiScaleChoices[5] = {DLANG(DJUI_THEMES, AUTO), "x0.5", "x0.85", "x1.0", "x1.5"};
djui_selectionbox_create(body, DLANG(DJUI_THEMES, DJUI_SCALE), djuiScaleChoices, 5, &configDjuiScale, djui_panel_misc_djui_setting_change);
djui_selectionbox_create(body, DLANG(DJUI_THEMES, DJUI_SCALE), djuiScaleChoices, 5, &configDjuiScale, djui_panel_menu_options_djui_setting_change);
char* djuiFontChoices[2] = {DLANG(DJUI_THEMES, FONT_NORMAL), DLANG(DJUI_THEMES, FONT_ALIASED)};
djui_selectionbox_create(body, DLANG(DJUI_THEMES, DJUI_FONT), djuiFontChoices, 2, &configDjuiThemeFont, djui_panel_misc_djui_setting_change);
djui_selectionbox_create(body, DLANG(DJUI_THEMES, DJUI_FONT), djuiFontChoices, 2, &configDjuiThemeFont, djui_panel_menu_options_djui_setting_change);
if (gDjuiInMainMenu) {
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;
char* levelChoices[] = {
DLANG(MENU_OPTIONS, STAFF_ROLL),
"CG",
"BOB",
"WF",
"WMOTR",
"JRB",
"SSL",
"TTM",
"SL",
"BBH",
"LLL",
"THI",
"HMC",
"CCM",
"RR",
"BITDW",
"PSS",
"TTC",
"WDW"
};
djui_checkbox_create(body, DLANG(DJUI_THEMES, CENTER), &configDjuiThemeCenter, djui_panel_misc_djui_setting_change);
djui_selectionbox_create(body, DLANG(MENU_OPTIONS, LEVEL), levelChoices, 19, &configMenuLevel, djui_panel_menu_options_level_menu);
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);
struct DjuiCheckbox* checkbox2 = djui_checkbox_create(body, DLANG(MENU_OPTIONS, RANDOM_STAGE), &configMenuRandom, djui_panel_level_menu);
struct DjuiCheckbox* checkbox3 = djui_checkbox_create(body, DLANG(MENU_OPTIONS, PLAY_VANILLA_DEMOS), &configMenuDemos, stop_demo);
djui_base_set_enabled(&checkbox1->base, !configMenuStaffRoll);
djui_base_set_enabled(&checkbox2->base, !configMenuStaffRoll);
djui_base_set_enabled(&checkbox3->base, !configMenuStaffRoll);
djui_base_set_enabled(&checkbox1->base, !gMenuStaffRoll);
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);
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);
sVanillaDemosCheckbox = checkbox3;
} else {
djui_checkbox_create(body, DLANG(DJUI_THEMES, CENTER), &configDjuiThemeCenter, djui_panel_misc_djui_setting_change);
}
djui_button_create(body, DLANG(MENU, BACK), DJUI_BUTTON_STYLE_BACK, djui_panel_menu_back);