Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add a few cutscene skips #55

Merged
merged 6 commits into from
Dec 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 78 additions & 0 deletions src/deku_princess_hooks.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
#include "modding.h"
#include "global.h"

#include "apcommon.h"

struct EnDnp;

typedef void (*EnDnpActionFunc)(struct EnDnp*, PlayState*);

#define DEKU_PRINCESS_LIMB_MAX 0x1A

typedef struct EnDnp {
/* 0x000 */ Actor actor;
/* 0x144 */ SkelAnime skelAnime;
/* 0x188 */ EnDnpActionFunc actionFunc;
/* 0x18C */ ColliderCylinder collider;
/* 0x1D8 */ Vec3f unk_1D8;
/* 0x1E4 */ Vec3s unk_1E4;
/* 0x1EA */ Vec3s jointTable[DEKU_PRINCESS_LIMB_MAX];
/* 0x286 */ Vec3s morphTable[DEKU_PRINCESS_LIMB_MAX];
/* 0x322 */ u16 unk_322;
/* 0x324 */ u8 cueId;
/* 0x328 */ s32 unk_328;
/* 0x32C */ UNK_TYPE1 unk_32C[0x2];
/* 0x32E */ s16 unk_32E;
/* 0x330 */ s16 unk_330;
/* 0x332 */ s16 unk_332;
/* 0x334 */ s16 blinkTimer;
/* 0x336 */ s16 eyeIndex;
/* 0x338 */ s16 unk_338;
/* 0x33A */ UNK_TYPE1 unk_33A[0x6];
/* 0x340 */ s32 animIndex;
} EnDnp; // size = 0x344

RECOMP_PATCH void func_80B3D558(EnDnp* this, PlayState* play) {
if (CutsceneManager_IsNext(this->actor.csId)) {
SET_WEEKEVENTREG(WEEKEVENTREG_23_20);
play->nextEntrance = ENTRANCE(DEKU_KINGS_CHAMBER, 3);
play->transitionType = TRANS_TYPE_FADE_BLACK_FAST;
gSaveContext.nextTransitionType = TRANS_TYPE_FADE_BLACK_FAST;
play->transitionTrigger = TRANS_TRIGGER_START;
// CutsceneManager_StartWithPlayerCs(this->actor.csId, &this->actor);
} else {
CutsceneManager_Queue(this->actor.csId);
}
}

struct BgDkjailIvy;

typedef void (*BgDkjailIvyActionFunc)(struct BgDkjailIvy*, PlayState*);

typedef struct BgDkjailIvy {
/* 0x000 */ DynaPolyActor dyna;
/* 0x15C */ ColliderCylinder collider;
/* 0x1A8 */ BgDkjailIvyActionFunc actionFunc;
/* 0x1AC */ s8 fadeOutTimer;
/* 0x1AD */ u8 alpha;
} BgDkjailIvy; // size = 0x1B0

#define BG_DKJAIL_GET_SWITCH_FLAG(thisx) ((thisx)->params & 0x7F)

void BgDkjailIvy_IvyCutEffects(BgDkjailIvy* this, PlayState* play);
void BgDkjailIvy_SetupFadeOut(BgDkjailIvy* this);

RECOMP_PATCH void BgDkjailIvy_BeginCutscene(BgDkjailIvy* this, PlayState* play) {
if (CutsceneManager_IsNext(this->dyna.actor.csId)) {
// CutsceneManager_StartWithPlayerCs(this->dyna.actor.csId, &this->dyna.actor);
func_800B7298(play, NULL, PLAYER_CSACTION_END);
this->fadeOutTimer = 50;
DynaPoly_DisableCollision(play, &play->colCtx.dyna, this->dyna.bgId);
Flags_SetSwitch(play, BG_DKJAIL_GET_SWITCH_FLAG(&this->dyna.actor));
BgDkjailIvy_IvyCutEffects(this, play);
Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_GRASS_WALL_BROKEN);
BgDkjailIvy_SetupFadeOut(this);
} else {
CutsceneManager_Queue(this->dyna.actor.csId);
}
}
101 changes: 101 additions & 0 deletions src/evan_hooks.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
#include "modding.h"
#include "global.h"

