diff options
Diffstat (limited to 'src/ap_state.cpp')
-rw-r--r-- | src/ap_state.cpp | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/src/ap_state.cpp b/src/ap_state.cpp index 62c9f3f..4fd241a 100644 --- a/src/ap_state.cpp +++ b/src/ap_state.cpp | |||
@@ -65,8 +65,14 @@ struct APState { | |||
65 | LocationChecks location_checks = kNORMAL_LOCATIONS; | 65 | LocationChecks location_checks = kNORMAL_LOCATIONS; |
66 | VictoryCondition victory_condition = kTHE_END; | 66 | VictoryCondition victory_condition = kTHE_END; |
67 | bool early_color_hallways = false; | 67 | bool early_color_hallways = false; |
68 | bool pilgrimage_enabled = false; | ||
69 | bool pilgrimage_allows_roof_access = false; | ||
70 | bool pilgrimage_allows_paintings = false; | ||
71 | SunwarpAccess sunwarp_access = kSUNWARP_ACCESS_NORMAL; | ||
72 | bool sunwarp_shuffle = false; | ||
68 | 73 | ||
69 | std::map<std::string, std::string> painting_mapping; | 74 | std::map<std::string, std::string> painting_mapping; |
75 | std::map<int, SunwarpMapping> sunwarp_mapping; | ||
70 | 76 | ||
71 | void Connect(std::string server, std::string player, std::string password) { | 77 | void Connect(std::string server, std::string player, std::string password) { |
72 | if (!initialized) { | 78 | if (!initialized) { |
@@ -138,6 +144,12 @@ struct APState { | |||
138 | location_checks = kNORMAL_LOCATIONS; | 144 | location_checks = kNORMAL_LOCATIONS; |
139 | victory_condition = kTHE_END; | 145 | victory_condition = kTHE_END; |
140 | early_color_hallways = false; | 146 | early_color_hallways = false; |
147 | pilgrimage_enabled = false; | ||
148 | pilgrimage_allows_roof_access = false; | ||
149 | pilgrimage_allows_paintings = false; | ||
150 | sunwarp_access = kSUNWARP_ACCESS_NORMAL; | ||
151 | sunwarp_shuffle = false; | ||
152 | sunwarp_mapping.clear(); | ||
141 | 153 | ||
142 | connected = false; | 154 | connected = false; |
143 | has_connection_result = false; | 155 | has_connection_result = false; |
@@ -234,6 +246,19 @@ struct APState { | |||
234 | slot_data["victory_condition"].get<VictoryCondition>(); | 246 | slot_data["victory_condition"].get<VictoryCondition>(); |
235 | early_color_hallways = slot_data.contains("early_color_hallways") && | 247 | early_color_hallways = slot_data.contains("early_color_hallways") && |
236 | slot_data["early_color_hallways"].get<int>() == 1; | 248 | slot_data["early_color_hallways"].get<int>() == 1; |
249 | pilgrimage_enabled = slot_data.contains("enable_pilgrimage") && | ||
250 | slot_data["enable_pilgrimage"].get<int>() == 1; | ||
251 | pilgrimage_allows_roof_access = | ||
252 | slot_data.contains("pilgrimage_allows_roof_access") && | ||
253 | slot_data["pilgrimage_allows_roof_access"].get<int>() == 1; | ||
254 | pilgrimage_allows_paintings = | ||
255 | slot_data.contains("pilgrimage_allows_paintings") && | ||
256 | slot_data["pilgrimage_allows_paintings"].get<int>() == 1; | ||
257 | sunwarp_access = slot_data.contains("sunwarp_access") | ||
258 | ? slot_data["sunwarp_access"].get<SunwarpAccess>() | ||
259 | : kSUNWARP_ACCESS_NORMAL; | ||
260 | sunwarp_shuffle = slot_data.contains("shuffle_sunwarps") && | ||
261 | slot_data["shuffle_sunwarps"].get<int>() == 1; | ||
237 | 262 | ||
238 | if (painting_shuffle && slot_data.contains("painting_entrance_to_exit")) { | 263 | if (painting_shuffle && slot_data.contains("painting_entrance_to_exit")) { |
239 | painting_mapping.clear(); | 264 | painting_mapping.clear(); |
@@ -244,6 +269,18 @@ struct APState { | |||
244 | } | 269 | } |
245 | } | 270 | } |
246 | 271 | ||
272 | if (sunwarp_shuffle && slot_data.contains("sunwarp_permutation")) { | ||
273 | std::vector<int> inverted_sunwarps; | ||
274 | for (const auto& item : slot_data["sunwarp_permutation"]) { | ||
275 | inverted_sunwarps.push_back(item); | ||
276 | } | ||
277 | |||
278 | for (int i = 0; i < 6; i++) { | ||
279 | sunwarp_mapping[inverted_sunwarps[i]] = SunwarpMapping{ | ||
280 | .dots = i + 1, .exit_index = inverted_sunwarps[i + 6]}; | ||
281 | } | ||
282 | } | ||
283 | |||
247 | connected = true; | 284 | connected = true; |
248 | has_connection_result = true; | 285 | has_connection_result = true; |
249 | 286 | ||
@@ -476,6 +513,24 @@ bool AP_HasAchievement(const std::string& achievement_name) { | |||
476 | 513 | ||
477 | bool AP_HasEarlyColorHallways() { return GetState().early_color_hallways; } | 514 | bool AP_HasEarlyColorHallways() { return GetState().early_color_hallways; } |
478 | 515 | ||
516 | bool AP_IsPilgrimageEnabled() { return GetState().pilgrimage_enabled; } | ||
517 | |||
518 | bool AP_DoesPilgrimageAllowRoofAccess() { | ||
519 | return GetState().pilgrimage_allows_roof_access; | ||
520 | } | ||
521 | |||
522 | bool AP_DoesPilgrimageAllowPaintings() { | ||
523 | return GetState().pilgrimage_allows_paintings; | ||
524 | } | ||
525 | |||
526 | SunwarpAccess AP_GetSunwarpAccess() { return GetState().sunwarp_access; } | ||
527 | |||
528 | bool AP_IsSunwarpShuffle() { return GetState().sunwarp_shuffle; } | ||
529 | |||
530 | const std::map<int, SunwarpMapping>& AP_GetSunwarpMapping() { | ||
531 | return GetState().sunwarp_mapping; | ||
532 | } | ||
533 | |||
479 | bool AP_HasReachedGoal() { return GetState().HasReachedGoal(); } | 534 | bool AP_HasReachedGoal() { return GetState().HasReachedGoal(); } |
480 | 535 | ||
481 | std::optional<std::tuple<int, int>> AP_GetPlayerPosition() { | 536 | std::optional<std::tuple<int, int>> AP_GetPlayerPosition() { |