From 6e6fee8871bb237b1200958cd235f7de79cd9021 Mon Sep 17 00:00:00 2001 From: Pepper0ni <93387759+Pepper0ni@users.noreply.github.com> Date: Thu, 18 Jun 2026 14:32:04 +0100 Subject: [PATCH] Fix Nabooru despawning from spirit when collecting an unrelated check (#6751) Fix nabooru cutscene skip setting the kidnapped flag too often --- .../TimeSavers/timesaver_hook_handlers.cpp | 6 ++- .../Enhancements/randomizer/hook_handlers.cpp | 40 ++++++++++--------- .../actors/ovl_player_actor/z_player.c | 16 ++++---- 3 files changed, 36 insertions(+), 26 deletions(-) diff --git a/soh/soh/Enhancements/TimeSavers/timesaver_hook_handlers.cpp b/soh/soh/Enhancements/TimeSavers/timesaver_hook_handlers.cpp index 7816cdf4de..12b3c83ef2 100644 --- a/soh/soh/Enhancements/TimeSavers/timesaver_hook_handlers.cpp +++ b/soh/soh/Enhancements/TimeSavers/timesaver_hook_handlers.cpp @@ -499,7 +499,11 @@ void TimeSaverOnVanillaBehaviorHandler(GIVanillaBehavior id, bool* should, va_li break; case VB_PLAY_NABOORU_CAPTURED_CS: if (CVarGetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.Story"), IS_RANDO)) { - Flags_SetEventChkInf(EVENTCHKINF_NABOORU_CAPTURED_BY_TWINROVA); + // we're only here if GetItem is Silver Gauntlets + // either it's randomiser, or we're about to enter (or skip) the Nabooru Capture + if (!IS_RANDO) { + Flags_SetEventChkInf(EVENTCHKINF_NABOORU_CAPTURED_BY_TWINROVA); + } *should = false; } break; diff --git a/soh/soh/Enhancements/randomizer/hook_handlers.cpp b/soh/soh/Enhancements/randomizer/hook_handlers.cpp index 1d01488a77..596aab536c 100644 --- a/soh/soh/Enhancements/randomizer/hook_handlers.cpp +++ b/soh/soh/Enhancements/randomizer/hook_handlers.cpp @@ -526,25 +526,29 @@ void RandomizerOnItemReceiveHandler(GetItemEntry receivedItemEntry) { } } - if (loc->GetRandomizerCheck() == RC_SPIRIT_TEMPLE_SILVER_GAUNTLETS_CHEST && - !CVarGetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.Story"), IS_RANDO)) { - static uint32_t updateHook; - updateHook = GameInteractor::Instance->RegisterGameHook([]() { - Player* player = GET_PLAYER(gPlayState); - if (player == NULL || Player_InBlockingCsMode(gPlayState, player) || - player->stateFlags1 & PLAYER_STATE1_IN_ITEM_CS || player->stateFlags1 & PLAYER_STATE1_GETTING_ITEM || - player->stateFlags1 & PLAYER_STATE1_CARRYING_ACTOR) { - return; - } + if (loc->GetRandomizerCheck() == RC_SPIRIT_TEMPLE_SILVER_GAUNTLETS_CHEST) { + if (!CVarGetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.Story"), IS_RANDO)) { + static uint32_t updateHook; + updateHook = GameInteractor::Instance->RegisterGameHook([]() { + Player* player = GET_PLAYER(gPlayState); + if (player == NULL || Player_InBlockingCsMode(gPlayState, player) || + player->stateFlags1 & PLAYER_STATE1_IN_ITEM_CS || + player->stateFlags1 & PLAYER_STATE1_GETTING_ITEM || + player->stateFlags1 & PLAYER_STATE1_CARRYING_ACTOR) { + return; + } - gPlayState->nextEntranceIndex = ENTR_DESERT_COLOSSUS_EAST_EXIT; - gPlayState->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.nextCutsceneIndex = 0xFFF1; - gPlayState->transitionType = TRANS_TYPE_SANDSTORM_END; - GET_PLAYER(gPlayState)->stateFlags1 &= ~PLAYER_STATE1_IN_CUTSCENE; - Player_TryCsAction(gPlayState, NULL, 8); - GameInteractor::Instance->UnregisterGameHook(updateHook); - }); + gPlayState->nextEntranceIndex = ENTR_DESERT_COLOSSUS_EAST_EXIT; + gPlayState->transitionTrigger = TRANS_TRIGGER_START; + gSaveContext.nextCutsceneIndex = 0xFFF1; + gPlayState->transitionType = TRANS_TYPE_SANDSTORM_END; + GET_PLAYER(gPlayState)->stateFlags1 &= ~PLAYER_STATE1_IN_CUTSCENE; + Player_TryCsAction(gPlayState, NULL, 8); + GameInteractor::Instance->UnregisterGameHook(updateHook); + }); + } else { + Flags_SetEventChkInf(EVENTCHKINF_NABOORU_CAPTURED_BY_TWINROVA); + } } } diff --git a/soh/src/overlays/actors/ovl_player_actor/z_player.c b/soh/src/overlays/actors/ovl_player_actor/z_player.c index cdeb7a8227..ba523a7053 100644 --- a/soh/src/overlays/actors/ovl_player_actor/z_player.c +++ b/soh/src/overlays/actors/ovl_player_actor/z_player.c @@ -14187,13 +14187,15 @@ s32 func_8084DFF4(PlayState* play, Player* this) { play->msgCtx.msgMode = MSGMODE_TEXT_DONE; } else { if (Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING) { - if (GameInteractor_Should(VB_PLAY_NABOORU_CAPTURED_CS, this->getItemId == GI_GAUNTLETS_SILVER)) { - play->nextEntranceIndex = ENTR_DESERT_COLOSSUS_EAST_EXIT; - play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.nextCutsceneIndex = 0xFFF1; - play->transitionType = TRANS_TYPE_SANDSTORM_END; - this->stateFlags1 &= ~PLAYER_STATE1_IN_CUTSCENE; - Player_TryCsAction(play, NULL, 8); + if (this->getItemId == GI_GAUNTLETS_SILVER) { + if (GameInteractor_Should(VB_PLAY_NABOORU_CAPTURED_CS, true)) { + play->nextEntranceIndex = ENTR_DESERT_COLOSSUS_EAST_EXIT; + play->transitionTrigger = TRANS_TRIGGER_START; + gSaveContext.nextCutsceneIndex = 0xFFF1; + play->transitionType = TRANS_TYPE_SANDSTORM_END; + this->stateFlags1 &= ~PLAYER_STATE1_IN_CUTSCENE; + Player_TryCsAction(play, NULL, 8); + } } // Set unk_862 to 0 early to not have the game draw non-custom colored models for a split second.