check tracker: don't show GS from wrong quest when always showing GS (#4803)

* check tracker: don't show GS from wrong quest when always showing GS

also fix comparing `char*` to `""`

* IsQuestOfLocationActive
This commit is contained in:
Philip Dubé
2025-01-05 18:36:34 +00:00
committed by GitHub
parent 23466e5a5e
commit 7267b47a83
4 changed files with 16 additions and 13 deletions

View File

@@ -121,6 +121,13 @@ void Context::AddLocations(const Container& locations, std::vector<RandomizerChe
destination->insert(destination->end(), std::cbegin(locations), std::cend(locations)); destination->insert(destination->end(), std::cbegin(locations), std::cend(locations));
} }
bool Context::IsQuestOfLocationActive(RandomizerCheck rc) {
const auto loc = Rando::StaticData::GetLocation(rc);
return loc->GetQuest() == RCQUEST_BOTH ||
loc->GetQuest() == RCQUEST_MQ && mDungeons->GetDungeonFromScene(loc->GetScene())->IsMQ() ||
loc->GetQuest() == RCQUEST_VANILLA && mDungeons->GetDungeonFromScene(loc->GetScene())->IsVanilla();
}
void Context::GenerateLocationPool() { void Context::GenerateLocationPool() {
allLocations.clear(); allLocations.clear();
if (mSettings->GetOption(RSK_TRIFORCE_HUNT)) { if (mSettings->GetOption(RSK_TRIFORCE_HUNT)) {

View File

@@ -50,6 +50,7 @@ class Context {
void AddLocation(RandomizerCheck loc, std::vector<RandomizerCheck>* destination = nullptr); void AddLocation(RandomizerCheck loc, std::vector<RandomizerCheck>* destination = nullptr);
template <typename Container> template <typename Container>
void AddLocations(const Container& locations, std::vector<RandomizerCheck>* destination = nullptr); void AddLocations(const Container& locations, std::vector<RandomizerCheck>* destination = nullptr);
bool IsQuestOfLocationActive(RandomizerCheck rc);
void GenerateLocationPool(); void GenerateLocationPool();
static std::vector<RandomizerCheck> GetLocations(const std::vector<RandomizerCheck>& locationPool, const RandomizerCheckType checkType); static std::vector<RandomizerCheck> GetLocations(const std::vector<RandomizerCheck>& locationPool, const RandomizerCheckType checkType);
void AddExcludedOptions(); void AddExcludedOptions();

View File

@@ -111,7 +111,7 @@ void RandomizerCheckObjects::UpdateImGuiVisibility() {
auto itemLoc = ctx->GetItemLocation(location.GetRandomizerCheck()); auto itemLoc = ctx->GetItemLocation(location.GetRandomizerCheck());
itemLoc->SetVisible( itemLoc->SetVisible(
(location.GetRandomizerCheck() != RC_UNKNOWN_CHECK) && (location.GetRandomizerCheck() != RC_UNKNOWN_CHECK) &&
(!RandomizerCheckObjects::AreaIsDungeon(location.GetArea()) || location.GetQuest() == RCQUEST_BOTH || (location.GetQuest() == RCQUEST_BOTH ||
location.GetQuest() == RCQUEST_MQ && location.GetQuest() == RCQUEST_MQ &&
((CVarGetInteger(CVAR_RANDOMIZER_SETTING("MQDungeons"), RO_MQ_DUNGEONS_NONE) == RO_MQ_DUNGEONS_SET_NUMBER && ((CVarGetInteger(CVAR_RANDOMIZER_SETTING("MQDungeons"), RO_MQ_DUNGEONS_NONE) == RO_MQ_DUNGEONS_SET_NUMBER &&
(CVarGetInteger(CVAR_RANDOMIZER_SETTING("MQDungeonCount"), 12) > 0) || // at least one MQ dungeon (CVarGetInteger(CVAR_RANDOMIZER_SETTING("MQDungeonCount"), 12) > 0) || // at least one MQ dungeon

View File

@@ -1297,11 +1297,7 @@ bool IsCheckShuffled(RandomizerCheck rc) {
(loc->GetRCType() != RCTYPE_CHEST_GAME) && // don't show non final reward chest game checks until we support shuffling them (loc->GetRCType() != RCTYPE_CHEST_GAME) && // don't show non final reward chest game checks until we support shuffling them
(rc != RC_HC_ZELDAS_LETTER) && // don't show zeldas letter until we support shuffling it (rc != RC_HC_ZELDAS_LETTER) && // don't show zeldas letter until we support shuffling it
(rc != RC_LINKS_POCKET || showLinksPocket) && (rc != RC_LINKS_POCKET || showLinksPocket) &&
(!RandomizerCheckObjects::AreaIsDungeon(loc->GetArea()) || OTRGlobals::Instance->gRandoContext->IsQuestOfLocationActive(rc) &&
loc->GetQuest() == RCQUEST_BOTH ||
loc->GetQuest() == RCQUEST_MQ && OTRGlobals::Instance->gRandoContext->GetDungeons()->GetDungeonFromScene(loc->GetScene())->IsMQ() ||
loc->GetQuest() == RCQUEST_VANILLA && OTRGlobals::Instance->gRandoContext->GetDungeons()->GetDungeonFromScene(loc->GetScene())->IsVanilla()
) &&
(loc->GetRCType() != RCTYPE_SHOP || (loc->GetRCType() != RCTYPE_SHOP ||
(showShops && OTRGlobals::Instance->gRandomizer->IdentifyShopItem(loc->GetScene(), loc->GetActorParams() + 1).enGirlAShopItem == 50)) && (showShops && OTRGlobals::Instance->gRandomizer->IdentifyShopItem(loc->GetScene(), loc->GetActorParams() + 1).enGirlAShopItem == 50)) &&
(rc != RC_TRIFORCE_COMPLETED || !hideTriforceCompleted) && (rc != RC_TRIFORCE_COMPLETED || !hideTriforceCompleted) &&
@@ -1351,10 +1347,7 @@ bool IsCheckShuffled(RandomizerCheck rc) {
); );
} }
else if (loc->IsVanillaCompletion()) { else if (loc->IsVanillaCompletion()) {
return (loc->GetQuest() == RCQUEST_BOTH || return (OTRGlobals::Instance->gRandoContext->IsQuestOfLocationActive(rc) || rc == RC_GIFT_FROM_RAURU) && rc != RC_LINKS_POCKET;
(loc->GetQuest() == RCQUEST_MQ && OTRGlobals::Instance->gRandoContext->GetDungeons()->GetDungeonFromScene(loc->GetScene())->IsMQ()) ||
(loc->GetQuest() == RCQUEST_VANILLA && OTRGlobals::Instance->gRandoContext->GetDungeons()->GetDungeonFromScene(loc->GetScene())->IsVanilla()) ||
rc == RC_GIFT_FROM_RAURU) && rc != RC_LINKS_POCKET;
} }
return false; return false;
} }
@@ -1362,8 +1355,10 @@ bool IsCheckShuffled(RandomizerCheck rc) {
bool IsVisibleInCheckTracker(RandomizerCheck rc) { bool IsVisibleInCheckTracker(RandomizerCheck rc) {
auto loc = Rando::StaticData::GetLocation(rc); auto loc = Rando::StaticData::GetLocation(rc);
if (IS_RANDO) { if (IS_RANDO) {
return IsCheckShuffled(rc) || (loc->GetRCType() == RCTYPE_SKULL_TOKEN && alwaysShowGS) || return IsCheckShuffled(rc) || (alwaysShowGS &&
(loc->GetRCType() == RCTYPE_SHOP && (showShops && (!hideShopUnshuffledChecks))); loc->GetRCType() == RCTYPE_SKULL_TOKEN &&
OTRGlobals::Instance->gRandoContext->IsQuestOfLocationActive(rc)
) || (loc->GetRCType() == RCTYPE_SHOP && showShops && !hideShopUnshuffledChecks);
} else { } else {
return loc->IsVanillaCompletion() && (!loc->IsDungeon() || (loc->IsDungeon() && loc->GetQuest() == gSaveContext.questId)); return loc->IsVanillaCompletion() && (!loc->IsDungeon() || (loc->IsDungeon() && loc->GetQuest() == gSaveContext.questId));
} }
@@ -1711,7 +1706,7 @@ void ImGuiDrawTwoColorPickerSection(const char* text, const char* cvarMainName,
ImGui::EndTable(); ImGui::EndTable();
} }
} }
if (tooltip != "") { if (tooltip != NULL && strlen(tooltip) != 0) {
ImGui::SameLine(); ImGui::SameLine();
ImGui::Text(" ?"); ImGui::Text(" ?");
UIWidgets::Tooltip(tooltip); UIWidgets::Tooltip(tooltip);