diff options
Diffstat (limited to 'src/ap_state.cpp')
| -rw-r--r-- | src/ap_state.cpp | 57 |
1 files changed, 56 insertions, 1 deletions
| diff --git a/src/ap_state.cpp b/src/ap_state.cpp index 58670e6..8feb78b 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,19 @@ 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.contains("sunwarp_access") | ||
| 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; | ||
| 224 | 249 | ||
| 225 | if (painting_shuffle && slot_data.contains("painting_entrance_to_exit")) { | 250 | if (painting_shuffle && slot_data.contains("painting_entrance_to_exit")) { |
| 226 | painting_mapping.clear(); | 251 | painting_mapping.clear(); |
| @@ -231,6 +256,18 @@ struct APState { | |||
| 231 | } | 256 | } |
| 232 | } | 257 | } |
| 233 | 258 | ||
| 259 | if (sunwarp_shuffle && slot_data.contains("sunwarp_permutation")) { | ||
| 260 | std::vector<int> inverted_sunwarps; | ||
| 261 | for (const auto& item : slot_data["sunwarp_permutation"]) { | ||
| 262 | inverted_sunwarps.push_back(item); | ||
| 263 | } | ||
| 264 | |||
| 265 | for (int i = 0; i < 6; i++) { | ||
| 266 | sunwarp_mapping[inverted_sunwarps[i]] = SunwarpMapping{ | ||
| 267 | .dots = i + 1, .exit_index = inverted_sunwarps[i + 6]}; | ||
| 268 | } | ||
| 269 | } | ||
| 270 | |||
| 234 | connected = true; | 271 | connected = true; |
| 235 | has_connection_result = true; | 272 | has_connection_result = true; |
| 236 | 273 | ||
| @@ -346,7 +383,7 @@ struct APState { | |||
| 346 | } else { | 383 | } else { |
| 347 | data_storage.erase(key); | 384 | data_storage.erase(key); |
| 348 | } | 385 | } |
| 349 | 386 | ||
| 350 | TrackerLog("Data storage " + key + " retrieved as null"); | 387 | TrackerLog("Data storage " + key + " retrieved as null"); |
| 351 | } | 388 | } |
| 352 | } | 389 | } |
| @@ -461,6 +498,24 @@ bool AP_HasAchievement(const std::string& achievement_name) { | |||
| 461 | 498 | ||
| 462 | bool AP_HasEarlyColorHallways() { return GetState().early_color_hallways; } | 499 | bool AP_HasEarlyColorHallways() { return GetState().early_color_hallways; } |
| 463 | 500 | ||
| 501 | bool AP_IsPilgrimageEnabled() { return GetState().pilgrimage_enabled; } | ||
| 502 | |||
| 503 | bool AP_DoesPilgrimageAllowRoofAccess() { | ||
| 504 | return GetState().pilgrimage_allows_roof_access; | ||
| 505 | } | ||
| 506 | |||
| 507 | bool AP_DoesPilgrimageAllowPaintings() { | ||
| 508 | return GetState().pilgrimage_allows_paintings; | ||
| 509 | } | ||
| 510 | |||
| 511 | SunwarpAccess AP_GetSunwarpAccess() { return GetState().sunwarp_access; } | ||
| 512 | |||
| 513 | bool AP_IsSunwarpShuffle() { return GetState().sunwarp_shuffle; } | ||
| 514 | |||
| 515 | const std::map<int, SunwarpMapping>& AP_GetSunwarpMapping() { | ||
| 516 | return GetState().sunwarp_mapping; | ||
| 517 | } | ||
| 518 | |||
| 464 | bool AP_HasReachedGoal() { return GetState().HasReachedGoal(); } | 519 | bool AP_HasReachedGoal() { return GetState().HasReachedGoal(); } |
| 465 | 520 | ||
| 466 | std::optional<std::tuple<int, int>> AP_GetPlayerPosition() { | 521 | std::optional<std::tuple<int, int>> AP_GetPlayerPosition() { |
