Fix ending cutscene crash and make game playable afterward without rehosting

This commit is contained in:
MysterD 2021-08-04 23:56:33 -07:00
parent 3ba77087e9
commit 0d05853138
5 changed files with 31 additions and 15 deletions

View file

@ -32,6 +32,10 @@ const LevelScript level_ending_entry[] = {
/*14*/ SLEEP(/*frames*/ 120), /*14*/ SLEEP(/*frames*/ 120),
/*15*/ CALL(/*arg*/ 0, /*func*/ lvl_play_the_end_screen_sound), /*15*/ CALL(/*arg*/ 0, /*func*/ lvl_play_the_end_screen_sound),
// L1: // L1:
/*17*/ SLEEP(/*frames*/ 1), /*17*/ //SLEEP(/*frames*/ 1),
/*18*/ JUMP(level_ending_entry + 17), /*18*/ //JUMP(level_ending_entry + 17),
SLEEP_BEFORE_EXIT(/*frames*/ 30 * 5),
/*15*/ CALL(/*arg*/ 0, /*func*/ lvl_exiting_credits),
CLEAR_LEVEL(),
EXIT(),
}; };

View file

@ -14,7 +14,9 @@
const LevelScript level_script_entry[] = { const LevelScript level_script_entry[] = {
SET_REG(/*value*/ LEVEL_CASTLE_GROUNDS), SET_REG(/*value*/ LEVEL_CASTLE_GROUNDS),
JUMP(/*target*/ level_main_scripts_entry), //JUMP(/*target*/ level_main_scripts_entry),
EXECUTE(/*seg*/ 0x14, /*script*/ _introSegmentRomStart, /*scriptEnd*/ _introSegmentRomEnd, /*entry*/ level_main_scripts_entry),
JUMP(level_script_entry),
// old behavior (intro) // old behavior (intro)
//INIT_LEVEL(), //INIT_LEVEL(),

View file

@ -1437,3 +1437,9 @@ s32 lvl_play_the_end_screen_sound(UNUSED s16 arg0, UNUSED s32 arg1) {
play_sound(SOUND_MENU_THANK_YOU_PLAYING_MY_GAME, gDefaultSoundArgs); play_sound(SOUND_MENU_THANK_YOU_PLAYING_MY_GAME, gDefaultSoundArgs);
return 1; return 1;
} }
s32 lvl_exiting_credits(UNUSED s16 arg0, UNUSED s32 arg1) {
gCurrActStarNum = 0;
gCurrActNum = 0;
return 1;
}

View file

@ -153,4 +153,6 @@ s32 init_level(void);
void star_select_finish_selection(void); void star_select_finish_selection(void);
s32 lvl_exiting_credits(UNUSED s16 arg0, UNUSED s32 arg1);
#endif // LEVEL_UPDATE_H #endif // LEVEL_UPDATE_H

View file

@ -2757,28 +2757,30 @@ static s32 act_credits_cutscene(struct MarioState *m) {
m->actionState += 2; m->actionState += 2;
} }
width = m->actionState * 640 / 100; if (m->playerIndex == 0) {
height = m->actionState * 480 / 100; width = m->actionState * 640 / 100;
height = m->actionState * 480 / 100;
sEndCutsceneVp.vp.vscale[0] = 640 - width; sEndCutsceneVp.vp.vscale[0] = 640 - width;
sEndCutsceneVp.vp.vscale[1] = 480 - height; sEndCutsceneVp.vp.vscale[1] = 480 - height;
sEndCutsceneVp.vp.vtrans[0] = sEndCutsceneVp.vp.vtrans[0] =
(gCurrCreditsEntry->unk02 & 0x10 ? width : -width) * 56 / 100 + 640; (gCurrCreditsEntry->unk02 & 0x10 ? width : -width) * 56 / 100 + 640;
sEndCutsceneVp.vp.vtrans[1] = sEndCutsceneVp.vp.vtrans[1] =
(gCurrCreditsEntry->unk02 & 0x20 ? height : -height) * 66 / 100 + 480; (gCurrCreditsEntry->unk02 & 0x20 ? height : -height) * 66 / 100 + 480;
override_viewport_and_clip(&sEndCutsceneVp, 0, 0, 0, 0); override_viewport_and_clip(&sEndCutsceneVp, 0, 0, 0, 0);
}
} }
if (m->actionTimer == TIMER_CREDITS_PROGRESS) { if (m->actionTimer == TIMER_CREDITS_PROGRESS && m->playerIndex == 0) {
reset_cutscene_msg_fade(); reset_cutscene_msg_fade();
} }
if (m->actionTimer >= TIMER_CREDITS_PROGRESS) { if (m->actionTimer >= TIMER_CREDITS_PROGRESS && m->playerIndex == 0) {
sDispCreditsEntry = gCurrCreditsEntry; sDispCreditsEntry = gCurrCreditsEntry;
} }
if (m->actionTimer++ == TIMER_CREDITS_WARP) { if (m->actionTimer++ == TIMER_CREDITS_WARP && m->playerIndex == 0) {
level_trigger_warp(m, 24); level_trigger_warp(m, 24);
} }