From 87aa18ef6579b2447693d828ec7cc89949e0eb22 Mon Sep 17 00:00:00 2001 From: Isaac <62234577+Isaac0-dev@users.noreply.github.com> Date: Thu, 31 Mar 2022 18:52:28 +1000 Subject: [PATCH] Credits skip (you can merge this now) (#52) --- src/game/mario.c | 1 + src/game/mario_actions_cutscene.c | 45 ++++++++++++++++--------------- 2 files changed, 25 insertions(+), 21 deletions(-) diff --git a/src/game/mario.c b/src/game/mario.c index f37702a64..9875ce3dc 100644 --- a/src/game/mario.c +++ b/src/game/mario.c @@ -1530,6 +1530,7 @@ void update_mario_inputs(struct MarioState *m) { /* End of developer stuff */ if ((m->action == ACT_END_PEACH_CUTSCENE || m->action == ACT_CREDITS_CUTSCENE) && m->controller->buttonPressed & START_BUTTON) { + gCurrCreditsEntry = NULL; gCurrActStarNum = 0; gCurrActNum = 0; gChangeLevel = 16; diff --git a/src/game/mario_actions_cutscene.c b/src/game/mario_actions_cutscene.c index 718053937..ecbfef33b 100644 --- a/src/game/mario_actions_cutscene.c +++ b/src/game/mario_actions_cutscene.c @@ -2807,33 +2807,36 @@ static s32 act_credits_cutscene(struct MarioState *m) { m->actionState += 2; } - if (m->playerIndex == 0) { - s32 width = m->actionState * 640 / 100; - s32 height = m->actionState * 480 / 100; + if (gCurrCreditsEntry != NULL) { + if (m->playerIndex == 0) { + s32 width = m->actionState * 640 / 100; + s32 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 && m->playerIndex == 0) { - reset_cutscene_msg_fade(); + if (gCurrCreditsEntry != NULL) { + if (m->actionTimer == TIMER_CREDITS_PROGRESS && m->playerIndex == 0) { + reset_cutscene_msg_fade(); + } + + if (m->actionTimer >= TIMER_CREDITS_PROGRESS && m->playerIndex == 0) { + sDispCreditsEntry = gCurrCreditsEntry; + } + + if (m->actionTimer++ == TIMER_CREDITS_WARP && m->playerIndex == 0) { + level_trigger_warp(m, WARP_OP_CREDITS_NEXT); + } + + m->marioObj->header.gfx.angle[1] += (gCurrCreditsEntry->unk02 & 0xC0) << 8; } - - if (m->actionTimer >= TIMER_CREDITS_PROGRESS && m->playerIndex == 0) { - sDispCreditsEntry = gCurrCreditsEntry; - } - - if (m->actionTimer++ == TIMER_CREDITS_WARP && m->playerIndex == 0) { - level_trigger_warp(m, WARP_OP_CREDITS_NEXT); - } - - m->marioObj->header.gfx.angle[1] += (gCurrCreditsEntry->unk02 & 0xC0) << 8; - return FALSE; }