From 53a2ec277f20a7c260e80af527659e769f6d2ac6 Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Tue, 9 May 2023 11:14:10 -0400 Subject: Support reduce_checks --- src/ap_state.cpp | 6 ++++++ src/ap_state.h | 2 ++ src/area_popup.cpp | 18 ++++++++++++++++++ src/game_data.cpp | 19 +++++++++++++++++-- src/game_data.h | 2 ++ src/tracker_panel.cpp | 10 +++++++++- src/tracker_panel.h | 1 + 7 files changed, 55 insertions(+), 3 deletions(-) (limited to 'src') 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 { bool color_shuffle = false; bool painting_shuffle = false; int mastery_requirement = 21; + bool reduce_checks = false; std::map painting_mapping; @@ -102,6 +103,7 @@ struct APState { painting_shuffle = false; painting_mapping.clear(); mastery_requirement = 21; + reduce_checks = false; connected = false; has_connection_result = false; @@ -154,6 +156,8 @@ struct APState { color_shuffle = slot_data["shuffle_colors"].get(); painting_shuffle = slot_data["shuffle_paintings"].get(); mastery_requirement = slot_data["mastery_achievements"].get(); + reduce_checks = (door_shuffle_mode == kNO_DOORS) && + slot_data["reduce_checks"].get(); if (painting_shuffle && slot_data.contains("painting_entrance_to_exit")) { painting_mapping.clear(); @@ -361,3 +365,5 @@ const std::map AP_GetPaintingMapping() { } int AP_GetMasteryRequirement() { return GetState().mastery_requirement; } + +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 AP_GetPaintingMapping(); int AP_GetMasteryRequirement(); +bool AP_IsReduceChecks(); + #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() { const MapArea& map_area = GD_GetMapArea(area_id_); for (int section_id = 0; section_id < map_area.locations.size(); section_id++) { + const Location& location = map_area.locations.at(section_id); + if (location.exclude_reduce) { + wxSizer* container_sizer = + section_labels_[section_id]->GetContainingSizer(); + + if (AP_IsReduceChecks()) { + container_sizer->Hide(section_labels_[section_id]); + container_sizer->Hide(eye_indicators_[section_id]); + continue; + } else { + container_sizer->Show(section_labels_[section_id]); + container_sizer->Show(eye_indicators_[section_id]); + } + } + bool checked = AP_HasCheckedGameLocation(area_id_, section_id); bool reachable = IsLocationReachable(area_id_, section_id); const wxColour* text_color = reachable ? wxWHITE : wxRED; @@ -50,4 +65,7 @@ void AreaPopup::UpdateIndicators() { section_labels_[section_id]->SetForegroundColour(*text_color); eye_indicators_[section_id]->SetChecked(checked); } + + section_labels_[0]->GetContainingSizer()->Layout(); + GetSizer()->Fit(this); } 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 { {.name = panel.name, .ap_location_name = room_name + " - " + panel.name, .room = panel.room, - .panels = {panel.id}}); + .panels = {panel.id}, + .exclude_reduce = panel.exclude_reduce}); } } @@ -372,7 +373,21 @@ struct GameData { map_area.locations.push_back({.name = section_name, .ap_location_name = door.location_name, .room = door.room, - .panels = door.panels}); + .panels = door.panels, + .exclude_reduce = door.exclude_reduce}); + } + } + + for (MapArea &map_area : map_areas_) { + bool all_exclude_reduce = true; + for (const Location &location : map_area.locations) { + if (!location.exclude_reduce) { + all_exclude_reduce = false; + break; + } + } + if (all_exclude_reduce) { + map_area.exclude_reduce = true; } } 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 { std::string ap_location_name; int room; std::vector panels; + bool exclude_reduce = false; }; struct MapArea { @@ -79,6 +80,7 @@ struct MapArea { std::vector locations; int map_x; int map_y; + bool exclude_reduce = false; }; const std::vector& 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) { void TrackerPanel::OnMouseMove(wxMouseEvent &event) { for (AreaIndicator &area : areas_) { - if (area.real_x1 <= event.GetX() && event.GetX() < area.real_x2 && + if (area.active && + area.real_x1 <= event.GetX() && event.GetX() < area.real_x2 && area.real_y1 <= event.GetY() && event.GetY() < area.real_y2) { area.popup->Show(); } else { @@ -94,6 +95,13 @@ void TrackerPanel::Redraw() { const wxBrush *brush_color = wxGREY_BRUSH; const MapArea &map_area = GD_GetMapArea(area.area_id); + if (map_area.exclude_reduce && AP_IsReduceChecks()) { + area.active = false; + continue; + } else { + area.active = true; + } + bool has_reachable_unchecked = false; bool has_unreachable_unchecked = false; 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 { int real_y1 = 0; int real_x2 = 0; int real_y2 = 0; + bool active = true; }; void OnPaint(wxPaintEvent &event); -- cgit 1.4.1