diff options
| author | Patrick12115 <115201185+Patrick12115@users.noreply.github.com> | 2024-02-01 21:30:48 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-02-01 20:30:48 -0600 |
| commit | c49908caa6bd1d3eb61385178f79ca37363f4d5b (patch) | |
| tree | 3c3859766859222c2e48d3399525ade84c6db003 | |
| parent | 81eb6de42ee4fbc51d11c17c99b3e62bfb9a8412 (diff) | |
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
| -rw-r--r-- | soh/soh/Enhancements/randomizer/randomizer_item_tracker.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
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<float>(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(); |
