Entrance tracker tweaks (#2446)

* Hide return transitions for dungeon, grotto and interior entrances when "Decouple entrances" is off.

* "Highlight last entrance" now highlights the override reverseIndex entry in the list if "Decouple entrances" is off, to correspond with not displaying return directions for the same setting (without this, nothing gets highlighted with the return transitions hidden with "Decouple entrances" off).

* Removed unnecessary printf

* Moved redundancy check to filtering loop instead of display loop.

Introduced setting to optionally force showing redundant entrances when decoupled is off.

Formatting changes suggested by Archez.

* Changed "show redundant" to "hide reverse" where applicable, and change

Added option disabling based on Decouple Entrances.

* Finished descriptive comment.

* Moved "Hide reverse" to left column of tracker settings.

Changed to PaddedEnhancementCheckbox, changed checkbox padding accordingly, and set default to true.

* Restore tooltip to Hide Reverse option, fix default value.

Co-authored-by: Adam Bird <Archez@users.noreply.github.com>

* Restored padding underneath last option in entrance tracker List Items section.

---------

Co-authored-by: Adam Bird <Archez@users.noreply.github.com>
This commit is contained in:
Malkierian 2023-02-17 05:38:07 -07:00 committed by GitHub
parent 68c8f50a71
commit 868689ce3e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 22 additions and 6 deletions

View File

@ -669,8 +669,14 @@ void DrawEntranceTracker(bool& open) {
UIWidgets::Tooltip("Highlight the previous entrance that Link came from");
UIWidgets::PaddedEnhancementCheckbox("Highlight available", "gEntranceTrackerHighlightAvailable", true, false);
UIWidgets::Tooltip("Highlight available entrances in the current scene");
UIWidgets::PaddedEnhancementCheckbox("Hide undiscovered", "gEntranceTrackerCollapseUndiscovered", true, true);
UIWidgets::PaddedEnhancementCheckbox("Hide undiscovered", "gEntranceTrackerCollapseUndiscovered", true, false);
UIWidgets::Tooltip("Collapse undiscovered entrances towards the bottom of each group");
bool disableHideReverseEntrances = OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_DECOUPLED_ENTRANCES) == RO_GENERIC_ON;
static const char* disableHideReverseEntrancesText = "This option is disabled because \"Decouple Entrances\" is enabled.";
UIWidgets::PaddedEnhancementCheckbox("Hide reverse", "gEntranceTrackerHideReverseEntrances", true, false,
disableHideReverseEntrances, disableHideReverseEntrancesText, UIWidgets::CheckboxGraphics::Cross, true);
UIWidgets::Tooltip("Hide reverse entrance transitions when Decouple Entrances is off");
UIWidgets::Spacer(0);
ImGui::TableNextColumn();
@ -779,6 +785,16 @@ void DrawEntranceTracker(bool& open) {
const EntranceData* original = GetEntranceData(entrance.index);
const EntranceData* override = GetEntranceData(entrance.override);
// If entrance is a dungeon, grotto, or interior entrance, the transition into that area has oneExit set, which means we can filter the return transitions as redundant
// if entrances are not decoupled, as this is redundant information. Also checks a setting, enabled by default, for hiding them.
// If all of these conditions are met, we skip adding this entrance to any lists.
// However, if entrances are decoupled, then all transitions need to be displayed, so we proceed with the filtering
if ((original->type == ENTRANCE_TYPE_DUNGEON || original->type == ENTRANCE_TYPE_GROTTO || original->type == ENTRANCE_TYPE_INTERIOR) &&
(original->oneExit != 1 && OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_DECOUPLED_ENTRANCES) == RO_GENERIC_OFF) &&
CVarGetInteger("gEntranceTrackerHideReverseEntrances", 1) == 1) {
continue;
}
bool isDiscovered = IsEntranceDiscovered(entrance.index);
bool showOriginal = (!destToggle ? CVarGetInteger("gEntranceTrackerShowTo", 0) : CVarGetInteger("gEntranceTrackerShowFrom", 0)) || isDiscovered;
@ -846,7 +862,11 @@ void DrawEntranceTracker(bool& open) {
uint32_t color = isDiscovered ? IM_COL32_WHITE : COLOR_GRAY;
// Handle highlighting and auto scroll
if (LinkIsInArea(original) != -1) {
if ((original->index == lastEntranceIndex ||
(override->reverseIndex == lastEntranceIndex && OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_DECOUPLED_ENTRANCES) == RO_GENERIC_OFF)) &&
CVarGetInteger("gEntranceTrackerHighlightPrevious", 0)) {
color = COLOR_ORANGE;
} else if (LinkIsInArea(original) != -1) {
if (CVarGetInteger("gEntranceTrackerHighlightAvailable", 0)) {
color = COLOR_GREEN;
}
@ -857,10 +877,6 @@ void DrawEntranceTracker(bool& open) {
ImGui::SetScrollHereY(0.0f);
}
}
} else if (original->index == lastEntranceIndex) {
if (CVarGetInteger("gEntranceTrackerHighlightPrevious", 0)) {
color = COLOR_ORANGE;
}
}
ImGui::PushStyleColor(ImGuiCol_Text, color);