diff --git a/soh/soh/Enhancements/mods.cpp b/soh/soh/Enhancements/mods.cpp index 94d8853db98..36ccef505f8 100644 --- a/soh/soh/Enhancements/mods.cpp +++ b/soh/soh/Enhancements/mods.cpp @@ -486,6 +486,24 @@ void RegisterBonkDamage() { }); } +void UpdateDirtPathFixState(int32_t sceneNum) { + switch (sceneNum) { + case SCENE_SPOT00: + case SCENE_SPOT04: + case SCENE_SPOT15: + CVarSetInteger("gDirtPathFix", CVarGetInteger("gSceneSpecificDirtPathFix", 0)); + return; + default: + CVarClear("gDirtPathFix"); + } +} + +void RegisterMenuPathFix() { + GameInteractor::Instance->RegisterGameHook([](int32_t sceneNum) { + UpdateDirtPathFixState(sceneNum); + }); +} + void InitMods() { RegisterTTS(); RegisterInfiniteMoney(); @@ -504,4 +522,5 @@ void InitMods() { RegisterRupeeDash(); RegisterHyperBosses(); RegisterBonkDamage(); + RegisterMenuPathFix(); } diff --git a/soh/soh/Enhancements/mods.h b/soh/soh/Enhancements/mods.h index 99f547d3a35..16effa71257 100644 --- a/soh/soh/Enhancements/mods.h +++ b/soh/soh/Enhancements/mods.h @@ -1,3 +1,5 @@ +#include + #ifndef MODS_H #define MODS_H @@ -5,6 +7,7 @@ extern "C" { #endif +void UpdateDirtPathFixState(int32_t sceneNum); void InitMods(); #ifdef __cplusplus diff --git a/soh/soh/GameMenuBar.cpp b/soh/soh/GameMenuBar.cpp index 42ee232844e..e25bf953e0c 100644 --- a/soh/soh/GameMenuBar.cpp +++ b/soh/soh/GameMenuBar.cpp @@ -29,6 +29,7 @@ #include "soh/SaveManager.h" #include "OTRGlobals.h" #include "soh/Enhancements/presets.h" +#include "soh/Enhancements/mods.h" #include "soh/resource/type/Skeleton.h" #ifdef ENABLE_CROWD_CONTROL @@ -46,6 +47,8 @@ extern "C" { void disableBetaQuest() { isBetaQuestEnabled = false; } } +extern "C" PlayState* gPlayState; + enum SeqPlayers { /* 0 */ SEQ_BGM_MAIN, /* 1 */ SEQ_FANFARE, @@ -860,7 +863,9 @@ namespace GameMenuBar { ImGui::EndMenu(); } UIWidgets::PaddedText("Fix Vanishing Paths", true, false); - UIWidgets::EnhancementCombobox("gDirtPathFix", zFightingOptions, 0); + if (UIWidgets::EnhancementCombobox("gSceneSpecificDirtPathFix", zFightingOptions, 0) && gPlayState != NULL) { + UpdateDirtPathFixState(gPlayState->sceneNum); + } UIWidgets::Tooltip("Disabled: Paths vanish more the higher the resolution (Z-fighting is based on resolution)\n" "Consistent: Certain paths vanish the same way in all resolutions\n" "No Vanish: Paths do not vanish, Link seems to sink in to some paths\n"