forked from HarbourMasters/2ship2harkinian
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* first pass * make sure the captain is gone after he's defeated * no `|| IS_RANDO` * clean up * newline * clean up again * clang-format --------- Co-authored-by: Garrett Cox <[email protected]>
- Loading branch information
1 parent
f11fcca
commit 259e7e5
Showing
3 changed files
with
65 additions
and
4 deletions.
There are no files selected for viewing
57 changes: 57 additions & 0 deletions
57
mm/2s2h/Enhancements/Cutscenes/StoryCutscenes/SkipDefeatCaptainSequence.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
#include <libultraship/bridge.h> | ||
#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" }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters