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
This commit is contained in:
Patrick12115 2024-02-01 21:30:48 -05:00 committed by GitHub
parent 81eb6de42e
commit c49908caa6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -416,7 +416,25 @@ void DrawItemCount(ItemTrackerItem item) {
ImVec2 p = ImGui::GetCursorScreenPos(); ImVec2 p = ImGui::GetCursorScreenPos();
int32_t trackerNumberDisplayMode = CVarGetInteger("gItemTrackerCapacityTrack", ITEM_TRACKER_NUMBER_CURRENT_CAPACITY_ONLY); int32_t trackerNumberDisplayMode = CVarGetInteger("gItemTrackerCapacityTrack", ITEM_TRACKER_NUMBER_CURRENT_CAPACITY_ONLY);
int32_t trackerKeyNumberDisplayMode = CVarGetInteger("gItemTrackerKeyTrack", KEYS_COLLECTED_MAX); 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()) { if (item.id == ITEM_KEY_SMALL && IsValidSaveFile()) {
std::string currentString = ""; std::string currentString = "";
std::string maxString = std::to_string(currentAndMax.maxCapacity); std::string maxString = std::to_string(currentAndMax.maxCapacity);
@ -1200,6 +1218,10 @@ void ItemTrackerSettingsWindow::DrawElement() {
shouldUpdateVectors = true; 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::PopStyleVar(1);
ImGui::EndTable(); ImGui::EndTable();