diff options
Diffstat (limited to 'tools/datapacker/main.cpp')
| -rw-r--r-- | tools/datapacker/main.cpp | 42 |
1 files changed, 38 insertions, 4 deletions
| diff --git a/tools/datapacker/main.cpp b/tools/datapacker/main.cpp index 596259b..8109bf5 100644 --- a/tools/datapacker/main.cpp +++ b/tools/datapacker/main.cpp | |||
| @@ -88,9 +88,17 @@ class DataPacker { | |||
| 88 | uint64_t map_id = container_.FindOrAddMap(map_name); | 88 | uint64_t map_id = container_.FindOrAddMap(map_name); |
| 89 | Map& map = *container_.all_objects().mutable_maps(map_id); | 89 | Map& map = *container_.all_objects().mutable_maps(map_id); |
| 90 | 90 | ||
| 91 | map.set_type(metadata.type()); | ||
| 92 | |||
| 91 | if (metadata.has_display_name()) { | 93 | if (metadata.has_display_name()) { |
| 92 | map.set_display_name(metadata.display_name()); | 94 | map.set_display_name(metadata.display_name()); |
| 93 | } | 95 | } |
| 96 | |||
| 97 | if (metadata.has_worldport_entrance()) { | ||
| 98 | map.set_worldport_entrance(container_.FindOrAddPort( | ||
| 99 | map_name, metadata.worldport_entrance().room(), | ||
| 100 | metadata.worldport_entrance().name(), std::nullopt, std::nullopt)); | ||
| 101 | } | ||
| 94 | } | 102 | } |
| 95 | 103 | ||
| 96 | void ProcessRooms(std::filesystem::path path, | 104 | void ProcessRooms(std::filesystem::path path, |
| @@ -239,7 +247,14 @@ class DataPacker { | |||
| 239 | Port& port = *container_.all_objects().mutable_ports(port_id); | 247 | Port& port = *container_.all_objects().mutable_ports(port_id); |
| 240 | 248 | ||
| 241 | port.set_path(h_port.path()); | 249 | port.set_path(h_port.path()); |
| 242 | port.set_orientation(h_port.orientation()); | 250 | port.set_display_name(h_port.display_name()); |
| 251 | |||
| 252 | if (h_port.no_shuffle()) { | ||
| 253 | port.set_no_shuffle(h_port.no_shuffle()); | ||
| 254 | } else { | ||
| 255 | *port.mutable_destination() = h_port.destination(); | ||
| 256 | port.set_rotation(h_port.rotation()); | ||
| 257 | } | ||
| 243 | 258 | ||
| 244 | // Setting this explicitly because the Godot protobuf doesn't support | 259 | // Setting this explicitly because the Godot protobuf doesn't support |
| 245 | // custom defaults. | 260 | // custom defaults. |
| @@ -396,8 +411,8 @@ class DataPacker { | |||
| 396 | container_.FindOrAddDoor(map_name, di.name(), current_map_name)); | 411 | container_.FindOrAddDoor(map_name, di.name(), current_map_name)); |
| 397 | } | 412 | } |
| 398 | 413 | ||
| 399 | for (const std::string& ending_name : h_door.endings()) { | 414 | if (h_door.has_white_ending()) { |
| 400 | door.add_endings(container_.FindOrAddEnding(ending_name)); | 415 | door.set_white_ending(h_door.white_ending()); |
| 401 | } | 416 | } |
| 402 | 417 | ||
| 403 | if (h_door.has_control_center_color()) { | 418 | if (h_door.has_control_center_color()) { |
| @@ -417,6 +432,14 @@ class DataPacker { | |||
| 417 | if (h_door.has_double_letters()) { | 432 | if (h_door.has_double_letters()) { |
| 418 | door.set_double_letters(h_door.double_letters()); | 433 | door.set_double_letters(h_door.double_letters()); |
| 419 | } | 434 | } |
| 435 | |||
| 436 | if (h_door.has_latch()) { | ||
| 437 | door.set_latch(h_door.latch()); | ||
| 438 | } | ||
| 439 | |||
| 440 | if (h_door.has_legacy_location()) { | ||
| 441 | door.set_legacy_location(h_door.legacy_location()); | ||
| 442 | } | ||
| 420 | } | 443 | } |
| 421 | 444 | ||
| 422 | void ProcessConnectionsFile(std::filesystem::path path, | 445 | void ProcessConnectionsFile(std::filesystem::path path, |
| @@ -483,6 +506,11 @@ class DataPacker { | |||
| 483 | r_connection.set_cyan_ending(human_connection.cyan_ending()); | 506 | r_connection.set_cyan_ending(human_connection.cyan_ending()); |
| 484 | } | 507 | } |
| 485 | 508 | ||
| 509 | if (human_connection.has_vanilla_only()) { | ||
| 510 | f_connection.set_vanilla_only(human_connection.vanilla_only()); | ||
| 511 | r_connection.set_vanilla_only(human_connection.vanilla_only()); | ||
| 512 | } | ||
| 513 | |||
| 486 | container_.AddConnection(f_connection); | 514 | container_.AddConnection(f_connection); |
| 487 | if (!human_connection.oneway()) { | 515 | if (!human_connection.oneway()) { |
| 488 | container_.AddConnection(r_connection); | 516 | container_.AddConnection(r_connection); |
| @@ -620,7 +648,7 @@ class DataPacker { | |||
| 620 | } | 648 | } |
| 621 | 649 | ||
| 622 | auto h_metadata = ReadMessageFromFile<HumanGlobalMetadata>(path.string()); | 650 | auto h_metadata = ReadMessageFromFile<HumanGlobalMetadata>(path.string()); |
| 623 | container_.all_objects().set_version(h_metadata.version()); | 651 | *container_.all_objects().mutable_version() = h_metadata.version(); |
| 624 | } | 652 | } |
| 625 | 653 | ||
| 626 | void ProcessIdsFile(std::filesystem::path path) { | 654 | void ProcessIdsFile(std::filesystem::path path) { |
| @@ -655,6 +683,12 @@ class DataPacker { | |||
| 655 | .mutable_keyholders(keyholder_id) | 683 | .mutable_keyholders(keyholder_id) |
| 656 | ->set_ap_id(ap_id); | 684 | ->set_ap_id(ap_id); |
| 657 | } | 685 | } |
| 686 | |||
| 687 | for (const auto& [port_name, ap_id] : room.ports()) { | ||
| 688 | uint64_t port_id = container_.FindOrAddPort( | ||
| 689 | map_name, room_name, port_name, std::nullopt, std::nullopt); | ||
| 690 | container_.all_objects().mutable_ports(port_id)->set_ap_id(ap_id); | ||
| 691 | } | ||
| 658 | } | 692 | } |
| 659 | } | 693 | } |
| 660 | 694 | ||
