From e71839ed8f90a902679f2533fde78d44e3000e6a Mon Sep 17 00:00:00 2001 From: Christopher Leggett Date: Sat, 4 May 2024 17:50:19 -0400 Subject: [PATCH] Conversion of Nabooru Quick Death to VB hook (#120) * Nabooru quick death conversion * Fix brackets, not sure exactly how this was working before. --- .../game-interactor/GameInteractor.h | 1 + .../Enhancements/timesaver_hook_handlers.cpp | 24 +++++++++++++++++++ soh/src/overlays/actors/ovl_En_Ik/z_en_ik.c | 20 +--------------- 3 files changed, 26 insertions(+), 19 deletions(-) diff --git a/soh/soh/Enhancements/game-interactor/GameInteractor.h b/soh/soh/Enhancements/game-interactor/GameInteractor.h index e0b1c1ce1..84126099f 100644 --- a/soh/soh/Enhancements/game-interactor/GameInteractor.h +++ b/soh/soh/Enhancements/game-interactor/GameInteractor.h @@ -387,6 +387,7 @@ typedef enum { /*** Quick Boss Deaths ***/ // Vanilla condition: true GI_VB_PHANTOM_GANON_DEATH_SCENE, + GI_VB_NABOORU_KNUCKLE_DEATH_SCENE, } GIVanillaBehavior; #ifdef __cplusplus diff --git a/soh/soh/Enhancements/timesaver_hook_handlers.cpp b/soh/soh/Enhancements/timesaver_hook_handlers.cpp index 52e14ab8c..642eae7cc 100644 --- a/soh/soh/Enhancements/timesaver_hook_handlers.cpp +++ b/soh/soh/Enhancements/timesaver_hook_handlers.cpp @@ -25,6 +25,7 @@ extern "C" { #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" #include +#include #include extern SaveContext gSaveContext; extern PlayState* gPlayState; @@ -746,6 +747,29 @@ void TimeSaverOnVanillaBehaviorHandler(GIVanillaBehavior id, bool* should, void* } break; } + case GI_VB_NABOORU_KNUCKLE_DEATH_SCENE: { + EnIk* ik = static_cast(opt); + if (CVarGetInteger("gTimeSavers.SkipCutscene.QuickBossDeaths", IS_RANDO)) { + // Because no CS in rando, we hide the death of the knuckle by spawning flames and kill the actor + if ((ik->actor.colChkInfo.health <= 10)) { + s32 i; + Vec3f pos; + Vec3f sp7C = { 0.0f, 0.5f, 0.0f }; + int flameAmount = 100; + + for (i = flameAmount; i >= 0; i--) { + pos.x = ik->actor.world.pos.x + Rand_CenteredFloat(120.0f); + pos.z = ik->actor.world.pos.z + Rand_CenteredFloat(120.0f); + pos.y = ik->actor.world.pos.y + 20.0f + Rand_CenteredFloat(120.0f); + EffectSsDeadDb_Spawn(gPlayState, &pos, &sp7C, &sp7C, 100, 0, 255, 255, 255, 255, 0, 0, 255, 1, 9, + true); + } + Actor_Kill(&ik->actor); + } + *should = false; + } + break; + } } } diff --git a/soh/src/overlays/actors/ovl_En_Ik/z_en_ik.c b/soh/src/overlays/actors/ovl_En_Ik/z_en_ik.c index aaf0e0342..5f1634237 100644 --- a/soh/src/overlays/actors/ovl_En_Ik/z_en_ik.c +++ b/soh/src/overlays/actors/ovl_En_Ik/z_en_ik.c @@ -1439,28 +1439,10 @@ void func_80A781CC(Actor* thisx, PlayState* play) { if (!Play_InCsMode(play)) { this->actor.update = EnIk_Update; this->actor.draw = EnIk_Draw; - // Don't initiate nabooru defeat CS in rando - if (!(IS_RANDO)) { + if (GameInteractor_Should(GI_VB_NABOORU_KNUCKLE_DEATH_SCENE, true, this)) { Cutscene_SetSegment(play, gSpiritBossNabooruKnuckleDefeatCs); gSaveContext.cutsceneTrigger = 1; Actor_SetScale(&this->actor, 0.01f); - } else { - // Because no CS in rando, we hide the death of the knuckle by spawning flames and kill the actor - if ((this->actor.colChkInfo.health <= 10)) { - s32 i; - Vec3f pos; - Vec3f sp7C = { 0.0f, 0.5f, 0.0f }; - int flameAmount = 100; - - for (i = flameAmount; i >= 0; i--) { - pos.x = this->actor.world.pos.x + Rand_CenteredFloat(120.0f); - pos.z = this->actor.world.pos.z + Rand_CenteredFloat(120.0f); - pos.y = this->actor.world.pos.y + 20.0f + Rand_CenteredFloat(120.0f); - EffectSsDeadDb_Spawn(play, &pos, &sp7C, &sp7C, 100, 0, 255, 255, 255, 255, 0, 0, 255, 1, 9, - true); - } - Actor_Kill(&this->actor); - } } Flags_SetEventChkInf(EVENTCHKINF_FINISHED_NABOORU_BATTLE); func_80A7735C(this, play);