From d83c7722df19ead301f7ccbf74062ac0cab3dda5 Mon Sep 17 00:00:00 2001 From: sonoftunk Date: Sun, 6 Nov 2022 12:44:08 -0500 Subject: [PATCH] Fixes gerudo fortress checks showing in tracker when settings have them removed --- .../randomizer/randomizer_check_objects.cpp | 7 ++++++- .../randomizer/randomizer_check_objects.h | 6 ++++++ .../randomizer/randomizer_item_tracker.cpp | 18 +++++++++++++++--- 3 files changed, 27 insertions(+), 4 deletions(-) diff --git a/soh/soh/Enhancements/randomizer/randomizer_check_objects.cpp b/soh/soh/Enhancements/randomizer/randomizer_check_objects.cpp index 8a53ad783..89d495830 100644 --- a/soh/soh/Enhancements/randomizer/randomizer_check_objects.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer_check_objects.cpp @@ -937,7 +937,12 @@ void RandomizerCheckObjects::UpdateImGuiVisibility() { ((locationIt.rcType != RCTYPE_SMALL_KEY) || CVar_GetS32("gRandomizeKeysanity", 0) != 1) && // 1 is the value for "vanilla" small keys ((locationIt.rcType != RCTYPE_GF_KEY) || CVar_GetS32("randoShuffleGerudoFortressKeys", 0) != 0) && // 0 is the value for "vanilla" gf keys ((locationIt.rcType != RCTYPE_BOSS_KEY) || CVar_GetS32("gRandomizeBossKeysanity", 0) != 1) && // 1 is the value for "vanilla" boss keys - ((locationIt.rcType != RCTYPE_GANON_BOSS_KEY) || CVar_GetS32("gRandomizeShuffleGanonBossKey", 0) != 0) // 0 is the value for "vanilla" ganon's boss key + ((locationIt.rcType != RCTYPE_GANON_BOSS_KEY) || CVar_GetS32("gRandomizeShuffleGanonBossKey", 0) != 0) && // 0 is the value for "vanilla" ganon's boss key + ((!RC_IS_CARPENTER(locationIt.rc) && locationIt.rc != RC_GF_GERUDO_MEMBERSHIP_CARD) || + (CVar_GetS32("gRandomizeGerudoFortress", 0) == 2 && !RC_IS_CARPENTER(locationIt.rc) && locationIt.rc != RC_GF_GERUDO_MEMBERSHIP_CARD) || //2 is the value for "open" gerudo's fortress + (CVar_GetS32("gRandomizeGerudoFortress", 0) == 1 && locationIt.rc == RC_GF_NORTH_F1_CARPENTER) || //1 is the value for "fast" gerudo's fortress + (CVar_GetS32("gRandomizeGerudoFortress", 0) == 0) //0 is the value for "normal" gerudo's fortress + ) ); } } diff --git a/soh/soh/Enhancements/randomizer/randomizer_check_objects.h b/soh/soh/Enhancements/randomizer/randomizer_check_objects.h index b15bf4a3d..482579e52 100644 --- a/soh/soh/Enhancements/randomizer/randomizer_check_objects.h +++ b/soh/soh/Enhancements/randomizer/randomizer_check_objects.h @@ -72,6 +72,12 @@ typedef enum { #define RC_OBJECT(rc, rc_v_or_mq, rc_type, rc_area, actor_id, scene_id, actor_params, og_item_id, rc_shortname, rc_spoilername) \ { rc, {rc, rc_v_or_mq, rc_type, rc_area, actor_id, scene_id, actor_params, og_item_id, false, rc_shortname, rc_spoilername} } +#define RC_IS_CARPENTER(a) \ + (a == RC_GF_NORTH_F1_CARPENTER || \ + a == RC_GF_NORTH_F2_CARPENTER || \ + a == RC_GF_SOUTH_F1_CARPENTER || \ + a == RC_GF_SOUTH_F2_CARPENTER) + typedef struct { RandomizerCheck rc; RandomizerCheckVanillaOrMQ vOrMQ; diff --git a/soh/soh/Enhancements/randomizer/randomizer_item_tracker.cpp b/soh/soh/Enhancements/randomizer/randomizer_item_tracker.cpp index 095a3003a..939a3490f 100644 --- a/soh/soh/Enhancements/randomizer/randomizer_item_tracker.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer_item_tracker.cpp @@ -729,7 +729,10 @@ void DrawLocations() { for (auto& [rcArea, rcObjects] : RandomizerCheckObjects::GetAllRCObjectsByArea()) { bool hasItems = false; for (auto& locationIt : rcObjects) { - if (locationIt.second.visibleInImgui && !checkedLocations.count(locationIt.second.rc) && + if (!locationIt.second.visibleInImgui) + continue; + + if (!checkedLocations.count(locationIt.second.rc) && locationSearch.PassFilter(locationIt.second.rcSpoilerName.c_str())) { hasItems = true; @@ -748,6 +751,9 @@ void DrawLocations() { doAreaScroll = false; } for (auto& locationIt : rcObjects) { + if (!locationIt.second.visibleInImgui) + continue; + // If the location has its scene flag set if (inGame && HasItemBeenCollected(locationIt.second)) { // && checkedLocations.find(locationIt.rc) != checkedLocations.end()) { // show it as checked @@ -807,10 +813,13 @@ void DrawLocations() { for (auto& [rcArea, rcObjects] : RandomizerCheckObjects::GetAllRCObjectsByArea()) { bool hasItems = false; for (auto& locationIt : rcObjects) { - if (locationIt.second.visibleInImgui && checkedLocations.count(locationIt.second.rc)) { + if (!locationIt.second.visibleInImgui) + continue; + + if (checkedLocations.count(locationIt.second.rc)) { hasItems = true; doAreaScroll = - (currentArea != RCAREA_INVALID && sceneId != SCENE_KAKUSIANA && // Don't move for grottos + (currentArea != RCAREA_INVALID && sceneId != SCENE_KAKUSIANA && // Don't move for kakusiana/grottos currentArea != lastArea && currentArea == rcArea); break; } @@ -824,6 +833,9 @@ void DrawLocations() { doAreaScroll = false; } for (auto& locationIt : rcObjects) { + if (!locationIt.second.visibleInImgui) + continue; + auto elfound = checkedLocations.find(locationIt.second.rc); if (locationIt.second.visibleInImgui && elfound != checkedLocations.end()) { // If the location has its scene flag set