#include "apcommon.h"

struct EnZos;

typedef void (*EnZosActionFunc)(struct EnZos*, PlayState*);

#define EVAN_LIMB_MAX 0x12

typedef struct EnZos {
/* 0x000 */ Actor actor;
/* 0x144 */ Vec3s jointTable[EVAN_LIMB_MAX];
/* 0x1B0 */ Vec3s morphTable[EVAN_LIMB_MAX];
/* 0x21C */ SkelAnime skelAnime;
/* 0x260 */ ColliderCylinder collider;
/* 0x2AC */ s16 eyeIndex;
/* 0x2AE */ s16 blinkTimer;
/* 0x2B0 */ UNK_TYPE1 unk2B0[6];
/* 0x2B6 */ u16 unk_2B6;
/* 0x2B8 */ s16 animIndex;
/* 0x2BA */ s16 cueId;
/* 0x2BC */ s16 unk_2BC;
/* 0x2C0 */ EnZosActionFunc actionFunc;
} EnZos; // size = 0x2C4

#define EN_ZOS_ANIM_LEAN_ON_KEYBOARD 0x00

void EnZos_ChangeAnim(EnZos* this, s16 animIndex, u8 animMode);
void func_80BBBB84(EnZos* this, PlayState* play);
void func_80BBB8AC(EnZos* this, PlayState* play);
void func_80BBBD5C(EnZos* this, PlayState* play);
void func_80BBB0D4(EnZos* this, PlayState* play);
void func_80BBB15C(EnZos* this, PlayState* play);
s32 func_80BBAF5C(EnZos* this, PlayState* play);
void func_80BBB2C4(EnZos* this, PlayState* play);

void func_80BBB354(EnZos* this, PlayState* play) {
// s32 getItemId;

if (Actor_HasParent(&this->actor, play)) {
this->actor.parent = NULL;
this->actionFunc = func_80BBB2C4;
SET_WEEKEVENTREG(WEEKEVENTREG_39_20);
this->actor.flags |= ACTOR_FLAG_10000;
Actor_OfferTalkExchange(&this->actor, play, 1000.0f, 1000.0f, PLAYER_IA_MINUS1);
} else {
// if (CHECK_WEEKEVENTREG(WEEKEVENTREG_39_20)) {
// getItemId = GI_RUPEE_PURPLE;
// } else {
// getItemId = GI_HEART_PIECE;
// }
Actor_OfferGetItem(&this->actor, play, GI_HEART_PIECE, 10000.0f, 50.0f);
}
}

RECOMP_PATCH void func_80BBBDE0(EnZos* this, PlayState* play) {
Actor* thisx = &this->actor;
Vec3f seqPos;

if (this->unk_2B6 & 1) {
Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.home.rot.y, 2, 0x1000, 0x200);
this->actor.world.rot.y = thisx->shape.rot.y;
if (this->actor.home.rot.y == thisx->shape.rot.y) {
EnZos_ChangeAnim(this, EN_ZOS_ANIM_LEAN_ON_KEYBOARD, ANIMMODE_ONCE);
this->unk_2B6 &= ~1;
}
}

func_80BBB0D4(this, play);

if (play->msgCtx.ocarinaMode == OCARINA_MODE_PLAYED_FULL_EVAN_SONG) {
play->msgCtx.ocarinaMode = OCARINA_MODE_END;
this->actionFunc = func_80BBB354;
// this->actionFunc = func_80BBBB84;
// this->actor.flags |= ACTOR_FLAG_10000;
// Actor_OfferTalk(&this->actor, play, 120.0f);
return;
}

