From 2c31f0977f916a7fb783dda8d8803118369f96ad Mon Sep 17 00:00:00 2001 From: Patrick12115 Date: Sun, 21 May 2023 14:54:32 -0400 Subject: [PATCH 1/3] Move from Dev to Dev-Spock --- .../game-interactor/GameInteractor.h | 1 + soh/soh/Enhancements/mods.cpp | 19 +++++++++++++++++++ soh/soh/GameMenuBar.cpp | 6 +++++- 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/soh/soh/Enhancements/game-interactor/GameInteractor.h b/soh/soh/Enhancements/game-interactor/GameInteractor.h index c2dd2c05fd7..9584103f4c0 100644 --- a/soh/soh/Enhancements/game-interactor/GameInteractor.h +++ b/soh/soh/Enhancements/game-interactor/GameInteractor.h @@ -87,6 +87,7 @@ uint8_t GameInteractor_SecondCollisionUpdate(); } #endif +void UpdateDirtPathFixState(int32_t sceneNum); #ifdef __cplusplus 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/GameMenuBar.cpp b/soh/soh/GameMenuBar.cpp index 42ee232844e..1b8608da4f2 100644 --- a/soh/soh/GameMenuBar.cpp +++ b/soh/soh/GameMenuBar.cpp @@ -46,6 +46,8 @@ extern "C" { void disableBetaQuest() { isBetaQuestEnabled = false; } } +extern "C" PlayState* gPlayState; + enum SeqPlayers { /* 0 */ SEQ_BGM_MAIN, /* 1 */ SEQ_FANFARE, @@ -860,7 +862,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" From 3b827ba0bddbbacd70be31a685881ce15b39f9f1 Mon Sep 17 00:00:00 2001 From: Patrick12115 Date: Sun, 21 May 2023 15:08:11 -0400 Subject: [PATCH 2/3] Moved to mod.h --- soh/soh/Enhancements/game-interactor/GameInteractor.h | 2 -- soh/soh/Enhancements/mods.h | 3 +++ soh/soh/GameMenuBar.cpp | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/soh/soh/Enhancements/game-interactor/GameInteractor.h b/soh/soh/Enhancements/game-interactor/GameInteractor.h index 9584103f4c0..95a101e80bb 100644 --- a/soh/soh/Enhancements/game-interactor/GameInteractor.h +++ b/soh/soh/Enhancements/game-interactor/GameInteractor.h @@ -87,8 +87,6 @@ uint8_t GameInteractor_SecondCollisionUpdate(); } #endif -void UpdateDirtPathFixState(int32_t sceneNum); - #ifdef __cplusplus #include 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 1b8608da4f2..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 From 33cf6596122ebec57fcb551a7c4c4f97e70b8967 Mon Sep 17 00:00:00 2001 From: Patrick12115 Date: Sun, 21 May 2023 15:10:52 -0400 Subject: [PATCH 3/3] Update GameInteractor.h --- soh/soh/Enhancements/game-interactor/GameInteractor.h | 1 + 1 file changed, 1 insertion(+) diff --git a/soh/soh/Enhancements/game-interactor/GameInteractor.h b/soh/soh/Enhancements/game-interactor/GameInteractor.h index 95a101e80bb..c2dd2c05fd7 100644 --- a/soh/soh/Enhancements/game-interactor/GameInteractor.h +++ b/soh/soh/Enhancements/game-interactor/GameInteractor.h @@ -87,6 +87,7 @@ uint8_t GameInteractor_SecondCollisionUpdate(); } #endif + #ifdef __cplusplus #include