Merge branch 'randomizer' of https://github.com/TwilitRealm/dusk into randomizer

This commit is contained in:
gymnast86
2026-05-28 20:22:12 -07:00
4 changed files with 96 additions and 7 deletions
+82 -4
View File
@@ -18,6 +18,9 @@
#include <numeric>
#include <ranges>
#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<int, std::pair<int, std::string>> 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)
+3 -3
View File
@@ -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};
+10
View File
@@ -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));
+1
View File
@@ -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