diff options
author | Star Rauchenberger <fefferburbia@gmail.com> | 2023-11-17 10:11:41 -0500 |
---|---|---|
committer | Star Rauchenberger <fefferburbia@gmail.com> | 2023-11-17 10:11:41 -0500 |
commit | a9bc708c7eeeada4c59952ce71aa071175f8f27d (patch) | |
tree | b55d7ae50b2e96a44319ba7ec97cebe32fe2febf /src/tracker_panel.cpp | |
parent | 2ee15755735ff6243d3e3b1c2ade4d9bbe0b6dc6 (diff) | |
download | lingo-ap-tracker-a9bc708c7eeeada4c59952ce71aa071175f8f27d.tar.gz lingo-ap-tracker-a9bc708c7eeeada4c59952ce71aa071175f8f27d.tar.bz2 lingo-ap-tracker-a9bc708c7eeeada4c59952ce71aa071175f8f27d.zip |
Added hybrid areas and settings dialog
Diffstat (limited to 'src/tracker_panel.cpp')
-rw-r--r-- | src/tracker_panel.cpp | 58 |
1 files changed, 40 insertions, 18 deletions
diff --git a/src/tracker_panel.cpp b/src/tracker_panel.cpp index 5580068..466440f 100644 --- a/src/tracker_panel.cpp +++ b/src/tracker_panel.cpp | |||
@@ -3,6 +3,7 @@ | |||
3 | #include "ap_state.h" | 3 | #include "ap_state.h" |
4 | #include "area_popup.h" | 4 | #include "area_popup.h" |
5 | #include "game_data.h" | 5 | #include "game_data.h" |
6 | #include "tracker_config.h" | ||
6 | #include "tracker_state.h" | 7 | #include "tracker_state.h" |
7 | 8 | ||
8 | constexpr int AREA_ACTUAL_SIZE = 64; | 9 | constexpr int AREA_ACTUAL_SIZE = 64; |
@@ -91,9 +92,17 @@ void TrackerPanel::Redraw() { | |||
91 | wxMemoryDC dc; | 92 | wxMemoryDC dc; |
92 | dc.SelectObject(rendered_); | 93 | dc.SelectObject(rendered_); |
93 | 94 | ||
94 | for (AreaIndicator &area : areas_) { | 95 | int real_area_size = |
95 | const wxBrush *brush_color = wxGREY_BRUSH; | 96 | final_width * AREA_EFFECTIVE_SIZE / image_size.GetWidth(); |
97 | int actual_border_size = | ||
98 | real_area_size * AREA_BORDER_SIZE / AREA_EFFECTIVE_SIZE; | ||
99 | const wxPoint upper_left_triangle[] = { | ||
100 | {0, 0}, {0, real_area_size}, {real_area_size, 0}}; | ||
101 | const wxPoint lower_right_triangle[] = {{0, real_area_size - 1}, | ||
102 | {real_area_size - 1, 0}, | ||
103 | {real_area_size, real_area_size}}; | ||
96 | 104 | ||
105 | for (AreaIndicator &area : areas_) { | ||
97 | const MapArea &map_area = GD_GetMapArea(area.area_id); | 106 | const MapArea &map_area = GD_GetMapArea(area.area_id); |
98 | if (!AP_IsLocationVisible(map_area.classification)) { | 107 | if (!AP_IsLocationVisible(map_area.classification)) { |
99 | area.active = false; | 108 | area.active = false; |
@@ -115,27 +124,40 @@ void TrackerPanel::Redraw() { | |||
115 | } | 124 | } |
116 | } | 125 | } |
117 | 126 | ||
118 | if (has_reachable_unchecked && has_unreachable_unchecked) { | ||
119 | brush_color = wxYELLOW_BRUSH; | ||
120 | } else if (has_reachable_unchecked) { | ||
121 | brush_color = wxGREEN_BRUSH; | ||
122 | } else if (has_unreachable_unchecked) { | ||
123 | brush_color = wxRED_BRUSH; | ||
124 | } | ||
125 | |||
126 | int real_area_size = | ||
127 | final_width * AREA_EFFECTIVE_SIZE / image_size.GetWidth(); | ||
128 | int actual_border_size = | ||
129 | real_area_size * AREA_BORDER_SIZE / AREA_EFFECTIVE_SIZE; | ||
130 | int real_area_x = final_x + (map_area.map_x - (AREA_EFFECTIVE_SIZE / 2)) * | 127 | int real_area_x = final_x + (map_area.map_x - (AREA_EFFECTIVE_SIZE / 2)) * |
131 | final_width / image_size.GetWidth(); | 128 | final_width / image_size.GetWidth(); |
132 | int real_area_y = final_y + (map_area.map_y - (AREA_EFFECTIVE_SIZE / 2)) * | 129 | int real_area_y = final_y + (map_area.map_y - (AREA_EFFECTIVE_SIZE / 2)) * |
133 | final_width / image_size.GetWidth(); | 130 | final_width / image_size.GetWidth(); |
134 | 131 | ||
135 | dc.SetPen(*wxThePenList->FindOrCreatePen(*wxBLACK, actual_border_size)); | 132 | if (has_reachable_unchecked && has_unreachable_unchecked && |
136 | dc.SetBrush(*brush_color); | 133 | GetTrackerConfig().hybrid_areas) { |
137 | dc.DrawRectangle({real_area_x, real_area_y}, | 134 | dc.SetPen(*wxTRANSPARENT_PEN); |
138 | {real_area_size, real_area_size}); | 135 | dc.SetBrush(*wxGREEN_BRUSH); |
136 | dc.DrawPolygon(3, upper_left_triangle, real_area_x, real_area_y); | ||
137 | |||
138 | dc.SetBrush(*wxRED_BRUSH); | ||
139 | dc.DrawPolygon(3, lower_right_triangle, real_area_x, real_area_y); | ||
140 | |||
141 | dc.SetPen(*wxThePenList->FindOrCreatePen(*wxBLACK, actual_border_size)); | ||
142 | dc.SetBrush(*wxTRANSPARENT_BRUSH); | ||
143 | dc.DrawRectangle({real_area_x, real_area_y}, | ||
144 | {real_area_size, real_area_size}); | ||
145 | |||
146 | } else { | ||
147 | const wxBrush *brush_color = wxGREY_BRUSH; | ||
148 | if (has_reachable_unchecked && has_unreachable_unchecked) { | ||
149 | brush_color = wxYELLOW_BRUSH; | ||
150 | } else if (has_reachable_unchecked) { | ||
151 | brush_color = wxGREEN_BRUSH; | ||
152 | } else if (has_unreachable_unchecked) { | ||
153 | brush_color = wxRED_BRUSH; | ||
154 | } | ||
155 | |||
156 | dc.SetPen(*wxThePenList->FindOrCreatePen(*wxBLACK, actual_border_size)); | ||
157 | dc.SetBrush(*brush_color); | ||
158 | dc.DrawRectangle({real_area_x, real_area_y}, | ||
159 | {real_area_size, real_area_size}); | ||
160 | } | ||
139 | 161 | ||
140 | area.real_x1 = real_area_x; | 162 | area.real_x1 = real_area_x; |
141 | area.real_x2 = real_area_x + real_area_size; | 163 | area.real_x2 = real_area_x + real_area_size; |