diff --git a/enhancements/mem_error_screen.patch b/enhancements/mem_error_screen.patch index 7530c2fc..c6c76eef 100644 --- a/enhancements/mem_error_screen.patch +++ b/enhancements/mem_error_screen.patch @@ -84,15 +84,15 @@ index 30a87806..6bf7b79a 100644 +}; + // 0x0E0002D0 - const GeoLayout intro_geo_0002D0[] = { + const GeoLayout intro_geo_splash_screen[] = { GEO_NODE_SCREEN_AREA(0, SCREEN_WIDTH/2, SCREEN_HEIGHT/2, SCREEN_WIDTH/2, SCREEN_HEIGHT/2), diff --git a/levels/intro/header.h b/levels/intro/header.h index 99277e86..04797cd7 100644 --- a/levels/intro/header.h +++ b/levels/intro/header.h -@@ -26,4 +26,8 @@ extern const LevelScript script_intro_L3[]; - extern const LevelScript script_intro_L4[]; - extern const LevelScript script_intro_L5[]; +@@ -26,4 +26,8 @@ extern const LevelScript script_intro_main_level_entry_stop_music[]; + extern const LevelScript script_intro_main_level_entry[]; + extern const LevelScript script_intro_splash_screen[]; +extern const GeoLayout intro_geo_error_screen[]; +extern const LevelScript level_intro_entry_error_screen[]; diff --git a/include/config.h b/include/config.h index d7e63a0a..bb47c503 100644 --- a/include/config.h +++ b/include/config.h @@ -98,6 +98,8 @@ //#define SKIP_TITLE_SCREEN // Uncomment this if you want to keep the mario head and not skip it //#define KEEP_MARIO_HEAD +// Disables the demo that plays when idle on the start screen (Arceveti) +#define DISABLE_DEMO // Enables "parallel lakitu camera" or "aglab cam" which lets you move the camera smoothly with the dpad #define PARALLEL_LAKITU_CAM // Allows Mario to ledgegrab sloped floors diff --git a/include/level_table.h b/include/level_table.h index e3062c49..3ad47eb7 100644 --- a/include/level_table.h +++ b/include/level_table.h @@ -9,11 +9,14 @@ enum LevelNum { + LEVEL_RESTART_GAME = -1, LEVEL_NONE, #include "levels/level_defines.h" LEVEL_COUNT, - LEVEL_MAX = LEVEL_COUNT - 1, - LEVEL_MIN = LEVEL_NONE + 1 + LEVEL_MAX = (LEVEL_COUNT - 1), + LEVEL_MIN = (LEVEL_NONE + 1), + LEVEL_FILE_SELECT = 100, //! This probably breaks if you have 99+ levels + LEVEL_LEVEL_SELECT = (LEVEL_FILE_SELECT + 1) }; #undef STUB_LEVEL diff --git a/levels/intro/geo.c b/levels/intro/geo.c index 91783833..c64670bb 100644 --- a/levels/intro/geo.c +++ b/levels/intro/geo.c @@ -18,7 +18,7 @@ #include "config.h" // 0x0E0002D0 -const GeoLayout intro_geo_0002D0[] = { +const GeoLayout intro_geo_splash_screen[] = { GEO_NODE_SCREEN_AREA(0, SCREEN_WIDTH/2, SCREEN_HEIGHT/2, SCREEN_WIDTH/2, SCREEN_HEIGHT/2), GEO_OPEN_NODE(), GEO_ZBUFFER(0), @@ -113,7 +113,7 @@ const GeoLayout intro_geo_mario_head_dizzy[] = { }; // 0x0E000414 -const GeoLayout intro_geo_000414[] = { +const GeoLayout intro_geo_debug_level_select[] = { GEO_NODE_SCREEN_AREA(0, SCREEN_WIDTH/2, SCREEN_HEIGHT/2, SCREEN_WIDTH/2, SCREEN_HEIGHT/2), GEO_OPEN_NODE(), GEO_ZBUFFER(0), diff --git a/levels/intro/header.h b/levels/intro/header.h index 99277e86..5197daf0 100644 --- a/levels/intro/header.h +++ b/levels/intro/header.h @@ -4,26 +4,26 @@ #include "types.h" // geo -extern const GeoLayout intro_geo_0002D0[]; +extern const GeoLayout intro_geo_splash_screen[]; extern const GeoLayout intro_geo_mario_head_regular[]; extern const GeoLayout intro_geo_mario_head_dizzy[]; -extern const GeoLayout intro_geo_000414[]; +extern const GeoLayout intro_geo_debug_level_select[]; // leveldata -extern const Gfx intro_seg7_dl_0700B3A0[]; -extern const Gfx intro_seg7_dl_0700C6A0[]; -extern const f32 intro_seg7_table_0700C790[]; -extern const f32 intro_seg7_table_0700C880[]; +extern const Gfx intro_seg7_dl_main_logo[]; +extern const Gfx intro_seg7_dl_copyright_trademark[]; +extern const f32 intro_seg7_table_scale_1[]; +extern const f32 intro_seg7_table_scale_2[]; // script extern const LevelScript level_intro_splash_screen[]; extern const LevelScript level_intro_mario_head_regular[]; extern const LevelScript level_intro_mario_head_dizzy[]; -extern const LevelScript level_intro_entry_4[]; -extern const LevelScript script_intro_L1[]; -extern const LevelScript script_intro_L2[]; -extern const LevelScript script_intro_L3[]; -extern const LevelScript script_intro_L4[]; -extern const LevelScript script_intro_L5[]; +extern const LevelScript level_intro_entry_level_select[]; +extern const LevelScript script_intro_file_select[]; +extern const LevelScript script_intro_level_select[]; +extern const LevelScript script_intro_main_level_entry_stop_music[]; +extern const LevelScript script_intro_main_level_entry[]; +extern const LevelScript script_intro_splash_screen[]; #endif diff --git a/levels/intro/leveldata.c b/levels/intro/leveldata.c index 7a4474d2..5f61dfe7 100644 --- a/levels/intro/leveldata.c +++ b/levels/intro/leveldata.c @@ -3298,7 +3298,7 @@ static const Gfx intro_seg7_dl_0700ADC0[] = { }; // 0x0700B3A0 - 0x0700B420 -const Gfx intro_seg7_dl_0700B3A0[] = { +const Gfx intro_seg7_dl_main_logo[] = { gsDPPipeSync(), gsDPSetCombineMode(G_CC_MODULATERGB, G_CC_MODULATERGB), gsSPClearGeometryMode(G_LIGHTING), @@ -3363,7 +3363,7 @@ ALIGNED8 static const Texture intro_seg7_texture_0700C4A0[] = { #endif // 0x0700C6A0 - 0x0700C790 -const Gfx intro_seg7_dl_0700C6A0[] = { +const Gfx intro_seg7_dl_copyright_trademark[] = { gsDPPipeSync(), gsDPSetCombineMode(G_CC_DECALFADE, G_CC_DECALFADE), gsSPTexture(0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON), @@ -3386,7 +3386,7 @@ const Gfx intro_seg7_dl_0700C6A0[] = { }; // 0x0700C790 -const f32 intro_seg7_table_0700C790[] = { +const f32 intro_seg7_table_scale_1[] = { 0.016000f, 0.052000f, 0.002500f, 0.148300f, 0.189200f, 0.035200f, 0.471600f, 0.525300f, 0.116600f, 0.875800f, 0.947000f, 0.222100f, @@ -3405,7 +3405,7 @@ const f32 intro_seg7_table_0700C790[] = { }; // 0x0700C880 -const f32 intro_seg7_table_0700C880[] = { +const f32 intro_seg7_table_scale_2[] = { 1.000000f, 1.000000f, 1.000000f, 0.987300f, 0.987300f, 0.987300f, 0.951400f, 0.951400f, 0.951400f, 0.896000f, 0.896000f, 0.896000f, diff --git a/levels/intro/script.c b/levels/intro/script.c index ebf9f557..bef41018 100644 --- a/levels/intro/script.c +++ b/levels/intro/script.c @@ -33,7 +33,7 @@ const LevelScript level_intro_splash_screen[] = { // Load "Super Mario 64" logo ALLOC_LEVEL_POOL(), - AREA(/*index*/ 1, intro_geo_0002D0), + AREA(/*index*/ 1, intro_geo_splash_screen), END_AREA(), FREE_LEVEL_POOL(), @@ -51,8 +51,8 @@ const LevelScript level_intro_splash_screen[] = { }; const LevelScript level_intro_mario_head_regular[] = { - INIT_LEVEL(), #ifdef KEEP_MARIO_HEAD + INIT_LEVEL(), BLACKOUT(/*active*/ TRUE), FIXED_LOAD(/*loadAddr*/ _goddardSegmentStart, /*romStart*/ _goddardSegmentRomStart, /*romEnd*/ _goddardSegmentRomEnd), LOAD_MARIO_HEAD(/*loadHeadID*/ REGULAR_FACE), @@ -72,9 +72,9 @@ const LevelScript level_intro_mario_head_regular[] = { SLEEP(/*frames*/ 20), #endif CALL_LOOP(/*arg*/ LVL_INTRO_REGULAR, /*func*/ lvl_intro_update), - JUMP_IF(/*op*/ OP_EQ, /*arg*/ 100, script_intro_L1), - JUMP_IF(/*op*/ OP_EQ, /*arg*/ 101, script_intro_L2), - JUMP(script_intro_L4), + JUMP_IF(/*op*/ OP_EQ, /*arg*/ LEVEL_FILE_SELECT, script_intro_file_select), + JUMP_IF(/*op*/ OP_EQ, /*arg*/ LEVEL_LEVEL_SELECT, script_intro_level_select), + JUMP(script_intro_main_level_entry), }; const LevelScript level_intro_mario_head_dizzy[] = { @@ -99,12 +99,12 @@ const LevelScript level_intro_mario_head_dizzy[] = { TRANSITION(/*transType*/ WARP_TRANSITION_FADE_FROM_STAR, /*time*/ 20, /*color*/ 0x00, 0x00, 0x00), SLEEP(/*frames*/ 20), CALL_LOOP(/*arg*/ LVL_INTRO_GAME_OVER, /*func*/ lvl_intro_update), - JUMP_IF(/*op*/ OP_EQ, /*arg*/ 100, script_intro_L1), - JUMP_IF(/*op*/ OP_EQ, /*arg*/ 101, script_intro_L2), - JUMP(script_intro_L4), + JUMP_IF(/*op*/ OP_EQ, /*arg*/ LEVEL_FILE_SELECT, script_intro_file_select), + JUMP_IF(/*op*/ OP_EQ, /*arg*/ LEVEL_LEVEL_SELECT, script_intro_level_select), + JUMP(script_intro_main_level_entry), }; -const LevelScript level_intro_entry_4[] = { +const LevelScript level_intro_entry_level_select[] = { INIT_LEVEL(), LOAD_RAW(/*seg*/ 0x13, _behaviorSegmentRomStart, _behaviorSegmentRomEnd), LOAD_YAY0_TEXTURE(/*seg*/ 0x0A, _title_screen_bg_yay0SegmentRomStart, _title_screen_bg_yay0SegmentRomEnd), @@ -112,7 +112,7 @@ const LevelScript level_intro_entry_4[] = { FIXED_LOAD(/*loadAddr*/ _goddardSegmentStart, /*romStart*/ _goddardSegmentRomStart, /*romEnd*/ _goddardSegmentRomEnd), ALLOC_LEVEL_POOL(), - AREA(/*index*/ 1, intro_geo_000414), + AREA(/*index*/ 1, intro_geo_debug_level_select), END_AREA(), FREE_LEVEL_POOL(), @@ -121,32 +121,36 @@ const LevelScript level_intro_entry_4[] = { TRANSITION(/*transType*/ WARP_TRANSITION_FADE_FROM_COLOR, /*time*/ 16, /*color*/ 0xFF, 0xFF, 0xFF), SLEEP(/*frames*/ 16), CALL_LOOP(/*arg*/ LVL_INTRO_LEVEL_SELECT, /*func*/ lvl_intro_update), - JUMP_IF(/*op*/ OP_EQ, /*arg*/ -1, script_intro_L5), - JUMP(script_intro_L3), + JUMP_IF(/*op*/ OP_EQ, /*arg*/ LEVEL_RESTART_GAME, script_intro_splash_screen), + JUMP(script_intro_main_level_entry_stop_music), }; // These should be static, but C doesn't allow non-sized forward declarations of static arrays -const LevelScript script_intro_L1[] = { +const LevelScript script_intro_file_select[] = { STOP_MUSIC(/*fadeOutTime*/ 0x00BE), TRANSITION(/*transType*/ WARP_TRANSITION_FADE_INTO_COLOR, /*time*/ 16, /*color*/ 0xFF, 0xFF, 0xFF), SLEEP(/*frames*/ 16), CLEAR_LEVEL(), SLEEP(/*frames*/ 2), SET_REG(/*value*/ 16), - EXIT_AND_EXECUTE(/*seg*/ 0x14, _menuSegmentRomStart, _menuSegmentRomEnd, level_main_menu_entry_1), + EXIT_AND_EXECUTE(/*seg*/ 0x14, _menuSegmentRomStart, _menuSegmentRomEnd, level_main_menu_entry_file_select), }; -const LevelScript script_intro_L2[] = { +const LevelScript script_intro_level_select[] = { TRANSITION(/*transType*/ WARP_TRANSITION_FADE_INTO_COLOR, /*time*/ 16, /*color*/ 0xFF, 0xFF, 0xFF), SLEEP(/*frames*/ 16), CLEAR_LEVEL(), SLEEP(/*frames*/ 2), - EXIT_AND_EXECUTE_WITH_CODE(/*seg*/ 0x14, _introSegmentRomStart, _introSegmentRomEnd, level_intro_entry_4, _introSegmentBssStart, _introSegmentBssEnd), + EXIT_AND_EXECUTE_WITH_CODE(/*seg*/ 0x14, _introSegmentRomStart, _introSegmentRomEnd, level_intro_entry_level_select, _introSegmentBssStart, _introSegmentBssEnd), }; -const LevelScript script_intro_L3[] = { +const LevelScript script_intro_main_level_entry_stop_music[] = { STOP_MUSIC(/*fadeOutTime*/ 0x00BE), + JUMP(script_intro_main_level_entry), +}; + +const LevelScript script_intro_main_level_entry[] = { TRANSITION(/*transType*/ WARP_TRANSITION_FADE_INTO_COLOR, /*time*/ 16, /*color*/ 0xFF, 0xFF, 0xFF), SLEEP(/*frames*/ 16), CLEAR_LEVEL(), @@ -154,15 +158,7 @@ const LevelScript script_intro_L3[] = { EXIT_AND_EXECUTE(/*seg*/ 0x15, _scriptsSegmentRomStart, _scriptsSegmentRomEnd, level_main_scripts_entry), }; -const LevelScript script_intro_L4[] = { - TRANSITION(/*transType*/ WARP_TRANSITION_FADE_INTO_COLOR, /*time*/ 16, /*color*/ 0xFF, 0xFF, 0xFF), - SLEEP(/*frames*/ 16), - CLEAR_LEVEL(), - SLEEP(/*frames*/ 2), - EXIT_AND_EXECUTE(/*seg*/ 0x15, _scriptsSegmentRomStart, _scriptsSegmentRomEnd, level_main_scripts_entry), -}; - -const LevelScript script_intro_L5[] = { +const LevelScript script_intro_splash_screen[] = { STOP_MUSIC(/*fadeOutTime*/ 0x00BE), TRANSITION(/*transType*/ WARP_TRANSITION_FADE_INTO_COLOR, /*time*/ 16, /*color*/ 0x00, 0x00, 0x00), SLEEP(/*frames*/ 16), diff --git a/levels/menu/header.h b/levels/menu/header.h index 170c16c1..59bfb341 100644 --- a/levels/menu/header.h +++ b/levels/menu/header.h @@ -46,7 +46,7 @@ extern const u8 eu_course_strings_de_table[]; #endif // script -extern const LevelScript level_main_menu_entry_1[]; -extern const LevelScript level_main_menu_entry_2[]; +extern const LevelScript level_main_menu_entry_file_select[]; +extern const LevelScript level_main_menu_entry_act_select[]; #endif diff --git a/levels/menu/script.c b/levels/menu/script.c index 5360dea5..bb1594ea 100644 --- a/levels/menu/script.c +++ b/levels/menu/script.c @@ -18,7 +18,7 @@ #include "make_const_nonconst.h" #include "levels/menu/header.h" -const LevelScript level_main_menu_entry_1[] = { +const LevelScript level_main_menu_entry_file_select[] = { INIT_LEVEL(), FIXED_LOAD(/*loadAddr*/ _goddardSegmentStart, /*romStart*/ _goddardSegmentRomStart, /*romEnd*/ _goddardSegmentRomEnd), LOAD_YAY0(/*seg*/ 0x07, _menu_segment_7SegmentRomStart, _menu_segment_7SegmentRomEnd), @@ -57,9 +57,9 @@ const LevelScript level_main_menu_entry_1[] = { EXIT_AND_EXECUTE(/*seg*/ 0x15, _scriptsSegmentRomStart, _scriptsSegmentRomEnd, level_main_scripts_entry), }; -const LevelScript level_main_menu_entry_2[] = { +const LevelScript level_main_menu_entry_act_select[] = { /*0*/ CALL(/*arg*/ 0, /*func*/ lvl_set_current_level), - /*2*/ JUMP_IF(/*op*/ OP_EQ, /*arg*/ 0, level_main_menu_entry_2 + 42), + /*2*/ JUMP_IF(/*op*/ OP_EQ, /*arg*/ 0, level_main_menu_entry_act_select + 42), /*5*/ INIT_LEVEL(), /*6*/ FIXED_LOAD(/*loadAddr*/ _goddardSegmentStart, /*romStart*/ _goddardSegmentRomStart, /*romEnd*/ _goddardSegmentRomEnd), /*10*/ LOAD_YAY0(/*seg*/ 0x07, _menu_segment_7SegmentRomStart, _menu_segment_7SegmentRomEnd), diff --git a/levels/scripts.c b/levels/scripts.c index 5d4c873a..d13d0d5b 100644 --- a/levels/scripts.c +++ b/levels/scripts.c @@ -44,11 +44,11 @@ static const LevelScript script_exec_level_table[2 #undef DEFINE_LEVEL #undef STUB_LEVEL -static const LevelScript script_L1[6]; -static const LevelScript script_L2[6]; +static const LevelScript goto_intro_splash_screen[6]; +static const LevelScript goto_ending[6]; static const LevelScript goto_mario_head_regular[6]; static const LevelScript goto_mario_head_dizzy[6]; -static const LevelScript script_L5[6]; +static const LevelScript goto_debug_level_select[6]; #define STUB_LEVEL(_0, _1, _2, _3, _4, _5, _6, _7, _8) #define DEFINE_LEVEL(_0, _1, _2, folder, _4, _5, _6, _7, _8, _9, _10) static const LevelScript script_exec_ ## folder [6 + 1]; @@ -101,7 +101,6 @@ const LevelScript level_main_scripts_entry[] = { LOAD_MODEL_FROM_GEO(MODEL_MARIOS_METAL_CAP, marios_metal_cap_geo), LOAD_MODEL_FROM_GEO(MODEL_MARIOS_WING_CAP, marios_wing_cap_geo), LOAD_MODEL_FROM_GEO(MODEL_MARIOS_CAP, marios_cap_geo), - //LOAD_MODEL_FROM_GEO(MODEL_MARIOS_CAP, marios_cap_geo), // repeated LOAD_MODEL_FROM_GEO(MODEL_BOWSER_KEY_CUTSCENE, bowser_key_cutscene_geo), LOAD_MODEL_FROM_GEO(MODEL_BOWSER_KEY, bowser_key_geo), LOAD_MODEL_FROM_GEO(MODEL_RED_FLAME_SHADOW, red_flame_shadow_geo), @@ -115,22 +114,22 @@ const LevelScript level_main_scripts_entry[] = { FREE_LEVEL_POOL(), CALL(/*arg*/ 0, /*func*/ lvl_init_from_save_file), LOOP_BEGIN(), - EXECUTE(/*seg*/ 0x14, _menuSegmentRomStart, _menuSegmentRomEnd, level_main_menu_entry_2), + EXECUTE(/*seg*/ 0x14, _menuSegmentRomStart, _menuSegmentRomEnd, level_main_menu_entry_act_select), JUMP_LINK(script_exec_level_table), SLEEP(/*frames*/ 1), - LOOP_UNTIL(/*op*/ OP_LT, /*arg*/ 0), - JUMP_IF(/*op*/ OP_EQ, /*arg*/ -1, script_L2), - JUMP_IF(/*op*/ OP_EQ, /*arg*/ -2, goto_mario_head_regular), - JUMP_IF(/*op*/ OP_EQ, /*arg*/ -3, goto_mario_head_dizzy), - JUMP_IF(/*op*/ OP_EQ, /*arg*/ -8, script_L1), - JUMP_IF(/*op*/ OP_EQ, /*arg*/ -9, script_L5), + LOOP_UNTIL(/*op*/ OP_LT, /*arg*/ WARP_SPECIAL_NONE), + JUMP_IF( /*op*/ OP_EQ, /*arg*/ WARP_SPECIAL_ENDING, goto_ending), + JUMP_IF( /*op*/ OP_EQ, /*arg*/ WARP_SPECIAL_MARIO_HEAD_REGULAR, goto_mario_head_regular), + JUMP_IF( /*op*/ OP_EQ, /*arg*/ WARP_SPECIAL_MARIO_HEAD_DIZZY, goto_mario_head_dizzy), + JUMP_IF( /*op*/ OP_EQ, /*arg*/ WARP_SPECIAL_INTRO_SPLASH_SCREEN, goto_intro_splash_screen), + JUMP_IF( /*op*/ OP_EQ, /*arg*/ WARP_SPECIAL_LEVEL_SELECT, goto_debug_level_select), }; -static const LevelScript script_L1[] = { +static const LevelScript goto_intro_splash_screen[] = { EXIT_AND_EXECUTE_WITH_CODE(/*seg*/ 0x14, _introSegmentRomStart, _introSegmentRomEnd, level_intro_splash_screen, _introSegmentBssStart, _introSegmentBssEnd), }; -static const LevelScript script_L2[] = { +static const LevelScript goto_ending[] = { EXIT_AND_EXECUTE_WITH_CODE(/*seg*/ 0x0E, _endingSegmentRomStart, _endingSegmentRomEnd, level_ending_entry, _endingSegmentBssStart, _endingSegmentBssEnd), }; @@ -142,8 +141,8 @@ static const LevelScript goto_mario_head_dizzy[] = { EXIT_AND_EXECUTE_WITH_CODE(/*seg*/ 0x14, _introSegmentRomStart, _introSegmentRomEnd, level_intro_mario_head_dizzy, _introSegmentBssStart, _introSegmentBssEnd), }; -static const LevelScript script_L5[] = { - EXIT_AND_EXECUTE_WITH_CODE(/*seg*/ 0x14, _introSegmentRomStart, _introSegmentRomEnd, level_intro_entry_4, _introSegmentBssStart, _introSegmentBssEnd), +static const LevelScript goto_debug_level_select[] = { + EXIT_AND_EXECUTE_WITH_CODE(/*seg*/ 0x14, _introSegmentRomStart, _introSegmentRomEnd, level_intro_entry_level_select, _introSegmentBssStart, _introSegmentBssEnd), }; // Include the level jumptable. diff --git a/src/engine/level_script.c b/src/engine/level_script.c index 739e6756..892525b6 100644 --- a/src/engine/level_script.c +++ b/src/engine/level_script.c @@ -21,6 +21,7 @@ #include "graph_node.h" #include "level_script.h" #include "level_misc_macros.h" +#include "level_commands.h" #include "math_util.h" #include "surface_collision.h" #include "surface_load.h" @@ -296,7 +297,6 @@ static void level_cmd_load_mario_head(void) { gd_add_to_heap(gFrameBuffer0, 3 * sizeof(gFrameBuffer0)); // 0x70800 gdm_setup(); gdm_maketestdl(CMD_GET(s16, 2)); - } else { } #endif sCurrentCmd = CMD_NEXT; @@ -756,39 +756,39 @@ static void level_cmd_38(void) { } static void level_cmd_get_or_set_var(void) { - if (CMD_GET(u8, 2) == 0) { + if (CMD_GET(u8, 2) == OP_SET) { switch (CMD_GET(u8, 3)) { - case 0: + case VAR_CURR_SAVE_FILE_NUM: gCurrSaveFileNum = sRegister; break; - case 1: + case VAR_CURR_COURSE_NUM: gCurrCourseNum = sRegister; break; - case 2: + case VAR_CURR_ACT_NUM: gCurrActNum = sRegister; break; - case 3: + case VAR_CURR_LEVEL_NUM: gCurrLevelNum = sRegister; break; - case 4: + case VAR_CURR_AREA_INDEX: gCurrAreaIndex = sRegister; break; } } else { switch (CMD_GET(u8, 3)) { - case 0: + case VAR_CURR_SAVE_FILE_NUM: sRegister = gCurrSaveFileNum; break; - case 1: + case VAR_CURR_COURSE_NUM: sRegister = gCurrCourseNum; break; - case 2: + case VAR_CURR_ACT_NUM: sRegister = gCurrActNum; break; - case 3: + case VAR_CURR_LEVEL_NUM: sRegister = gCurrLevelNum; break; - case 4: + case VAR_CURR_AREA_INDEX: sRegister = gCurrAreaIndex; break; } diff --git a/src/game/game_init.c b/src/game/game_init.c index f698f9af..37b96c29 100644 --- a/src/game/game_init.c +++ b/src/game/game_init.c @@ -414,8 +414,7 @@ void select_gfx_pool(void) { */ void display_and_vsync(void) { gIsVC = IS_VC(); - if (IO_READ(DPC_PIPEBUSY_REG) && gIsConsole != 1) - { + if (IO_READ(DPC_PIPEBUSY_REG) && gIsConsole != 1) { gIsConsole = 1; gBorderHeight = BORDER_HEIGHT_CONSOLE; } @@ -444,6 +443,7 @@ void display_and_vsync(void) { gGlobalTimer++; } +#if !defined(DISABLE_DEMO) && defined(KEEP_MARIO_HEAD) // this function records distinct inputs over a 255-frame interval to RAM locations and was likely // used to record the demo sequences seen in the final game. This function is unused. UNUSED static void record_demo(void) { @@ -476,44 +476,6 @@ UNUSED static void record_demo(void) { gRecordedDemoInput.timer++; } -/** - * Take the updated controller struct and calculate the new x, y, and distance floats. - */ -void adjust_analog_stick(struct Controller *controller) { - // Reset the controller's x and y floats. - controller->stickX = 0; - controller->stickY = 0; - - // Modulate the rawStickX and rawStickY to be the new f32 values by adding/subtracting 6. - if (controller->rawStickX <= -8) { - controller->stickX = controller->rawStickX + 6; - } - - if (controller->rawStickX >= 8) { - controller->stickX = controller->rawStickX - 6; - } - - if (controller->rawStickY <= -8) { - controller->stickY = controller->rawStickY + 6; - } - - if (controller->rawStickY >= 8) { - controller->stickY = controller->rawStickY - 6; - } - - // Calculate f32 magnitude from the center by vector length. - controller->stickMag = - sqrtf(controller->stickX * controller->stickX + controller->stickY * controller->stickY); - - // Magnitude cannot exceed 64.0f: if it does, modify the values - // appropriately to flatten the values down to the allowed maximum value. - if (controller->stickMag > 64) { - controller->stickX *= 64 / controller->stickMag; - controller->stickY *= 64 / controller->stickMag; - controller->stickMag = 64; - } -} - /** * If a demo sequence exists, this will run the demo input list until it is complete. */ @@ -571,6 +533,46 @@ void run_demo_inputs(void) { } } +#endif + +/** + * Take the updated controller struct and calculate the new x, y, and distance floats. + */ +void adjust_analog_stick(struct Controller *controller) { + // Reset the controller's x and y floats. + controller->stickX = 0; + controller->stickY = 0; + + // Modulate the rawStickX and rawStickY to be the new f32 values by adding/subtracting 6. + if (controller->rawStickX <= -8) { + controller->stickX = controller->rawStickX + 6; + } + + if (controller->rawStickX >= 8) { + controller->stickX = controller->rawStickX - 6; + } + + if (controller->rawStickY <= -8) { + controller->stickY = controller->rawStickY + 6; + } + + if (controller->rawStickY >= 8) { + controller->stickY = controller->rawStickY - 6; + } + + // Calculate f32 magnitude from the center by vector length. + controller->stickMag = + sqrtf(controller->stickX * controller->stickX + controller->stickY * controller->stickY); + + // Magnitude cannot exceed 64.0f: if it does, modify the values + // appropriately to flatten the values down to the allowed maximum value. + if (controller->stickMag > 64) { + controller->stickX *= 64 / controller->stickMag; + controller->stickY *= 64 / controller->stickMag; + controller->stickMag = 64; + } +} + /** * Update the controller struct with available inputs if present. */ @@ -586,7 +588,9 @@ void read_controller_inputs(s32 threadID) { release_rumble_pak_control(); #endif } +#if !defined(DISABLE_DEMO) && defined(KEEP_MARIO_HEAD) run_demo_inputs(); +#endif for (i = 0; i < 2; i++) { struct Controller *controller = &gControllers[i]; @@ -673,8 +677,6 @@ void init_controllers(void) { * Setup main segments and framebuffers. */ void setup_game_memory(void) { - UNUSED u64 padding; - // Setup general Segment 0 set_segment_base_addr(0, (void *) 0x80000000); // Create Mesg Queues diff --git a/src/game/interaction.c b/src/game/interaction.c index fc4ffde5..5997b100 100644 --- a/src/game/interaction.c +++ b/src/game/interaction.c @@ -675,7 +675,7 @@ u32 should_push_or_pull_door(struct MarioState *m, struct Object *o) { s16 dYaw = o->oMoveAngleYaw - atan2s(dz, dx); - return (dYaw >= -0x4000 && dYaw <= 0x4000) ? 0x00000001 : 0x00000002; + return (dYaw >= -0x4000 && dYaw <= 0x4000) ? WARP_FLAG_DOOR_PULLED : WARP_FLAG_DOOR_FLIP_MARIO; } u32 take_damage_from_interact_object(struct MarioState *m) { @@ -947,10 +947,10 @@ u32 interact_warp_door(struct MarioState *m, UNUSED u32 interactType, struct Obj #endif if (m->action == ACT_WALKING || m->action == ACT_DECELERATING) { - actionArg = should_push_or_pull_door(m, o) + 0x00000004; + actionArg = should_push_or_pull_door(m, o) + WARP_FLAG_DOOR_IS_WARP; if (doorAction == 0) { - if (actionArg & 0x00000001) { + if (actionArg & WARP_FLAG_DOOR_PULLED) { doorAction = ACT_PULLING_DOOR; } else { doorAction = ACT_PUSHING_DOOR; @@ -1018,7 +1018,7 @@ u32 interact_door(struct MarioState *m, UNUSED u32 interactType, struct Object * u32 enterDoorAction; u32 doorSaveFileFlag; - if (actionArg & 0x00000001) { + if (actionArg & WARP_FLAG_DOOR_PULLED) { enterDoorAction = ACT_PULLING_DOOR; } else { enterDoorAction = ACT_PUSHING_DOOR; diff --git a/src/game/level_update.c b/src/game/level_update.c index 5f36f66c..15ece932 100644 --- a/src/game/level_update.c +++ b/src/game/level_update.c @@ -34,24 +34,25 @@ #include "config.h" -#define PLAY_MODE_NORMAL 0 -#define PLAY_MODE_PAUSED 2 -#define PLAY_MODE_CHANGE_AREA 3 -#define PLAY_MODE_CHANGE_LEVEL 4 -#define PLAY_MODE_FRAME_ADVANCE 5 +#define PLAY_MODE_NORMAL 0x00 +#define PLAY_MODE_PAUSED 0x02 +#define PLAY_MODE_CHANGE_AREA 0x03 +#define PLAY_MODE_CHANGE_LEVEL 0x04 +#define PLAY_MODE_FRAME_ADVANCE 0x05 -#define WARP_TYPE_NOT_WARPING 0 -#define WARP_TYPE_CHANGE_LEVEL 1 -#define WARP_TYPE_CHANGE_AREA 2 -#define WARP_TYPE_SAME_AREA 3 +#define WARP_TYPE_NOT_WARPING 0x00 +#define WARP_TYPE_CHANGE_LEVEL 0x01 +#define WARP_TYPE_CHANGE_AREA 0x02 +#define WARP_TYPE_SAME_AREA 0x03 -#define WARP_NODE_F0 0xF0 -#define WARP_NODE_DEATH 0xF1 -#define WARP_NODE_F2 0xF2 -#define WARP_NODE_WARP_FLOOR 0xF3 -#define WARP_NODE_CREDITS_START 0xF8 -#define WARP_NODE_CREDITS_NEXT 0xF9 -#define WARP_NODE_CREDITS_END 0xFA +#define WARP_NODE 0xF0 +#define WARP_NODE_F0 (0x00 | WARP_NODE) +#define WARP_NODE_DEATH (0x01 | WARP_NODE) +#define WARP_NODE_LOOK_UP (0x02 | WARP_NODE) +#define WARP_NODE_WARP_FLOOR (0x03 | WARP_NODE) +#define WARP_NODE_CREDITS_START (0x08 | WARP_NODE) +#define WARP_NODE_CREDITS_NEXT (0x09 | WARP_NODE) +#define WARP_NODE_CREDITS_END (0x0A | WARP_NODE) #define WARP_NODE_CREDITS_MIN 0xF8 @@ -278,7 +279,7 @@ void load_level_init_text(u32 arg) { } void init_door_warp(struct SpawnInfo *spawnInfo, u32 arg1) { - if (arg1 & 0x00000002) { + if (arg1 & WARP_FLAG_DOOR_FLIP_MARIO) { spawnInfo->startAngle[1] += 0x8000; } @@ -706,7 +707,7 @@ void initiate_painting_warp(void) { sWarpCheckpointActive = check_warp_checkpoint(&warpNode); } - initiate_warp(warpNode.destLevel & 0x7F, warpNode.destArea, warpNode.destNode, 0); + initiate_warp(warpNode.destLevel & 0x7F, warpNode.destArea, warpNode.destNode, WARP_FLAGS_NONE); check_if_should_set_warp_checkpoint(&warpNode); play_transition_after_delay(WARP_TRANSITION_FADE_INTO_COLOR, 30, 255, 255, 255, 45); @@ -737,7 +738,7 @@ s16 level_trigger_warp(struct MarioState *m, s32 warpOp) { if (sDelayedWarpOp == WARP_OP_NONE) { m->invincTimer = -1; - sDelayedWarpArg = 0; + sDelayedWarpArg = WARP_FLAGS_NONE; sDelayedWarpOp = warpOp; switch (warpOp) { @@ -794,16 +795,16 @@ s16 level_trigger_warp(struct MarioState *m, s32 warpOp) { play_transition(WARP_TRANSITION_FADE_INTO_CIRCLE, 0x14, 0x00, 0x00, 0x00); break; - case WARP_OP_UNKNOWN_01: // enter totwc + case WARP_OP_LOOK_UP: // enter totwc sDelayedWarpTimer = 30; - sSourceWarpNodeId = WARP_NODE_F2; + sSourceWarpNodeId = WARP_NODE_LOOK_UP; play_transition(WARP_TRANSITION_FADE_INTO_COLOR, 0x1E, 0xFF, 0xFF, 0xFF); #ifndef VERSION_JP play_sound(SOUND_MENU_STAR_SOUND, gGlobalSoundSource); #endif break; - case WARP_OP_UNKNOWN_02: // bbh enter + case WARP_OP_SPIN_SHRINK: // bbh enter sDelayedWarpTimer = 30; sSourceWarpNodeId = (m->usedObj->oBehParams & 0x00FF0000) >> 16; play_transition(WARP_TRANSITION_FADE_INTO_COLOR, 0x1E, 0xFF, 0xFF, 0xFF); @@ -867,34 +868,34 @@ void initiate_delayed_warp(void) { reset_dialog_render_state(); if (gDebugLevelSelect && (sDelayedWarpOp & WARP_OP_TRIGGERS_LEVEL_SELECT)) { - warp_special(-9); + warp_special(WARP_SPECIAL_LEVEL_SELECT); } else if (gCurrDemoInput != NULL) { if (sDelayedWarpOp == WARP_OP_DEMO_END) { - warp_special(-8); + warp_special(WARP_SPECIAL_INTRO_SPLASH_SCREEN); } else { - warp_special(-2); + warp_special(WARP_SPECIAL_MARIO_HEAD_REGULAR); } } else { switch (sDelayedWarpOp) { case WARP_OP_GAME_OVER: save_file_reload(); - warp_special(-3); + warp_special(WARP_SPECIAL_MARIO_HEAD_DIZZY); break; case WARP_OP_CREDITS_END: - warp_special(-1); + warp_special(WARP_SPECIAL_ENDING); sound_banks_enable(SEQ_PLAYER_SFX, SOUND_BANKS_ALL & ~SOUND_BANKS_DISABLED_AFTER_CREDITS); break; case WARP_OP_DEMO_NEXT: - warp_special(-2); + warp_special(WARP_SPECIAL_MARIO_HEAD_REGULAR); break; case WARP_OP_CREDITS_START: gCurrCreditsEntry = &sCreditsSequence[0]; initiate_warp(gCurrCreditsEntry->levelNum, gCurrCreditsEntry->areaIndex, - WARP_NODE_CREDITS_START, 0); + WARP_NODE_CREDITS_START, WARP_FLAGS_NONE); break; case WARP_OP_CREDITS_NEXT: @@ -1066,10 +1067,10 @@ s32 play_mode_paused(void) { set_play_mode(PLAY_MODE_NORMAL); } else { // MENU_OPT_EXIT_COURSE if (gDebugLevelSelect) { - fade_into_special_warp(-9, 1); + fade_into_special_warp(WARP_SPECIAL_LEVEL_SELECT, 1); } else { - initiate_warp(EXIT_COURSE_LEVEL, EXIT_COURSE_AREA, EXIT_COURSE_NODE, 0); - fade_into_special_warp(0, 0); + initiate_warp(EXIT_COURSE_LEVEL, EXIT_COURSE_AREA, EXIT_COURSE_NODE, WARP_FLAGS_NONE); + fade_into_special_warp(WARP_SPECIAL_NONE, 0); gSavedCourseNum = COURSE_NONE; } @@ -1211,7 +1212,7 @@ s32 init_level(void) { sDelayedWarpOp = WARP_OP_NONE; sTransitionTimer = 0; - sSpecialWarpDest = 0; + sSpecialWarpDest = WARP_SPECIAL_NONE; if (gCurrCreditsEntry == NULL) { gHudDisplay.flags = HUD_DISPLAY_DEFAULT; @@ -1352,8 +1353,7 @@ s32 lvl_set_current_level(UNUSED s16 arg0, s32 levelNum) { return 0; } - if (gCurrLevelNum != LEVEL_BOWSER_1 && gCurrLevelNum != LEVEL_BOWSER_2 - && gCurrLevelNum != LEVEL_BOWSER_3) { + if (gCurrLevelNum != LEVEL_BOWSER_1 && gCurrLevelNum != LEVEL_BOWSER_2 && gCurrLevelNum != LEVEL_BOWSER_3) { gMarioState->numCoins = 0; gHudDisplay.coins = 0; gCurrCourseStarFlags = save_file_get_star_flags(gCurrSaveFileNum - 1, gCurrCourseNum - 1); diff --git a/src/game/level_update.h b/src/game/level_update.h index cbc8199b..a8bd0e3c 100644 --- a/src/game/level_update.h +++ b/src/game/level_update.h @@ -12,8 +12,8 @@ #define TIMER_CONTROL_HIDE 0x03 #define WARP_OP_NONE 0x00 -#define WARP_OP_UNKNOWN_01 0x01 -#define WARP_OP_UNKNOWN_02 0x02 +#define WARP_OP_LOOK_UP 0x01 +#define WARP_OP_SPIN_SHRINK 0x02 #define WARP_OP_WARP_DOOR 0x03 #define WARP_OP_WARP_OBJECT 0x04 #define WARP_OP_TELEPORT 0x05 @@ -29,6 +29,18 @@ #define WARP_OP_TRIGGERS_LEVEL_SELECT 0x10 +#define WARP_SPECIAL_LEVEL_SELECT -9 +#define WARP_SPECIAL_INTRO_SPLASH_SCREEN -8 +#define WARP_SPECIAL_MARIO_HEAD_DIZZY -3 +#define WARP_SPECIAL_MARIO_HEAD_REGULAR -2 +#define WARP_SPECIAL_ENDING -1 +#define WARP_SPECIAL_NONE 0 + +#define WARP_FLAGS_NONE (0 << 0) // 0x00 +#define WARP_FLAG_DOOR_PULLED (1 << 0) // 0x01 +#define WARP_FLAG_DOOR_FLIP_MARIO (1 << 1) // 0x02 +#define WARP_FLAG_DOOR_IS_WARP (1 << 2) // 0x04 + #define MARIO_SPAWN_DOOR_WARP 0x01 #define MARIO_SPAWN_UNKNOWN_02 0x02 #define MARIO_SPAWN_UNKNOWN_03 0x03 diff --git a/src/game/mario_actions_cutscene.c b/src/game/mario_actions_cutscene.c index 24845944..08ea592d 100644 --- a/src/game/mario_actions_cutscene.c +++ b/src/game/mario_actions_cutscene.c @@ -253,7 +253,8 @@ void handle_save_menu(struct MarioState *m) { save_file_do_save(gCurrSaveFileNum - 1); if (gSaveOptSelectIndex == MENU_OPT_SAVE_AND_QUIT) { - fade_into_special_warp(-2, 0); // reset game + //! crashes + fade_into_special_warp(WARP_SPECIAL_MARIO_HEAD_REGULAR, 0);// reset game } } @@ -778,7 +779,7 @@ s32 act_unlocking_key_door(struct MarioState *m) { m->pos[0] = m->usedObj->oPosX + coss(m->faceAngle[1]) * 75.0f; m->pos[2] = m->usedObj->oPosZ + sins(m->faceAngle[1]) * 75.0f; - if (m->actionArg & 2) { + if (m->actionArg & WARP_FLAG_DOOR_FLIP_MARIO) { m->faceAngle[1] += 0x8000; } @@ -818,7 +819,7 @@ s32 act_unlocking_star_door(struct MarioState *m) { switch (m->actionState) { case 0: m->faceAngle[1] = m->usedObj->oMoveAngleYaw; - if (m->actionArg & 2) { + if (m->actionArg & WARP_FLAG_DOOR_FLIP_MARIO) { m->faceAngle[1] += 0x8000; } m->marioObj->oMarioReadingSignDPosX = m->pos[0]; @@ -865,7 +866,7 @@ s32 act_entering_star_door(struct MarioState *m) { // ~30 degrees / 1/12 rot targetAngle = m->usedObj->oMoveAngleYaw + 0x1555; - if (m->actionArg & 2) { + if (m->actionArg & WARP_FLAG_DOOR_FLIP_MARIO) { targetAngle += 0x5556; // ~120 degrees / 1/3 rot (total 150d / 5/12) } @@ -897,7 +898,7 @@ s32 act_entering_star_door(struct MarioState *m) { else { m->faceAngle[1] = m->usedObj->oMoveAngleYaw; - if (m->actionArg & 2) { + if (m->actionArg & WARP_FLAG_DOOR_FLIP_MARIO) { m->faceAngle[1] += 0x8000; } @@ -918,7 +919,7 @@ s32 act_entering_star_door(struct MarioState *m) { s32 act_going_through_door(struct MarioState *m) { if (m->actionTimer == 0) { - if (m->actionArg & 1) { + if (m->actionArg & WARP_FLAG_DOOR_PULLED) { m->interactObj->oInteractStatus = INT_STATUS_DOOR_PULLED; set_mario_animation(m, MARIO_ANIM_PULL_DOOR_WALK_IN); } else { @@ -933,12 +934,12 @@ s32 act_going_through_door(struct MarioState *m) { update_mario_pos_for_anim(m); stop_and_set_height_to_floor(m); - if (m->actionArg & 4) { + if (m->actionArg & WARP_FLAG_DOOR_IS_WARP) { if (m->actionTimer == 16) { level_trigger_warp(m, WARP_OP_WARP_DOOR); } } else if (is_anim_at_end(m)) { - if (m->actionArg & 2) { + if (m->actionArg & WARP_FLAG_DOOR_FLIP_MARIO) { m->faceAngle[1] += 0x8000; } set_mario_action(m, ACT_IDLE, 0); @@ -951,7 +952,7 @@ s32 act_going_through_door(struct MarioState *m) { s32 act_warp_door_spawn(struct MarioState *m) { if (m->actionState == 0) { m->actionState = 1; - if (m->actionArg & 1) { + if (m->actionArg & WARP_FLAG_DOOR_PULLED) { m->usedObj->oInteractStatus = INT_STATUS_WARP_DOOR_PULLED; } else { m->usedObj->oInteractStatus = INT_STATUS_WARP_DOOR_PUSHED; @@ -1328,7 +1329,7 @@ s32 act_bbh_enter_spin(struct MarioState *m) { mario_set_forward_vel(m, forwardVel); m->flags &= ~MARIO_JUMPING; if (perform_air_step(m, 0) == AIR_STEP_LANDED) { - level_trigger_warp(m, WARP_OP_UNKNOWN_02); + level_trigger_warp(m, WARP_OP_SPIN_SHRINK); #if ENABLE_RUMBLE queue_rumble_data(15, 80); #endif diff --git a/src/game/mario_actions_stationary.c b/src/game/mario_actions_stationary.c index 163e2d2e..1d9aa8b9 100644 --- a/src/game/mario_actions_stationary.c +++ b/src/game/mario_actions_stationary.c @@ -1071,7 +1071,7 @@ s32 act_first_person(struct MarioState *m) { s16 headRX = m->statusForCamera->headRotation[0]; s16 totalRY = ((m->statusForCamera->headRotation[1] * 4) / 3) + m->faceAngle[1]; if (headRX == -0x1800 && (totalRY < -0x6FFF || totalRY >= 0x7000)) { - level_trigger_warp(m, WARP_OP_UNKNOWN_01); + level_trigger_warp(m, WARP_OP_LOOK_UP); } } diff --git a/src/game/puppycam2.c b/src/game/puppycam2.c index dcac6145..ad928260 100644 --- a/src/game/puppycam2.c +++ b/src/game/puppycam2.c @@ -544,7 +544,7 @@ void puppycam_init(void) gPuppyCam.intendedFlags = PUPPYCAM_BEHAVIOUR_DEFAULT; - if (gCurrLevelNum == 27 || (gCurrLevelNum == 36 && gCurrAreaIndex == 2) || (gCurrLevelNum == 5 && gCurrAreaIndex == 2)) + if (gCurrLevelNum == LEVEL_PSS || (gCurrLevelNum == LEVEL_TTM && gCurrAreaIndex == 2) || (gCurrLevelNum == LEVEL_CCM && gCurrAreaIndex == 2)) gPuppyCam.intendedFlags |= PUPPYCAM_BEHAVIOUR_SLIDE_CORRECTION; gPuppyCam.flags = gPuppyCam.intendedFlags; gPuppyCam.zoom = gPuppyCam.zoomPoints[1]; diff --git a/src/game/puppylights.c b/src/game/puppylights.c index bdc06231..a3a49900 100644 --- a/src/game/puppylights.c +++ b/src/game/puppylights.c @@ -220,7 +220,7 @@ void puppylights_run(Lights1 *src, struct Object *obj, s32 flags, u32 baseColour s32 offsetPlaced = 0; s32 lightFlags = flags; - if (gCurrLevelNum < 4) + if (gCurrLevelNum < LEVEL_BBH) return; //Checks if there's a hardset colour. Colours are only the first 3 bytes, so you can really put whatever you want in the last. //If there isn't a colour, then it decides whether to apply the ambient lighting, or the default lighting as the baseline. @@ -272,7 +272,7 @@ void puppylights_run(Lights1 *src, struct Object *obj, s32 flags, u32 baseColour void puppylights_object_emit(struct Object *obj) { s32 i; - if (gCurrLevelNum < 4) + if (gCurrLevelNum < LEVEL_BBH) return; if (obj->oFlags & OBJ_FLAG_EMIT_LIGHT) diff --git a/src/game/segment7.h b/src/game/segment7.h index 6692ac6b..c552be2e 100644 --- a/src/game/segment7.h +++ b/src/game/segment7.h @@ -24,9 +24,9 @@ extern const u8 eu_course_strings_de_table[]; #endif // from intro_segment7 -extern Gfx *intro_seg7_dl_0700B3A0; -extern Gfx *intro_seg7_dl_0700C6A0; -extern f32 intro_seg7_table_0700C790[]; -extern f32 intro_seg7_table_0700C880[]; +extern Gfx *intro_seg7_dl_main_logo; +extern Gfx *intro_seg7_dl_copyright_trademark; +extern f32 intro_seg7_table_scale_1[]; +extern f32 intro_seg7_table_scale_2[]; #endif // SEGMENT7_H diff --git a/src/goddard/renderer.c b/src/goddard/renderer.c index b701067d..a0c98c72 100644 --- a/src/goddard/renderer.c +++ b/src/goddard/renderer.c @@ -1164,8 +1164,6 @@ void gdm_init(void *blockpool, u32 size) { * Initializes the Mario head demo */ void gdm_setup(void) { - UNUSED u32 pad; - imin("gdm_setup"); sYoshiSceneGrp = NULL; sMarioSceneGrp = NULL; diff --git a/src/menu/intro_geo.c b/src/menu/intro_geo.c index 3058081d..8f6ca65f 100644 --- a/src/menu/intro_geo.c +++ b/src/menu/intro_geo.c @@ -44,8 +44,8 @@ Gfx *geo_intro_super_mario_64_logo(s32 state, struct GraphNode *node, UNUSED voi Gfx *dl = NULL; Gfx *dlIter = NULL; Mtx *scaleMat; - f32 *scaleTable1 = segmented_to_virtual(intro_seg7_table_0700C790); - f32 *scaleTable2 = segmented_to_virtual(intro_seg7_table_0700C880); + f32 *scaleTable1 = segmented_to_virtual(intro_seg7_table_scale_1); + f32 *scaleTable2 = segmented_to_virtual(intro_seg7_table_scale_2); f32 scaleX; f32 scaleY; f32 scaleZ; @@ -83,7 +83,7 @@ Gfx *geo_intro_super_mario_64_logo(s32 state, struct GraphNode *node, UNUSED voi guScale(scaleMat, scaleX, scaleY, scaleZ); gSPMatrix(dlIter++, scaleMat, G_MTX_MODELVIEW | G_MTX_MUL | G_MTX_PUSH); - gSPDisplayList(dlIter++, &intro_seg7_dl_0700B3A0); // draw model + gSPDisplayList(dlIter++, &intro_seg7_dl_main_logo); // draw model gSPPopMatrix(dlIter++, G_MTX_MODELVIEW); gSPEndDisplayList(dlIter); @@ -117,7 +117,7 @@ Gfx *geo_intro_tm_copyright(s32 state, struct GraphNode *node, UNUSED void *cont gDPSetRenderMode(dlIter++, G_RM_AA_XLU_SURF, G_RM_AA_XLU_SURF2); break; } - gSPDisplayList(dlIter++, &intro_seg7_dl_0700C6A0); // draw model + gSPDisplayList(dlIter++, &intro_seg7_dl_copyright_trademark); // draw model gSPEndDisplayList(dlIter); // Once the "Super Mario 64" logo has just about zoomed fully, fade in the "TM" and copyright text diff --git a/src/menu/title_screen.c b/src/menu/title_screen.c index 9ba6aade..33eef734 100644 --- a/src/menu/title_screen.c +++ b/src/menu/title_screen.c @@ -32,12 +32,16 @@ static char sLevelSelectStageNames[64][16] = { #undef STUB_LEVEL #undef DEFINE_LEVEL +#ifdef KEEP_MARIO_HEAD +#ifndef DISABLE_DEMO static u16 sDemoCountdown = 0; +#endif #ifndef VERSION_JP static s16 sPlayMarioGreeting = TRUE; static s16 sPlayMarioGameOver = TRUE; #endif +#ifndef DISABLE_DEMO #define PRESS_START_DEMO_TIMER 800 /** @@ -77,13 +81,15 @@ s32 run_level_id_or_demo(s32 level) { } return level; } +#endif +#endif /** * Level select intro function, updates the selected stage * count if an input was received. signals the stage to be started * or the level select to be exited if start or the quit combo is pressed. */ -s16 intro_level_select(void) { +s16 intro_level_select(void) { //! this function runs and crashes on save+quit even if level select is disabled s32 stageChanged = FALSE; // perform the ID updates per each button press. @@ -138,14 +144,15 @@ s16 intro_level_select(void) { // is the case, quit the menu instead. if (gPlayer1Controller->buttonDown == QUIT_LEVEL_SELECT_COMBO) { gDebugLevelSelect = FALSE; - return -1; + return LEVEL_RESTART_GAME; } play_sound(SOUND_MENU_STAR_SOUND, gGlobalSoundSource); return gCurrLevelNum; } - return 0; + return LEVEL_NONE; } +#ifdef KEEP_MARIO_HEAD /** * Regular intro function that handles Mario's greeting voice and game start. */ @@ -177,12 +184,16 @@ s32 intro_regular(void) { // calls level ID 100 (or 101 adding level select bool value) // defined in level_intro_mario_head_regular JUMP_IF commands // 100 is File Select - 101 is Level Select - level = 100 + gDebugLevelSelect; + level = (LEVEL_FILE_SELECT + gDebugLevelSelect); #ifndef VERSION_JP sPlayMarioGreeting = TRUE; #endif } +#if !defined(DISABLE_DEMO) && defined(KEEP_MARIO_HEAD) return run_level_id_or_demo(level); +#else + return level; +#endif } /** @@ -207,12 +218,16 @@ s32 intro_game_over(void) { queue_rumble_decay(1); #endif // same criteria as intro_regular - level = 100 + gDebugLevelSelect; + level = LEVEL_FILE_SELECT + gDebugLevelSelect; #ifndef VERSION_JP sPlayMarioGameOver = TRUE; #endif } +#if !defined(DISABLE_DEMO) && defined(KEEP_MARIO_HEAD) return run_level_id_or_demo(level); +#else + return level; +#endif } /** @@ -221,37 +236,29 @@ s32 intro_game_over(void) { s32 intro_play_its_a_me_mario(void) { set_background_music(0, SEQ_SOUND_PLAYER, 0); play_sound(SOUND_MENU_COIN_ITS_A_ME_MARIO, gGlobalSoundSource); - return 1; + return (LEVEL_NONE + 1); } +#endif + /** * Update intro functions to handle title screen actions. * Returns a level ID after their criteria is met. */ s32 lvl_intro_update(s16 arg, UNUSED s32 unusedArg) { - s32 retVar = 0; + s32 retVar = LEVEL_NONE; switch (arg) { - case LVL_INTRO_PLAY_ITS_A_ME_MARIO: - retVar = intro_play_its_a_me_mario(); - break; #ifdef KEEP_MARIO_HEAD - case LVL_INTRO_REGULAR: - retVar = intro_regular(); - break; - case LVL_INTRO_GAME_OVER: - retVar = intro_game_over(); - break; + case LVL_INTRO_PLAY_ITS_A_ME_MARIO: retVar = intro_play_its_a_me_mario(); break; + case LVL_INTRO_REGULAR: retVar = intro_regular(); break; + case LVL_INTRO_GAME_OVER: retVar = intro_game_over(); break; #else - case LVL_INTRO_REGULAR: - // fall through - case LVL_INTRO_GAME_OVER: - retVar = (100 + gDebugLevelSelect); - break; + case LVL_INTRO_PLAY_ITS_A_ME_MARIO: // fall through + case LVL_INTRO_REGULAR: // fall through + case LVL_INTRO_GAME_OVER: retVar = (LEVEL_FILE_SELECT + gDebugLevelSelect); break; #endif - case LVL_INTRO_LEVEL_SELECT: - retVar = intro_level_select(); - break; + case LVL_INTRO_LEVEL_SELECT: retVar = intro_level_select(); break; //! this runs on save and quit for some reason? } return retVar; }