From 7865a8a944beb70c52236da7fa7fd0a257083871 Mon Sep 17 00:00:00 2001 From: Gedof Date: Sat, 16 Nov 2024 00:02:40 -0300 Subject: [PATCH] Added time saver to open the Shadow Temple Door in both ages at the same time. --- soh/soh/Enhancements/enhancementTypes.h | 6 ++++++ soh/soh/Enhancements/mods.cpp | 22 ++++++++++++++++++++++ soh/soh/SohMenuBar.cpp | 7 +++++++ 3 files changed, 35 insertions(+) diff --git a/soh/soh/Enhancements/enhancementTypes.h b/soh/soh/Enhancements/enhancementTypes.h index d57a94991..e235703e0 100644 --- a/soh/soh/Enhancements/enhancementTypes.h +++ b/soh/soh/Enhancements/enhancementTypes.h @@ -28,6 +28,12 @@ typedef enum { FORCED_DIALOG_SKIP_ALL } ForcedDialogMode; +typedef enum { + PERSIST_SHADOW_DOOR_DISABLED, + PERSIST_SHADOW_DOOR_CHILD, + PERSIST_SHADOW_DOOR_BOTH +} PersistShadowDoorMode; + typedef enum { BUNNY_HOOD_VANILLA, BUNNY_HOOD_FAST_AND_JUMP, diff --git a/soh/soh/Enhancements/mods.cpp b/soh/soh/Enhancements/mods.cpp index 0dacbef42..5dceaac93 100644 --- a/soh/soh/Enhancements/mods.cpp +++ b/soh/soh/Enhancements/mods.cpp @@ -1395,6 +1395,27 @@ void RegisterRandomizerCompasses() { }); } +void RegisterPersistShadowDoor() { + //Change both age flags when opening Shadow Temple Door + GameInteractor::Instance->RegisterGameHook( + [](int16_t sceneNum, int16_t flagType, int16_t flag) + { + int32_t pShdwDoor = CVarGetInteger(CVAR_ENHANCEMENT("PersistShadowDoor"), PERSIST_SHADOW_DOOR_DISABLED); + int16_t childDoor = 0x1F; //child flag + int16_t adultDoor = 0x1E; //adult flag + + if (pShdwDoor != PERSIST_SHADOW_DOOR_DISABLED && + sceneNum == SCENE_GRAVEYARD && + flagType == FLAG_SCENE_SWITCH) + { + if ((pShdwDoor == PERSIST_SHADOW_DOOR_CHILD || pShdwDoor == PERSIST_SHADOW_DOOR_BOTH) && flag == childDoor) + GameInteractor::RawAction::SetSceneFlag(SCENE_GRAVEYARD, FLAG_SCENE_SWITCH, adultDoor); + else if (pShdwDoor == PERSIST_SHADOW_DOOR_BOTH && flag == adultDoor) + GameInteractor::RawAction::SetSceneFlag(SCENE_GRAVEYARD, FLAG_SCENE_SWITCH, childDoor); + } + }); +} + void InitMods() { BossRush_RegisterHooks(); RandomizerRegisterHooks(); @@ -1438,4 +1459,5 @@ void InitMods() { RegisterHurtContainerModeHandler(); RegisterPauseMenuHooks(); RandoKaleido_RegisterHooks(); + RegisterPersistShadowDoor(); } diff --git a/soh/soh/SohMenuBar.cpp b/soh/soh/SohMenuBar.cpp index 71336671b..61fab1684 100644 --- a/soh/soh/SohMenuBar.cpp +++ b/soh/soh/SohMenuBar.cpp @@ -80,6 +80,7 @@ static const char* imguiScaleOptions[4] = { "Small", "Normal", "Large", "X-Large static const char* chestStyleMatchesContentsOptions[4] = { "Disabled", "Both", "Texture Only", "Size Only" }; static const char* skipGetItemAnimationOptions[3] = { "Disabled", "Junk Items", "All Items" }; static const char* skipForcedDialogOptions[4] = { "None", "Navi Only", "NPCs Only", "All" }; + static const char* persistShadowDoorOptions[3] = { "Disabled", "Child to Adult", "Both Ways"}; static const char* bunnyHoodOptions[3] = { "Disabled", "Faster Run & Longer Jump", "Faster Run" }; static const char* mirroredWorldModes[9] = { "Disabled", "Always", "Random", "Random (Seeded)", "Dungeons", @@ -794,6 +795,12 @@ void DrawEnhancementsMenu() { "- Not within range of Ocarina playing spots"); UIWidgets::PaddedEnhancementCheckbox("Pause Warp", CVAR_ENHANCEMENT("PauseWarp"), true, false); UIWidgets::Tooltip("Selection of warp song in pause menu initiates warp. Disables song playback."); + UIWidgets::PaddedText("Persist Shadow Temple Door through time", true, false); + UIWidgets::EnhancementCombobox(CVAR_ENHANCEMENT("PersistShadowDoor"), persistShadowDoorOptions, PERSIST_SHADOW_DOOR_DISABLED); + UIWidgets::Tooltip( + "The Shadow Temple Door in Graveyard opens for both ages.\n" + " - Child to Adult: If you open the door as Child, it will be open as Adult\n" + " - Both Ways: If you open the door in any age, it will be open as the other too"); ImGui::EndTable(); ImGui::EndMenu();