diff --git a/soh/soh/Enhancements/randomizer/randomizer.cpp b/soh/soh/Enhancements/randomizer/randomizer.cpp index 070909814..11e654316 100644 --- a/soh/soh/Enhancements/randomizer/randomizer.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer.cpp @@ -3748,14 +3748,25 @@ void DrawRandoEditor(bool& open) { ImGui::BeginChild("ChildRandomizedLocations"); for (auto areaIt : RandomizerCheckObjects::GetAllRCAreas()) { - // todo fix this, it's hacky and we shouldn't need to iterate through so many times + // todo fix this, it's hacky and copypasta bool hasItems = false; for (auto locationIt : RandomizerCheckObjects::GetAllRCObjects()) { if (!excludedLocations.count(locationIt.second.rc) && + locationIt.second.vOrMQ != RCVORMQ_MQ && //disable all MQ checks until we support them + locationIt.second.rcType != RCTYPE_SHOP && //disable shops until we have shopsanity + locationIt.second.rcType != RCTYPE_GOSSIP_STONE && + locationIt.second.rcType != RCTYPE_LINKS_POCKET && + locationIt.second.rcType != RCTYPE_CHEST_GAME && + ((locationIt.second.rcType != RCTYPE_SKULL_TOKEN) || + (CVar_GetS32("gRandomizeShuffleTokens", 0) == 3) || // all tokens + ((CVar_GetS32("gRandomizeShuffleTokens", 0) == 2) && RandomizerCheckObjects::AreaIsOverworld(areaIt.first)) || // overworld tokens + ((CVar_GetS32("gRandomizeShuffleTokens", 0) == 1) && RandomizerCheckObjects::AreaIsDungeon(areaIt.first)) // dungeon tokens + ) && locationIt.second.rcArea == areaIt.first && locationSearch.PassFilter(locationIt.second.rcSpoilerName.c_str())) { - hasItems = true; - break; + + hasItems = true; + break; } } @@ -3764,8 +3775,19 @@ void DrawRandoEditor(bool& open) { if (ImGui::TreeNode(areaIt.second.c_str())) { for (auto locationIt : RandomizerCheckObjects::GetAllRCObjects()) { if (!excludedLocations.count(locationIt.second.rc) && + locationIt.second.vOrMQ != RCVORMQ_MQ && //disable all MQ checks until we support them + locationIt.second.rcType != RCTYPE_SHOP && //disable shops until we have shopsanity + locationIt.second.rcType != RCTYPE_GOSSIP_STONE && + locationIt.second.rcType != RCTYPE_LINKS_POCKET && + locationIt.second.rcType != RCTYPE_CHEST_GAME && + ((locationIt.second.rcType != RCTYPE_SKULL_TOKEN) || + (CVar_GetS32("gRandomizeShuffleTokens", 0) == 3) || // all tokens + ((CVar_GetS32("gRandomizeShuffleTokens", 0) == 2) && RandomizerCheckObjects::AreaIsOverworld(areaIt.first)) || // overworld tokens + ((CVar_GetS32("gRandomizeShuffleTokens", 0) == 1) && RandomizerCheckObjects::AreaIsDungeon(areaIt.first)) // dungeon tokens + ) && locationIt.second.rcArea == areaIt.first && locationSearch.PassFilter(locationIt.second.rcSpoilerName.c_str())) { + if (ImGui::ArrowButton(std::to_string(locationIt.first).c_str(), ImGuiDir_Right)) { excludedLocations.insert(locationIt.first); } diff --git a/soh/soh/Enhancements/randomizer/randomizer_check_objects.cpp b/soh/soh/Enhancements/randomizer/randomizer_check_objects.cpp index f7106e0ec..494aed2a8 100644 --- a/soh/soh/Enhancements/randomizer/randomizer_check_objects.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer_check_objects.cpp @@ -14,7 +14,7 @@ typedef struct { } RandomizerCheckObject; */ std::unordered_map rcObjects = { - { RC_UNKNOWN_CHECK, {RC_UNKNOWN_CHECK, RCVORMQ_VANILLA, RCTYPE_STANDARD, RCAREA_KOKIRI_FOREST, "Invalid Location", "Invalid Location"}}, + { RC_UNKNOWN_CHECK, {RC_UNKNOWN_CHECK, RCVORMQ_VANILLA, RCTYPE_STANDARD, RCAREA_INVALID, "Invalid Location", "Invalid Location"}}, { RC_KF_KOKIRI_SWORD_CHEST, {RC_KF_KOKIRI_SWORD_CHEST, RCVORMQ_VANILLA, RCTYPE_STANDARD, RCAREA_KOKIRI_FOREST, "Kokiri Sword Chest", "KF Kokiri Sword Chest"}}, { RC_KF_MIDOS_TOP_LEFT_CHEST, {RC_KF_MIDOS_TOP_LEFT_CHEST, RCVORMQ_VANILLA, RCTYPE_STANDARD, RCAREA_KOKIRI_FOREST, "Mido Top Left Chest", "KF Mido Top Left Chest"}}, { RC_KF_MIDOS_TOP_RIGHT_CHEST, {RC_KF_MIDOS_TOP_RIGHT_CHEST, RCVORMQ_VANILLA, RCTYPE_STANDARD, RCAREA_KOKIRI_FOREST, "Mido Top Right Chest", "KF Mido Top Right Chest"}}, @@ -783,6 +783,25 @@ std::map rcAreas = { { RCAREA_GANONS_CASTLE, "Ganon's Castle"}, }; +bool RandomizerCheckObjects::AreaIsDungeon(RandomizerCheckArea area) { + return area == RCAREA_GANONS_CASTLE || + area == RCAREA_GERUDO_TRAINING_GROUND || + area == RCAREA_ICE_CAVERN || + area == RCAREA_BOTTOM_OF_THE_WELL || + area == RCAREA_SHADOW_TEMPLE || + area == RCAREA_SPIRIT_TEMPLE || + area == RCAREA_WATER_TEMPLE || + area == RCAREA_FIRE_TEMPLE || + area == RCAREA_FOREST_TEMPLE || + area == RCAREA_JABU_JABUS_BELLY || + area == RCAREA_DODONGOS_CAVERN || + area == RCAREA_DEKU_TREE; +} + +bool RandomizerCheckObjects::AreaIsOverworld(RandomizerCheckArea area) { + return !AreaIsDungeon(area); +} + std::map RandomizerCheckObjects::GetAllRCAreas() { return rcAreas; } diff --git a/soh/soh/Enhancements/randomizer/randomizer_check_objects.h b/soh/soh/Enhancements/randomizer/randomizer_check_objects.h index 44e8a149a..14c7e80e6 100644 --- a/soh/soh/Enhancements/randomizer/randomizer_check_objects.h +++ b/soh/soh/Enhancements/randomizer/randomizer_check_objects.h @@ -60,7 +60,8 @@ typedef enum { RCAREA_BOTTOM_OF_THE_WELL, RCAREA_ICE_CAVERN, RCAREA_GERUDO_TRAINING_GROUND, - RCAREA_GANONS_CASTLE + RCAREA_GANONS_CASTLE, + RCAREA_INVALID } RandomizerCheckArea; typedef struct { @@ -73,8 +74,9 @@ typedef struct { } RandomizerCheckObject; namespace RandomizerCheckObjects { + bool AreaIsDungeon(RandomizerCheckArea area); + bool AreaIsOverworld(RandomizerCheckArea area); std::map GetAllRCAreas(); std::unordered_map GetAllRCObjects(); RandomizerCheckObject GetRCObject(RandomizerCheck check); - } \ No newline at end of file