From 83748ed7381253f646148291027b43b4cd28948a Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Wed, 24 Jul 2024 11:33:21 -0400 Subject: Panel icon should be red for unreachable checked paintings --- src/tracker_panel.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/tracker_panel.cpp b/src/tracker_panel.cpp index 2e1497b..42c3132 100644 --- a/src/tracker_panel.cpp +++ b/src/tracker_panel.cpp @@ -223,9 +223,8 @@ void TrackerPanel::Redraw() { if (AP_IsPaintingShuffle() && !panels_mode_) { for (int painting_id : map_area.paintings) { const PaintingExit &painting = GD_GetPaintingExit(painting_id); - if (!AP_IsPaintingChecked(painting.internal_id)) { - bool reachable = IsPaintingReachable(painting_id); - + bool reachable = IsPaintingReachable(painting_id); + if (!reachable || !AP_IsPaintingChecked(painting.internal_id)) { if (reachable) { has_reachable_unchecked = true; } else { -- cgit 1.4.1 From 4ffb5871e4bc54ab6765fcd738835c295d1e2924 Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Wed, 24 Jul 2024 13:36:07 -0400 Subject: Pilgrim Antechamber sunwarp now shows if pilgrimage is doable --- src/network_set.cpp | 13 +++++++++++++ src/network_set.h | 2 ++ src/subway_map.cpp | 20 +++++++++++++++++++- src/tracker_state.cpp | 13 +++++++++++++ src/tracker_state.h | 2 ++ 5 files changed, 49 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/network_set.cpp b/src/network_set.cpp index 6d2a098..2a9e12c 100644 --- a/src/network_set.cpp +++ b/src/network_set.cpp @@ -21,6 +21,19 @@ void NetworkSet::AddLink(int id1, int id2) { network_by_item_[id2].insert({id1, id2}); } +void NetworkSet::AddLinkToNetwork(int network_id, int id1, int id2) { + if (id2 > id1) { + // Make sure id1 < id2 + std::swap(id1, id2); + } + + if (!network_by_item_.count(network_id)) { + network_by_item_[network_id] = {}; + } + + network_by_item_[network_id].insert({id1, id2}); +} + bool NetworkSet::IsItemInNetwork(int id) const { return network_by_item_.count(id); } diff --git a/src/network_set.h b/src/network_set.h index e6f0c07..cec3f39 100644 --- a/src/network_set.h +++ b/src/network_set.h @@ -13,6 +13,8 @@ class NetworkSet { void AddLink(int id1, int id2); + void AddLinkToNetwork(int network_id, int id1, int id2); + bool IsItemInNetwork(int id) const; const std::set>& GetNetworkGraph(int id) const; diff --git a/src/subway_map.cpp b/src/subway_map.cpp index 9bfedf9..e7ac317 100644 --- a/src/subway_map.cpp +++ b/src/subway_map.cpp @@ -107,7 +107,7 @@ void SubwayMap::OnConnect() { if (!AP_IsSunwarpShuffle() && subway_item.sunwarp && subway_item.sunwarp->type != SubwaySunwarpType::kFinal) { - std::string tag = fmt::format("subway{}", subway_item.sunwarp->dots); + std::string tag = fmt::format("sunwarp{}", subway_item.sunwarp->dots); tagged[tag].push_back(subway_item.id); } @@ -119,6 +119,9 @@ void SubwayMap::OnConnect() { } if (AP_IsSunwarpShuffle()) { + SubwaySunwarp final_sunwarp{.dots = 6, .type = SubwaySunwarpType::kFinal}; + int final_sunwarp_item = GD_GetSubwayItemForSunwarp(final_sunwarp); + for (const auto &[index, mapping] : AP_GetSunwarpMapping()) { std::string tag = fmt::format("sunwarp{}", mapping.dots); @@ -142,6 +145,11 @@ void SubwayMap::OnConnect() { tagged[tag].push_back(GD_GetSubwayItemForSunwarp(fromWarp)); tagged[tag].push_back(GD_GetSubwayItemForSunwarp(toWarp)); + + networks_.AddLinkToNetwork( + final_sunwarp_item, GD_GetSubwayItemForSunwarp(fromWarp), + mapping.dots == 6 ? final_sunwarp_item + : GD_GetSubwayItemForSunwarp(toWarp)); } } @@ -570,6 +578,16 @@ void SubwayMap::Redraw() { brush_color = wxRED_BRUSH; } } + } else if (subway_item.sunwarp && + subway_item.sunwarp->type == SubwaySunwarpType::kFinal && + AP_IsPilgrimageEnabled()) { + draw_type = ItemDrawType::kBox; + + if (IsPilgrimageDoable()) { + brush_color = wxGREEN_BRUSH; + } else { + brush_color = wxRED_BRUSH; + } } else if (!subway_item.paintings.empty()) { if (AP_IsPaintingShuffle()) { bool has_checked_painting = false; diff --git a/src/tracker_state.cpp b/src/tracker_state.cpp index bd63076..2ee705c 100644 --- a/src/tracker_state.cpp +++ b/src/tracker_state.cpp @@ -152,6 +152,7 @@ struct TrackerState { std::mutex reachability_mutex; RequirementCalculator requirements; std::map> door_reports; + bool pilgrimage_doable = false; }; enum Decision { kYes, kNo, kMaybe }; @@ -361,6 +362,8 @@ class StateCalculator { return door_report_; } + bool IsPilgrimageDoable() const { return pilgrimage_doable_; } + std::string GetPathToRoom(int room_id) const { if (!paths_.count(room_id)) { return ""; @@ -572,6 +575,8 @@ class StateCalculator { } } + pilgrimage_doable_ = true; + return kYes; } @@ -612,6 +617,7 @@ class StateCalculator { std::set solveable_panels_; std::set reachable_paintings_; std::map> door_report_; + bool pilgrimage_doable_ = false; std::map> paths_; }; @@ -663,6 +669,7 @@ void RecalculateReachability() { std::swap(GetState().reachable_doors, new_reachable_doors); std::swap(GetState().reachable_paintings, reachable_paintings); std::swap(GetState().door_reports, door_reports); + GetState().pilgrimage_doable = state_calculator.IsPilgrimageDoable(); } bool IsLocationReachable(int location_id) { @@ -692,3 +699,9 @@ const std::map& GetDoorRequirements(int door_id) { return GetState().door_reports[door_id]; } + +bool IsPilgrimageDoable() { + std::lock_guard reachability_guard(GetState().reachability_mutex); + + return GetState().pilgrimage_doable; +} diff --git a/src/tracker_state.h b/src/tracker_state.h index c7857a0..a8f155d 100644 --- a/src/tracker_state.h +++ b/src/tracker_state.h @@ -16,4 +16,6 @@ bool IsPaintingReachable(int painting_id); const std::map& GetDoorRequirements(int door_id); +bool IsPilgrimageDoable(); + #endif /* end of include guard: TRACKER_STATE_H_8639BC90 */ -- cgit 1.4.1 From e7503333e1a71fab0c97315ae0a8ac1388f10d14 Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Wed, 24 Jul 2024 14:17:40 -0400 Subject: Save analysis uses remote location for non-counting panels --- src/area_popup.cpp | 14 +++++++------- src/game_data.cpp | 4 ++-- src/game_data.h | 4 ++-- src/tracker_panel.cpp | 15 +++++++++------ 4 files changed, 20 insertions(+), 17 deletions(-) (limited to 'src') diff --git a/src/area_popup.cpp b/src/area_popup.cpp index b18ba62..8d6487e 100644 --- a/src/area_popup.cpp +++ b/src/area_popup.cpp @@ -55,7 +55,7 @@ void AreaPopup::UpdateIndicators() { const Location& location = map_area.locations.at(section_id); if (tracker_panel->IsPanelsMode()) { - if (!location.panel) { + if (!location.single_panel) { continue; } } else { @@ -117,12 +117,12 @@ void AreaPopup::UpdateIndicators() { if (IsLocationWinCondition(location)) { checked = AP_HasReachedGoal(); } else if (tracker_panel->IsPanelsMode()) { - checked = location.panel && std::any_of( - location.panels.begin(), location.panels.end(), - [tracker_panel](int panel_id) { - const Panel& panel = GD_GetPanel(panel_id); - return tracker_panel->GetSolvedPanels().contains(panel.nodepath); - }); + const Panel& panel = GD_GetPanel(*location.single_panel); + if (panel.non_counting) { + checked = AP_HasCheckedGameLocation(location.ap_location_id); + } else { + checked = tracker_panel->GetSolvedPanels().contains(panel.nodepath); + } } else { checked = AP_HasCheckedGameLocation(location.ap_location_id) || diff --git a/src/game_data.cpp b/src/game_data.cpp index b8e1386..c39e239 100644 --- a/src/game_data.cpp +++ b/src/game_data.cpp @@ -570,7 +570,7 @@ struct GameData { .panels = {panel.id}, .classification = classification, .hunt = panel.hunt, - .panel = true}); + .single_panel = panel.id}); locations_by_name[location_name] = {area_id, map_area.locations.size() - 1}; } @@ -623,7 +623,7 @@ struct GameData { for (const Location &location : map_area.locations) { map_area.classification |= location.classification; map_area.hunt |= location.hunt; - map_area.panel |= location.panel; + map_area.has_single_panel |= location.single_panel.has_value(); } } diff --git a/src/game_data.h b/src/game_data.h index 71bc533..3179365 100644 --- a/src/game_data.h +++ b/src/game_data.h @@ -114,7 +114,7 @@ struct Location { std::vector panels; int classification = 0; bool hunt = false; - bool panel = false; + std::optional single_panel; }; struct MapArea { @@ -126,7 +126,7 @@ struct MapArea { int map_y; int classification = 0; bool hunt = false; - bool panel = false; + bool has_single_panel = false; }; enum class SubwaySunwarpType { diff --git a/src/tracker_panel.cpp b/src/tracker_panel.cpp index 42c3132..27e825a 100644 --- a/src/tracker_panel.cpp +++ b/src/tracker_panel.cpp @@ -180,7 +180,7 @@ void TrackerPanel::Redraw() { for (AreaIndicator &area : areas_) { const MapArea &map_area = GD_GetMapArea(area.area_id); if (panels_mode_) { - area.active = map_area.panel; + area.active = map_area.has_single_panel; } else if (!AP_IsLocationVisible(map_area.classification) && !(map_area.hunt && GetTrackerConfig().show_hunt_panels) && !(AP_IsPaintingShuffle() && !map_area.paintings.empty())) { @@ -200,11 +200,14 @@ void TrackerPanel::Redraw() { if (IsLocationWinCondition(section)) { has_unchecked = !AP_HasReachedGoal(); } else if (panels_mode_) { - has_unchecked = section.panel && std::any_of( - section.panels.begin(), section.panels.end(), [this](int panel_id) { - const Panel &panel = GD_GetPanel(panel_id); - return !solved_panels_.contains(panel.nodepath); - }); + if (section.single_panel) { + const Panel &panel = GD_GetPanel(*section.single_panel); + if (panel.non_counting) { + has_unchecked = !AP_HasCheckedGameLocation(section.ap_location_id); + } else { + has_unchecked = !solved_panels_.contains(panel.nodepath); + } + } } else if (AP_IsLocationVisible(section.classification)) { has_unchecked = !AP_HasCheckedGameLocation(section.ap_location_id); } else if (section.hunt && GetTrackerConfig().show_hunt_panels) { -- cgit 1.4.1 From c3106d027414ca73a106df6894bb6a30b3a296ce Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Wed, 24 Jul 2024 14:23:08 -0400 Subject: Fixed subway squares for shuffled sunwarps showing unshuffled access --- src/subway_map.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/subway_map.cpp b/src/subway_map.cpp index e7ac317..5b3ff5f 100644 --- a/src/subway_map.cpp +++ b/src/subway_map.cpp @@ -563,6 +563,7 @@ void SubwayMap::Redraw() { ItemDrawType draw_type = ItemDrawType::kNone; const wxBrush *brush_color = wxGREY_BRUSH; std::optional shade_color; + std::optional subway_door = GetRealSubwayDoor(subway_item); if (AP_HasEarlyColorHallways() && subway_item.special == "starting_room_paintings") { @@ -624,10 +625,10 @@ void SubwayMap::Redraw() { } else if (!subway_item.tags.empty()) { draw_type = ItemDrawType::kOwl; } - } else if (subway_item.door) { + } else if (subway_door) { draw_type = ItemDrawType::kBox; - if (IsDoorOpen(*subway_item.door)) { + if (IsDoorOpen(*subway_door)) { brush_color = wxGREEN_BRUSH; } else { brush_color = wxRED_BRUSH; -- cgit 1.4.1 From 9b70c6ccd3ea6c65d927af8b506ffdea374a4dc2 Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Thu, 25 Jul 2024 08:07:21 -0400 Subject: Bump version --- src/version.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/version.h b/src/version.h index ed5e97c..24c04b4 100644 --- a/src/version.h +++ b/src/version.h @@ -36,6 +36,6 @@ struct Version { } }; -constexpr const Version kTrackerVersion = Version(0, 11, 0); +constexpr const Version kTrackerVersion = Version(0, 11, 1); #endif /* end of include guard: VERSION_H_C757E53C */ \ No newline at end of file -- cgit 1.4.1