From 34d7d25da4d4721c93e2418a17228a8322d9a5ed Mon Sep 17 00:00:00 2001 From: John Collins Date: Sun, 23 Aug 2020 13:34:02 -0500 Subject: [PATCH 1/4] First draft for speed running level reset code. --- levels/menu/script.c | 12 ++++++++++-- src/game/level_update.c | 11 +++++++++++ src/game/level_update.h | 1 + src/game/mario.c | 7 +++++++ src/game/mario.h | 1 + src/menu/star_select.c | 8 +++++--- 6 files changed, 35 insertions(+), 5 deletions(-) diff --git a/levels/menu/script.c b/levels/menu/script.c index 4e955c12..0673cdd4 100644 --- a/levels/menu/script.c +++ b/levels/menu/script.c @@ -18,6 +18,14 @@ #include "make_const_nonconst.h" #include "levels/menu/header.h" +static const LevelScript script_func_local_1[] = { + + /*0*/ CALL(/*arg*/ 0, /*func*/ resetLevelAct), + /*35*/ GET_OR_SET(/*op*/ OP_SET, /*var*/ VAR_CURR_ACT_NUM), + STOP_MUSIC(/*fadeOutTime*/ 0x00BE), + EXIT(), +}; + const LevelScript level_main_menu_entry_1[] = { INIT_LEVEL(), FIXED_LOAD(/*loadAddr*/ _goddardSegmentStart, /*romStart*/ _goddardSegmentRomStart, /*romEnd*/ _goddardSegmentRomEnd), @@ -59,7 +67,7 @@ const LevelScript level_main_menu_entry_1[] = { const LevelScript level_main_menu_entry_2[] = { /*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_LINK_IF(/*op*/ OP_EQ, /*arg*/ 0, script_func_local_1), /*5*/ INIT_LEVEL(), /*6*/ FIXED_LOAD(/*loadAddr*/ _goddardSegmentStart, /*romStart*/ _goddardSegmentRomStart, /*romEnd*/ _goddardSegmentRomEnd), /*10*/ LOAD_MIO0(/*seg*/ 0x07, _menu_segment_7SegmentRomStart, _menu_segment_7SegmentRomEnd), @@ -90,5 +98,5 @@ const LevelScript level_main_menu_entry_2[] = { /*40*/ CLEAR_LEVEL(), /*41*/ SLEEP_BEFORE_EXIT(/*frames*/ 1), // L1: - /*42*/ EXIT(), + /*42*/ EXIT(), }; diff --git a/src/game/level_update.c b/src/game/level_update.c index 72a6a607..eea87749 100644 --- a/src/game/level_update.c +++ b/src/game/level_update.c @@ -481,6 +481,8 @@ void warp_level(void) { load_area(sWarpDest.areaIdx); init_mario_after_warp(); + level_control_timer(TIMER_CONTROL_SHOW); + level_control_timer(TIMER_CONTROL_START); } void warp_credits(void) { @@ -1315,9 +1317,18 @@ s32 lvl_set_current_level(UNUSED s16 arg0, s32 levelNum) { return 0; } + if(levelResetActNum){ + return 0; + } + return 1; } +s32 resetLevelAct(UNUSED s16 arg0){ + s32 returnVal = levelResetActNum; +levelResetActNum = 0; + return returnVal; +} /** * Play the "thank you so much for to playing my game" sound. */ diff --git a/src/game/level_update.h b/src/game/level_update.h index ecf9c3a3..c0ec78bc 100644 --- a/src/game/level_update.h +++ b/src/game/level_update.h @@ -126,6 +126,7 @@ void level_set_transition(s16 length, void (*updateFunction)(s16 *)); s32 lvl_init_or_update(s16 initOrUpdate, UNUSED s32 unused); s32 lvl_init_from_save_file(UNUSED s16 arg0, s32 levelNum); s32 lvl_set_current_level(UNUSED s16 arg0, s32 levelNum); +s32 resetLevelAct(UNUSED s16 arg0); s32 lvl_play_the_end_screen_sound(UNUSED s16 arg0, UNUSED s32 arg1); void basic_update(UNUSED s16 *arg); diff --git a/src/game/mario.c b/src/game/mario.c index 5f8e5114..65e834a2 100644 --- a/src/game/mario.c +++ b/src/game/mario.c @@ -38,6 +38,7 @@ #ifdef BETTERCAMERA #include "bettercamera.h" #endif +int levelResetActNum = 0; u32 unused80339F10; s8 filler80339F1C[20]; @@ -1414,6 +1415,12 @@ void update_mario_inputs(struct MarioState *m) { debug_print_speed_action_normal(m); + if(m->controller->buttonDown& L_TRIG && m->controller->buttonPressed & R_TRIG){ + sWarpDest.levelNum = gCurrLevelNum; + sWarpDest.areaIdx = m->area->index; + levelResetActNum = gCurrActNum; + sWarpDest.type = 1; + } /* Moonjump cheat */ while (Cheats.MoonJump == true && Cheats.EnableCheats == true && m->controller->buttonDown & L_TRIG ){ m->vel[1] = 25; diff --git a/src/game/mario.h b/src/game/mario.h index ad0d005a..3841462e 100644 --- a/src/game/mario.h +++ b/src/game/mario.h @@ -50,5 +50,6 @@ s32 set_water_plunge_action(struct MarioState *m); s32 execute_mario_action(UNUSED struct Object *o); void init_mario(void); void init_mario_from_save_file(void); + extern s32 levelResetActNum; #endif // MARIO_H diff --git a/src/menu/star_select.c b/src/menu/star_select.c index 08b988e6..03b9909d 100644 --- a/src/menu/star_select.c +++ b/src/menu/star_select.c @@ -52,6 +52,8 @@ static s8 sSelectableStarIndex = 0; // Act Selector menu timer that keeps counting until you choose an act. static s32 sActSelectorMenuTimer = 0; +extern int levelResetActNum; + /** * Act Selector Star Type Loop Action * Defines a select type for a star in the act selector. @@ -389,20 +391,20 @@ Gfx *geo_act_selector_strings(s16 callContext, UNUSED struct GraphNode *node) { */ s32 lvl_init_act_selector_values_and_stars(UNUSED s32 arg, UNUSED s32 unused) { u8 stars = save_file_get_star_flags(gCurrSaveFileNum - 1, gCurrCourseNum - 1); + sLoadedActNum = 0; - sLoadedActNum = 0; sInitSelectedActNum = 0; sVisibleStars = 0; sActSelectorMenuTimer = 0; sSelectedActIndex = 0; sSelectableStarIndex = 0; sObtainedStars = save_file_get_course_star_count(gCurrSaveFileNum - 1, gCurrCourseNum - 1); - + // Don't count 100 coin star if (stars & (1 << 6)) { sObtainedStars--; } - + //! no return value #ifdef AVOID_UB return 0; From 44c51a850c19d9a9e032d18ba0db7992b8db3947 Mon Sep 17 00:00:00 2001 From: John Collins Date: Sun, 23 Aug 2020 13:41:07 -0500 Subject: [PATCH 2/4] First draft for speed running level reset code. --- levels/menu/script.c | 12 ++++++++++-- src/game/level_update.c | 11 +++++++++++ src/game/level_update.h | 1 + src/game/mario.c | 7 +++++++ src/game/mario.h | 1 + src/menu/star_select.c | 8 +++++--- 6 files changed, 35 insertions(+), 5 deletions(-) diff --git a/levels/menu/script.c b/levels/menu/script.c index 4e955c12..0673cdd4 100644 --- a/levels/menu/script.c +++ b/levels/menu/script.c @@ -18,6 +18,14 @@ #include "make_const_nonconst.h" #include "levels/menu/header.h" +static const LevelScript script_func_local_1[] = { + + /*0*/ CALL(/*arg*/ 0, /*func*/ resetLevelAct), + /*35*/ GET_OR_SET(/*op*/ OP_SET, /*var*/ VAR_CURR_ACT_NUM), + STOP_MUSIC(/*fadeOutTime*/ 0x00BE), + EXIT(), +}; + const LevelScript level_main_menu_entry_1[] = { INIT_LEVEL(), FIXED_LOAD(/*loadAddr*/ _goddardSegmentStart, /*romStart*/ _goddardSegmentRomStart, /*romEnd*/ _goddardSegmentRomEnd), @@ -59,7 +67,7 @@ const LevelScript level_main_menu_entry_1[] = { const LevelScript level_main_menu_entry_2[] = { /*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_LINK_IF(/*op*/ OP_EQ, /*arg*/ 0, script_func_local_1), /*5*/ INIT_LEVEL(), /*6*/ FIXED_LOAD(/*loadAddr*/ _goddardSegmentStart, /*romStart*/ _goddardSegmentRomStart, /*romEnd*/ _goddardSegmentRomEnd), /*10*/ LOAD_MIO0(/*seg*/ 0x07, _menu_segment_7SegmentRomStart, _menu_segment_7SegmentRomEnd), @@ -90,5 +98,5 @@ const LevelScript level_main_menu_entry_2[] = { /*40*/ CLEAR_LEVEL(), /*41*/ SLEEP_BEFORE_EXIT(/*frames*/ 1), // L1: - /*42*/ EXIT(), + /*42*/ EXIT(), }; diff --git a/src/game/level_update.c b/src/game/level_update.c index 72a6a607..eea87749 100644 --- a/src/game/level_update.c +++ b/src/game/level_update.c @@ -481,6 +481,8 @@ void warp_level(void) { load_area(sWarpDest.areaIdx); init_mario_after_warp(); + level_control_timer(TIMER_CONTROL_SHOW); + level_control_timer(TIMER_CONTROL_START); } void warp_credits(void) { @@ -1315,9 +1317,18 @@ s32 lvl_set_current_level(UNUSED s16 arg0, s32 levelNum) { return 0; } + if(levelResetActNum){ + return 0; + } + return 1; } +s32 resetLevelAct(UNUSED s16 arg0){ + s32 returnVal = levelResetActNum; +levelResetActNum = 0; + return returnVal; +} /** * Play the "thank you so much for to playing my game" sound. */ diff --git a/src/game/level_update.h b/src/game/level_update.h index ecf9c3a3..c0ec78bc 100644 --- a/src/game/level_update.h +++ b/src/game/level_update.h @@ -126,6 +126,7 @@ void level_set_transition(s16 length, void (*updateFunction)(s16 *)); s32 lvl_init_or_update(s16 initOrUpdate, UNUSED s32 unused); s32 lvl_init_from_save_file(UNUSED s16 arg0, s32 levelNum); s32 lvl_set_current_level(UNUSED s16 arg0, s32 levelNum); +s32 resetLevelAct(UNUSED s16 arg0); s32 lvl_play_the_end_screen_sound(UNUSED s16 arg0, UNUSED s32 arg1); void basic_update(UNUSED s16 *arg); diff --git a/src/game/mario.c b/src/game/mario.c index 5f8e5114..65e834a2 100644 --- a/src/game/mario.c +++ b/src/game/mario.c @@ -38,6 +38,7 @@ #ifdef BETTERCAMERA #include "bettercamera.h" #endif +int levelResetActNum = 0; u32 unused80339F10; s8 filler80339F1C[20]; @@ -1414,6 +1415,12 @@ void update_mario_inputs(struct MarioState *m) { debug_print_speed_action_normal(m); + if(m->controller->buttonDown& L_TRIG && m->controller->buttonPressed & R_TRIG){ + sWarpDest.levelNum = gCurrLevelNum; + sWarpDest.areaIdx = m->area->index; + levelResetActNum = gCurrActNum; + sWarpDest.type = 1; + } /* Moonjump cheat */ while (Cheats.MoonJump == true && Cheats.EnableCheats == true && m->controller->buttonDown & L_TRIG ){ m->vel[1] = 25; diff --git a/src/game/mario.h b/src/game/mario.h index ad0d005a..3841462e 100644 --- a/src/game/mario.h +++ b/src/game/mario.h @@ -50,5 +50,6 @@ s32 set_water_plunge_action(struct MarioState *m); s32 execute_mario_action(UNUSED struct Object *o); void init_mario(void); void init_mario_from_save_file(void); + extern s32 levelResetActNum; #endif // MARIO_H diff --git a/src/menu/star_select.c b/src/menu/star_select.c index 08b988e6..03b9909d 100644 --- a/src/menu/star_select.c +++ b/src/menu/star_select.c @@ -52,6 +52,8 @@ static s8 sSelectableStarIndex = 0; // Act Selector menu timer that keeps counting until you choose an act. static s32 sActSelectorMenuTimer = 0; +extern int levelResetActNum; + /** * Act Selector Star Type Loop Action * Defines a select type for a star in the act selector. @@ -389,20 +391,20 @@ Gfx *geo_act_selector_strings(s16 callContext, UNUSED struct GraphNode *node) { */ s32 lvl_init_act_selector_values_and_stars(UNUSED s32 arg, UNUSED s32 unused) { u8 stars = save_file_get_star_flags(gCurrSaveFileNum - 1, gCurrCourseNum - 1); + sLoadedActNum = 0; - sLoadedActNum = 0; sInitSelectedActNum = 0; sVisibleStars = 0; sActSelectorMenuTimer = 0; sSelectedActIndex = 0; sSelectableStarIndex = 0; sObtainedStars = save_file_get_course_star_count(gCurrSaveFileNum - 1, gCurrCourseNum - 1); - + // Don't count 100 coin star if (stars & (1 << 6)) { sObtainedStars--; } - + //! no return value #ifdef AVOID_UB return 0; From 2d22401db44bb9cac529ff0b926388df93720bd7 Mon Sep 17 00:00:00 2001 From: John Collins Date: Sun, 6 Sep 2020 14:30:05 -0500 Subject: [PATCH 3/4] Fixed bug when reseting with better camera. Fixed bug when reseting with a dialog box onscreen. Added seperate timer for speedruns / Fixed conflict with in-game timer. Added feature to store last warp to use when reseting.(L+R) Changed reset to Z+R to prevet conflicts with Better Camera. --- src/game/hud.c | 39 +++++++++++++++++++++++++++++++++ src/game/level_update.c | 48 +++++++++++++++++++++++++++++++++-------- src/game/level_update.h | 4 +++- src/game/mario.c | 29 +++++++++++++++++++++---- src/game/mario.h | 1 + src/menu/star_select.c | 3 +-- 6 files changed, 108 insertions(+), 16 deletions(-) diff --git a/src/game/hud.c b/src/game/hud.c index 1540b675..8f6feb4f 100644 --- a/src/game/hud.c +++ b/src/game/hud.c @@ -363,7 +363,43 @@ void render_hud_timer(void) { render_hud_tex_lut(GFX_DIMENSIONS_RECT_FROM_RIGHT_EDGE(46), 32, (*hudLUT)[GLYPH_DOUBLE_QUOTE]); gSPDisplayList(gDisplayListHead++, dl_hud_img_end); } +void render_hud_speedrunning_timer(void) { + u8 *(*hudLUT)[58]; + u16 timerValFrames; + u16 timerMins; + u16 timerSecs; + u16 timerFracSecs; + hudLUT = segmented_to_virtual(&main_hud_lut); + timerValFrames = gHudDisplay.speedRunTimer; +#ifdef VERSION_EU + switch (eu_get_language()) { + case LANGUAGE_ENGLISH: + print_text(GFX_DIMENSIONS_RECT_FROM_RIGHT_EDGE(150), 185, "TIME"); + break; + case LANGUAGE_FRENCH: + print_text(GFX_DIMENSIONS_RECT_FROM_RIGHT_EDGE(155), 185, "TEMPS"); + break; + case LANGUAGE_GERMAN: + print_text(GFX_DIMENSIONS_RECT_FROM_RIGHT_EDGE(150), 185, "ZEIT"); + break; + } +#endif + timerMins = timerValFrames / (30 * 60); + timerSecs = (timerValFrames - (timerMins * 1800)) / 30; + + timerFracSecs = ((timerValFrames - (timerMins * 1800) - (timerSecs * 30)) & 0xFFFF) ; +#ifndef VERSION_EU + print_text(GFX_DIMENSIONS_RECT_FROM_RIGHT_EDGE(190), 167, "RUN TIME"); +#endif + print_text_fmt_int(GFX_DIMENSIONS_RECT_FROM_RIGHT_EDGE(91), 167, "%0d", timerMins); + print_text_fmt_int(GFX_DIMENSIONS_RECT_FROM_RIGHT_EDGE(71), 167, "%02d", timerSecs); + print_text_fmt_int(GFX_DIMENSIONS_RECT_FROM_RIGHT_EDGE(37), 167, "%02d", timerFracSecs); + gSPDisplayList(gDisplayListHead++, dl_hud_img_begin); + render_hud_tex_lut(GFX_DIMENSIONS_RECT_FROM_RIGHT_EDGE(81), 50, (*hudLUT)[GLYPH_APOSTROPHE]); + render_hud_tex_lut(GFX_DIMENSIONS_RECT_FROM_RIGHT_EDGE(46), 50, (*hudLUT)[GLYPH_DOUBLE_QUOTE]); + gSPDisplayList(gDisplayListHead++, dl_hud_img_end); +} /** * Sets HUD status camera value depending of the actions * defined in update_camera_status. @@ -476,6 +512,9 @@ void render_hud(void) { if (hudDisplayFlags & HUD_DISPLAY_FLAG_TIMER && configHUD) { render_hud_timer(); + } + if (hudDisplayFlags & HUD_DISPLAY_FLAG_SPEED_TIMER && configHUD) { + render_hud_speedrunning_timer(); } } } diff --git a/src/game/level_update.c b/src/game/level_update.c index eea87749..fef25d37 100644 --- a/src/game/level_update.c +++ b/src/game/level_update.c @@ -162,6 +162,7 @@ u16 D_80339ECA; s16 sTransitionTimer; void (*sTransitionUpdate)(s16 *); struct WarpDest sWarpDest; +struct WarpDest storedWarpDest; s16 D_80339EE0; s16 sDelayedWarpOp; s16 sDelayedWarpTimer; @@ -171,6 +172,7 @@ s32 sDelayedWarpArg; s16 unusedEULevelUpdateBss1; #endif s8 sTimerRunning; +s8 speedTimerRunning; s8 gShouldNotPlayCastleMusic; struct MarioState *gMarioState = &gMarioStates[0]; @@ -179,6 +181,7 @@ s8 D_8032C9E0 = 0; u8 unused3[4]; u8 unused4[2]; + u16 level_control_timer(s32 timerOp) { switch (timerOp) { case TIMER_CONTROL_SHOW: @@ -204,6 +207,31 @@ u16 level_control_timer(s32 timerOp) { return gHudDisplay.timer; } +u16 speed_running_control_timer(s32 timerOp) { + switch (timerOp) { + case TIMER_CONTROL_SHOW: + gHudDisplay.flags |= HUD_DISPLAY_FLAG_SPEED_TIMER; + speedTimerRunning = FALSE; + gHudDisplay.speedRunTimer = 0; + break; + + case TIMER_CONTROL_START: + speedTimerRunning = TRUE; + break; + + case TIMER_CONTROL_STOP: + speedTimerRunning = FALSE; + break; + + case TIMER_CONTROL_HIDE: + gHudDisplay.flags &= ~HUD_DISPLAY_FLAG_SPEED_TIMER; + speedTimerRunning = FALSE; + gHudDisplay.speedRunTimer = 0; + break; + } + + return gHudDisplay.speedRunTimer; +} u32 pressed_pause(void) { u32 val4 = get_dialog_id() >= 0; @@ -478,11 +506,12 @@ void warp_level(void) { gCurrLevelNum = sWarpDest.levelNum; level_control_timer(TIMER_CONTROL_HIDE); + load_area(sWarpDest.areaIdx); init_mario_after_warp(); - level_control_timer(TIMER_CONTROL_SHOW); - level_control_timer(TIMER_CONTROL_START); + speed_running_control_timer(TIMER_CONTROL_SHOW); + speed_running_control_timer(TIMER_CONTROL_START); } void warp_credits(void) { @@ -672,6 +701,7 @@ void initiate_painting_warp(void) { if (!(warpNode.destLevel & 0x80)) { D_8032C9E0 = check_warp_checkpoint(&warpNode); } + skipStarSelect = false; initiate_warp(warpNode.destLevel & 0x7F, warpNode.destArea, warpNode.destNode, 0); check_if_should_set_warp_checkpoint(&warpNode); @@ -981,7 +1011,9 @@ s32 play_mode_normal(void) { if (sTimerRunning && gHudDisplay.timer < 17999) { gHudDisplay.timer += 1; } - + if (speedTimerRunning) { + gHudDisplay.speedRunTimer += 1; + } area_update_objects(); update_hud_values(); @@ -1226,7 +1258,7 @@ s32 init_level(void) { if (gMarioState->action == ACT_INTRO_CUTSCENE) { sound_banks_disable(2, 0x0330); } - + return 1; } @@ -1317,17 +1349,15 @@ s32 lvl_set_current_level(UNUSED s16 arg0, s32 levelNum) { return 0; } - if(levelResetActNum){ + if(skipStarSelect){ return 0; } return 1; } -s32 resetLevelAct(UNUSED s16 arg0){ - s32 returnVal = levelResetActNum; -levelResetActNum = 0; - return returnVal; +s32 resetLevelAct(UNUSED s16 arg0) { + return levelResetActNum; } /** * Play the "thank you so much for to playing my game" sound. diff --git a/src/game/level_update.h b/src/game/level_update.h index c0ec78bc..6e707112 100644 --- a/src/game/level_update.h +++ b/src/game/level_update.h @@ -78,7 +78,7 @@ struct WarpDest { u8 nodeId; u32 arg; }; - +extern struct WarpDest storedWarpDest; extern struct WarpDest sWarpDest; extern s16 D_80339EE0; @@ -97,6 +97,7 @@ struct HudDisplay { /*0x08*/ s16 keys; /*0x0A*/ s16 flags; /*0x0C*/ u16 timer; + u32 speedRunTimer; }; extern struct HudDisplay gHudDisplay; @@ -110,6 +111,7 @@ enum HUDDisplayFlag { HUD_DISPLAY_FLAG_KEYS = 0x0010, HUD_DISPLAY_FLAG_UNKNOWN_0020 = 0x0020, HUD_DISPLAY_FLAG_TIMER = 0x0040, + HUD_DISPLAY_FLAG_SPEED_TIMER = 0x0080, HUD_DISPLAY_FLAG_EMPHASIZE_POWER = 0x8000, HUD_DISPLAY_NONE = 0x0000, diff --git a/src/game/mario.c b/src/game/mario.c index 65e834a2..1f3c40dd 100644 --- a/src/game/mario.c +++ b/src/game/mario.c @@ -37,8 +37,11 @@ #include "pc/cheats.h" #ifdef BETTERCAMERA #include "bettercamera.h" +extern f32 newcam_yaw_acc; +extern f32 newcam_tilt_acc; #endif int levelResetActNum = 0; +u8 skipStarSelect = false; u32 unused80339F10; s8 filler80339F1C[20]; @@ -1414,12 +1417,30 @@ void update_mario_inputs(struct MarioState *m) { update_mario_geometry_inputs(m); debug_print_speed_action_normal(m); - - if(m->controller->buttonDown& L_TRIG && m->controller->buttonPressed & R_TRIG){ - sWarpDest.levelNum = gCurrLevelNum; - sWarpDest.areaIdx = m->area->index; + + if (m->controller->buttonDown & L_TRIG && m->controller->buttonPressed & R_TRIG) { + storedWarpDest = sWarpDest; levelResetActNum = gCurrActNum; + } + if (m->controller->buttonDown & Z_TRIG && m->controller->buttonPressed & R_TRIG) { + skipStarSelect = true; + + m->health = 0x880; + if (storedWarpDest.levelNum != 0) { + sWarpDest = storedWarpDest; + levelResetActNum = gCurrActNum; + + } else { + sWarpDest.levelNum = gCurrLevelNum; + sWarpDest.areaIdx = m->area->index; + } + sWarpDest.type = 1; + reset_dialog_render_state(); +#ifdef BETTERCAMERA + newcam_yaw_acc = 0; + newcam_tilt_acc = 0; +#endif } /* Moonjump cheat */ while (Cheats.MoonJump == true && Cheats.EnableCheats == true && m->controller->buttonDown & L_TRIG ){ diff --git a/src/game/mario.h b/src/game/mario.h index 3841462e..004b8f7d 100644 --- a/src/game/mario.h +++ b/src/game/mario.h @@ -51,5 +51,6 @@ s32 execute_mario_action(UNUSED struct Object *o); void init_mario(void); void init_mario_from_save_file(void); extern s32 levelResetActNum; + extern u8 skipStarSelect; #endif // MARIO_H diff --git a/src/menu/star_select.c b/src/menu/star_select.c index 03b9909d..27f41d30 100644 --- a/src/menu/star_select.c +++ b/src/menu/star_select.c @@ -52,7 +52,6 @@ static s8 sSelectableStarIndex = 0; // Act Selector menu timer that keeps counting until you choose an act. static s32 sActSelectorMenuTimer = 0; -extern int levelResetActNum; /** * Act Selector Star Type Loop Action @@ -391,8 +390,8 @@ Gfx *geo_act_selector_strings(s16 callContext, UNUSED struct GraphNode *node) { */ s32 lvl_init_act_selector_values_and_stars(UNUSED s32 arg, UNUSED s32 unused) { u8 stars = save_file_get_star_flags(gCurrSaveFileNum - 1, gCurrCourseNum - 1); - sLoadedActNum = 0; + sLoadedActNum = 0; sInitSelectedActNum = 0; sVisibleStars = 0; sActSelectorMenuTimer = 0; From 7e3ceb557942672cb46e456ca61ae18df37ea2e6 Mon Sep 17 00:00:00 2001 From: John Collins Date: Sun, 6 Sep 2020 14:40:23 -0500 Subject: [PATCH 4/4] Small bugfix. --- src/game/mario.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/game/mario.c b/src/game/mario.c index 1f3c40dd..cd645541 100644 --- a/src/game/mario.c +++ b/src/game/mario.c @@ -1433,6 +1433,7 @@ void update_mario_inputs(struct MarioState *m) { } else { sWarpDest.levelNum = gCurrLevelNum; sWarpDest.areaIdx = m->area->index; + levelResetActNum = gCurrActNum; } sWarpDest.type = 1;