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
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
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));
}
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() {
allLocations.clear();
if (mSettings->GetOption(RSK_TRIFORCE_HUNT)) {

View File

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

View File

@ -111,7 +111,7 @@ void RandomizerCheckObjects::UpdateImGuiVisibility() {
auto itemLoc = ctx->GetItemLocation(location.GetRandomizerCheck());
itemLoc->SetVisible(
(location.GetRandomizerCheck() != RC_UNKNOWN_CHECK) &&
(!RandomizerCheckObjects::AreaIsDungeon(location.GetArea()) || location.GetQuest() == RCQUEST_BOTH ||
(location.GetQuest() == RCQUEST_BOTH ||
location.GetQuest() == RCQUEST_MQ &&
((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

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
(rc != RC_HC_ZELDAS_LETTER) && // don't show zeldas letter until we support shuffling it
(rc != RC_LINKS_POCKET || showLinksPocket) &&
(!RandomizerCheckObjects::AreaIsDungeon(loc->GetArea()) ||
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()
) &&
OTRGlobals::Instance->gRandoContext->IsQuestOfLocationActive(rc) &&
(loc->GetRCType() != RCTYPE_SHOP ||
(showShops && OTRGlobals::Instance->gRandomizer->IdentifyShopItem(loc->GetScene(), loc->GetActorParams() + 1).enGirlAShopItem == 50)) &&
(rc != RC_TRIFORCE_COMPLETED || !hideTriforceCompleted) &&
@ -1351,10 +1347,7 @@ bool IsCheckShuffled(RandomizerCheck rc) {
);
}
else if (loc->IsVanillaCompletion()) {
return (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()) ||
rc == RC_GIFT_FROM_RAURU) && rc != RC_LINKS_POCKET;
return (OTRGlobals::Instance->gRandoContext->IsQuestOfLocationActive(rc) || rc == RC_GIFT_FROM_RAURU) && rc != RC_LINKS_POCKET;
}
return false;
}
@ -1362,8 +1355,10 @@ bool IsCheckShuffled(RandomizerCheck rc) {
bool IsVisibleInCheckTracker(RandomizerCheck rc) {
auto loc = Rando::StaticData::GetLocation(rc);
if (IS_RANDO) {
return IsCheckShuffled(rc) || (loc->GetRCType() == RCTYPE_SKULL_TOKEN && alwaysShowGS) ||
(loc->GetRCType() == RCTYPE_SHOP && (showShops && (!hideShopUnshuffledChecks)));
return IsCheckShuffled(rc) || (alwaysShowGS &&
loc->GetRCType() == RCTYPE_SKULL_TOKEN &&
OTRGlobals::Instance->gRandoContext->IsQuestOfLocationActive(rc)
) || (loc->GetRCType() == RCTYPE_SHOP && showShops && !hideShopUnshuffledChecks);
} else {
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();
}
}
if (tooltip != "") {
if (tooltip != NULL && strlen(tooltip) != 0) {
ImGui::SameLine();
ImGui::Text(" ?");
UIWidgets::Tooltip(tooltip);