diff options
Diffstat (limited to 'tools/datapacker')
| -rw-r--r-- | tools/datapacker/main.cpp | 55 |
1 files changed, 51 insertions, 4 deletions
| diff --git a/tools/datapacker/main.cpp b/tools/datapacker/main.cpp index 6bbb461..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. |
| @@ -345,6 +360,9 @@ class DataPacker { | |||
| 345 | std::copy( | 360 | std::copy( |
| 346 | h_door.receivers().begin(), h_door.receivers().end(), | 361 | h_door.receivers().begin(), h_door.receivers().end(), |
| 347 | google::protobuf::RepeatedFieldBackInserter(door.mutable_receivers())); | 362 | google::protobuf::RepeatedFieldBackInserter(door.mutable_receivers())); |
| 363 | std::copy( | ||
| 364 | h_door.senders().begin(), h_door.senders().end(), | ||
| 365 | google::protobuf::RepeatedFieldBackInserter(door.mutable_senders())); | ||
| 348 | 366 | ||
| 349 | for (const PaintingIdentifier& pi : h_door.move_paintings()) { | 367 | for (const PaintingIdentifier& pi : h_door.move_paintings()) { |
| 350 | std::optional<std::string> map_name = | 368 | std::optional<std::string> map_name = |
| @@ -393,8 +411,8 @@ class DataPacker { | |||
| 393 | container_.FindOrAddDoor(map_name, di.name(), current_map_name)); | 411 | container_.FindOrAddDoor(map_name, di.name(), current_map_name)); |
| 394 | } | 412 | } |
| 395 | 413 | ||
| 396 | for (const std::string& ending_name : h_door.endings()) { | 414 | if (h_door.has_white_ending()) { |
| 397 | door.add_endings(container_.FindOrAddEnding(ending_name)); | 415 | door.set_white_ending(h_door.white_ending()); |
| 398 | } | 416 | } |
| 399 | 417 | ||
| 400 | if (h_door.has_control_center_color()) { | 418 | if (h_door.has_control_center_color()) { |
| @@ -414,6 +432,14 @@ class DataPacker { | |||
| 414 | if (h_door.has_double_letters()) { | 432 | if (h_door.has_double_letters()) { |
| 415 | door.set_double_letters(h_door.double_letters()); | 433 | door.set_double_letters(h_door.double_letters()); |
| 416 | } | 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 | } | ||
| 417 | } | 443 | } |
| 418 | 444 | ||
| 419 | void ProcessConnectionsFile(std::filesystem::path path, | 445 | void ProcessConnectionsFile(std::filesystem::path path, |
| @@ -470,6 +496,21 @@ class DataPacker { | |||
| 470 | r_connection.set_roof_access(human_connection.roof_access()); | 496 | r_connection.set_roof_access(human_connection.roof_access()); |
| 471 | } | 497 | } |
| 472 | 498 | ||
| 499 | if (human_connection.has_purple_ending()) { | ||
| 500 | f_connection.set_purple_ending(human_connection.purple_ending()); | ||
| 501 | r_connection.set_purple_ending(human_connection.purple_ending()); | ||
| 502 | } | ||
| 503 | |||
| 504 | if (human_connection.has_cyan_ending()) { | ||
| 505 | f_connection.set_cyan_ending(human_connection.cyan_ending()); | ||
| 506 | r_connection.set_cyan_ending(human_connection.cyan_ending()); | ||
| 507 | } | ||
| 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 | |||
| 473 | container_.AddConnection(f_connection); | 514 | container_.AddConnection(f_connection); |
| 474 | if (!human_connection.oneway()) { | 515 | if (!human_connection.oneway()) { |
| 475 | container_.AddConnection(r_connection); | 516 | container_.AddConnection(r_connection); |
| @@ -607,7 +648,7 @@ class DataPacker { | |||
| 607 | } | 648 | } |
| 608 | 649 | ||
| 609 | auto h_metadata = ReadMessageFromFile<HumanGlobalMetadata>(path.string()); | 650 | auto h_metadata = ReadMessageFromFile<HumanGlobalMetadata>(path.string()); |
| 610 | container_.all_objects().set_version(h_metadata.version()); | 651 | *container_.all_objects().mutable_version() = h_metadata.version(); |
| 611 | } | 652 | } |
| 612 | 653 | ||
| 613 | void ProcessIdsFile(std::filesystem::path path) { | 654 | void ProcessIdsFile(std::filesystem::path path) { |
| @@ -642,6 +683,12 @@ class DataPacker { | |||
| 642 | .mutable_keyholders(keyholder_id) | 683 | .mutable_keyholders(keyholder_id) |
| 643 | ->set_ap_id(ap_id); | 684 | ->set_ap_id(ap_id); |
| 644 | } | 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 | } | ||
| 645 | } | 692 | } |
| 646 | } | 693 | } |
| 647 | 694 | ||
