mirror of
https://github.com/HarbourMasters/Shipwright
synced 2026-09-10 04:42:04 -04:00
item tracker: don't render items for disabled settings (#7151)
This commit is contained in:
@@ -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();
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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) {
|
||||
@@ -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) {
|
||||
@@ -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) {
|
||||
@@ -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) {
|
||||
@@ -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));
|
||||
@@ -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) {
|
||||
@@ -1648,8 +1703,7 @@ 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) {
|
||||
@@ -1657,12 +1711,11 @@ void UpdateVectors() {
|
||||
}
|
||||
|
||||
// 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));
|
||||
@@ -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) {
|
||||
@@ -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) {
|
||||
@@ -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));
|
||||
}
|
||||
@@ -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");
|
||||
@@ -1850,57 +1897,51 @@ 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");
|
||||
@@ -1908,8 +1949,7 @@ void ItemTrackerWindow::DrawElement() {
|
||||
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();
|
||||
|
||||
Reference in New Issue
Block a user