diff --git a/levels/intro/script.c b/levels/intro/script.c index 4975dbb..53ed8eb 100644 --- a/levels/intro/script.c +++ b/levels/intro/script.c @@ -18,6 +18,10 @@ #include "make_const_nonconst.h" #include "levels/intro/header.h" +// Enable the debug level selector. +// TODO Figure out how to add to the games menu and switch to this, it should be possible. +// #define _LEVEL_SELECTOR + const LevelScript level_intro_entry_1[] = { INIT_LEVEL(), FIXED_LOAD(/*loadAddr*/ _goddardSegmentStart, /*romStart*/ _goddardSegmentRomStart, /*romEnd*/ _goddardSegmentRomEnd), @@ -37,7 +41,12 @@ const LevelScript level_intro_entry_1[] = { CMD2A(/*unk2*/ 1), CLEAR_LEVEL(), SLEEP(/*frames*/ 2), + + #ifdef _LEVEL_SELECTOR //Level selector patch + EXIT_AND_EXECUTE(/*seg*/ 0x14, _introSegmentRomStart, _introSegmentRomEnd, level_intro_entry_4), + #else EXIT_AND_EXECUTE(/*seg*/ 0x14, _introSegmentRomStart, _introSegmentRomEnd, level_intro_entry_2), + #endif //_LEVEL_SELECTOR }; const LevelScript level_intro_entry_2[] = { @@ -56,6 +65,7 @@ const LevelScript level_intro_entry_2[] = { SLEEP(/*frames*/ 2), BLACKOUT(/*active*/ FALSE), LOAD_AREA(/*area*/ 1), + // Toggle the intro music by commenting this out. SET_MENU_MUSIC(/*seq*/ 0x0002), TRANSITION(/*transType*/ WARP_TRANSITION_FADE_FROM_STAR, /*time*/ 20, /*color*/ 0x00, 0x00, 0x00), SLEEP(/*frames*/ 20), @@ -81,6 +91,7 @@ const LevelScript level_intro_entry_3[] = { SLEEP(/*frames*/ 2), BLACKOUT(/*active*/ FALSE), LOAD_AREA(/*area*/ 1), + // Toggle the intro music by commenting this out. SET_MENU_MUSIC(/*seq*/ 0x0082), TRANSITION(/*transType*/ WARP_TRANSITION_FADE_FROM_STAR, /*time*/ 20, /*color*/ 0x00, 0x00, 0x00), SLEEP(/*frames*/ 20), @@ -103,6 +114,7 @@ const LevelScript level_intro_entry_4[] = { FREE_LEVEL_POOL(), LOAD_AREA(/*area*/ 1), + // Toggle the intro music by commenting this out. SET_MENU_MUSIC(/*seq*/ 0x0002), TRANSITION(/*transType*/ WARP_TRANSITION_FADE_FROM_COLOR, /*time*/ 16, /*color*/ 0xFF, 0xFF, 0xFF), SLEEP(/*frames*/ 16), diff --git a/levels/menu/header.h b/levels/menu/header.h index 170c16c..312f321 100644 --- a/levels/menu/header.h +++ b/levels/menu/header.h @@ -3,12 +3,22 @@ #include "types.h" +// Enable my custom menus, I don't know how to use these yet. +// #define _CUSTOM_CODE +// Disables the menu music +// #define _DISABLE_MENU_MUSIC + // geo extern const GeoLayout geo_menu_mario_save_button[]; extern const GeoLayout geo_menu_mario_save_button_fade[]; extern const GeoLayout geo_menu_mario_new_button[]; extern const GeoLayout geo_menu_mario_new_button_fade[]; extern const GeoLayout geo_menu_erase_button[]; + +#ifdef _CUSTOM_CODE +extern const GeoLayout geo_menu_custom_button[]; +#endif //_CUSTOM_CODE + extern const GeoLayout geo_menu_copy_button[]; extern const GeoLayout geo_menu_file_button[]; extern const GeoLayout geo_menu_score_button[]; diff --git a/levels/menu/script.c b/levels/menu/script.c index 4e955c1..02541e7 100644 --- a/levels/menu/script.c +++ b/levels/menu/script.c @@ -35,6 +35,13 @@ const LevelScript level_main_menu_entry_1[] = { LOAD_MODEL_FROM_GEO(MODEL_MAIN_MENU_PURPLE_SOUND_BUTTON, geo_menu_sound_button), LOAD_MODEL_FROM_GEO(MODEL_MAIN_MENU_GENERIC_BUTTON, geo_menu_generic_button), + // TODO Figure out how to add to the main menu, enable this in header.h + #ifdef _CUSTOM_CODE + LOAD_MODEL_FROM_GEO(MODEL_MAIN_MENU_GENERIC_BUTTON, geo_menu_custom_button), + + #endif //_CUSTOM_CODE + + AREA(/*index*/ 1, geo_menu_file_select_strings_and_menu_cursor), OBJECT(/*model*/ MODEL_NONE, /*pos*/ 0, 0, -19000, /*angle*/ 0, 0, 0, /*behParam*/ 0x04000000, /*beh*/ bhvMenuButtonManager), OBJECT(/*model*/ MODEL_MAIN_MENU_YELLOW_FILE_BUTTON, /*pos*/ 0, 0, -19000, /*angle*/ 0, 0, 0, /*behParam*/ 0x04000000, /*beh*/ bhvYellowBackgroundInMenu), @@ -43,7 +50,13 @@ const LevelScript level_main_menu_entry_1[] = { FREE_LEVEL_POOL(), LOAD_AREA(/*area*/ 1), + + #ifdef _DISABLE_MENU_MUSIC + // Make this do nothing if enabled + #else SET_MENU_MUSIC(/*seq*/ 0x0021), + #endif //_DISABLE_MENU_MUSIC + TRANSITION(/*transType*/ WARP_TRANSITION_FADE_FROM_COLOR, /*time*/ 16, /*color*/ 0xFF, 0xFF, 0xFF), CALL(/*arg*/ 0, /*func*/ lvl_init_menu_values_and_cursor_pos), CALL_LOOP(/*arg*/ 0, /*func*/ lvl_update_obj_and_load_file_selected), diff --git a/src/game/level_update.c b/src/game/level_update.c index 72a6a60..193c766 100644 --- a/src/game/level_update.c +++ b/src/game/level_update.c @@ -1160,6 +1160,8 @@ s32 update_level(void) { return changeLevel; } +#define _DISABLE_START_INTRO + s32 init_level(void) { s32 val4 = 0; @@ -1198,9 +1200,11 @@ s32 init_level(void) { if (gMarioState->action != ACT_UNINITIALIZED) { if (save_file_exists(gCurrSaveFileNum - 1)) { set_mario_action(gMarioState, ACT_IDLE, 0); + #ifndef _DISABLE_START_INTRO //Disable the starting intro when launching a new save. } else if (gCLIOpts.SkipIntro == 0 && configSkipIntro == 0) { set_mario_action(gMarioState, ACT_INTRO_CUTSCENE, 0); val4 = 1; + #endif //_DISABLE_START_INTRO } } } @@ -1246,6 +1250,8 @@ s32 lvl_init_or_update(s16 initOrUpdate, UNUSED s32 unused) { return result; } +#undef _LEVEL_SELECTOR + s32 lvl_init_from_save_file(UNUSED s16 arg0, s32 levelNum) { #ifdef VERSION_EU s16 var = eu_get_language(); @@ -1267,7 +1273,6 @@ s32 lvl_init_from_save_file(UNUSED s16 arg0, s32 levelNum) { sWarpDest.type = WARP_TYPE_NOT_WARPING; sDelayedWarpOp = WARP_OP_NONE; gShouldNotPlayCastleMusic = !save_file_exists(gCurrSaveFileNum - 1) && gCLIOpts.SkipIntro == 0 && configSkipIntro == 0; - gCurrLevelNum = levelNum; gCurrCourseNum = COURSE_NONE; gSavedCourseNum = COURSE_NONE;