diff --git a/soh/soh/Enhancements/mods.cpp b/soh/soh/Enhancements/mods.cpp index e9fa86982f6..b5a91698d36 100644 --- a/soh/soh/Enhancements/mods.cpp +++ b/soh/soh/Enhancements/mods.cpp @@ -152,6 +152,28 @@ void RegisterFreezeTime() { }); } +/// Clears the cutscene pointer to a value safe for wrong warps. +void RegisterClearCutscenePointer() { + GameInteractor::Instance->RegisterGameHook([]() { + if (!gPlayState) return; + if (CVarGetInteger("gClearCutscenePointer", 0)) { + static uint32_t null_cs[] = {0, 0}; + gPlayState->csCtx.segment = &null_cs; + CVarSetInteger("gClearCutscenePointer", 0); + } + }); +} + +void RegisterSafeWrongWarp() { + GameInteractor::Instance->RegisterGameHook([](int32_t sceneNum) { + if (!gPlayState) return; + if (CVarGetInteger("gSafeWrongWarps", 0) && (sceneNum == 17 || sceneNum == 18 || sceneNum == 19 || sceneNum == 21)) { + static uint32_t null_cs[] = {0, 0}; + gPlayState->csCtx.segment = &null_cs; + } + }); +} + /// Switches Link's age and respawns him at the last entrance he entered. void RegisterSwitchAge() { GameInteractor::Instance->RegisterGameHook([]() { @@ -559,6 +581,8 @@ void InitMods() { RegisterInfiniteISG(); RegisterUnrestrictedItems(); RegisterFreezeTime(); + RegisterClearCutscenePointer(); + RegisterSafeWrongWarp(); RegisterSwitchAge(); RegisterOcarinaTimeTravel(); RegisterAutoSave(); diff --git a/soh/soh/SohMenuBar.cpp b/soh/soh/SohMenuBar.cpp index d028ec79f53..3d5aea87144 100644 --- a/soh/soh/SohMenuBar.cpp +++ b/soh/soh/SohMenuBar.cpp @@ -1139,6 +1139,8 @@ void DrawCheatsMenu() { UIWidgets::Tooltip("This syncs the ingame time with the real world time"); UIWidgets::PaddedEnhancementCheckbox("No ReDead/Gibdo Freeze", "gNoRedeadFreeze", true, false); UIWidgets::Tooltip("Prevents ReDeads and Gibdos from being able to freeze you with their scream"); + UIWidgets::PaddedEnhancementCheckbox("Safe Wrong Warps", "gSafeWrongWarps", true, false); + UIWidgets::Tooltip("Wrong Warps using blue warps will never softlock"); { static int32_t betaQuestEnabled = CVarGetInteger("gEnableBetaQuest", 0);