Skip to content
Merged
Show file tree
Hide file tree
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
16 changes: 16 additions & 0 deletions gui/desktop/tracker/tracker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,22 @@ void MainWindow::initialize_tracker_world(Settings& settings,
// Copy settings to modify them
trackerSettings = settings;

// Show or hide chart tracker buttons depending on settings
for (auto chartButton : ui->tracker_tab->findChildren<TrackerChartButton*>())
{
// If charts are randomized, show all charts if either chart progression is enabled
if (trackerSettings.randomize_charts)
{
chartButton->setVisible(trackerSettings.progression_treasure_charts || trackerSettings.progression_triforce_charts);
}
// If charts aren't randomized, show chart only if their rerespective chart type is progression
else
{
chartButton->setVisible((trackerSettings.progression_treasure_charts && chartButton->isForTreasureChart()) ||
(trackerSettings.progression_triforce_charts && chartButton->isForTriforceChart()));
}
}

selectedChartIsland = 0;
if (settings.randomize_charts)
{
Expand Down
17 changes: 14 additions & 3 deletions gui/desktop/tracker/tracker_inventory_button.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ void TrackerChartButton::updateIcon()
std::string chartState = "treasure_chart_closed.png";
if(mainWindow->trackerSettings.randomize_charts) {
if(const GameItem chart = mainWindow->chartForIsland(islandNum); chart != GameItem::INVALID) {
if(chart == GameItem::TriforceChart1 || chart == GameItem::TriforceChart2 || chart == GameItem::TriforceChart3) {
if(this->isForTriforceChart()) {
chartState = "triforce_chart_open.png";
}
else {
Expand All @@ -174,15 +174,15 @@ void TrackerChartButton::updateIcon()
}
}
else if(const GameItem chart = roomNumToDefaultChart(islandNum); elementInPool(Item(chart, &mainWindow->trackerWorlds[0]), mainWindow->trackerInventory)) {
if(chart == GameItem::TriforceChart1 || chart == GameItem::TriforceChart2 || chart == GameItem::TriforceChart3) {
if(this->isForTriforceChart()) {
chartState = "triforce_chart_open.png";
}
else {
chartState = "treasure_chart_open.png";
}
}
else {
if(chart == GameItem::TriforceChart1 || chart == GameItem::TriforceChart2 || chart == GameItem::TriforceChart3) {
if(this->isForTriforceChart()) {
chartState = "triforce_chart_closed.png";
}
}
Expand All @@ -192,6 +192,17 @@ void TrackerChartButton::updateIcon()
+ "background-position: center;");
}

bool TrackerChartButton::isForTriforceChart() const
{
const GameItem chart = roomNumToDefaultChart(islandNum);
return chart == GameItem::TriforceChart1 || chart == GameItem::TriforceChart2 || chart == GameItem::TriforceChart3;
}

bool TrackerChartButton::isForTreasureChart() const
{
return !isForTriforceChart();
}

void TrackerChartButton::mouseReleaseEvent(QMouseEvent* e)
{
if (e->button() == Qt::LeftButton)
Expand Down
2 changes: 2 additions & 0 deletions gui/desktop/tracker/tracker_inventory_button.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ class TrackerChartButton : public QLabel
QPoint mouseEnterPosition = QPoint();

void updateIcon();
bool isForTriforceChart() const;
bool isForTreasureChart() const;

signals:
void chart_map_button_pressed(uint8_t islandNum);
Expand Down