From c49908caa6bd1d3eb61385178f79ca37363f4d5b Mon Sep 17 00:00:00 2001 From: Patrick12115 <115201185+Patrick12115@users.noreply.github.com> Date: Thu, 1 Feb 2024 21:30:48 -0500 Subject: [PATCH] Item Tracker Hookshot/Longshot Identifiers (#3848) * H & L Adds an H and L for Hookshot and Longshot to be able to tell more clearly which one you have. * Added Toggle and Refined Adds a toggle if players don't want it on. Also scales the letter to stay constant with the icons, both size and position. Also now hides the letter if you don't have a hookshot yet. * Clean up some of the comments * prefix --- .../randomizer/randomizer_item_tracker.cpp | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/soh/soh/Enhancements/randomizer/randomizer_item_tracker.cpp b/soh/soh/Enhancements/randomizer/randomizer_item_tracker.cpp index 2ac5b5c34..f1841bd50 100644 --- a/soh/soh/Enhancements/randomizer/randomizer_item_tracker.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer_item_tracker.cpp @@ -416,7 +416,25 @@ void DrawItemCount(ItemTrackerItem item) { ImVec2 p = ImGui::GetCursorScreenPos(); int32_t trackerNumberDisplayMode = CVarGetInteger("gItemTrackerCapacityTrack", ITEM_TRACKER_NUMBER_CURRENT_CAPACITY_ONLY); int32_t trackerKeyNumberDisplayMode = CVarGetInteger("gItemTrackerKeyTrack", KEYS_COLLECTED_MAX); + float textScalingFactor = static_cast(iconSize) / 36.0f; + uint32_t actualItemId = INV_CONTENT(item.id); + bool hasItem = actualItemId != ITEM_NONE; + if (CVarGetInteger("gTrackers.ItemTracker.HookshotIdentifier", 0)) { + if ((actualItemId == ITEM_HOOKSHOT || actualItemId == ITEM_LONGSHOT) && hasItem) { + + // Calculate the scaled position for the text + ImVec2 textPos = ImVec2(p.x + (iconSize / 2) - (ImGui::CalcTextSize(item.id == ITEM_HOOKSHOT ? "H" : "L").x * + textScalingFactor / 2) + 8 * textScalingFactor, p.y - 22 * textScalingFactor); + + ImGui::SetCursorScreenPos(textPos); + + ImGui::SetWindowFontScale(textScalingFactor); + + ImGui::Text(item.id == ITEM_HOOKSHOT ? "H" : "L"); + ImGui::SetWindowFontScale(1.0f); // Reset font scale to the original state + } + } if (item.id == ITEM_KEY_SMALL && IsValidSaveFile()) { std::string currentString = ""; std::string maxString = std::to_string(currentAndMax.maxCapacity); @@ -1200,6 +1218,10 @@ void ItemTrackerSettingsWindow::DrawElement() { shouldUpdateVectors = true; } } + UIWidgets::EnhancementCheckbox("Show Hookshot Identifiers", "gTrackers.ItemTracker.HookshotIdentifier"); + UIWidgets::InsertHelpHoverText("Shows an 'H' or an 'L' to more easiely distinguish between Hookshot and Longshot."); + + UIWidgets::Spacer(0); ImGui::PopStyleVar(1); ImGui::EndTable();