about summary refs log tree commit diff stats
path: root/tracker_panel.cpp
diff options
context:
space:
mode:
authorStar Rauchenberger <fefferburbia@gmail.com>2023-05-03 18:27:37 -0400
committerStar Rauchenberger <fefferburbia@gmail.com>2023-05-03 18:27:37 -0400
commit325ea53e7bb873870b46d3e38b2b314493a22f79 (patch)
tree53968efbfd78a5960f68147cd6c671513f04938d /tracker_panel.cpp
parent08ffb400114029569b4043b4f4c5a3f2af9b37b8 (diff)
downloadlingo-ap-tracker-325ea53e7bb873870b46d3e38b2b314493a22f79.tar.gz
lingo-ap-tracker-325ea53e7bb873870b46d3e38b2b314493a22f79.tar.bz2
lingo-ap-tracker-325ea53e7bb873870b46d3e38b2b314493a22f79.zip
Refactored APState
It is no longer a class, because it didn't need to be.
Diffstat (limited to 'tracker_panel.cpp')
-rw-r--r--tracker_panel.cpp27
1 files changed, 12 insertions, 15 deletions
diff --git a/tracker_panel.cpp b/tracker_panel.cpp index 73cac41..0e0569b 100644 --- a/tracker_panel.cpp +++ b/tracker_panel.cpp
@@ -21,7 +21,7 @@ TrackerPanel::TrackerPanel(wxWindow *parent) : wxPanel(parent, wxID_ANY) {
21 21
22 area.popup = new AreaPopup(this, map_area.id); 22 area.popup = new AreaPopup(this, map_area.id);
23 area.popup->SetPosition({0, 0}); 23 area.popup->SetPosition({0, 0});
24 24
25 areas_.push_back(area); 25 areas_.push_back(area);
26 } 26 }
27 27
@@ -34,7 +34,7 @@ TrackerPanel::TrackerPanel(wxWindow *parent) : wxPanel(parent, wxID_ANY) {
34void TrackerPanel::UpdateIndicators() { 34void TrackerPanel::UpdateIndicators() {
35 Redraw(); 35 Redraw();
36 36
37 for (AreaIndicator& area : areas_) { 37 for (AreaIndicator &area : areas_) {
38 area.popup->UpdateIndicators(); 38 area.popup->UpdateIndicators();
39 } 39 }
40} 40}
@@ -90,7 +90,7 @@ void TrackerPanel::Redraw() {
90 wxMemoryDC dc; 90 wxMemoryDC dc;
91 dc.SelectObject(rendered_); 91 dc.SelectObject(rendered_);
92 92
93 for (AreaIndicator& area : areas_) { 93 for (AreaIndicator &area : areas_) {
94 const wxBrush *brush_color = wxGREY_BRUSH; 94 const wxBrush *brush_color = wxGREY_BRUSH;
95 95
96 const MapArea &map_area = GetGameData().GetMapArea(area.area_id); 96 const MapArea &map_area = GetGameData().GetMapArea(area.area_id);
@@ -98,10 +98,8 @@ void TrackerPanel::Redraw() {
98 bool has_unreachable_unchecked = false; 98 bool has_unreachable_unchecked = false;
99 for (int section_id = 0; section_id < map_area.locations.size(); 99 for (int section_id = 0; section_id < map_area.locations.size();
100 section_id++) { 100 section_id++) {
101 if (!GetAPState().HasCheckedGameLocation(area.area_id, 101 if (!AP_HasCheckedGameLocation(area.area_id, section_id)) {
102 section_id)) { 102 if (GetTrackerState().IsLocationReachable(area.area_id, section_id)) {
103 if (GetTrackerState().IsLocationReachable(area.area_id,
104 section_id)) {
105 has_reachable_unchecked = true; 103 has_reachable_unchecked = true;
106 } else { 104 } else {
107 has_unreachable_unchecked = true; 105 has_unreachable_unchecked = true;
@@ -121,16 +119,15 @@ void TrackerPanel::Redraw() {
121 final_width * AREA_EFFECTIVE_SIZE / image_size.GetWidth(); 119 final_width * AREA_EFFECTIVE_SIZE / image_size.GetWidth();
122 int actual_border_size = 120 int actual_border_size =
123 real_area_size * AREA_BORDER_SIZE / AREA_EFFECTIVE_SIZE; 121 real_area_size * AREA_BORDER_SIZE / AREA_EFFECTIVE_SIZE;
124 int real_area_x = 122 int real_area_x = final_x + (map_area.map_x - (AREA_EFFECTIVE_SIZE / 2)) *
125 final_x + (map_area.map_x - (AREA_EFFECTIVE_SIZE / 2)) * 123 final_width / image_size.GetWidth();
126 final_width / image_size.GetWidth(); 124 int real_area_y = final_y + (map_area.map_y - (AREA_EFFECTIVE_SIZE / 2)) *
127 int real_area_y = 125 final_width / image_size.GetWidth();
128 final_y + (map_area.map_y - (AREA_EFFECTIVE_SIZE / 2)) * 126
129 final_width / image_size.GetWidth();
130
131 dc.SetPen(*wxThePenList->FindOrCreatePen(*wxBLACK, actual_border_size)); 127 dc.SetPen(*wxThePenList->FindOrCreatePen(*wxBLACK, actual_border_size));
132 dc.SetBrush(*brush_color); 128 dc.SetBrush(*brush_color);
133 dc.DrawRectangle({real_area_x, real_area_y}, {real_area_size, real_area_size}); 129 dc.DrawRectangle({real_area_x, real_area_y},
130 {real_area_size, real_area_size});
134 131
135 area.real_x1 = real_area_x; 132 area.real_x1 = real_area_x;
136 area.real_x2 = real_area_x + real_area_size; 133 area.real_x2 = real_area_x + real_area_size;