about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorStar Rauchenberger <fefferburbia@gmail.com>2024-01-31 15:20:57 -0500
committerStar Rauchenberger <fefferburbia@gmail.com>2024-01-31 15:20:57 -0500
commitb13d3678a9b09ba5dd8a58a7ab441d1e09ee5b77 (patch)
tree2a3c2ee3857dec9d9d99bfa004a7b7a6474412f6
parent19959f8479d1bb74f75890dcccbc038871771480 (diff)
downloadlingo-ap-tracker-b13d3678a9b09ba5dd8a58a7ab441d1e09ee5b77.tar.gz
lingo-ap-tracker-b13d3678a9b09ba5dd8a58a7ab441d1e09ee5b77.tar.bz2
lingo-ap-tracker-b13d3678a9b09ba5dd8a58a7ab441d1e09ee5b77.zip
Added sunwarp access support
-rw-r--r--assets/pilgrimage.yaml18
-rw-r--r--src/ap_state.cpp5
-rw-r--r--src/ap_state.h4
-rw-r--r--src/game_data.cpp44
-rw-r--r--src/game_data.h3
-rw-r--r--src/tracker_state.cpp37
6 files changed, 91 insertions, 20 deletions
diff --git a/assets/pilgrimage.yaml b/assets/pilgrimage.yaml index 7eb8e66..04487da 100644 --- a/assets/pilgrimage.yaml +++ b/assets/pilgrimage.yaml
@@ -1,20 +1,35 @@
1--- 1---
2 - room: Second Room 2 - room: Second Room
3 door: Exit Door 3 door: Exit Door
4 - room: Hub Room
5 door: 1 Sunwarp
6 sunwarp: True
4 - room: Crossroads 7 - room: Crossroads
5 door: Tower Entrance 8 door: Tower Entrance
6 - room: Orange Tower Fourth Floor 9 - room: Orange Tower Fourth Floor
7 door: Hot Crusts Door 10 door: Hot Crusts Door
11 - room: Hot Crusts Area
12 door: 2 Sunwarp
13 sunwarp: True
14 - room: Orange Tower Third Floor
15 door: 3 Sunwarp
16 sunwarp: True
8 - room: Outside The Initiated 17 - room: Outside The Initiated
9 door: Shortcut to Hub Room 18 door: Shortcut to Hub Room
10 - room: Orange Tower First Floor 19 - room: Orange Tower First Floor
11 door: Shortcut to Hub Room 20 door: Shortcut to Hub Room
21 - room: Orange Tower First Floor
22 door: 4 Sunwarp
23 sunwarp: True
12 - room: Directional Gallery 24 - room: Directional Gallery
13 door: Shortcut to The Undeterred 25 door: Shortcut to The Undeterred
14 - room: Orange Tower First Floor 26 - room: Orange Tower First Floor
15 door: Salt Pepper Door 27 door: Salt Pepper Door
16 - room: Hub Room 28 - room: Hub Room
17 door: Crossroads Entrance 29 door: Crossroads Entrance
30 - room: Orange Tower Fourth Floor
31 door: 5 Sunwarp
32 sunwarp: True
18 - room: Color Hunt 33 - room: Color Hunt
19 door: Shortcut to The Steady 34 door: Shortcut to The Steady
20 - room: The Bearer 35 - room: The Bearer
@@ -25,3 +40,6 @@
25 door: Shortcut to Hub Room 40 door: Shortcut to Hub Room
26 - room: Outside The Agreeable 41 - room: Outside The Agreeable
27 door: Tenacious Entrance 42 door: Tenacious Entrance
43 - room: Outside The Agreeable
44 door: 6 Sunwarp
45 sunwarp: True
diff --git a/src/ap_state.cpp b/src/ap_state.cpp index 5b02ba6..efa94bf 100644 --- a/src/ap_state.cpp +++ b/src/ap_state.cpp
@@ -60,6 +60,7 @@ struct APState {
60 LocationChecks location_checks = kNORMAL_LOCATIONS; 60 LocationChecks location_checks = kNORMAL_LOCATIONS;
61 VictoryCondition victory_condition = kTHE_END; 61 VictoryCondition victory_condition = kTHE_END;
62 bool early_color_hallways = false; 62 bool early_color_hallways = false;
63 SunwarpAccess sunwarp_access = kSUNWARP_ACCESS_NORMAL;
63 64
64 std::map<std::string, std::string> painting_mapping; 65 std::map<std::string, std::string> painting_mapping;
65 66
@@ -128,6 +129,7 @@ struct APState {
128 location_checks = kNORMAL_LOCATIONS; 129 location_checks = kNORMAL_LOCATIONS;
129 victory_condition = kTHE_END; 130 victory_condition = kTHE_END;
130 early_color_hallways = false; 131 early_color_hallways = false;
132 sunwarp_access = kSUNWARP_ACCESS_NORMAL;
131 133
132 connected = false; 134 connected = false;
133 has_connection_result = false; 135 has_connection_result = false;
@@ -222,6 +224,7 @@ struct APState {
222 slot_data["victory_condition"].get<VictoryCondition>(); 224 slot_data["victory_condition"].get<VictoryCondition>();
223 early_color_hallways = slot_data.contains("early_color_hallways") && 225 early_color_hallways = slot_data.contains("early_color_hallways") &&
224 slot_data["early_color_hallways"].get<int>() == 1; 226 slot_data["early_color_hallways"].get<int>() == 1;
227 sunwarp_access = slot_data["sunwarp_access"].get<SunwarpAccess>();
225 228
226 if (painting_shuffle && slot_data.contains("painting_entrance_to_exit")) { 229 if (painting_shuffle && slot_data.contains("painting_entrance_to_exit")) {
227 painting_mapping.clear(); 230 painting_mapping.clear();
@@ -417,3 +420,5 @@ bool AP_HasAchievement(const std::string& achievement_name) {
417} 420}
418 421
419bool AP_HasEarlyColorHallways() { return GetState().early_color_hallways; } 422bool AP_HasEarlyColorHallways() { return GetState().early_color_hallways; }
423
424SunwarpAccess AP_GetSunwarpAccess() { return GetState().sunwarp_access; }
diff --git a/src/ap_state.h b/src/ap_state.h index 9b94a72..0231628 100644 --- a/src/ap_state.h +++ b/src/ap_state.h
@@ -14,6 +14,8 @@ enum VictoryCondition { kTHE_END = 0, kTHE_MASTER = 1, kLEVEL_2 = 2 };
14 14
15enum LocationChecks { kNORMAL_LOCATIONS = 0, kREDUCED_LOCATIONS = 1, kPANELSANITY = 2 }; 15enum LocationChecks { kNORMAL_LOCATIONS = 0, kREDUCED_LOCATIONS = 1, kPANELSANITY = 2 };
16 16
17enum SunwarpAccess { kSUNWARP_ACCESS_NORMAL = 0, kSUNWARP_ACCESS_DISABLED = 1, kSUNWARP_ACCESS_UNLOCK = 2, kSUNWARP_ACCESS_PROGRESSIVE = 3 };
18
17void AP_SetTrackerFrame(TrackerFrame* tracker_frame); 19void AP_SetTrackerFrame(TrackerFrame* tracker_frame);
18 20
19void AP_Connect(std::string server, std::string player, std::string password); 21void AP_Connect(std::string server, std::string player, std::string password);
@@ -44,4 +46,6 @@ bool AP_HasAchievement(const std::string& achievement_name);
44 46
45bool AP_HasEarlyColorHallways(); 47bool AP_HasEarlyColorHallways();
46 48
49SunwarpAccess AP_GetSunwarpAccess();
50
47#endif /* end of include guard: AP_STATE_H_664A4180 */ 51#endif /* end of include guard: AP_STATE_H_664A4180 */
diff --git a/src/game_data.cpp b/src/game_data.cpp index 8f237b0..dd6e924 100644 --- a/src/game_data.cpp +++ b/src/game_data.cpp
@@ -58,6 +58,9 @@ struct GameData {
58 58
59 std::map<LingoColor, int> ap_id_by_color_; 59 std::map<LingoColor, int> ap_id_by_color_;
60 60
61 std::vector<int> pilgrimage_;
62 std::vector<int> pilgrimage_with_sunwarps_;
63
61 bool loaded_area_data_ = false; 64 bool loaded_area_data_ = false;
62 std::set<std::string> malconfigured_areas_; 65 std::set<std::string> malconfigured_areas_;
63 66
@@ -125,6 +128,10 @@ struct GameData {
125 exit_obj.painting = entrance_it.second["painting"].as<bool>(); 128 exit_obj.painting = entrance_it.second["painting"].as<bool>();
126 } 129 }
127 130
131 if (entrance_it.second["sunwarp"]) {
132 exit_obj.sunwarp = entrance_it.second["sunwarp"].as<bool>();
133 }
134
128 rooms_[from_room_id].exits.push_back(exit_obj); 135 rooms_[from_room_id].exits.push_back(exit_obj);
129 break; 136 break;
130 } 137 }
@@ -144,6 +151,10 @@ struct GameData {
144 exit_obj.painting = option["painting"].as<bool>(); 151 exit_obj.painting = option["painting"].as<bool>();
145 } 152 }
146 153
154 if (option["sunwarp"]) {
155 exit_obj.sunwarp = option["sunwarp"].as<bool>();
156 }
157
147 rooms_[from_room_id].exits.push_back(exit_obj); 158 rooms_[from_room_id].exits.push_back(exit_obj);
148 } 159 }
149 160
@@ -576,31 +587,20 @@ struct GameData {
576 } 587 }
577 588
578 // Set up fake pilgrimage. 589 // Set up fake pilgrimage.
579 int fake_pilgrim_panel_id =
580 AddOrGetPanel("Starting Room", "!! Fake Pilgrimage Panel");
581 Panel &fake_pilgrim_panel_obj = panels_[fake_pilgrim_panel_id];
582 fake_pilgrim_panel_obj.non_counting = true;
583
584 for (const auto &config_node : pilgrimage_config) { 590 for (const auto &config_node : pilgrimage_config) {
585 fake_pilgrim_panel_obj.required_doors.push_back( 591 int door_id = AddOrGetDoor(config_node["room"].as<std::string>(),
586 AddOrGetDoor(config_node["room"].as<std::string>(), 592 config_node["door"].as<std::string>());
587 config_node["door"].as<std::string>())); 593 if (config_node["sunwarp"] && config_node["sunwarp"].as<bool>()) {
594 pilgrimage_with_sunwarps_.push_back(door_id);
595 }
596 pilgrimage_.push_back(door_id);
588 } 597 }
589 598
590 int fake_pilgrim_door_id =
591 AddOrGetDoor("Starting Room", "!! Fake Pilgrimage Door");
592 Door &fake_pilgrim_door_obj = doors_[fake_pilgrim_door_id];
593 fake_pilgrim_door_obj.panels.push_back(fake_pilgrim_panel_id);
594 fake_pilgrim_door_obj.skip_location = true;
595 fake_pilgrim_door_obj.skip_item = true;
596 fake_pilgrim_door_obj.is_event = true;
597
598 int starting_room_id = AddOrGetRoom("Starting Room"); 599 int starting_room_id = AddOrGetRoom("Starting Room");
599 Room &starting_room_obj = rooms_[starting_room_id]; 600 Room &starting_room_obj = rooms_[starting_room_id];
600 starting_room_obj.panels.push_back(fake_pilgrim_panel_id);
601 starting_room_obj.exits.push_back( 601 starting_room_obj.exits.push_back(
602 Exit{.destination_room = AddOrGetRoom("Pilgrim Antechamber"), 602 Exit{.destination_room = AddOrGetRoom("Pilgrim Antechamber"),
603 .door = fake_pilgrim_door_id}); 603 .pilgrimage = true});
604 604
605 // Report errors. 605 // Report errors.
606 for (const std::string &area : malconfigured_areas_) { 606 for (const std::string &area : malconfigured_areas_) {
@@ -694,3 +694,11 @@ const std::vector<int> &GD_GetAchievementPanels() {
694int GD_GetItemIdForColor(LingoColor color) { 694int GD_GetItemIdForColor(LingoColor color) {
695 return GetState().ap_id_by_color_.at(color); 695 return GetState().ap_id_by_color_.at(color);
696} 696}
697
698const std::vector<int> &GD_GetPilgrimageDoors(bool include_sunwarps) {
699 if (include_sunwarps) {
700 return GetState().pilgrimage_with_sunwarps_;
701 } else {
702 return GetState().pilgrimage_;
703 }
704}
diff --git a/src/game_data.h b/src/game_data.h index 8a38264..c230034 100644 --- a/src/game_data.h +++ b/src/game_data.h
@@ -67,6 +67,8 @@ struct Exit {
67 int destination_room; 67 int destination_room;
68 std::optional<int> door; 68 std::optional<int> door;
69 bool painting = false; 69 bool painting = false;
70 bool sunwarp = false;
71 bool pilgrimage = false;
70}; 72};
71 73
72struct PaintingExit { 74struct PaintingExit {
@@ -111,5 +113,6 @@ const Panel& GD_GetPanel(int panel_id);
111int GD_GetRoomForPainting(const std::string& painting_id); 113int GD_GetRoomForPainting(const std::string& painting_id);
112const std::vector<int>& GD_GetAchievementPanels(); 114const std::vector<int>& GD_GetAchievementPanels();
113int GD_GetItemIdForColor(LingoColor color); 115int GD_GetItemIdForColor(LingoColor color);
116const std::vector<int>& GD_GetPilgrimageDoors(bool include_sunwarps);
114 117
115#endif /* end of include guard: GAME_DATA_H_9C42AC51 */ 118#endif /* end of include guard: GAME_DATA_H_9C42AC51 */
diff --git a/src/tracker_state.cpp b/src/tracker_state.cpp index e02ee14..43f84b4 100644 --- a/src/tracker_state.cpp +++ b/src/tracker_state.cpp
@@ -182,13 +182,46 @@ void RecalculateReachability() {
182 182
183 bool valid_transition = false; 183 bool valid_transition = false;
184 if (room_exit.door.has_value()) { 184 if (room_exit.door.has_value()) {
185 Decision door_reachable = IsDoorReachable_Helper( 185 Decision door_reachable = kMaybe;
186 *room_exit.door, reachable_rooms, solveable_panels); 186 if (room_exit.sunwarp) {
187 if (AP_GetSunwarpAccess() == kSUNWARP_ACCESS_NORMAL) {
188 door_reachable = kYes;
189 } else if (AP_GetSunwarpAccess() == kSUNWARP_ACCESS_DISABLED) {
190 door_reachable = kNo;
191 } else {
192 door_reachable = IsDoorReachable_Helper(
193 *room_exit.door, reachable_rooms, solveable_panels);
194 }
195 } else {
196 door_reachable = IsDoorReachable_Helper(
197 *room_exit.door, reachable_rooms, solveable_panels);
198 }
187 if (door_reachable == kYes) { 199 if (door_reachable == kYes) {
188 valid_transition = true; 200 valid_transition = true;
189 } else if (door_reachable == kMaybe) { 201 } else if (door_reachable == kMaybe) {
190 new_boundary.push_back(room_exit); 202 new_boundary.push_back(room_exit);
191 } 203 }
204 } else if (room_exit.pilgrimage) {
205 Decision pilgrimage_reachable = kYes;
206 if (AP_GetSunwarpAccess() == kSUNWARP_ACCESS_DISABLED) {
207 pilgrimage_reachable = kNo;
208 }
209 if (pilgrimage_reachable == kYes) {
210 for (int door_id : GD_GetPilgrimageDoors(
211 AP_GetSunwarpAccess() == kSUNWARP_ACCESS_UNLOCK ||
212 AP_GetSunwarpAccess() == kSUNWARP_ACCESS_PROGRESSIVE)) {
213 pilgrimage_reachable = IsDoorReachable_Helper(
214 door_id, reachable_rooms, solveable_panels);
215 if (pilgrimage_reachable != kYes) {
216 break;
217 }
218 }
219 }
220 if (pilgrimage_reachable == kYes) {
221 valid_transition = true;
222 } else if (pilgrimage_reachable == kMaybe) {
223 new_boundary.push_back(room_exit);
224 }
192 } else { 225 } else {
193 valid_transition = true; 226 valid_transition = true;
194 } 227 }