diff --git a/mm/2s2h/Enhancements/Cutscenes/StoryCutscenes/SkipDefeatCaptainSequence.cpp b/mm/2s2h/Enhancements/Cutscenes/StoryCutscenes/SkipDefeatCaptainSequence.cpp new file mode 100644 index 0000000000..0214814c93 --- /dev/null +++ b/mm/2s2h/Enhancements/Cutscenes/StoryCutscenes/SkipDefeatCaptainSequence.cpp @@ -0,0 +1,57 @@ +#include +#include "2s2h/GameInteractor/GameInteractor.h" +#include "2s2h/ShipInit.hpp" + +extern "C" { +#include "variables.h" +#include "overlays/actors/ovl_En_Bsb/z_en_bsb.h" +} + +#define CVAR_NAME "gEnhancements.Cutscenes.SkipStoryCutscenes" +#define CVAR CVarGetInteger(CVAR_NAME, 0) + +void SkipDefeatCaptainTextbox(EnBsb* captain) { + // from func_80C0D9B4 + gPlayState->nextEntrance = Entrance_CreateFromSpawn(5); + gSaveContext.nextCutsceneIndex = 0; + gPlayState->transitionTrigger = 0x14; + gPlayState->transitionType = 2; + gSaveContext.nextTransitionType = 3; + captain->unk_111A = 0; +} + +void SkipDefeatCaptainCutscene() { + Player* player = GET_PLAYER(gPlayState); + + // the cutscene sets link's position/rotation to + // + // player->actor.world = { { -100.0f, 474.0f, -2330.0f }, { 0, -16384, 0 } }; + // + // but link walks forward when not told not to by the cutscene, so we're + // setting link's position back a little bit so he doesn't walk off the ledge + player->actor.world = { { 64.0f, 488.0f, -2332.0f }, { 0, -16384, 0 } }; + + // make sure captain's gone + SET_WEEKEVENTREG(WEEKEVENTREG_23_04); + + // get rid of the fire from the chest + Flags_SetSwitch(gPlayState, 0x0B); +} + +void RegisterSkipDefeatCaptainSequence() { + COND_VB_SHOULD(VB_PLAY_DEFEAT_CAPTAIN_SEQUENCE, CVAR, { + *should = false; + EnBsb* captain = (EnBsb*)va_arg(args, EnBsb*); + SkipDefeatCaptainTextbox(captain); + }); + + COND_VB_SHOULD(VB_START_CUTSCENE, CVAR, { + s16* csId = va_arg(args, s16*); + if (gPlayState->sceneId == SCENE_BOTI && *csId == 20) { + *should = false; + SkipDefeatCaptainCutscene(); + } + }); +} + +static RegisterShipInitFunc initFunc(RegisterSkipDefeatCaptainSequence, { CVAR_NAME, "IS_RANDO" }); diff --git a/mm/2s2h/GameInteractor/GameInteractor.h b/mm/2s2h/GameInteractor/GameInteractor.h index 3fb64b1b48..c61fc043d2 100644 --- a/mm/2s2h/GameInteractor/GameInteractor.h +++ b/mm/2s2h/GameInteractor/GameInteractor.h @@ -203,6 +203,7 @@ typedef enum { VB_GORON_ROLL_INCREASE_SPIKE_LEVEL, VB_GORON_ROLL_DISABLE_SPIKE_MODE, VB_DEKU_LINK_SPIN_ON_LAST_HOP, + VB_PLAY_DEFEAT_CAPTAIN_SEQUENCE, VB_CLAMP_ANIMATION_SPEED, } GIVanillaBehavior; diff --git a/mm/src/overlays/actors/ovl_En_Bsb/z_en_bsb.c b/mm/src/overlays/actors/ovl_En_Bsb/z_en_bsb.c index 1d09f8ef76..681087a340 100644 --- a/mm/src/overlays/actors/ovl_En_Bsb/z_en_bsb.c +++ b/mm/src/overlays/actors/ovl_En_Bsb/z_en_bsb.c @@ -9,6 +9,7 @@ #include "objects/gameplay_keep/gameplay_keep.h" #include "z64rumble.h" #include "z64shrink_window.h" +#include "2s2h/GameInteractor/GameInteractor.h" #define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_UNFRIENDLY | ACTOR_FLAG_10 | ACTOR_FLAG_20 | ACTOR_FLAG_2000000) @@ -328,7 +329,7 @@ void EnBsb_Init(Actor* thisx, PlayState* play) { this->actor.targetMode = 0xA; - if (WEEKEVENTREG(0x17) & 4) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_23_04)) { Actor_Kill(&this->actor); return; } @@ -1073,8 +1074,10 @@ void func_80C0D964(EnBsb* this, PlayState* play) { this->unk_02A4 = 0; this->unk_02A8 = 0; this->actor.textId = 0x1535; - Message_StartTextbox(play, this->actor.textId, &this->actor); - this->actionFunc = func_80C0D9B4; + if (GameInteractor_Should(VB_PLAY_DEFEAT_CAPTAIN_SEQUENCE, true)) { + Message_StartTextbox(play, this->actor.textId, &this->actor); + this->actionFunc = func_80C0D9B4; + } } void func_80C0D9B4(EnBsb* this, PlayState* play) { @@ -1517,7 +1520,7 @@ s32 func_80C0E9CC(EnBsb* this, PlayState* play) { break; case 5: - WEEKEVENTREG(23) |= 4; + SET_WEEKEVENTREG(WEEKEVENTREG_23_04); Actor_PlaySfx(&this->actor, NA_SE_EN_KITA_BREAK); break;