start filtering

This commit is contained in:
briaguya 2022-08-18 08:48:24 -04:00
parent dbb4e3eefc
commit 5ac69e0bd8
3 changed files with 49 additions and 6 deletions

View File

@ -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);
}

View File

@ -14,7 +14,7 @@ typedef struct {
} RandomizerCheckObject;
*/
std::unordered_map<RandomizerCheck, RandomizerCheckObject> 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<RandomizerCheckArea, std::string> 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<RandomizerCheckArea, std::string> RandomizerCheckObjects::GetAllRCAreas() {
return rcAreas;
}

View File

@ -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<RandomizerCheckArea, std::string> GetAllRCAreas();
std::unordered_map<RandomizerCheck, RandomizerCheckObject> GetAllRCObjects();
RandomizerCheckObject GetRCObject(RandomizerCheck check);
}