if (Actor_ProcessTalkRequest(&this->actor, &play->state)) {
this->actionFunc = func_80BBB8AC;
func_80BBB15C(this, play);
} else if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_501)) {
this->actionFunc = func_80BBBD5C;
} else if (func_80BBAF5C(this, play)) {
Actor_OfferTalk(&this->actor, play, 120.0f);
}

if (!Actor_IsFacingPlayer(&this->actor, 0x4000) && (this->actor.xzDistToPlayer < 100.0f)) {
SET_WEEKEVENTREG(WEEKEVENTREG_52_10);
} else {
CLEAR_WEEKEVENTREG(WEEKEVENTREG_52_10);
}

seqPos.x = this->actor.projectedPos.x;
seqPos.y = this->actor.projectedPos.y;
seqPos.z = this->actor.projectedPos.z;
Audio_PlaySequenceAtPos(SEQ_PLAYER_BGM_SUB, &seqPos, NA_BGM_PIANO_PLAY, 1000.0f);
}
39 changes: 39 additions & 0 deletions src/ice_poly_hooks.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#include "modding.h"
#include "global.h"

#include "apcommon.h"

struct ObjIcePoly;

typedef void (*ObjIcePolyActionFunc)(struct ObjIcePoly*, PlayState*);

typedef struct ObjIcePoly {
/* 0x000 */ Actor actor;
/* 0x144 */ ObjIcePolyActionFunc actionFunc;
/* 0x148 */ u8 unk_148;
/* 0x149 */ u8 switchFlag;
/* 0x14A */ s16 unk_14A;
/* 0x14C */ ColliderCylinder colliders1[2];
/* 0x1E4 */ ColliderCylinder colliders2[2];
} ObjIcePoly; // size = 0x27C

void func_80931828(ObjIcePoly* this, PlayState* play);
void func_80931EEC(ObjIcePoly* this, PlayState* play);

RECOMP_PATCH void func_80931E58(ObjIcePoly* this, PlayState* play) {
if (CutsceneManager_IsNext(this->actor.csId)) {
// CutsceneManager_StartWithPlayerCs(this->actor.csId, &this->actor);
func_800B7298(play, NULL, PLAYER_CSACTION_END);
if (this->unk_14A == 1) {
func_80931828(this, play);
Actor_Kill(&this->actor);
return;
}

this->unk_14A = 40;
Actor_PlaySfx(&this->actor, NA_SE_EV_ICE_MELT);
this->actionFunc = func_80931EEC;
} else {
CutsceneManager_Queue(this->actor.csId);
}
}
19 changes: 16 additions & 3 deletions src/init_save.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ void Sram_GenerateRandomSaveFields(void);
void Sram_ResetSave(void);

bool drankChateau = false;
bool spawnedTurtle = false;

