diff options
Diffstat (limited to 'src/ap_state.cpp')
-rw-r--r-- | src/ap_state.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/ap_state.cpp b/src/ap_state.cpp index bdd9cb2..1ac6575 100644 --- a/src/ap_state.cpp +++ b/src/ap_state.cpp | |||
@@ -67,8 +67,10 @@ struct APState { | |||
67 | bool pilgrimage_allows_roof_access = false; | 67 | bool pilgrimage_allows_roof_access = false; |
68 | bool pilgrimage_allows_paintings = false; | 68 | bool pilgrimage_allows_paintings = false; |
69 | SunwarpAccess sunwarp_access = kSUNWARP_ACCESS_NORMAL; | 69 | SunwarpAccess sunwarp_access = kSUNWARP_ACCESS_NORMAL; |
70 | bool sunwarp_shuffle = false; | ||
70 | 71 | ||
71 | std::map<std::string, std::string> painting_mapping; | 72 | std::map<std::string, std::string> painting_mapping; |
73 | std::map<int, SunwarpMapping> sunwarp_mapping; | ||
72 | 74 | ||
73 | void Connect(std::string server, std::string player, std::string password) { | 75 | void Connect(std::string server, std::string player, std::string password) { |
74 | if (!initialized) { | 76 | if (!initialized) { |
@@ -140,6 +142,8 @@ struct APState { | |||
140 | pilgrimage_allows_roof_access = false; | 142 | pilgrimage_allows_roof_access = false; |
141 | pilgrimage_allows_paintings = false; | 143 | pilgrimage_allows_paintings = false; |
142 | sunwarp_access = kSUNWARP_ACCESS_NORMAL; | 144 | sunwarp_access = kSUNWARP_ACCESS_NORMAL; |
145 | sunwarp_shuffle = false; | ||
146 | sunwarp_mapping.clear(); | ||
143 | 147 | ||
144 | connected = false; | 148 | connected = false; |
145 | has_connection_result = false; | 149 | has_connection_result = false; |
@@ -251,6 +255,7 @@ struct APState { | |||
251 | slot_data.contains("pilgrimage_allows_paintings") && | 255 | slot_data.contains("pilgrimage_allows_paintings") && |
252 | slot_data["pilgrimage_allows_paintings"].get<int>() == 1; | 256 | slot_data["pilgrimage_allows_paintings"].get<int>() == 1; |
253 | sunwarp_access = slot_data["sunwarp_access"].get<SunwarpAccess>(); | 257 | sunwarp_access = slot_data["sunwarp_access"].get<SunwarpAccess>(); |
258 | sunwarp_shuffle = slot_data["shuffle_sunwarps"].get<int>() == 1; | ||
254 | 259 | ||
255 | if (painting_shuffle && slot_data.contains("painting_entrance_to_exit")) { | 260 | if (painting_shuffle && slot_data.contains("painting_entrance_to_exit")) { |
256 | painting_mapping.clear(); | 261 | painting_mapping.clear(); |
@@ -261,6 +266,18 @@ struct APState { | |||
261 | } | 266 | } |
262 | } | 267 | } |
263 | 268 | ||
269 | if (sunwarp_shuffle && slot_data.contains("sunwarp_permutation")) { | ||
270 | std::vector<int> inverted_sunwarps; | ||
271 | for (const auto& item : slot_data["sunwarp_permutation"]) { | ||
272 | inverted_sunwarps.push_back(item); | ||
273 | } | ||
274 | |||
275 | for (int i = 0; i < 6; i++) { | ||
276 | sunwarp_mapping[inverted_sunwarps[i]] = SunwarpMapping{ | ||
277 | .dots = i + 1, .exit_index = inverted_sunwarps[i + 6]}; | ||
278 | } | ||
279 | } | ||
280 | |||
264 | connected = true; | 281 | connected = true; |
265 | has_connection_result = true; | 282 | has_connection_result = true; |
266 | 283 | ||
@@ -474,4 +491,10 @@ bool AP_DoesPilgrimageAllowPaintings() { | |||
474 | 491 | ||
475 | SunwarpAccess AP_GetSunwarpAccess() { return GetState().sunwarp_access; } | 492 | SunwarpAccess AP_GetSunwarpAccess() { return GetState().sunwarp_access; } |
476 | 493 | ||
494 | bool AP_IsSunwarpShuffle() { return GetState().sunwarp_shuffle; } | ||
495 | |||
496 | const std::map<int, SunwarpMapping>& AP_GetSunwarpMapping() { | ||
497 | return GetState().sunwarp_mapping; | ||
498 | } | ||
499 | |||
477 | bool AP_HasReachedGoal() { return GetState().HasReachedGoal(); } | 500 | bool AP_HasReachedGoal() { return GetState().HasReachedGoal(); } |