From abdbe25c8a92c0c38b28ef2445ef197c45883187 Mon Sep 17 00:00:00 2001 From: Garrett Cox Date: Thu, 18 Apr 2024 21:36:10 -0500 Subject: [PATCH] Migrate purple poe faster fight --- .../Enhancements/timesaver_hook_handlers.cpp | 30 +++++++++++++++++++ .../ovl_En_Po_Sisters/z_en_po_sisters.c | 11 ------- .../ovl_En_Po_Sisters/z_en_po_sisters.h | 2 ++ 3 files changed, 32 insertions(+), 11 deletions(-) diff --git a/soh/soh/Enhancements/timesaver_hook_handlers.cpp b/soh/soh/Enhancements/timesaver_hook_handlers.cpp index 886b3ddea..6c6930ec4 100644 --- a/soh/soh/Enhancements/timesaver_hook_handlers.cpp +++ b/soh/soh/Enhancements/timesaver_hook_handlers.cpp @@ -23,6 +23,7 @@ extern "C" { #include "src/overlays/actors/ovl_Bg_Hidan_Kousi/z_bg_hidan_kousi.h" #include "src/overlays/actors/ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.h" #include "src/overlays/actors/ovl_En_Dnt_Demo/z_en_dnt_demo.h" +#include "src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.h" extern SaveContext gSaveContext; extern PlayState* gPlayState; } @@ -686,6 +687,8 @@ static uint32_t enFuUpdateHook = 0; static uint32_t enFuKillHook = 0; static uint32_t bgSpot02UpdateHook = 0; static uint32_t bgSpot02KillHook = 0; +static uint32_t enPoSistersUpdateHook = 0; +static uint32_t enPoSistersKillHook = 0; void TimeSaverOnActorInitHandler(void* actorRef) { Actor* actor = static_cast(actorRef); @@ -816,6 +819,33 @@ void TimeSaverOnActorInitHandler(void* actorRef) { EnDntDemo* enDntDemo = static_cast(actorRef); enDntDemo->actionFunc = EnDntDemo_JudgeSkipToReward; } + + // Forest Temple entrance cutscene + if (actor->id == ACTOR_EN_PO_SISTERS && actor->params == 4124) { + if (CVarGetInteger("gTimeSavers.SkipCutscene.GlitchAiding", 0)) { + Flags_SetSwitch(gPlayState, 0x1B); + Actor_Kill(actor); + } + } + + // Forest Temple purple poe fight speedup + if (actor->id == ACTOR_EN_PO_SISTERS && actor->params == 28) { + enPoSistersUpdateHook = GameInteractor::Instance->RegisterGameHook([](void* innerActorRef) mutable { + Actor* innerActor = static_cast(innerActorRef); + if (innerActor->id == ACTOR_EN_PO_SISTERS && innerActor->params == 28 && (CVarGetInteger("gTimeSavers.SkipMiscInteractions", IS_RANDO))) { + EnPoSisters* enPoSisters = static_cast(innerActorRef); + if (enPoSisters->actionFunc == func_80ADB338) { + enPoSisters->unk_19C = 0; + } + } + }); + enPoSistersKillHook = GameInteractor::Instance->RegisterGameHook([](int16_t sceneNum) mutable { + GameInteractor::Instance->UnregisterGameHook(enPoSistersUpdateHook); + GameInteractor::Instance->UnregisterGameHook(enPoSistersKillHook); + enPoSistersUpdateHook = 0; + enPoSistersKillHook = 0; + }); + } } void TimeSaverOnSceneInitHandler(int16_t sceneNum) { diff --git a/soh/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c b/soh/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c index ea324c5a5..280640efd 100644 --- a/soh/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c +++ b/soh/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c @@ -183,12 +183,6 @@ void EnPoSisters_Init(Actor* thisx, PlayState* play) { this->epoch++; - // Skip Poe Intro Cutscene - if (IS_RANDO && thisx->params == 4124 && !Randomizer_GetSettingValue(RSK_ENABLE_GLITCH_CUTSCENES)) { - Flags_SetSwitch(play, 0x1B); - Actor_Kill(thisx); - } - Actor_ProcessInitChain(&this->actor, sInitChain); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 50.0f); SkelAnime_Init(play, &this->skelAnime, &gPoeSistersSkel, &gPoeSistersSwayAnim, this->jointTable, @@ -862,11 +856,6 @@ void func_80ADB338(EnPoSisters* this, PlayState* play) { if (Actor_WorldDistXZToPoint(&player->actor, &this->actor.home.pos) < 600.0f) { if (this->unk_19C != 0) { this->unk_19C--; - - // Force Meg to respawn instantly after getting hit - if (IS_RANDO) { - this->unk_19C = 0; - } } } else { this->unk_19C = 100; diff --git a/soh/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.h b/soh/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.h index 2bd780983..5f42856a4 100644 --- a/soh/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.h +++ b/soh/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.h @@ -32,4 +32,6 @@ typedef struct EnPoSisters { u32 epoch; } EnPoSisters; // size = 0x0338 +void func_80ADB338(EnPoSisters* enPoSisters, PlayState* play); + #endif