From c4a13c8c10959df1094cdb2ba5fb2af064e7c2bc Mon Sep 17 00:00:00 2001 From: CraftyBoss Date: Thu, 28 May 2026 01:16:53 -0700 Subject: [PATCH] add WIP inventory window in check tracker, only decrease available locations if check is accessible also fixed issue with getSaveItemPool not counting base skybook item, as well as Aurus Memo if it was used --- src/dusk/imgui/ImGuiMenuRandomizer.cpp | 86 ++++++++++++++++++++++++-- src/dusk/imgui/ImGuiMenuRandomizer.hpp | 6 +- src/dusk/randomizer/game/tools.cpp | 10 +++ src/dusk/randomizer/game/tools.h | 1 + 4 files changed, 96 insertions(+), 7 deletions(-) diff --git a/src/dusk/imgui/ImGuiMenuRandomizer.cpp b/src/dusk/imgui/ImGuiMenuRandomizer.cpp index 033c8e44d8..3ba223c9dd 100644 --- a/src/dusk/imgui/ImGuiMenuRandomizer.cpp +++ b/src/dusk/imgui/ImGuiMenuRandomizer.cpp @@ -18,6 +18,9 @@ #include #include +#include "imgui_internal.h" +#include "dusk/randomizer/game/verify_item_functions.h" + namespace dusk { @@ -28,6 +31,7 @@ namespace dusk { static constexpr ImVec4 TRACKER_COLOR_INACCESSIBLE = ImVec4(1.0f, 0.0f, 0.0f, 1.0f); static constexpr ImVec4 TRACKER_COLOR_ACCESSIBLE = ImVec4(0.f, 1.f, 0.f, 1.f); static constexpr ImVec4 TRACKER_COLOR_COLLECTED = ImVec4(0.4f, 0.4f, 0.4f, 1.0f); + static constexpr ImVec4 TRACKER_COLOR_COLLECTED_OUT_LOGIC = ImVec4(0.4f, 0.4f, 0.0f, 1.0f); static constexpr ImVec4 TRACKER_COLOR_ACTIVE = ImVec4(1.0f, 1.0f, 0.0f, 1.0f); static void StartSeedGeneration() { @@ -227,7 +231,6 @@ namespace dusk { ImGui::End(); } - void ImGuiMenuRandomizer::windowRandoTracker() { if (!g_randomizerState.mShowTracker) { return; @@ -280,6 +283,75 @@ namespace dusk { ImGui::TextColored(ImVec4(1.0f, 0.0f,0.0f,1.0f), "Error: Current Stage Save Tbl mismatch!"); } + // TODO: move this out of tracker + if (ImGui::CollapsingHeader("Current Inventory")) { + if (ImGui::BeginChild("ScrollRegionCurInventory", ImVec2(500, 200), true)) { + ImGui::SeparatorText("Story Items Count"); + + ImGui::Text("Fused Shadows: %d/3", numFusedShadows()); + ImGui::Text("Mirror Shards: %d/4", numMirrorShards()); + + static std::unordered_map> keyRegionItemNameMap = { + {0x10, {4, "Forest Temple"}}, + {0x11, {3, "Goron Mines"}}, + {0x12, {3, "Lakebed Temple"}}, + {0x13, {5, "Arbiters Grounds"}}, + {0x14, {4, "Snowpeak Ruins"}}, + {0x15, {3, "Temple of Time"}}, + {0x16, {1, "City in the Sky"}}, + {0x17, {7, "Palace of Twilight"}}, + {0x18, {3, "Hyrule Castle"}}, + {0xA, {1, "Gerudo Desert Bulblin Camp"}}, + }; + for (auto& [stage, keyInfo] : keyRegionItemNameMap) { + ImGui::SeparatorText(keyInfo.second.c_str()); + + int smallKeys = getTempleKeysFound(stage); + + ImGui::Text("Keys: %d/%d", smallKeys, keyInfo.first); + + if (stage == 0xA) + continue; + + ImGui::Text("Has:"); + + if (dComIfGs_isDungeonItemBossKey(stage)) { + ImGui::SameLine(); + ImGui::Text("Big Key"); + } + if (dComIfGs_isDungeonItemMap(stage)) { + ImGui::SameLine(); + ImGui::Text("Map"); + } + if (dComIfGs_isDungeonItemCompass(stage)) { + ImGui::SameLine(); + ImGui::Text("Compass"); + } + + if (stage == 0x14) { + // Ordon Pumpkin + if (haveItem(dItemNo_Randomizer_TOMATO_PUREE_e)) { + ImGui::SameLine(); + ImGui::Text("Pumpkin"); + } + + // Ordon Cheese + if (haveItem(dItemNo_Randomizer_TASTE_e)) { + ImGui::SameLine(); + ImGui::Text("Cheese"); + } + } + } + + ImGui::SeparatorText("Overworld Keys"); + + ImGui::Text("Faron Gate: %s", haveItem(dItemNo_SMALL_KEY2_e) ? "Yes" : "No"); + ImGui::Text("Coro Gate: %s", haveItem(dItemNo_KEY_OF_FILONE_e) ? "Yes" : "No"); + ImGui::Text("Gate Keys: %s", haveItem(dItemNo_Randomizer_BOSSRIDER_KEY_e) ? "Yes" : "No"); + } + ImGui::EndChild(); + } + ImGui::Checkbox("Show Only Accessible Locations", &m_onlyAccessible); ImGui::Checkbox("Hide Area Header", &m_hideAreaHeader); ImGui::Checkbox("Show Location Requirements", &m_showRequirements); @@ -288,7 +360,7 @@ namespace dusk { // Show total number of available locations auto locations = trackerRando->GetWorld()->GetAllLocations(); // TODO: maybe add remaining? - ImGui::Text("Locations Available: %zu / %zu (%zu Checked)", m_numAvailableLocations, m_numProgressionLocations, m_numCollectedLocations); + ImGui::Text("Locations Available: %d / %d (%d Checked)", m_numAvailableLocations, m_numProgressionLocations, m_numCollectedLocations); ImGui::SetNextWindowBgAlpha(0.5f); if (ImGui::BeginChild("ScrollRegion", ImVec2(500, 500), true)) @@ -304,9 +376,15 @@ namespace dusk { } if (info.collected) { - ImGui::TextColored(TRACKER_COLOR_COLLECTED, "%s [%s]", + if (info.accessible) { + ImGui::TextColored(TRACKER_COLOR_COLLECTED, "%s [%s]", info.locationName.c_str(), info.locationItem.c_str()); + }else { + ImGui::TextColored(TRACKER_COLOR_COLLECTED_OUT_LOGIC, "%s [%s]", + info.locationName.c_str(), + info.locationItem.c_str()); + } } else { if (ImGui::SmallButton(fmt::format("{}###HideCheckBtn_{}", info.hidden ? "+" : "-", info.locationName.c_str()).c_str())) { @@ -441,7 +519,7 @@ namespace dusk { info.hidden = std::ranges::find(m_HiddenChecks, info.locationName) != m_HiddenChecks.end(); - if (info.collected) + if (info.accessible && info.collected) m_numAvailableLocations--; // Gather the hint regions this location is in (set avoids duplicates) diff --git a/src/dusk/imgui/ImGuiMenuRandomizer.hpp b/src/dusk/imgui/ImGuiMenuRandomizer.hpp index 0064506e2a..0d50410aa6 100644 --- a/src/dusk/imgui/ImGuiMenuRandomizer.hpp +++ b/src/dusk/imgui/ImGuiMenuRandomizer.hpp @@ -43,9 +43,9 @@ private: void addToGroup(LocationTrackerInfo& loc); }; - size_t m_numAvailableLocations; - size_t m_numProgressionLocations; - size_t m_numCollectedLocations; + int m_numAvailableLocations; + int m_numProgressionLocations; + int m_numCollectedLocations; bool m_showRandoStats{false}; bool m_showRandoGeneration{false}; diff --git a/src/dusk/randomizer/game/tools.cpp b/src/dusk/randomizer/game/tools.cpp index c5ffe150b3..e235686f1b 100644 --- a/src/dusk/randomizer/game/tools.cpp +++ b/src/dusk/randomizer/game/tools.cpp @@ -249,6 +249,11 @@ randomizer::logic::item_pool::ItemPool getSaveItemPool(randomizer::logic::world: case dItemNo_Randomizer_ASHS_SCRIBBLING_e: pool.push_back(world->GetItem("Asheis Sketch", true)); break; + case dItemNo_Randomizer_ANCIENT_DOCUMENT_e: + case dItemNo_Randomizer_ANCIENT_DOCUMENT2_e: + case dItemNo_Randomizer_AIR_LETTER_e: + pool.push_back(world->GetItem("Progressive Sky Book", true)); + break; case dItemNo_Randomizer_EMPTY_BOTTLE_e: case dItemNo_Randomizer_RED_BOTTLE_e: case dItemNo_Randomizer_GREEN_BOTTLE_e: @@ -291,6 +296,11 @@ randomizer::logic::item_pool::ItemPool getSaveItemPool(randomizer::logic::world: pool.push_back(world->GetItem("Shadow Crystal", true)); } + // Showed Auru's Memo to Fyer + if (dComIfGs_isEventBit(0x2680)) { + pool.push_back(world->GetItem("Aurus Memo", true)); + } + // Fused Shadows for (int i = 0; i < numFusedShadows(); ++i) { pool.push_back(world->GetItem("Progressive Fused Shadow", true)); diff --git a/src/dusk/randomizer/game/tools.h b/src/dusk/randomizer/game/tools.h index 39fdb90140..dba138a4bd 100644 --- a/src/dusk/randomizer/game/tools.h +++ b/src/dusk/randomizer/game/tools.h @@ -17,6 +17,7 @@ u16 getItemMessageID(u8 itemId); int numCompletedDungeons(); int numFusedShadows(); int numMirrorShards(); +int getTempleKeysFound(int stage); /* * Reads the current player inventory and returns an ItemPool that can be used for logic searches