diff options
| author | Star Rauchenberger <fefferburbia@gmail.com> | 2024-07-24 09:40:22 -0400 | 
|---|---|---|
| committer | Star Rauchenberger <fefferburbia@gmail.com> | 2024-07-24 09:40:22 -0400 | 
| commit | c443acfd0b25b3e4f3446f795777b8dd18b00e2b (patch) | |
| tree | 86340c00f1723310cbab02f0ebc496b25a780278 /src/area_popup.cpp | |
| parent | 378766bcee3cad04256ada937f96b232aba85cf3 (diff) | |
| parent | ab5206255603f6401d9c216ffce26607da16ad33 (diff) | |
| download | lingo-ap-tracker-c443acfd0b25b3e4f3446f795777b8dd18b00e2b.tar.gz lingo-ap-tracker-c443acfd0b25b3e4f3446f795777b8dd18b00e2b.tar.bz2 lingo-ap-tracker-c443acfd0b25b3e4f3446f795777b8dd18b00e2b.zip | |
Merge branch 'main' into panels
Diffstat (limited to 'src/area_popup.cpp')
| -rw-r--r-- | src/area_popup.cpp | 48 | 
1 files changed, 35 insertions, 13 deletions
| diff --git a/src/area_popup.cpp b/src/area_popup.cpp index 58d8897..b18ba62 100644 --- a/src/area_popup.cpp +++ b/src/area_popup.cpp | |||
| @@ -2,10 +2,13 @@ | |||
| 2 | 2 | ||
| 3 | #include <wx/dcbuffer.h> | 3 | #include <wx/dcbuffer.h> | 
| 4 | 4 | ||
| 5 | #include <algorithm> | ||
| 6 | |||
| 5 | #include "ap_state.h" | 7 | #include "ap_state.h" | 
| 6 | #include "game_data.h" | 8 | #include "game_data.h" | 
| 7 | #include "global.h" | 9 | #include "global.h" | 
| 8 | #include "tracker_config.h" | 10 | #include "tracker_config.h" | 
| 11 | #include "tracker_panel.h" | ||
| 9 | #include "tracker_state.h" | 12 | #include "tracker_state.h" | 
| 10 | 13 | ||
| 11 | AreaPopup::AreaPopup(wxWindow* parent, int area_id) | 14 | AreaPopup::AreaPopup(wxWindow* parent, int area_id) | 
| @@ -43,15 +46,23 @@ void AreaPopup::UpdateIndicators() { | |||
| 43 | 46 | ||
| 44 | mem_dc.SetFont(GetFont()); | 47 | mem_dc.SetFont(GetFont()); | 
| 45 | 48 | ||
| 49 | TrackerPanel* tracker_panel = dynamic_cast<TrackerPanel*>(GetParent()); | ||
| 50 | |||
| 46 | std::vector<int> real_locations; | 51 | std::vector<int> real_locations; | 
| 47 | 52 | ||
| 48 | for (int section_id = 0; section_id < map_area.locations.size(); | 53 | for (int section_id = 0; section_id < map_area.locations.size(); | 
| 49 | section_id++) { | 54 | section_id++) { | 
| 50 | const Location& location = map_area.locations.at(section_id); | 55 | const Location& location = map_area.locations.at(section_id); | 
| 51 | 56 | ||
| 52 | if (!AP_IsLocationVisible(location.classification) && | 57 | if (tracker_panel->IsPanelsMode()) { | 
| 53 | !(location.hunt && GetTrackerConfig().show_hunt_panels)) { | 58 | if (!location.panel) { | 
| 54 | continue; | 59 | continue; | 
| 60 | } | ||
| 61 | } else { | ||
| 62 | if (!AP_IsLocationVisible(location.classification) && | ||
| 63 | !(location.hunt && GetTrackerConfig().show_hunt_panels)) { | ||
| 64 | continue; | ||
| 65 | } | ||
| 55 | } | 66 | } | 
| 56 | 67 | ||
| 57 | real_locations.push_back(section_id); | 68 | real_locations.push_back(section_id); | 
| @@ -65,7 +76,7 @@ void AreaPopup::UpdateIndicators() { | |||
| 65 | } | 76 | } | 
| 66 | } | 77 | } | 
| 67 | 78 | ||
| 68 | if (AP_IsPaintingShuffle()) { | 79 | if (AP_IsPaintingShuffle() && !tracker_panel->IsPanelsMode()) { | 
| 69 | for (int painting_id : map_area.paintings) { | 80 | for (int painting_id : map_area.paintings) { | 
| 70 | const PaintingExit& painting = GD_GetPaintingExit(painting_id); | 81 | const PaintingExit& painting = GD_GetPaintingExit(painting_id); | 
| 71 | wxSize item_extent = mem_dc.GetTextExtent(painting.internal_id); // TODO: Replace with a friendly name. | 82 | wxSize item_extent = mem_dc.GetTextExtent(painting.internal_id); // TODO: Replace with a friendly name. | 
| @@ -102,10 +113,21 @@ void AreaPopup::UpdateIndicators() { | |||
| 102 | for (int section_id : real_locations) { | 113 | for (int section_id : real_locations) { | 
| 103 | const Location& location = map_area.locations.at(section_id); | 114 | const Location& location = map_area.locations.at(section_id); | 
| 104 | 115 | ||
| 105 | bool checked = | 116 | bool checked = false; | 
| 106 | AP_HasCheckedGameLocation(location.ap_location_id) || | 117 | if (IsLocationWinCondition(location)) { | 
| 107 | (location.hunt && AP_HasCheckedHuntPanel(location.ap_location_id)) || | 118 | checked = AP_HasReachedGoal(); | 
| 108 | (IsLocationWinCondition(location) && AP_HasReachedGoal()); | 119 | } else if (tracker_panel->IsPanelsMode()) { | 
| 120 | checked = location.panel && std::any_of( | ||
| 121 | location.panels.begin(), location.panels.end(), | ||
| 122 | [tracker_panel](int panel_id) { | ||
| 123 | const Panel& panel = GD_GetPanel(panel_id); | ||
| 124 | return tracker_panel->GetSolvedPanels().contains(panel.nodepath); | ||
| 125 | }); | ||
| 126 | } else { | ||
| 127 | checked = | ||
| 128 | AP_HasCheckedGameLocation(location.ap_location_id) || | ||
| 129 | (location.hunt && AP_HasCheckedHuntPanel(location.ap_location_id)); | ||
| 130 | } | ||
| 109 | 131 | ||
| 110 | wxBitmap* eye_ptr = checked ? &checked_eye_ : &unchecked_eye_; | 132 | wxBitmap* eye_ptr = checked ? &checked_eye_ : &unchecked_eye_; | 
| 111 | 133 | ||
| @@ -123,18 +145,18 @@ void AreaPopup::UpdateIndicators() { | |||
| 123 | cur_height += 10 + 32; | 145 | cur_height += 10 + 32; | 
| 124 | } | 146 | } | 
| 125 | 147 | ||
| 126 | if (AP_IsPaintingShuffle()) { | 148 | if (AP_IsPaintingShuffle() && !tracker_panel->IsPanelsMode()) { | 
| 127 | for (int painting_id : map_area.paintings) { | 149 | for (int painting_id : map_area.paintings) { | 
| 128 | const PaintingExit& painting = GD_GetPaintingExit(painting_id); | 150 | const PaintingExit& painting = GD_GetPaintingExit(painting_id); | 
| 129 | bool checked = AP_IsPaintingChecked(painting.internal_id); | ||
| 130 | wxBitmap* eye_ptr = checked ? &checked_eye_ : &unchecked_eye_; | ||
| 131 | |||
| 132 | mem_dc.DrawBitmap(*eye_ptr, {10, cur_height}); | ||
| 133 | 151 | ||
| 134 | bool reachable = IsPaintingReachable(painting_id); | 152 | bool reachable = IsPaintingReachable(painting_id); | 
| 135 | const wxColour* text_color = reachable ? wxWHITE : wxRED; | 153 | const wxColour* text_color = reachable ? wxWHITE : wxRED; | 
| 136 | mem_dc.SetTextForeground(*text_color); | 154 | mem_dc.SetTextForeground(*text_color); | 
| 137 | 155 | ||
| 156 | bool checked = reachable && AP_IsPaintingChecked(painting.internal_id); | ||
| 157 | wxBitmap* eye_ptr = checked ? &checked_eye_ : &unchecked_eye_; | ||
| 158 | mem_dc.DrawBitmap(*eye_ptr, {10, cur_height}); | ||
| 159 | |||
| 138 | wxSize item_extent = mem_dc.GetTextExtent(painting.internal_id); // TODO: Replace with friendly name. | 160 | wxSize item_extent = mem_dc.GetTextExtent(painting.internal_id); // TODO: Replace with friendly name. | 
| 139 | mem_dc.DrawText(painting.internal_id, | 161 | mem_dc.DrawText(painting.internal_id, | 
| 140 | {10 + 32 + 10, | 162 | {10 + 32 + 10, | 
