diff options
Diffstat (limited to 'src/tracker_state.cpp')
-rw-r--r-- | src/tracker_state.cpp | 49 |
1 files changed, 39 insertions, 10 deletions
diff --git a/src/tracker_state.cpp b/src/tracker_state.cpp index 2ee705c..4a49fac 100644 --- a/src/tracker_state.cpp +++ b/src/tracker_state.cpp | |||
@@ -19,11 +19,12 @@ namespace { | |||
19 | struct Requirements { | 19 | struct Requirements { |
20 | bool disabled = false; | 20 | bool disabled = false; |
21 | 21 | ||
22 | std::set<int> doors; // non-grouped, handles progressive | 22 | std::set<int> doors; // non-grouped, handles progressive |
23 | std::set<int> items; // all other items | 23 | std::set<int> panel_doors; // non-grouped, handles progressive |
24 | std::set<int> rooms; // maybe | 24 | std::set<int> items; // all other items |
25 | bool mastery = false; // maybe | 25 | std::set<int> rooms; // maybe |
26 | bool panel_hunt = false; // maybe | 26 | bool mastery = false; // maybe |
27 | bool panel_hunt = false; // maybe | ||
27 | 28 | ||
28 | void Merge(const Requirements& rhs) { | 29 | void Merge(const Requirements& rhs) { |
29 | if (rhs.disabled) { | 30 | if (rhs.disabled) { |
@@ -33,6 +34,9 @@ struct Requirements { | |||
33 | for (int id : rhs.doors) { | 34 | for (int id : rhs.doors) { |
34 | doors.insert(id); | 35 | doors.insert(id); |
35 | } | 36 | } |
37 | for (int id : rhs.panel_doors) { | ||
38 | panel_doors.insert(id); | ||
39 | } | ||
36 | for (int id : rhs.items) { | 40 | for (int id : rhs.items) { |
37 | items.insert(id); | 41 | items.insert(id); |
38 | } | 42 | } |
@@ -78,15 +82,14 @@ class RequirementCalculator { | |||
78 | requirements.doors.insert(door_obj.id); | 82 | requirements.doors.insert(door_obj.id); |
79 | break; | 83 | break; |
80 | } | 84 | } |
81 | } else if (AP_GetDoorShuffleMode() == kNO_DOORS || door_obj.skip_item) { | 85 | } else if (AP_GetDoorShuffleMode() != kDOORS_MODE || door_obj.skip_item) { |
82 | requirements.rooms.insert(door_obj.room); | 86 | requirements.rooms.insert(door_obj.room); |
83 | 87 | ||
84 | for (int panel_id : door_obj.panels) { | 88 | for (int panel_id : door_obj.panels) { |
85 | const Requirements& panel_reqs = GetPanel(panel_id); | 89 | const Requirements& panel_reqs = GetPanel(panel_id); |
86 | requirements.Merge(panel_reqs); | 90 | requirements.Merge(panel_reqs); |
87 | } | 91 | } |
88 | } else if (AP_GetDoorShuffleMode() == kSIMPLE_DOORS && | 92 | } else if (AP_AreDoorsGrouped() && !door_obj.group_name.empty()) { |
89 | !door_obj.group_name.empty()) { | ||
90 | requirements.items.insert(door_obj.group_ap_item_id); | 93 | requirements.items.insert(door_obj.group_ap_item_id); |
91 | } else { | 94 | } else { |
92 | requirements.doors.insert(door_obj.id); | 95 | requirements.doors.insert(door_obj.id); |
@@ -133,6 +136,17 @@ class RequirementCalculator { | |||
133 | requirements.items.insert(GD_GetItemIdForColor(color)); | 136 | requirements.items.insert(GD_GetItemIdForColor(color)); |
134 | } | 137 | } |
135 | } | 138 | } |
139 | |||
140 | if (panel_obj.panel_door != -1 && | ||
141 | AP_GetDoorShuffleMode() == kPANELS_MODE) { | ||
142 | const PanelDoor& panel_door_obj = GD_GetPanelDoor(panel_obj.panel_door); | ||
143 | |||
144 | if (panel_door_obj.group_ap_item_id != -1 && AP_AreDoorsGrouped()) { | ||
145 | requirements.items.insert(panel_door_obj.group_ap_item_id); | ||
146 | } else { | ||
147 | requirements.panel_doors.insert(panel_obj.panel_door); | ||
148 | } | ||
149 | } | ||
136 | 150 | ||
137 | panels_[panel_id] = requirements; | 151 | panels_[panel_id] = requirements; |
138 | } | 152 | } |
@@ -296,7 +310,7 @@ class StateCalculator { | |||
296 | if (AP_HasEarlyColorHallways() && room_obj.name == "Starting Room") { | 310 | if (AP_HasEarlyColorHallways() && room_obj.name == "Starting Room") { |
297 | new_boundary.push_back( | 311 | new_boundary.push_back( |
298 | {.source_room = room_exit.destination_room, | 312 | {.source_room = room_exit.destination_room, |
299 | .destination_room = GD_GetRoomByName("Outside The Undeterred"), | 313 | .destination_room = GD_GetRoomByName("Color Hallways"), |
300 | .type = EntranceType::kPainting}); | 314 | .type = EntranceType::kPainting}); |
301 | } | 315 | } |
302 | 316 | ||
@@ -378,7 +392,8 @@ class StateCalculator { | |||
378 | } | 392 | } |
379 | 393 | ||
380 | private: | 394 | private: |
381 | Decision IsNonGroupedDoorReachable(const Door& door_obj) { | 395 | template <typename T> |
396 | Decision IsNonGroupedDoorReachable(const T& door_obj) { | ||
382 | bool has_item = AP_HasItem(door_obj.ap_item_id); | 397 | bool has_item = AP_HasItem(door_obj.ap_item_id); |
383 | 398 | ||
384 | if (!has_item) { | 399 | if (!has_item) { |
@@ -414,6 +429,20 @@ class StateCalculator { | |||
414 | } | 429 | } |
415 | } | 430 | } |
416 | 431 | ||
432 | for (int panel_door_id : reqs.panel_doors) { | ||
433 | const PanelDoor& panel_door_obj = GD_GetPanelDoor(panel_door_id); | ||
434 | Decision decision = IsNonGroupedDoorReachable(panel_door_obj); | ||
435 | |||
436 | if (report) { | ||
437 | (*report)[AP_GetItemName(panel_door_obj.ap_item_id)] = | ||
438 | (decision == kYes); | ||
439 | } | ||
440 | |||
441 | if (decision != kYes) { | ||
442 | final_decision = decision; | ||
443 | } | ||
444 | } | ||
445 | |||
417 | for (int item_id : reqs.items) { | 446 | for (int item_id : reqs.items) { |
418 | bool has_item = AP_HasItem(item_id); | 447 | bool has_item = AP_HasItem(item_id); |
419 | if (report) { | 448 | if (report) { |