diff options
author | Star Rauchenberger <fefferburbia@gmail.com> | 2023-05-09 11:14:10 -0400 |
---|---|---|
committer | Star Rauchenberger <fefferburbia@gmail.com> | 2023-05-09 11:14:10 -0400 |
commit | 53a2ec277f20a7c260e80af527659e769f6d2ac6 (patch) | |
tree | 93527b1a1458352aa2d35916a3621cd144d48e0c | |
parent | 884549457f8f5d9a13fd575ddf70aa317cd752ed (diff) | |
download | lingo-ap-tracker-53a2ec277f20a7c260e80af527659e769f6d2ac6.tar.gz lingo-ap-tracker-53a2ec277f20a7c260e80af527659e769f6d2ac6.tar.bz2 lingo-ap-tracker-53a2ec277f20a7c260e80af527659e769f6d2ac6.zip |
Support reduce_checks
-rw-r--r-- | src/ap_state.cpp | 6 | ||||
-rw-r--r-- | src/ap_state.h | 2 | ||||
-rw-r--r-- | src/area_popup.cpp | 18 | ||||
-rw-r--r-- | src/game_data.cpp | 19 | ||||
-rw-r--r-- | src/game_data.h | 2 | ||||
-rw-r--r-- | src/tracker_panel.cpp | 10 | ||||
-rw-r--r-- | src/tracker_panel.h | 1 |
7 files changed, 55 insertions, 3 deletions
diff --git a/src/ap_state.cpp b/src/ap_state.cpp index efbca8c..a0d0f66 100644 --- a/src/ap_state.cpp +++ b/src/ap_state.cpp | |||
@@ -56,6 +56,7 @@ struct APState { | |||
56 | bool color_shuffle = false; | 56 | bool color_shuffle = false; |
57 | bool painting_shuffle = false; | 57 | bool painting_shuffle = false; |
58 | int mastery_requirement = 21; | 58 | int mastery_requirement = 21; |
59 | bool reduce_checks = false; | ||
59 | 60 | ||
60 | std::map<std::string, std::string> painting_mapping; | 61 | std::map<std::string, std::string> painting_mapping; |
61 | 62 | ||
@@ -102,6 +103,7 @@ struct APState { | |||
102 | painting_shuffle = false; | 103 | painting_shuffle = false; |
103 | painting_mapping.clear(); | 104 | painting_mapping.clear(); |
104 | mastery_requirement = 21; | 105 | mastery_requirement = 21; |
106 | reduce_checks = false; | ||
105 | 107 | ||
106 | connected = false; | 108 | connected = false; |
107 | has_connection_result = false; | 109 | has_connection_result = false; |
@@ -154,6 +156,8 @@ struct APState { | |||
154 | color_shuffle = slot_data["shuffle_colors"].get<bool>(); | 156 | color_shuffle = slot_data["shuffle_colors"].get<bool>(); |
155 | painting_shuffle = slot_data["shuffle_paintings"].get<bool>(); | 157 | painting_shuffle = slot_data["shuffle_paintings"].get<bool>(); |
156 | mastery_requirement = slot_data["mastery_achievements"].get<int>(); | 158 | mastery_requirement = slot_data["mastery_achievements"].get<int>(); |
159 | reduce_checks = (door_shuffle_mode == kNO_DOORS) && | ||
160 | slot_data["reduce_checks"].get<bool>(); | ||
157 | 161 | ||
158 | if (painting_shuffle && slot_data.contains("painting_entrance_to_exit")) { | 162 | if (painting_shuffle && slot_data.contains("painting_entrance_to_exit")) { |
159 | painting_mapping.clear(); | 163 | painting_mapping.clear(); |
@@ -361,3 +365,5 @@ const std::map<std::string, std::string> AP_GetPaintingMapping() { | |||
361 | } | 365 | } |
362 | 366 | ||
363 | int AP_GetMasteryRequirement() { return GetState().mastery_requirement; } | 367 | int AP_GetMasteryRequirement() { return GetState().mastery_requirement; } |
368 | |||
369 | bool AP_IsReduceChecks() { return GetState().reduce_checks; } | ||
diff --git a/src/ap_state.h b/src/ap_state.h index d880c71..f0dcadb 100644 --- a/src/ap_state.h +++ b/src/ap_state.h | |||
@@ -30,4 +30,6 @@ const std::map<std::string, std::string> AP_GetPaintingMapping(); | |||
30 | 30 | ||
31 | int AP_GetMasteryRequirement(); | 31 | int AP_GetMasteryRequirement(); |
32 | 32 | ||
33 | bool AP_IsReduceChecks(); | ||
34 | |||
33 | #endif /* end of include guard: AP_STATE_H_664A4180 */ | 35 | #endif /* end of include guard: AP_STATE_H_664A4180 */ |
diff --git a/src/area_popup.cpp b/src/area_popup.cpp index 88dffe0..a3ac588 100644 --- a/src/area_popup.cpp +++ b/src/area_popup.cpp | |||
@@ -43,6 +43,21 @@ void AreaPopup::UpdateIndicators() { | |||
43 | const MapArea& map_area = GD_GetMapArea(area_id_); | 43 | const MapArea& map_area = GD_GetMapArea(area_id_); |
44 | for (int section_id = 0; section_id < map_area.locations.size(); | 44 | for (int section_id = 0; section_id < map_area.locations.size(); |
45 | section_id++) { | 45 | section_id++) { |
46 | const Location& location = map_area.locations.at(section_id); | ||
47 | if (location.exclude_reduce) { | ||
48 | wxSizer* container_sizer = | ||
49 | section_labels_[section_id]->GetContainingSizer(); | ||
50 | |||
51 | if (AP_IsReduceChecks()) { | ||
52 | container_sizer->Hide(section_labels_[section_id]); | ||
53 | container_sizer->Hide(eye_indicators_[section_id]); | ||
54 | continue; | ||
55 | } else { | ||
56 | container_sizer->Show(section_labels_[section_id]); | ||
57 | container_sizer->Show(eye_indicators_[section_id]); | ||
58 | } | ||
59 | } | ||
60 | |||
46 | bool checked = AP_HasCheckedGameLocation(area_id_, section_id); | 61 | bool checked = AP_HasCheckedGameLocation(area_id_, section_id); |
47 | bool reachable = IsLocationReachable(area_id_, section_id); | 62 | bool reachable = IsLocationReachable(area_id_, section_id); |
48 | const wxColour* text_color = reachable ? wxWHITE : wxRED; | 63 | const wxColour* text_color = reachable ? wxWHITE : wxRED; |
@@ -50,4 +65,7 @@ void AreaPopup::UpdateIndicators() { | |||
50 | section_labels_[section_id]->SetForegroundColour(*text_color); | 65 | section_labels_[section_id]->SetForegroundColour(*text_color); |
51 | eye_indicators_[section_id]->SetChecked(checked); | 66 | eye_indicators_[section_id]->SetChecked(checked); |
52 | } | 67 | } |
68 | |||
69 | section_labels_[0]->GetContainingSizer()->Layout(); | ||
70 | GetSizer()->Fit(this); | ||
53 | } | 71 | } |
diff --git a/src/game_data.cpp b/src/game_data.cpp index 482818b..f21bc3d 100644 --- a/src/game_data.cpp +++ b/src/game_data.cpp | |||
@@ -343,7 +343,8 @@ struct GameData { | |||
343 | {.name = panel.name, | 343 | {.name = panel.name, |
344 | .ap_location_name = room_name + " - " + panel.name, | 344 | .ap_location_name = room_name + " - " + panel.name, |
345 | .room = panel.room, | 345 | .room = panel.room, |
346 | .panels = {panel.id}}); | 346 | .panels = {panel.id}, |
347 | .exclude_reduce = panel.exclude_reduce}); | ||
347 | } | 348 | } |
348 | } | 349 | } |
349 | 350 | ||
@@ -372,7 +373,21 @@ struct GameData { | |||
372 | map_area.locations.push_back({.name = section_name, | 373 | map_area.locations.push_back({.name = section_name, |
373 | .ap_location_name = door.location_name, | 374 | .ap_location_name = door.location_name, |
374 | .room = door.room, | 375 | .room = door.room, |
375 | .panels = door.panels}); | 376 | .panels = door.panels, |
377 | .exclude_reduce = door.exclude_reduce}); | ||
378 | } | ||
379 | } | ||
380 | |||
381 | for (MapArea &map_area : map_areas_) { | ||
382 | bool all_exclude_reduce = true; | ||
383 | for (const Location &location : map_area.locations) { | ||
384 | if (!location.exclude_reduce) { | ||
385 | all_exclude_reduce = false; | ||
386 | break; | ||
387 | } | ||
388 | } | ||
389 | if (all_exclude_reduce) { | ||
390 | map_area.exclude_reduce = true; | ||
376 | } | 391 | } |
377 | } | 392 | } |
378 | 393 | ||
diff --git a/src/game_data.h b/src/game_data.h index 75eede3..7348809 100644 --- a/src/game_data.h +++ b/src/game_data.h | |||
@@ -71,6 +71,7 @@ struct Location { | |||
71 | std::string ap_location_name; | 71 | std::string ap_location_name; |
72 | int room; | 72 | int room; |
73 | std::vector<int> panels; | 73 | std::vector<int> panels; |
74 | bool exclude_reduce = false; | ||
74 | }; | 75 | }; |
75 | 76 | ||
76 | struct MapArea { | 77 | struct MapArea { |
@@ -79,6 +80,7 @@ struct MapArea { | |||
79 | std::vector<Location> locations; | 80 | std::vector<Location> locations; |
80 | int map_x; | 81 | int map_x; |
81 | int map_y; | 82 | int map_y; |
83 | bool exclude_reduce = false; | ||
82 | }; | 84 | }; |
83 | 85 | ||
84 | const std::vector<MapArea>& GD_GetMapAreas(); | 86 | const std::vector<MapArea>& GD_GetMapAreas(); |
diff --git a/src/tracker_panel.cpp b/src/tracker_panel.cpp index 736db82..90b8eb9 100644 --- a/src/tracker_panel.cpp +++ b/src/tracker_panel.cpp | |||
@@ -52,7 +52,8 @@ void TrackerPanel::OnPaint(wxPaintEvent &event) { | |||
52 | 52 | ||
53 | void TrackerPanel::OnMouseMove(wxMouseEvent &event) { | 53 | void TrackerPanel::OnMouseMove(wxMouseEvent &event) { |
54 | for (AreaIndicator &area : areas_) { | 54 | for (AreaIndicator &area : areas_) { |
55 | if (area.real_x1 <= event.GetX() && event.GetX() < area.real_x2 && | 55 | if (area.active && |
56 | area.real_x1 <= event.GetX() && event.GetX() < area.real_x2 && | ||
56 | area.real_y1 <= event.GetY() && event.GetY() < area.real_y2) { | 57 | area.real_y1 <= event.GetY() && event.GetY() < area.real_y2) { |
57 | area.popup->Show(); | 58 | area.popup->Show(); |
58 | } else { | 59 | } else { |
@@ -94,6 +95,13 @@ void TrackerPanel::Redraw() { | |||
94 | const wxBrush *brush_color = wxGREY_BRUSH; | 95 | const wxBrush *brush_color = wxGREY_BRUSH; |
95 | 96 | ||
96 | const MapArea &map_area = GD_GetMapArea(area.area_id); | 97 | const MapArea &map_area = GD_GetMapArea(area.area_id); |
98 | if (map_area.exclude_reduce && AP_IsReduceChecks()) { | ||
99 | area.active = false; | ||
100 | continue; | ||
101 | } else { | ||
102 | area.active = true; | ||
103 | } | ||
104 | |||
97 | bool has_reachable_unchecked = false; | 105 | bool has_reachable_unchecked = false; |
98 | bool has_unreachable_unchecked = false; | 106 | bool has_unreachable_unchecked = false; |
99 | for (int section_id = 0; section_id < map_area.locations.size(); | 107 | for (int section_id = 0; section_id < map_area.locations.size(); |
diff --git a/src/tracker_panel.h b/src/tracker_panel.h index a871f90..cb4f082 100644 --- a/src/tracker_panel.h +++ b/src/tracker_panel.h | |||
@@ -23,6 +23,7 @@ class TrackerPanel : public wxPanel { | |||
23 | int real_y1 = 0; | 23 | int real_y1 = 0; |
24 | int real_x2 = 0; | 24 | int real_x2 = 0; |
25 | int real_y2 = 0; | 25 | int real_y2 = 0; |
26 | bool active = true; | ||
26 | }; | 27 | }; |
27 | 28 | ||
28 | void OnPaint(wxPaintEvent &event); | 29 | void OnPaint(wxPaintEvent &event); |