diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/ap_state.cpp | 9 | ||||
-rw-r--r-- | src/game_data.cpp | 30 | ||||
-rw-r--r-- | src/game_data.h | 1 | ||||
-rw-r--r-- | src/tracker_state.cpp | 38 | ||||
-rw-r--r-- | src/version.h | 2 |
5 files changed, 56 insertions, 24 deletions
diff --git a/src/ap_state.cpp b/src/ap_state.cpp index 9aceef6..b0b4f0b 100644 --- a/src/ap_state.cpp +++ b/src/ap_state.cpp | |||
@@ -241,8 +241,11 @@ struct APState { | |||
241 | pilgrimage_allows_paintings = | 241 | pilgrimage_allows_paintings = |
242 | slot_data.contains("pilgrimage_allows_paintings") && | 242 | slot_data.contains("pilgrimage_allows_paintings") && |
243 | slot_data["pilgrimage_allows_paintings"].get<int>() == 1; | 243 | slot_data["pilgrimage_allows_paintings"].get<int>() == 1; |
244 | sunwarp_access = slot_data["sunwarp_access"].get<SunwarpAccess>(); | 244 | sunwarp_access = slot_data.contains("sunwarp_access") |
245 | sunwarp_shuffle = slot_data["shuffle_sunwarps"].get<int>() == 1; | 245 | ? slot_data["sunwarp_access"].get<SunwarpAccess>() |
246 | : kSUNWARP_ACCESS_NORMAL; | ||
247 | sunwarp_shuffle = slot_data.contains("shuffle_sunwarps") && | ||
248 | slot_data["shuffle_sunwarps"].get<int>() == 1; | ||
246 | 249 | ||
247 | if (painting_shuffle && slot_data.contains("painting_entrance_to_exit")) { | 250 | if (painting_shuffle && slot_data.contains("painting_entrance_to_exit")) { |
248 | painting_mapping.clear(); | 251 | painting_mapping.clear(); |
@@ -380,7 +383,7 @@ struct APState { | |||
380 | } else { | 383 | } else { |
381 | data_storage.erase(key); | 384 | data_storage.erase(key); |
382 | } | 385 | } |
383 | 386 | ||
384 | TrackerLog("Data storage " + key + " retrieved as null"); | 387 | TrackerLog("Data storage " + key + " retrieved as null"); |
385 | } | 388 | } |
386 | } | 389 | } |
diff --git a/src/game_data.cpp b/src/game_data.cpp index dbc269a..bc4f41b 100644 --- a/src/game_data.cpp +++ b/src/game_data.cpp | |||
@@ -254,6 +254,11 @@ struct GameData { | |||
254 | achievement_panels_.push_back(panel_id); | 254 | achievement_panels_.push_back(panel_id); |
255 | } | 255 | } |
256 | 256 | ||
257 | if (panel_it.second["location_name"]) { | ||
258 | panels_[panel_id].location_name = | ||
259 | panel_it.second["location_name"].as<std::string>(); | ||
260 | } | ||
261 | |||
257 | if (panel_it.second["hunt"]) { | 262 | if (panel_it.second["hunt"]) { |
258 | panels_[panel_id].hunt = panel_it.second["hunt"].as<bool>(); | 263 | panels_[panel_id].hunt = panel_it.second["hunt"].as<bool>(); |
259 | } | 264 | } |
@@ -521,8 +526,21 @@ struct GameData { | |||
521 | std::string room_name = rooms_[room_id].name; | 526 | std::string room_name = rooms_[room_id].name; |
522 | 527 | ||
523 | std::string area_name = room_name; | 528 | std::string area_name = room_name; |
524 | if (fold_areas.count(room_name)) { | 529 | std::string section_name = panel.name; |
525 | int fold_area_id = fold_areas[room_name]; | 530 | std::string location_name = room_name + " - " + panel.name; |
531 | |||
532 | if (!panel.location_name.empty()) { | ||
533 | location_name = panel.location_name; | ||
534 | |||
535 | size_t divider_pos = location_name.find(" - "); | ||
536 | if (divider_pos != std::string::npos) { | ||
537 | area_name = location_name.substr(0, divider_pos); | ||
538 | section_name = location_name.substr(divider_pos + 3); | ||
539 | } | ||
540 | } | ||
541 | |||
542 | if (fold_areas.count(area_name)) { | ||
543 | int fold_area_id = fold_areas[area_name]; | ||
526 | area_name = map_areas_[fold_area_id].name; | 544 | area_name = map_areas_[fold_area_id].name; |
527 | } | 545 | } |
528 | 546 | ||
@@ -542,15 +560,15 @@ struct GameData { | |||
542 | MapArea &map_area = map_areas_[area_id]; | 560 | MapArea &map_area = map_areas_[area_id]; |
543 | // room field should be the original room ID | 561 | // room field should be the original room ID |
544 | map_area.locations.push_back( | 562 | map_area.locations.push_back( |
545 | {.name = panel.name, | 563 | {.name = section_name, |
546 | .ap_location_name = room_name + " - " + panel.name, | 564 | .ap_location_name = location_name, |
547 | .ap_location_id = panel.ap_location_id, | 565 | .ap_location_id = panel.ap_location_id, |
548 | .room = panel.room, | 566 | .room = panel.room, |
549 | .panels = {panel.id}, | 567 | .panels = {panel.id}, |
550 | .classification = classification, | 568 | .classification = classification, |
551 | .hunt = panel.hunt}); | 569 | .hunt = panel.hunt}); |
552 | locations_by_name[map_area.locations.back().ap_location_name] = { | 570 | locations_by_name[location_name] = {area_id, |
553 | area_id, map_area.locations.size() - 1}; | 571 | map_area.locations.size() - 1}; |
554 | } | 572 | } |
555 | 573 | ||
556 | for (int door_id : door_definition_order_) { | 574 | for (int door_id : door_definition_order_) { |
diff --git a/src/game_data.h b/src/game_data.h index 88f8a13..e30675a 100644 --- a/src/game_data.h +++ b/src/game_data.h | |||
@@ -51,6 +51,7 @@ struct Panel { | |||
51 | bool exclude_reduce = false; | 51 | bool exclude_reduce = false; |
52 | bool achievement = false; | 52 | bool achievement = false; |
53 | std::string achievement_name; | 53 | std::string achievement_name; |
54 | std::string location_name; | ||
54 | bool non_counting = false; | 55 | bool non_counting = false; |
55 | int ap_location_id = -1; | 56 | int ap_location_id = -1; |
56 | bool hunt = false; | 57 | bool hunt = false; |
diff --git a/src/tracker_state.cpp b/src/tracker_state.cpp index 0101e98..640a159 100644 --- a/src/tracker_state.cpp +++ b/src/tracker_state.cpp | |||
@@ -27,7 +27,7 @@ TrackerState& GetState() { | |||
27 | class StateCalculator; | 27 | class StateCalculator; |
28 | 28 | ||
29 | struct StateCalculatorOptions { | 29 | struct StateCalculatorOptions { |
30 | std::string start = "Menu"; | 30 | int start; |
31 | bool pilgrimage = false; | 31 | bool pilgrimage = false; |
32 | StateCalculator* parent = nullptr; | 32 | StateCalculator* parent = nullptr; |
33 | }; | 33 | }; |
@@ -42,8 +42,7 @@ class StateCalculator { | |||
42 | void Calculate() { | 42 | void Calculate() { |
43 | std::list<int> panel_boundary; | 43 | std::list<int> panel_boundary; |
44 | std::list<Exit> flood_boundary; | 44 | std::list<Exit> flood_boundary; |
45 | flood_boundary.push_back( | 45 | flood_boundary.push_back({.destination_room = options_.start}); |
46 | {.destination_room = GD_GetRoomByName(options_.start)}); | ||
47 | 46 | ||
48 | bool reachable_changed = true; | 47 | bool reachable_changed = true; |
49 | while (reachable_changed) { | 48 | while (reachable_changed) { |
@@ -328,21 +327,32 @@ class StateCalculator { | |||
328 | } | 327 | } |
329 | } | 328 | } |
330 | 329 | ||
331 | static const std::vector<std::tuple<std::string, std::string>> | 330 | std::vector<std::tuple<int, int>> pilgrimage_pairs; |
332 | pilgrimage_pairs = { | 331 | if (AP_IsSunwarpShuffle()) { |
333 | {"Crossroads", "Hot Crusts Area"}, | 332 | pilgrimage_pairs = std::vector<std::tuple<int, int>>(5); |
334 | // {"Orange Tower Third Floor", "Orange Tower Third Floor"}, | ||
335 | {"Outside The Initiated", "Orange Tower First Floor"}, | ||
336 | {"Outside The Undeterred", "Orange Tower Fourth Floor"}, | ||
337 | {"Color Hunt", "Outside The Agreeable"}}; | ||
338 | 333 | ||
339 | for (const auto& [from_room, to_room] : pilgrimage_pairs) { | 334 | for (const auto& [start_index, mapping] : AP_GetSunwarpMapping()) { |
335 | if (mapping.dots > 1) { | ||
336 | std::get<1>(pilgrimage_pairs[mapping.dots - 2]) = start_index; | ||
337 | } | ||
338 | if (mapping.dots < 6) { | ||
339 | std::get<0>(pilgrimage_pairs[mapping.dots - 1]) = | ||
340 | mapping.exit_index; | ||
341 | } | ||
342 | } | ||
343 | } else { | ||
344 | pilgrimage_pairs = {{6, 1}, {8, 3}, {9, 4}, {10, 5}}; | ||
345 | } | ||
346 | |||
347 | for (const auto& [from_sunwarp, to_sunwarp] : pilgrimage_pairs) { | ||
340 | StateCalculator pilgrimage_calculator( | 348 | StateCalculator pilgrimage_calculator( |
341 | {.start = from_room, .pilgrimage = true, .parent = this}); | 349 | {.start = GD_GetRoomForSunwarp(from_sunwarp), |
350 | .pilgrimage = true, | ||
351 | .parent = this}); | ||
342 | pilgrimage_calculator.Calculate(); | 352 | pilgrimage_calculator.Calculate(); |
343 | 353 | ||
344 | if (!pilgrimage_calculator.GetReachableRooms().count( | 354 | if (!pilgrimage_calculator.GetReachableRooms().count( |
345 | GD_GetRoomByName(to_room))) { | 355 | GD_GetRoomForSunwarp(to_sunwarp))) { |
346 | return kMaybe; | 356 | return kMaybe; |
347 | } | 357 | } |
348 | } | 358 | } |
@@ -390,7 +400,7 @@ class StateCalculator { | |||
390 | } // namespace | 400 | } // namespace |
391 | 401 | ||
392 | void RecalculateReachability() { | 402 | void RecalculateReachability() { |
393 | StateCalculator state_calculator; | 403 | StateCalculator state_calculator({.start = GD_GetRoomByName("Menu")}); |
394 | state_calculator.Calculate(); | 404 | state_calculator.Calculate(); |
395 | 405 | ||
396 | const std::set<int>& reachable_rooms = state_calculator.GetReachableRooms(); | 406 | const std::set<int>& reachable_rooms = state_calculator.GetReachableRooms(); |
diff --git a/src/version.h b/src/version.h index 8c567e9..f127610 100644 --- a/src/version.h +++ b/src/version.h | |||
@@ -35,6 +35,6 @@ std::ostream& operator<<(std::ostream& out, const Version& ver) { | |||
35 | return out << "v" << ver.major << "." << ver.minor << "." << ver.revision; | 35 | return out << "v" << ver.major << "." << ver.minor << "." << ver.revision; |
36 | } | 36 | } |
37 | 37 | ||
38 | constexpr const Version kTrackerVersion = Version(0, 8, 0); | 38 | constexpr const Version kTrackerVersion = Version(0, 9, 1); |
39 | 39 | ||
40 | #endif /* end of include guard: VERSION_H_C757E53C */ \ No newline at end of file | 40 | #endif /* end of include guard: VERSION_H_C757E53C */ \ No newline at end of file |