diff options
author | Star Rauchenberger <fefferburbia@gmail.com> | 2024-04-21 14:34:30 -0400 |
---|---|---|
committer | Star Rauchenberger <fefferburbia@gmail.com> | 2024-04-21 14:34:30 -0400 |
commit | 85b4303b60bde56c16ca0c23f9ca2407e3f8b50c (patch) | |
tree | 2dbc69d71e44166b1ee6c1a0fbbb1d9739a25048 /src/ap_state.cpp | |
parent | dc56f752bb33b4e779c5507dea03a6764d08fd0a (diff) | |
parent | f90f0847f55490167d0395ad1b9408595b4f4667 (diff) | |
download | lingo-ap-tracker-85b4303b60bde56c16ca0c23f9ca2407e3f8b50c.tar.gz lingo-ap-tracker-85b4303b60bde56c16ca0c23f9ca2407e3f8b50c.tar.bz2 lingo-ap-tracker-85b4303b60bde56c16ca0c23f9ca2407e3f8b50c.zip |
Merge branch 'future' into tinysphere
Diffstat (limited to 'src/ap_state.cpp')
-rw-r--r-- | src/ap_state.cpp | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/src/ap_state.cpp b/src/ap_state.cpp index 58670e6..aeed914 100644 --- a/src/ap_state.cpp +++ b/src/ap_state.cpp | |||
@@ -64,8 +64,14 @@ struct APState { | |||
64 | LocationChecks location_checks = kNORMAL_LOCATIONS; | 64 | LocationChecks location_checks = kNORMAL_LOCATIONS; |
65 | VictoryCondition victory_condition = kTHE_END; | 65 | VictoryCondition victory_condition = kTHE_END; |
66 | bool early_color_hallways = false; | 66 | bool early_color_hallways = false; |
67 | bool pilgrimage_enabled = false; | ||
68 | bool pilgrimage_allows_roof_access = false; | ||
69 | bool pilgrimage_allows_paintings = false; | ||
70 | SunwarpAccess sunwarp_access = kSUNWARP_ACCESS_NORMAL; | ||
71 | bool sunwarp_shuffle = false; | ||
67 | 72 | ||
68 | std::map<std::string, std::string> painting_mapping; | 73 | std::map<std::string, std::string> painting_mapping; |
74 | std::map<int, SunwarpMapping> sunwarp_mapping; | ||
69 | 75 | ||
70 | void Connect(std::string server, std::string player, std::string password) { | 76 | void Connect(std::string server, std::string player, std::string password) { |
71 | if (!initialized) { | 77 | if (!initialized) { |
@@ -136,6 +142,12 @@ struct APState { | |||
136 | location_checks = kNORMAL_LOCATIONS; | 142 | location_checks = kNORMAL_LOCATIONS; |
137 | victory_condition = kTHE_END; | 143 | victory_condition = kTHE_END; |
138 | early_color_hallways = false; | 144 | early_color_hallways = false; |
145 | pilgrimage_enabled = false; | ||
146 | pilgrimage_allows_roof_access = false; | ||
147 | pilgrimage_allows_paintings = false; | ||
148 | sunwarp_access = kSUNWARP_ACCESS_NORMAL; | ||
149 | sunwarp_shuffle = false; | ||
150 | sunwarp_mapping.clear(); | ||
139 | 151 | ||
140 | connected = false; | 152 | connected = false; |
141 | has_connection_result = false; | 153 | has_connection_result = false; |
@@ -221,6 +233,16 @@ struct APState { | |||
221 | slot_data["victory_condition"].get<VictoryCondition>(); | 233 | slot_data["victory_condition"].get<VictoryCondition>(); |
222 | early_color_hallways = slot_data.contains("early_color_hallways") && | 234 | early_color_hallways = slot_data.contains("early_color_hallways") && |
223 | slot_data["early_color_hallways"].get<int>() == 1; | 235 | slot_data["early_color_hallways"].get<int>() == 1; |
236 | pilgrimage_enabled = slot_data.contains("enable_pilgrimage") && | ||
237 | slot_data["enable_pilgrimage"].get<int>() == 1; | ||
238 | pilgrimage_allows_roof_access = | ||
239 | slot_data.contains("pilgrimage_allows_roof_access") && | ||
240 | slot_data["pilgrimage_allows_roof_access"].get<int>() == 1; | ||
241 | pilgrimage_allows_paintings = | ||
242 | slot_data.contains("pilgrimage_allows_paintings") && | ||
243 | slot_data["pilgrimage_allows_paintings"].get<int>() == 1; | ||
244 | sunwarp_access = slot_data["sunwarp_access"].get<SunwarpAccess>(); | ||
245 | sunwarp_shuffle = slot_data["shuffle_sunwarps"].get<int>() == 1; | ||
224 | 246 | ||
225 | if (painting_shuffle && slot_data.contains("painting_entrance_to_exit")) { | 247 | if (painting_shuffle && slot_data.contains("painting_entrance_to_exit")) { |
226 | painting_mapping.clear(); | 248 | painting_mapping.clear(); |
@@ -231,6 +253,18 @@ struct APState { | |||
231 | } | 253 | } |
232 | } | 254 | } |
233 | 255 | ||
256 | if (sunwarp_shuffle && slot_data.contains("sunwarp_permutation")) { | ||
257 | std::vector<int> inverted_sunwarps; | ||
258 | for (const auto& item : slot_data["sunwarp_permutation"]) { | ||
259 | inverted_sunwarps.push_back(item); | ||
260 | } | ||
261 | |||
262 | for (int i = 0; i < 6; i++) { | ||
263 | sunwarp_mapping[inverted_sunwarps[i]] = SunwarpMapping{ | ||
264 | .dots = i + 1, .exit_index = inverted_sunwarps[i + 6]}; | ||
265 | } | ||
266 | } | ||
267 | |||
234 | connected = true; | 268 | connected = true; |
235 | has_connection_result = true; | 269 | has_connection_result = true; |
236 | 270 | ||
@@ -461,6 +495,24 @@ bool AP_HasAchievement(const std::string& achievement_name) { | |||
461 | 495 | ||
462 | bool AP_HasEarlyColorHallways() { return GetState().early_color_hallways; } | 496 | bool AP_HasEarlyColorHallways() { return GetState().early_color_hallways; } |
463 | 497 | ||
498 | bool AP_IsPilgrimageEnabled() { return GetState().pilgrimage_enabled; } | ||
499 | |||
500 | bool AP_DoesPilgrimageAllowRoofAccess() { | ||
501 | return GetState().pilgrimage_allows_roof_access; | ||
502 | } | ||
503 | |||
504 | bool AP_DoesPilgrimageAllowPaintings() { | ||
505 | return GetState().pilgrimage_allows_paintings; | ||
506 | } | ||
507 | |||
508 | SunwarpAccess AP_GetSunwarpAccess() { return GetState().sunwarp_access; } | ||
509 | |||
510 | bool AP_IsSunwarpShuffle() { return GetState().sunwarp_shuffle; } | ||
511 | |||
512 | const std::map<int, SunwarpMapping>& AP_GetSunwarpMapping() { | ||
513 | return GetState().sunwarp_mapping; | ||
514 | } | ||
515 | |||
464 | bool AP_HasReachedGoal() { return GetState().HasReachedGoal(); } | 516 | bool AP_HasReachedGoal() { return GetState().HasReachedGoal(); } |
465 | 517 | ||
466 | std::optional<std::tuple<int, int>> AP_GetPlayerPosition() { | 518 | std::optional<std::tuple<int, int>> AP_GetPlayerPosition() { |