about summary refs log tree commit diff stats
path: root/src/game_data.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/game_data.cpp')
-rw-r--r--src/game_data.cpp44
1 files changed, 26 insertions, 18 deletions
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}