mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2024-11-22 17:32:19 -05:00
Fix: exclude locations not updating and add more location logic (#2428)
* fix location tab not updating and remove hidden excludes during generation * add more exclude locations and fix broken ones * update check tracker check visibility * rename enum * rename enums again
This commit is contained in:
parent
177194ca5a
commit
f57cae120d
@ -2939,6 +2939,14 @@ void GenerateRandomizerImgui(std::string seed = "") {
|
||||
excludedLocations.insert((RandomizerCheck)std::stoi(excludedLocationString));
|
||||
}
|
||||
|
||||
// Remove excludes for locations that are no longer allowed to be excluded
|
||||
for (auto [randomizerCheck, rcObject] : RandomizerCheckObjects::GetAllRCObjects()) {
|
||||
auto elfound = excludedLocations.find(rcObject.rc);
|
||||
if (!rcObject.visibleInImgui && elfound != excludedLocations.end()) {
|
||||
excludedLocations.erase(elfound);
|
||||
}
|
||||
}
|
||||
|
||||
RandoMain::GenerateRando(cvarSettings, excludedLocations, seed);
|
||||
|
||||
memset(seedInputBuffer, 0, MAX_SEED_BUFFER_SIZE);
|
||||
@ -4202,8 +4210,8 @@ void DrawRandoEditor(bool& open) {
|
||||
for (auto [rcArea, rcObjects] : RandomizerCheckObjects::GetAllRCObjectsByArea()) {
|
||||
bool hasItems = false;
|
||||
for (auto [randomizerCheck, rcObject] : rcObjects) {
|
||||
if (rcObject.visibleInImgui && !excludedLocations.count(rcObject.rc) &&
|
||||
locationSearch.PassFilter(rcObject.rcSpoilerName.c_str())) {
|
||||
if (rcObject->visibleInImgui && !excludedLocations.count(rcObject->rc) &&
|
||||
locationSearch.PassFilter(rcObject->rcSpoilerName.c_str())) {
|
||||
|
||||
hasItems = true;
|
||||
break;
|
||||
@ -4214,11 +4222,11 @@ void DrawRandoEditor(bool& open) {
|
||||
ImGui::SetNextItemOpen(true, ImGuiCond_Once);
|
||||
if (ImGui::TreeNode(RandomizerCheckObjects::GetRCAreaName(rcArea).c_str())) {
|
||||
for (auto [randomizerCheck, rcObject] : rcObjects) {
|
||||
if (rcObject.visibleInImgui && !excludedLocations.count(rcObject.rc) &&
|
||||
locationSearch.PassFilter(rcObject.rcSpoilerName.c_str())) {
|
||||
if (rcObject->visibleInImgui && !excludedLocations.count(rcObject->rc) &&
|
||||
locationSearch.PassFilter(rcObject->rcSpoilerName.c_str())) {
|
||||
|
||||
if (ImGui::ArrowButton(std::to_string(rcObject.rc).c_str(), ImGuiDir_Right)) {
|
||||
excludedLocations.insert(rcObject.rc);
|
||||
if (ImGui::ArrowButton(std::to_string(rcObject->rc).c_str(), ImGuiDir_Right)) {
|
||||
excludedLocations.insert(rcObject->rc);
|
||||
// todo: this efficently when we build out cvar array support
|
||||
std::string excludedLocationString = "";
|
||||
for (auto excludedLocationIt : excludedLocations) {
|
||||
@ -4229,7 +4237,7 @@ void DrawRandoEditor(bool& open) {
|
||||
SohImGui::RequestCvarSaveOnNextTick();
|
||||
}
|
||||
ImGui::SameLine();
|
||||
ImGui::Text(rcObject.rcShortName.c_str());
|
||||
ImGui::Text(rcObject->rcShortName.c_str());
|
||||
}
|
||||
}
|
||||
ImGui::TreePop();
|
||||
@ -4246,7 +4254,7 @@ void DrawRandoEditor(bool& open) {
|
||||
for (auto [rcArea, rcObjects] : RandomizerCheckObjects::GetAllRCObjectsByArea()) {
|
||||
bool hasItems = false;
|
||||
for (auto [randomizerCheck, rcObject] : rcObjects) {
|
||||
if (rcObject.visibleInImgui && excludedLocations.count(rcObject.rc)) {
|
||||
if (rcObject->visibleInImgui && excludedLocations.count(rcObject->rc)) {
|
||||
hasItems = true;
|
||||
break;
|
||||
}
|
||||
@ -4256,9 +4264,9 @@ void DrawRandoEditor(bool& open) {
|
||||
ImGui::SetNextItemOpen(true, ImGuiCond_Once);
|
||||
if (ImGui::TreeNode(RandomizerCheckObjects::GetRCAreaName(rcArea).c_str())) {
|
||||
for (auto [randomizerCheck, rcObject] : rcObjects) {
|
||||
auto elfound = excludedLocations.find(rcObject.rc);
|
||||
if (rcObject.visibleInImgui && elfound != excludedLocations.end()) {
|
||||
if (ImGui::ArrowButton(std::to_string(rcObject.rc).c_str(), ImGuiDir_Left)) {
|
||||
auto elfound = excludedLocations.find(rcObject->rc);
|
||||
if (rcObject->visibleInImgui && elfound != excludedLocations.end()) {
|
||||
if (ImGui::ArrowButton(std::to_string(rcObject->rc).c_str(), ImGuiDir_Left)) {
|
||||
excludedLocations.erase(elfound);
|
||||
// todo: this efficently when we build out cvar array support
|
||||
std::string excludedLocationString = "";
|
||||
@ -4270,7 +4278,7 @@ void DrawRandoEditor(bool& open) {
|
||||
SohImGui::RequestCvarSaveOnNextTick();
|
||||
}
|
||||
ImGui::SameLine();
|
||||
ImGui::Text(rcObject.rcShortName.c_str());
|
||||
ImGui::Text(rcObject->rcShortName.c_str());
|
||||
}
|
||||
}
|
||||
ImGui::TreePop();
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -25,6 +25,10 @@ typedef enum {
|
||||
RCTYPE_CHEST_GAME, //todo replace this once we implement it, just using it to exclude for now
|
||||
RCTYPE_LINKS_POCKET, //todo this feels hacky
|
||||
RCTYPE_GOSSIP_STONE,
|
||||
RCTYPE_SONG_LOCATION, // Song locations
|
||||
RCTYPE_BOSS_HEART_OR_OTHER_REWARD, // Boss heart container or lesser dungeon rewards (lens, ice arrow)
|
||||
RCTYPE_DUNGEON_REWARD, // Dungeon rewards (blue warps)
|
||||
RCTYPE_OCARINA, // Ocarina locations
|
||||
} RandomizerCheckType;
|
||||
|
||||
typedef enum {
|
||||
@ -94,7 +98,7 @@ namespace RandomizerCheckObjects {
|
||||
bool AreaIsOverworld(RandomizerCheckArea area);
|
||||
std::string GetRCAreaName(RandomizerCheckArea area);
|
||||
std::map<RandomizerCheck, RandomizerCheckObject> GetAllRCObjects();
|
||||
std::map<RandomizerCheckArea, std::map<RandomizerCheck, RandomizerCheckObject>> GetAllRCObjectsByArea();
|
||||
std::map<RandomizerCheckArea, std::map<RandomizerCheck, RandomizerCheckObject*>> GetAllRCObjectsByArea();
|
||||
std::map<SceneID, RandomizerCheckArea> GetAllRCAreaBySceneID();
|
||||
RandomizerCheckArea GetRCAreaBySceneID(SceneID sceneId);
|
||||
void UpdateImGuiVisibility();
|
||||
|
@ -376,6 +376,8 @@ bool showKeysanity;
|
||||
bool showGerudoFortressKeys;
|
||||
bool showBossKeysanity;
|
||||
bool showGanonBossKey;
|
||||
bool showOcarinas;
|
||||
bool show100SkullReward;
|
||||
bool fortressFast;
|
||||
bool fortressNormal;
|
||||
|
||||
@ -429,6 +431,12 @@ void LoadSettings() {
|
||||
showGanonBossKey = gSaveContext.n64ddFlag ?
|
||||
OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_GANONS_BOSS_KEY) != RO_GANON_BOSS_KEY_VANILLA
|
||||
: false;
|
||||
showOcarinas = gSaveContext.n64ddFlag ?
|
||||
OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_SHUFFLE_OCARINA) == RO_GENERIC_YES
|
||||
: false;
|
||||
show100SkullReward = gSaveContext.n64ddFlag ?
|
||||
OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_SHUFFLE_100_GS_REWARD) == RO_GENERIC_YES
|
||||
: false;
|
||||
|
||||
if (gSaveContext.n64ddFlag) {
|
||||
switch (OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_SHUFFLE_TOKENS)) {
|
||||
@ -475,6 +483,7 @@ bool IsVisibleInCheckTracker(RandomizerCheckObject rcObj) {
|
||||
(rcObj.rcArea != RCAREA_INVALID) && // don't show Invalid locations
|
||||
(rcObj.rcType != RCTYPE_GOSSIP_STONE) && //TODO: Don't show hints until tracker supports them
|
||||
(rcObj.rcType != RCTYPE_CHEST_GAME) && // don't show non final reward chest game checks until we support shuffling them
|
||||
(rcObj.rc != RC_HC_ZELDAS_LETTER) && // don't show zeldas letter until we support shuffling it
|
||||
(!RandomizerCheckObjects::AreaIsDungeon(rcObj.rcArea) ||
|
||||
rcObj.vOrMQ == RCVORMQ_BOTH ||
|
||||
rcObj.vOrMQ == RCVORMQ_MQ && OTRGlobals::Instance->gRandomizer->masterQuestDungeons.contains(rcObj.sceneId) ||
|
||||
@ -482,30 +491,32 @@ bool IsVisibleInCheckTracker(RandomizerCheckObject rcObj) {
|
||||
) &&
|
||||
(rcObj.rcType != RCTYPE_SHOP || showShops) &&
|
||||
(rcObj.rcType != RCTYPE_SCRUB ||
|
||||
showScrubs ||
|
||||
rcObj.rc == RC_LW_DEKU_SCRUB_NEAR_BRIDGE || // The 3 scrubs that are always randomized
|
||||
rcObj.rc == RC_HF_DEKU_SCRUB_GROTTO ||
|
||||
rcObj.rc == RC_LW_DEKU_SCRUB_GROTTO_FRONT
|
||||
showScrubs ||
|
||||
rcObj.rc == RC_LW_DEKU_SCRUB_NEAR_BRIDGE || // The 3 scrubs that are always randomized
|
||||
rcObj.rc == RC_HF_DEKU_SCRUB_GROTTO ||
|
||||
rcObj.rc == RC_LW_DEKU_SCRUB_GROTTO_FRONT
|
||||
) &&
|
||||
(rcObj.rcType != RCTYPE_MERCHANT || showMerchants) &&
|
||||
(rcObj.rcType != RCTYPE_OCARINA || showOcarinas) &&
|
||||
(rcObj.rcType != RCTYPE_SKULL_TOKEN ||
|
||||
(showOverworldTokens && RandomizerCheckObjects::AreaIsOverworld(rcObj.rcArea)) ||
|
||||
(showDungeonTokens && RandomizerCheckObjects::AreaIsDungeon(rcObj.rcArea))
|
||||
) &&
|
||||
(rcObj.rcType != RCTYPE_COW || showCows) &&
|
||||
(rcObj.rcType != RCTYPE_ADULT_TRADE ||
|
||||
showAdultTrade ||
|
||||
rcObj.rc == RC_KAK_ANJU_AS_ADULT || // adult trade checks that are always shuffled
|
||||
rcObj.rc == RC_DMT_TRADE_CLAIM_CHECK // even when shuffle adult trade is off
|
||||
showAdultTrade ||
|
||||
rcObj.rc == RC_KAK_ANJU_AS_ADULT || // adult trade checks that are always shuffled
|
||||
rcObj.rc == RC_DMT_TRADE_CLAIM_CHECK // even when shuffle adult trade is off
|
||||
) &&
|
||||
(rcObj.rc != RC_KF_KOKIRI_SWORD_CHEST || showKokiriSword) &&
|
||||
(rcObj.rc != RC_ZR_MAGIC_BEAN_SALESMAN || showBeans) &&
|
||||
(rcObj.rc != RC_HC_MALON_EGG || showWeirdEgg) &&
|
||||
(rcObj.rcType != RCTYPE_FROG_SONG || showFrogSongRupees) &&
|
||||
(rcObj.rcType != RCTYPE_MAP_COMPASS || showStartingMapsCompasses) &&
|
||||
(rcObj.rcType != RCTYPE_SMALL_KEY || showKeysanity) &&
|
||||
(rcObj.rcType != RCTYPE_BOSS_KEY || showBossKeysanity) &&
|
||||
(rcObj.rcType != RCTYPE_GANON_BOSS_KEY || showGanonBossKey) &&
|
||||
(rcObj.rc != RC_KF_KOKIRI_SWORD_CHEST || showKokiriSword) &&
|
||||
(rcObj.rc != RC_ZR_MAGIC_BEAN_SALESMAN || showBeans) &&
|
||||
(rcObj.rc != RC_HC_MALON_EGG || showWeirdEgg) &&
|
||||
(rcObj.rcType != RCTYPE_FROG_SONG || showFrogSongRupees) &&
|
||||
(rcObj.rcType != RCTYPE_MAP_COMPASS || showStartingMapsCompasses) &&
|
||||
(rcObj.rcType != RCTYPE_SMALL_KEY || showKeysanity) &&
|
||||
(rcObj.rcType != RCTYPE_BOSS_KEY || showBossKeysanity) &&
|
||||
(rcObj.rcType != RCTYPE_GANON_BOSS_KEY || showGanonBossKey) &&
|
||||
(rcObj.rc != RC_KAK_100_GOLD_SKULLTULA_REWARD || show100SkullReward) &&
|
||||
(rcObj.rcType != RCTYPE_GF_KEY && rcObj.rc != RC_GF_GERUDO_MEMBERSHIP_CARD ||
|
||||
(showGerudoCard && rcObj.rc == RC_GF_GERUDO_MEMBERSHIP_CARD) ||
|
||||
(fortressNormal && showGerudoFortressKeys && rcObj.rcType == RCTYPE_GF_KEY) ||
|
||||
|
Loading…
Reference in New Issue
Block a user