Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
136 changes: 88 additions & 48 deletions soh/soh/Enhancements/randomizer/randomizer_item_tracker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,17 @@ void TrackSilverRupees(std::vector<ItemTrackerItem>* trackList) {
}
}

// Ganon's soul is shuffled separately from the other boss souls
static void TrackBossSouls(std::vector<ItemTrackerItem>* trackList) {
bool bossSouls = IS_RANDO && RAND_GET_OPTION(RSK_SHUFFLE_BOSS_SOULS);
bool ganonSoul = IS_RANDO && RAND_GET_OPTION(RSK_GANONS_SOUL).IsNot(RO_GANONS_SOUL_STARTWITH);
for (auto bossSoul : bossSoulItems) {
if (bossSoul.id == RG_GANON_SOUL ? ganonSoul : bossSouls) {
trackList->push_back(bossSoul);
}
}
}

void DrawName(std::string str, ImU32 color) {
int iconSize = CVarGetInteger(CVAR_TRACKER_ITEM("IconSize"), 36);
ImVec2 p = ImGui::GetCursorScreenPos();
Expand Down Expand Up @@ -1470,6 +1481,56 @@ std::vector<ItemTrackerItem> GetDungeonItemsVector(std::vector<ItemTrackerDungeo
}
/* ****************************************************** */

// Don't render when setting disabled
static int32_t GetGatedSectionDisplay(const char* cvar, bool inPool) {
return inPool ? CVarGetInteger(cvar, SECTION_DISPLAY_HIDDEN) : SECTION_DISPLAY_HIDDEN;
}

static int32_t GregDisplay() {
return GetGatedSectionDisplay(CVAR_TRACKER_ITEM("DisplayType.Greg"), IS_RANDO);
}

static int32_t TriforcePiecesDisplay() {
return GetGatedSectionDisplay(CVAR_TRACKER_ITEM("DisplayType.TriforcePieces"),
IS_RANDO && RAND_GET_OPTION(RSK_TRIFORCE_HUNT_PIECES_TOTAL));
}

static int32_t BeanSoulsDisplay() {
return GetGatedSectionDisplay(CVAR_TRACKER_ITEM("DisplayType.BeanSouls"),
IS_RANDO && RAND_GET_OPTION(RSK_SHUFFLE_BEAN_SOULS));
}

static int32_t BossSoulsDisplay() {
return GetGatedSectionDisplay(CVAR_TRACKER_ITEM("DisplayType.BossSouls"),
IS_RANDO && (RAND_GET_OPTION(RSK_SHUFFLE_BOSS_SOULS) ||
RAND_GET_OPTION(RSK_GANONS_SOUL).IsNot(RO_GANONS_SOUL_STARTWITH)));
}

static int32_t JabberNutsDisplay() {
return GetGatedSectionDisplay(CVAR_TRACKER_ITEM("DisplayType.JabberNuts"),
IS_RANDO && RAND_GET_OPTION(RSK_SHUFFLE_SPEAK));
}

static int32_t OcarinaButtonsDisplay() {
return GetGatedSectionDisplay(CVAR_TRACKER_ITEM("DisplayType.OcarinaButtons"),
IS_RANDO && RAND_GET_OPTION(RSK_SHUFFLE_OCARINA_BUTTONS));
}

static int32_t OverworldKeysDisplay() {
return GetGatedSectionDisplay(CVAR_TRACKER_ITEM("DisplayType.OverworldKeys"),
IS_RANDO && RAND_GET_OPTION(RSK_LOCK_OVERWORLD_DOORS));
}

static int32_t SilverRupeesDisplay() {
return GetGatedSectionDisplay(CVAR_TRACKER_ITEM("DisplayType.SilverRupees"),
IS_RANDO && RAND_GET_OPTION(RSK_SHUFFLE_SILVER).IsNot(RO_SHUFFLE_SILVER_OFF));
}

static int32_t FishingPoleDisplay() {
return GetGatedSectionDisplay(CVAR_TRACKER_ITEM("DisplayType.FishingPole"),
IS_RANDO && RAND_GET_OPTION(RSK_SHUFFLE_FISHING_POLE));
}

void RefreshItemTrackerMainWindow() {
shouldUpdateVectors = true;
}
Expand Down Expand Up @@ -1562,8 +1623,7 @@ void UpdateVectors() {
// if we're adding greg to the misc window,
// and misc isn't on the main window,
// and it doesn't already have greg, add him
if (CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.Greg"), SECTION_DISPLAY_EXTENDED_HIDDEN) ==
SECTION_DISPLAY_EXTENDED_MISC_WINDOW &&
if (GregDisplay() == SECTION_DISPLAY_EXTENDED_MISC_WINDOW &&
CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.Misc"), SECTION_DISPLAY_MAIN_WINDOW) !=
SECTION_DISPLAY_MAIN_WINDOW) {
if (std::none_of(miscItems.begin(), miscItems.end(), [](ItemTrackerItem item) {
Expand All @@ -1578,8 +1638,7 @@ void UpdateVectors() {

bool newRowAdded = false;
// if we're adding greg to the main window
if (CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.Greg"), SECTION_DISPLAY_EXTENDED_HIDDEN) ==
SECTION_DISPLAY_EXTENDED_MAIN_WINDOW) {
if (GregDisplay() == SECTION_DISPLAY_EXTENDED_MAIN_WINDOW) {
if (!newRowAdded) {
// insert empty items until we're on a new row for greg
while (mainWindowItems.size() % 6) {
Expand All @@ -1593,8 +1652,7 @@ void UpdateVectors() {
}

// If we're adding triforce pieces to the main window
if (CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.TriforcePieces"), SECTION_DISPLAY_HIDDEN) ==
SECTION_DISPLAY_MAIN_WINDOW) {
if (TriforcePiecesDisplay() == SECTION_DISPLAY_MAIN_WINDOW) {
// If Greg isn't on the main window, add empty items to place the triforce pieces on a new row.
if (!newRowAdded) {
while (mainWindowItems.size() % 6) {
Expand All @@ -1608,8 +1666,7 @@ void UpdateVectors() {
}

// if misc is separate and fishing pole isn't added, add fishing pole to misc
if (CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.FishingPole"), SECTION_DISPLAY_EXTENDED_HIDDEN) ==
SECTION_DISPLAY_EXTENDED_MISC_WINDOW &&
if (FishingPoleDisplay() == SECTION_DISPLAY_EXTENDED_MISC_WINDOW &&
CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.Misc"), SECTION_DISPLAY_MAIN_WINDOW) !=
SECTION_DISPLAY_MAIN_WINDOW) {
if (std::none_of(miscItems.begin(), miscItems.end(), [](ItemTrackerItem item) {
Expand All @@ -1622,8 +1679,7 @@ void UpdateVectors() {
miscItems.end());
}
// add fishing pole to main window
if (CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.FishingPole"), SECTION_DISPLAY_EXTENDED_HIDDEN) ==
SECTION_DISPLAY_EXTENDED_MAIN_WINDOW) {
if (FishingPoleDisplay() == SECTION_DISPLAY_EXTENDED_MAIN_WINDOW) {
if (!newRowAdded) {
while (mainWindowItems.size() % 6) {
mainWindowItems.push_back(ITEM_TRACKER_ITEM(ITEM_NONE, "", 0, DrawItem));
Expand All @@ -1635,8 +1691,7 @@ void UpdateVectors() {
}

// If we're adding bean souls to the main window...
if (CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.BeanSouls"), SECTION_DISPLAY_HIDDEN) ==
SECTION_DISPLAY_MAIN_WINDOW) {
if (BeanSoulsDisplay() == SECTION_DISPLAY_MAIN_WINDOW) {
//...add empty items on the main window to get the souls on their own row. (Too many to sit with Greg/Triforce
// pieces)
while (mainWindowItems.size() % 6) {
Expand All @@ -1648,21 +1703,19 @@ void UpdateVectors() {
}

// If we're adding boss souls to the main window...
if (CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.BossSouls"), SECTION_DISPLAY_HIDDEN) ==
SECTION_DISPLAY_MAIN_WINDOW) {
if (BossSoulsDisplay() == SECTION_DISPLAY_MAIN_WINDOW) {
//...add empty items on the main window to get the souls on their own row
// (Too many to sit with Greg/Triforce pieces)
while (mainWindowItems.size() % 6) {
mainWindowItems.push_back(ITEM_TRACKER_ITEM(ITEM_NONE, "", 0, DrawItem));
}

// Add boss souls
mainWindowItems.insert(mainWindowItems.end(), bossSoulItems.begin(), bossSoulItems.end());
TrackBossSouls(&mainWindowItems);
}

// If we're adding jabbernuts to the main window...
if (CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.JabberNuts"), SECTION_DISPLAY_HIDDEN) ==
SECTION_DISPLAY_MAIN_WINDOW) {
if (JabberNutsDisplay() == SECTION_DISPLAY_MAIN_WINDOW) {
// there are 6 jabbernuts, perfect for a row
while (mainWindowItems.size() % 6) {
mainWindowItems.push_back(ITEM_TRACKER_ITEM(ITEM_NONE, "", 0, DrawItem));
Expand All @@ -1673,8 +1726,7 @@ void UpdateVectors() {
}

// If we're adding ocarina buttons to the main window...
if (CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.OcarinaButtons"), SECTION_DISPLAY_HIDDEN) ==
SECTION_DISPLAY_MAIN_WINDOW) {
if (OcarinaButtonsDisplay() == SECTION_DISPLAY_MAIN_WINDOW) {
//...add empty items on the main window to get the buttons on their own row.
// (Too many to sit with Greg/Triforce pieces/boss souls)
while (mainWindowItems.size() % 6) {
Expand All @@ -1686,8 +1738,7 @@ void UpdateVectors() {
}

// If we're adding overworld keys to the main window...
if (CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.OverworldKeys"), SECTION_DISPLAY_HIDDEN) ==
SECTION_DISPLAY_MAIN_WINDOW) {
if (OverworldKeysDisplay() == SECTION_DISPLAY_MAIN_WINDOW) {
//...add empty items on the main window to get the keys on their own row.
// (Too many to sit with Greg/Triforce pieces/boss souls/ocarina buttons)
while (mainWindowItems.size() % 6) {
Expand All @@ -1699,8 +1750,7 @@ void UpdateVectors() {
}

// If we're adding silver rupees to the main window...
if (CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.SilverRupees"), SECTION_DISPLAY_HIDDEN) ==
SECTION_DISPLAY_MAIN_WINDOW) {
if (SilverRupeesDisplay() == SECTION_DISPLAY_MAIN_WINDOW) {
while (mainWindowItems.size() % 6) {
mainWindowItems.push_back(ITEM_TRACKER_ITEM(ITEM_NONE, "", 0, DrawItem));
}
Expand Down Expand Up @@ -1773,12 +1823,9 @@ void ItemTrackerWindow::DrawElement() {
SECTION_DISPLAY_MAIN_WINDOW) ||
(CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.DungeonItems"), SECTION_DISPLAY_HIDDEN) ==
SECTION_DISPLAY_MAIN_WINDOW) ||
(CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.Greg"), SECTION_DISPLAY_EXTENDED_HIDDEN) ==
SECTION_DISPLAY_EXTENDED_MAIN_WINDOW) ||
(CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.TriforcePieces"), SECTION_DISPLAY_HIDDEN) ==
SECTION_DISPLAY_MAIN_WINDOW) ||
(CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.FishingPole"), SECTION_DISPLAY_EXTENDED_HIDDEN) ==
SECTION_DISPLAY_EXTENDED_MAIN_WINDOW) ||
(GregDisplay() == SECTION_DISPLAY_EXTENDED_MAIN_WINDOW) ||
(TriforcePiecesDisplay() == SECTION_DISPLAY_MAIN_WINDOW) ||
(FishingPoleDisplay() == SECTION_DISPLAY_EXTENDED_MAIN_WINDOW) ||
(CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.Notes"), SECTION_DISPLAY_HIDDEN) ==
SECTION_DISPLAY_MAIN_WINDOW)) {
BeginFloatingWindows("Item Tracker");
Expand Down Expand Up @@ -1850,66 +1897,59 @@ void ItemTrackerWindow::DrawElement() {
Trackers::EndFloatWindows();
}

if (CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.Greg"), SECTION_DISPLAY_EXTENDED_HIDDEN) ==
SECTION_DISPLAY_EXTENDED_SEPARATE) {
if (GregDisplay() == SECTION_DISPLAY_EXTENDED_SEPARATE) {
BeginFloatingWindows("Greg Tracker");
DrawItemsInRows(gregItems);
Trackers::EndFloatWindows();
}

if (CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.TriforcePieces"), SECTION_DISPLAY_HIDDEN) ==
SECTION_DISPLAY_SEPARATE) {
if (TriforcePiecesDisplay() == SECTION_DISPLAY_SEPARATE) {
BeginFloatingWindows("Triforce Piece Tracker");
DrawItemsInRows(triforcePieces);
Trackers::EndFloatWindows();
}

if (CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.BeanSouls"), SECTION_DISPLAY_HIDDEN) ==
SECTION_DISPLAY_SEPARATE) {
if (BeanSoulsDisplay() == SECTION_DISPLAY_SEPARATE) {
BeginFloatingWindows("Bean Soul Tracker");
DrawItemsInRows(beanSoulItems);
Trackers::EndFloatWindows();
}

if (CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.BossSouls"), SECTION_DISPLAY_HIDDEN) ==
SECTION_DISPLAY_SEPARATE) {
if (BossSoulsDisplay() == SECTION_DISPLAY_SEPARATE) {
std::vector<ItemTrackerItem> shuffledBossSoulItems;
TrackBossSouls(&shuffledBossSoulItems);
BeginFloatingWindows("Boss Soul Tracker");
DrawItemsInRows(bossSoulItems);
DrawItemsInRows(shuffledBossSoulItems);
Trackers::EndFloatWindows();
}

if (CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.JabberNuts"), SECTION_DISPLAY_HIDDEN) ==
SECTION_DISPLAY_SEPARATE) {
if (JabberNutsDisplay() == SECTION_DISPLAY_SEPARATE) {
BeginFloatingWindows("Jabber Nut Tracker");
DrawItemsInRows(jabbernutItems);
Trackers::EndFloatWindows();
}

if (CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.OcarinaButtons"), SECTION_DISPLAY_HIDDEN) ==
SECTION_DISPLAY_SEPARATE) {
if (OcarinaButtonsDisplay() == SECTION_DISPLAY_SEPARATE) {
BeginFloatingWindows("Ocarina Button Tracker");
DrawItemsInRows(ocarinaButtonItems);
Trackers::EndFloatWindows();
}

if (CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.OverworldKeys"), SECTION_DISPLAY_HIDDEN) ==
SECTION_DISPLAY_SEPARATE) {
if (OverworldKeysDisplay() == SECTION_DISPLAY_SEPARATE) {
BeginFloatingWindows("Overworld Key Tracker");
DrawItemsInRows(overworldKeyItems);
Trackers::EndFloatWindows();
}

if (CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.SilverRupees"), SECTION_DISPLAY_HIDDEN) ==
SECTION_DISPLAY_SEPARATE) {
if (SilverRupeesDisplay() == SECTION_DISPLAY_SEPARATE) {
std::vector<ItemTrackerItem> questMatchingSilverRupeeItems;
TrackSilverRupees(&questMatchingSilverRupeeItems);
BeginFloatingWindows("Silver Rupee Tracker");
DrawItemsInRows(questMatchingSilverRupeeItems);
Trackers::EndFloatWindows();
}

if (CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.FishingPole"), SECTION_DISPLAY_EXTENDED_HIDDEN) ==
SECTION_DISPLAY_EXTENDED_SEPARATE) {
if (FishingPoleDisplay() == SECTION_DISPLAY_EXTENDED_SEPARATE) {
BeginFloatingWindows("Fishing Pole Tracker");
DrawItemsInRows(fishingPoleItems);
Trackers::EndFloatWindows();
Expand Down