void Sram_SetInitialWeekEvents(void) {
SET_WEEKEVENTREG(WEEKEVENTREG_15_20);
Expand Down Expand Up @@ -83,8 +84,14 @@ void Sram_SetInitialWeekEvents(void) {
// moon's tear deku scrub starts out in flower
SET_WEEKEVENTREG(PACK_WEEKEVENTREG_FLAG(73, 0x04));

// skip the princess prison cutscene
// skip the princess prison cutscenes
SET_WEEKEVENTREG(WEEKEVENTREG_ENTERED_WOODFALL_TEMPLE_PRISON);
SET_WEEKEVENTREG(WEEKEVENTREG_29_40);

// skip having to rewatch the great bay turtle cutscene
if(spawnedTurtle) {
SET_WEEKEVENTREG(WEEKEVENTREG_53_20);
}

// restore chateau romani state after cycle reset
if (drankChateau && rando_get_permanent_chateau_romani_enabled()) {
Expand Down Expand Up @@ -132,14 +139,16 @@ RECOMP_PATCH void Sram_InitDebugSave(void) {

Sram_SetInitialWeekEvents();

// skip the *insanely long* skull kid tatl/tael backstory cutscene
u8* save_ptr = (u8*) &gSaveContext;
save_ptr[0x5EB] |= 0x10;
save_ptr[0x42F3] |= 0x10;

gSaveContext.cycleSceneFlags[SCENE_INSIDETOWER].switch0 = 1;
gSaveContext.save.saveInfo.permanentSceneFlags[SCENE_INSIDETOWER].switch0 = 1;

gSaveContext.cycleSceneFlags[SCENE_PIRATE].switch1 |= (1 << 29);
gSaveContext.save.saveInfo.permanentSceneFlags[SCENE_PIRATE].switch1 |= (1 << 29);

gSaveContext.save.saveInfo.playerData.healthCapacity = 0x10;
gSaveContext.save.saveInfo.playerData.health = 0x10;

Expand Down Expand Up @@ -336,6 +345,9 @@ RECOMP_PATCH void Sram_SaveEndOfCycle(PlayState* play) {
sceneId = Play_GetOriginalSceneId(play->sceneId);
Play_SaveCycleSceneFlags(&play->state);

// sPersistentCycleSceneFlags override
sPersistentCycleSceneFlags[SCENE_PIRATE].switch1 |= (1 << 29);

play->actorCtx.sceneFlags.chest &= sPersistentCycleSceneFlags[sceneId].chest;
play->actorCtx.sceneFlags.switches[0] &= sPersistentCycleSceneFlags[sceneId].switch0;
play->actorCtx.sceneFlags.switches[1] &= sPersistentCycleSceneFlags[sceneId].switch1;
Expand Down Expand Up @@ -372,8 +384,9 @@ RECOMP_PATCH void Sram_SaveEndOfCycle(PlayState* play) {
//Inventory_DeleteItem(ITEM_MASK_FIERCE_DEITY, SLOT(ITEM_MASK_FIERCE_DEITY));
}

// persistent chateau romani state
// persistent flags
drankChateau = CHECK_WEEKEVENTREG(WEEKEVENTREG_DRANK_CHATEAU_ROMANI);
spawnedTurtle = CHECK_WEEKEVENTREG(WEEKEVENTREG_53_20);

for (i = 0; i < ARRAY_COUNT(sPersistentCycleWeekEventRegs); i++) {
u16 isPersistentBits = sPersistentCycleWeekEventRegs[i];
Expand Down
63 changes: 63 additions & 0 deletions src/scarecrow_hooks.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
#include "modding.h"
#include "global.h"

#include "apcommon.h"

typedef s32 (*PictoValidationFunc)(struct PlayState*, Actor*);

typedef struct {
/* 0x000 */ Actor actor;
/* 0x144 */ PictoValidationFunc validationFunc;
} PictoActor;

struct EnKakasi;

typedef void (*EnKakasiActionFunc)(struct EnKakasi*, PlayState*);

typedef struct EnKakasi {
/* 0x000 */ PictoActor picto;
/* 0x148 */ EnKakasiActionFunc actionFunc;
/* 0x14C */ SkelAnime skelAnime;
/* 0x190 */ s16 unk190; // camera index for song teaching angles?
/* 0x192 */ s16 postTeachTimer;
/* 0x194 */ s16 aboveGroundStatus; // from params, changed to 2 in init
/* 0x196 */ s16 unkState196;
/* 0x19A */ UNK_TYPE1 pad198[0x8];
/* 0x1A0 */ s32 animIndex;
/* 0x1A4 */ s32 unkCounter1A4; // counter, counts up to F while he digs away, reused elsewhere
/* 0x1A8 */ s32 unkState1A8;
/* 0x1AC */ s16 talkState;
/* 0x1AE */ s16 csIdList[3];
/* 0x1B4 */ f32 animEndFrame;
/* 0x1B8 */ f32 unkHeight;
/* 0x1BC */ Vec3f unk1BC; // set by post limbdraw func for one limb
/* 0x1C8 */ UNK_TYPE1 pad1C8[0x3C];
/* 0x204 */ s16 unk204; // set to A, F, 0x14, 0x28 frequently
/* 0x206 */ UNK_TYPE1 pad206[2];
/* 0x208 */ s16 subCamId;
/* 0x20C */ f32 subCamFov;
/* 0x210 */ f32 subCamFovNext;
/* 0x214 */ Vec3f subCamEye;
/* 0x220 */ Vec3f subCamAt;
/* 0x22C */ Vec3f unk22C;
/* 0x238 */ Vec3f subCamEyeNext;
/* 0x244 */ Vec3f subCamAtNext;
/* 0x250 */ f32 songSummonDist;
/* 0x254 */ ColliderCylinder collider;
} EnKakasi; // size = 0x2A0

#define ACTOR_FLAG_LOCK_ON_DISABLED (1 << 27)

void EnKakasi_SetupRiseOutOfGround(EnKakasi* this, PlayState* play);

RECOMP_PATCH void EnKakasi_IdleUnderground(EnKakasi* this, PlayState* play) {
// if (CHECK_WEEKEVENTREG(WEEKEVENTREG_79_08) && (this->picto.actor.xzDistToPlayer < this->songSummonDist) &&
// ((BREG(1) != 0) || (play->msgCtx.ocarinaMode == OCARINA_MODE_PLAYED_SCARECROW_SPAWN))) {
if ((this->picto.actor.xzDistToPlayer < this->songSummonDist) && ((BREG(1) != 0) || (play->msgCtx.ocarinaMode == OCARINA_MODE_ACTIVE))) {
this->picto.actor.flags &= ~ACTOR_FLAG_LOCK_ON_DISABLED;
play->msgCtx.ocarinaMode = OCARINA_MODE_END;
AudioOcarina_SetOcarinaDisableTimer(0, 20);
// Message_CloseTextbox(play);
this->actionFunc = EnKakasi_SetupRiseOutOfGround;
}
}
25 changes: 25 additions & 0 deletions src/shooting_gallery_hooks.c
Original file line number Diff line number Diff line change
Expand Up @@ -372,4 +372,29 @@ RECOMP_PATCH void EnSyatekiMan_Swamp_SetupGiveReward(EnSyatekiMan* this, PlaySta
Actor_OfferGetItem(&this->actor, play, GI_RUPEE_RED, 500.0f, 100.0f);
}
}
}

void EnSyatekiMan_Swamp_EndGame(EnSyatekiMan* this, PlayState* play);

RECOMP_PATCH void EnSyatekiMan_Swamp_AddBonusPoints(EnSyatekiMan* this, PlayState* play) {
static s32 sBonusTimer = 0;
Player* player = GET_PLAYER(play);

player->stateFlags1 |= PLAYER_STATE1_20;
if (!play->interfaceCtx.perfectLettersOn) {
if (gSaveContext.timerCurTimes[TIMER_ID_MINIGAME_1] == SECONDS_TO_TIMER(0)) {
gSaveContext.timerCurTimes[TIMER_ID_MINIGAME_1] = SECONDS_TO_TIMER(0);
gSaveContext.timerStates[TIMER_ID_MINIGAME_1] = TIMER_STATE_STOP;
this->flagsIndex = 0;
this->currentWave = 0;
this->actionFunc = EnSyatekiMan_Swamp_EndGame;
sBonusTimer = 0;
} else {
gSaveContext.timerStopTimes[TIMER_ID_MINIGAME_1] += SECONDS_TO_TIMER(1);
play->interfaceCtx.minigamePoints += SG_BONUS_POINTS_PER_SECOND;
this->score += SG_BONUS_POINTS_PER_SECOND;
Actor_PlaySfx(&this->actor, NA_SE_SY_TRE_BOX_APPEAR);
sBonusTimer = 0;
}
}
}
Loading