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),
/*15*/ CALL(/*arg*/ 0, /*func*/ lvl_play_the_end_screen_sound),
// L1:
/*17*/ SLEEP(/*frames*/ 1),
/*18*/ JUMP(level_ending_entry + 17),
/*17*/ //SLEEP(/*frames*/ 1),
/*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[] = {
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)
//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);
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);
s32 lvl_exiting_credits(UNUSED s16 arg0, UNUSED s32 arg1);
#endif // LEVEL_UPDATE_H

View File

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