From b6166f41c85c5834a4e68807bb94d3460f7033d1 Mon Sep 17 00:00:00 2001 From: Malkierian Date: Mon, 25 Aug 2025 11:59:38 -0700 Subject: [PATCH] Restore previous state of `z_door_warp1.c`, and reimplement boss rush blue warp bypass. This also fixes the issue with shadow and spirit medallions not being given in vanilla without cutscene skips on. (#5763) Ensure shadow and spirit medallions get queued when skipping story cutscenes in vanilla. --- .../TimeSavers/SkipCutscene/Story/SkipBlueWarp.cpp | 9 +++++++++ soh/soh/Enhancements/boss-rush/BossRush.cpp | 4 ++++ soh/soh/Enhancements/timesaver_hook_handlers.cpp | 5 ++++- soh/soh/Enhancements/timesaver_hook_handlers.h | 3 +++ soh/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c | 6 ++---- 5 files changed, 22 insertions(+), 5 deletions(-) diff --git a/soh/soh/Enhancements/TimeSavers/SkipCutscene/Story/SkipBlueWarp.cpp b/soh/soh/Enhancements/TimeSavers/SkipCutscene/Story/SkipBlueWarp.cpp index 674adcdfb..de2e5fc5f 100644 --- a/soh/soh/Enhancements/TimeSavers/SkipCutscene/Story/SkipBlueWarp.cpp +++ b/soh/soh/Enhancements/TimeSavers/SkipCutscene/Story/SkipBlueWarp.cpp @@ -1,6 +1,7 @@ #include "soh/Enhancements/game-interactor/GameInteractor.h" #include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h" #include "soh/OTRGlobals.h" +#include "soh/Enhancements/timesaver_hook_handlers.h" extern "C" { #include "macros.h" @@ -12,6 +13,7 @@ extern "C" { #define RAND_GET_OPTION(option) Rando::Context::GetInstance()->GetOption(option).Get() +extern "C" PlayState* gPlayState; static bool sEnteredBlueWarp = false; /** @@ -124,6 +126,13 @@ void SkipBlueWarp_ShouldPlayBlueWarpCS(GIVanillaBehavior _, bool* should, va_lis */ void SkipBlueWarp_ShouldGiveItem(GIVanillaBehavior _, bool* should, va_list originalArgs) { if (CVarGetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.Story"), IS_RANDO)) { + if (IS_VANILLA) { + if (gPlayState->sceneNum == SCENE_SHADOW_TEMPLE_BOSS) { + TimeSaverQueueItem(RG_SHADOW_MEDALLION); + } else if (gPlayState->sceneNum == SCENE_SPIRIT_TEMPLE_BOSS) { + TimeSaverQueueItem(RG_SPIRIT_MEDALLION); + } + } *should = false; } } diff --git a/soh/soh/Enhancements/boss-rush/BossRush.cpp b/soh/soh/Enhancements/boss-rush/BossRush.cpp index 76cf5637e..17ffd70c7 100644 --- a/soh/soh/Enhancements/boss-rush/BossRush.cpp +++ b/soh/soh/Enhancements/boss-rush/BossRush.cpp @@ -501,6 +501,10 @@ void BossRush_OnVanillaBehaviorHandler(GIVanillaBehavior id, bool* should, va_li } break; } + case VB_PLAY_BLUE_WARP_CS: { + *should = false; + break; + } // Spawn clean blue warps (no ruto, adult animation, etc) case VB_SPAWN_BLUE_WARP: { switch (gPlayState->sceneNum) { diff --git a/soh/soh/Enhancements/timesaver_hook_handlers.cpp b/soh/soh/Enhancements/timesaver_hook_handlers.cpp index 27bf1f02d..fdcc23ba3 100644 --- a/soh/soh/Enhancements/timesaver_hook_handlers.cpp +++ b/soh/soh/Enhancements/timesaver_hook_handlers.cpp @@ -1,6 +1,5 @@ #include #include "soh/OTRGlobals.h" -#include "soh/Enhancements/randomizer/randomizerTypes.h" #include "soh/Enhancements/game-interactor/GameInteractor.h" #include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h" #include "soh/Enhancements/enhancementTypes.h" @@ -1199,6 +1198,10 @@ void TimeSaverOnSceneInitHandler(int16_t sceneNum) { static GetItemEntry vanillaQueuedItemEntry = GET_ITEM_NONE; +void TimeSaverQueueItem(RandomizerGet randoGet) { + vanillaQueuedItemEntry = Rando::StaticData::RetrieveItem(randoGet).GetGIEntry_Copy(); +} + void TimeSaverOnFlagSetHandler(int16_t flagType, int16_t flag) { // Do nothing when in a boss rush if (IS_BOSS_RUSH) { diff --git a/soh/soh/Enhancements/timesaver_hook_handlers.h b/soh/soh/Enhancements/timesaver_hook_handlers.h index 41bccd8d9..373c9eaf8 100644 --- a/soh/soh/Enhancements/timesaver_hook_handlers.h +++ b/soh/soh/Enhancements/timesaver_hook_handlers.h @@ -1,6 +1,9 @@ #ifndef TIMESAVER_HOOK_HANDLERS_H #define TIMESAVER_HOOK_HANDLERS_H +#include "soh/Enhancements/randomizer/randomizerTypes.h" + void TimeSaverRegisterHooks(); +void TimeSaverQueueItem(RandomizerGet randoGet); #endif // TIMESAVER_HOOK_HANDLERS_H \ No newline at end of file diff --git a/soh/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c b/soh/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c index 54e9768b4..a90764717 100644 --- a/soh/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c +++ b/soh/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c @@ -813,8 +813,7 @@ void DoorWarp1_AdultWarpOut(DoorWarp1* this, PlayState* play) { gSaveContext.nextCutsceneIndex = 0; } } else if (play->sceneNum == SCENE_SPIRIT_TEMPLE_BOSS) { - if (GameInteractor_Should(VB_PLAY_BLUE_WARP_CS, - !Flags_GetRandomizerInf(RAND_INF_DUNGEONS_DONE_SPIRIT_TEMPLE), + if (GameInteractor_Should(VB_PLAY_BLUE_WARP_CS, !CHECK_QUEST_ITEM(QUEST_MEDALLION_SPIRIT), RAND_INF_DUNGEONS_DONE_SPIRIT_TEMPLE)) { Flags_SetRandomizerInf(RAND_INF_DUNGEONS_DONE_SPIRIT_TEMPLE); if (GameInteractor_Should(VB_GIVE_ITEM_FROM_BLUE_WARP, true, ITEM_MEDALLION_SPIRIT)) { @@ -832,8 +831,7 @@ void DoorWarp1_AdultWarpOut(DoorWarp1* this, PlayState* play) { gSaveContext.nextCutsceneIndex = 0; } } else if (play->sceneNum == SCENE_SHADOW_TEMPLE_BOSS) { - if (GameInteractor_Should(VB_PLAY_BLUE_WARP_CS, - !Flags_GetRandomizerInf(RAND_INF_DUNGEONS_DONE_SHADOW_TEMPLE), + if (GameInteractor_Should(VB_PLAY_BLUE_WARP_CS, !CHECK_QUEST_ITEM(QUEST_MEDALLION_SHADOW), RAND_INF_DUNGEONS_DONE_SHADOW_TEMPLE)) { Flags_SetRandomizerInf(RAND_INF_DUNGEONS_DONE_SHADOW_TEMPLE); if (GameInteractor_Should(VB_GIVE_ITEM_FROM_BLUE_WARP, true, ITEM_MEDALLION_SHADOW)) {