diff options
Diffstat (limited to 'tools/datapacker')
| -rw-r--r-- | tools/datapacker/main.cpp | 83 |
1 files changed, 79 insertions, 4 deletions
| diff --git a/tools/datapacker/main.cpp b/tools/datapacker/main.cpp index 596259b..4ecde74 100644 --- a/tools/datapacker/main.cpp +++ b/tools/datapacker/main.cpp | |||
| @@ -88,9 +88,28 @@ 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 | map.set_daedalus_only_mode(metadata.daedalus_only_mode()); | ||
| 93 | |||
| 91 | if (metadata.has_display_name()) { | 94 | if (metadata.has_display_name()) { |
| 92 | map.set_display_name(metadata.display_name()); | 95 | map.set_display_name(metadata.display_name()); |
| 93 | } | 96 | } |
| 97 | |||
| 98 | if (metadata.has_worldport_entrance()) { | ||
| 99 | map.set_worldport_entrance(container_.FindOrAddPort( | ||
| 100 | map_name, metadata.worldport_entrance().room(), | ||
| 101 | metadata.worldport_entrance().name(), std::nullopt, std::nullopt)); | ||
| 102 | } | ||
| 103 | |||
| 104 | if (metadata.has_rte_room()) { | ||
| 105 | map.set_rte_room(container_.FindOrAddRoom(map_name, metadata.rte_room(), | ||
| 106 | std::nullopt)); | ||
| 107 | } | ||
| 108 | |||
| 109 | if (metadata.has_rte_trigger_pos()) { | ||
| 110 | *map.mutable_rte_trigger_pos() = metadata.rte_trigger_pos(); | ||
| 111 | *map.mutable_rte_trigger_scale() = metadata.rte_trigger_scale(); | ||
| 112 | } | ||
| 94 | } | 113 | } |
| 95 | 114 | ||
| 96 | void ProcessRooms(std::filesystem::path path, | 115 | void ProcessRooms(std::filesystem::path path, |
| @@ -113,6 +132,10 @@ class DataPacker { | |||
| 113 | room.set_panel_display_name(h_room.panel_display_name()); | 132 | room.set_panel_display_name(h_room.panel_display_name()); |
| 114 | } | 133 | } |
| 115 | 134 | ||
| 135 | if (h_room.has_daedalus_only_allow()) { | ||
| 136 | room.set_daedalus_only_allow(h_room.daedalus_only_allow()); | ||
| 137 | } | ||
| 138 | |||
| 116 | for (const HumanPanel& h_panel : h_room.panels()) { | 139 | for (const HumanPanel& h_panel : h_room.panels()) { |
| 117 | room.add_panels(ProcessPanel(h_panel, current_map_name, room.name())); | 140 | room.add_panels(ProcessPanel(h_panel, current_map_name, room.name())); |
| 118 | } | 141 | } |
| @@ -186,6 +209,10 @@ class DataPacker { | |||
| 186 | panel.set_display_name(h_panel.display_name()); | 209 | panel.set_display_name(h_panel.display_name()); |
| 187 | } | 210 | } |
| 188 | 211 | ||
| 212 | if (h_panel.has_exclude_from_panelsanity()) { | ||
| 213 | panel.set_exclude_from_panelsanity(h_panel.exclude_from_panelsanity()); | ||
| 214 | } | ||
| 215 | |||
| 189 | return panel_id; | 216 | return panel_id; |
| 190 | } | 217 | } |
| 191 | 218 | ||
| @@ -239,7 +266,14 @@ class DataPacker { | |||
| 239 | Port& port = *container_.all_objects().mutable_ports(port_id); | 266 | Port& port = *container_.all_objects().mutable_ports(port_id); |
| 240 | 267 | ||
| 241 | port.set_path(h_port.path()); | 268 | port.set_path(h_port.path()); |
| 242 | port.set_orientation(h_port.orientation()); | 269 | port.set_display_name(h_port.display_name()); |
| 270 | |||
| 271 | if (h_port.no_shuffle()) { | ||
| 272 | port.set_no_shuffle(h_port.no_shuffle()); | ||
| 273 | } else { | ||
| 274 | *port.mutable_destination() = h_port.destination(); | ||
| 275 | port.set_rotation(h_port.rotation()); | ||
| 276 | } | ||
| 243 | 277 | ||
| 244 | // Setting this explicitly because the Godot protobuf doesn't support | 278 | // Setting this explicitly because the Godot protobuf doesn't support |
| 245 | // custom defaults. | 279 | // custom defaults. |
| @@ -396,8 +430,8 @@ class DataPacker { | |||
| 396 | container_.FindOrAddDoor(map_name, di.name(), current_map_name)); | 430 | container_.FindOrAddDoor(map_name, di.name(), current_map_name)); |
| 397 | } | 431 | } |
| 398 | 432 | ||
| 399 | for (const std::string& ending_name : h_door.endings()) { | 433 | if (h_door.has_white_ending()) { |
| 400 | door.add_endings(container_.FindOrAddEnding(ending_name)); | 434 | door.set_white_ending(h_door.white_ending()); |
| 401 | } | 435 | } |
| 402 | 436 | ||
| 403 | if (h_door.has_control_center_color()) { | 437 | if (h_door.has_control_center_color()) { |
| @@ -417,6 +451,22 @@ class DataPacker { | |||
| 417 | if (h_door.has_double_letters()) { | 451 | if (h_door.has_double_letters()) { |
| 418 | door.set_double_letters(h_door.double_letters()); | 452 | door.set_double_letters(h_door.double_letters()); |
| 419 | } | 453 | } |
| 454 | |||
| 455 | if (h_door.has_latch()) { | ||
| 456 | door.set_latch(h_door.latch()); | ||
| 457 | } | ||
| 458 | |||
| 459 | if (h_door.has_legacy_location()) { | ||
| 460 | door.set_legacy_location(h_door.legacy_location()); | ||
| 461 | } | ||
| 462 | |||
| 463 | if (h_door.has_daedalus_only_allow()) { | ||
| 464 | door.set_daedalus_only_allow(h_door.daedalus_only_allow()); | ||
| 465 | } | ||
| 466 | |||
| 467 | if (h_door.has_daedalus_only_always_item()) { | ||
| 468 | door.set_daedalus_only_always_item(h_door.daedalus_only_always_item()); | ||
| 469 | } | ||
| 420 | } | 470 | } |
| 421 | 471 | ||
| 422 | void ProcessConnectionsFile(std::filesystem::path path, | 472 | void ProcessConnectionsFile(std::filesystem::path path, |
| @@ -483,6 +533,16 @@ class DataPacker { | |||
| 483 | r_connection.set_cyan_ending(human_connection.cyan_ending()); | 533 | r_connection.set_cyan_ending(human_connection.cyan_ending()); |
| 484 | } | 534 | } |
| 485 | 535 | ||
| 536 | if (human_connection.has_mint_ending()) { | ||
| 537 | f_connection.set_mint_ending(human_connection.mint_ending()); | ||
| 538 | r_connection.set_mint_ending(human_connection.mint_ending()); | ||
| 539 | } | ||
| 540 | |||
| 541 | if (human_connection.has_vanilla_only()) { | ||
| 542 | f_connection.set_vanilla_only(human_connection.vanilla_only()); | ||
| 543 | r_connection.set_vanilla_only(human_connection.vanilla_only()); | ||
| 544 | } | ||
| 545 | |||
| 486 | container_.AddConnection(f_connection); | 546 | container_.AddConnection(f_connection); |
| 487 | if (!human_connection.oneway()) { | 547 | if (!human_connection.oneway()) { |
| 488 | container_.AddConnection(r_connection); | 548 | container_.AddConnection(r_connection); |
| @@ -612,6 +672,10 @@ class DataPacker { | |||
| 612 | container_.FindOrAddDoor(di.map(), di.name(), std::nullopt); | 672 | container_.FindOrAddDoor(di.map(), di.name(), std::nullopt); |
| 613 | group.add_doors(door_id); | 673 | group.add_doors(door_id); |
| 614 | } | 674 | } |
| 675 | |||
| 676 | if (h_group.has_daedalus_only_always_item()) { | ||
| 677 | group.set_daedalus_only_always_item(h_group.daedalus_only_always_item()); | ||
| 678 | } | ||
| 615 | } | 679 | } |
| 616 | 680 | ||
| 617 | void ProcessGlobalMetadataFile(std::filesystem::path path) { | 681 | void ProcessGlobalMetadataFile(std::filesystem::path path) { |
| @@ -620,7 +684,7 @@ class DataPacker { | |||
| 620 | } | 684 | } |
| 621 | 685 | ||
| 622 | auto h_metadata = ReadMessageFromFile<HumanGlobalMetadata>(path.string()); | 686 | auto h_metadata = ReadMessageFromFile<HumanGlobalMetadata>(path.string()); |
| 623 | container_.all_objects().set_version(h_metadata.version()); | 687 | *container_.all_objects().mutable_version() = h_metadata.version(); |
| 624 | } | 688 | } |
| 625 | 689 | ||
| 626 | void ProcessIdsFile(std::filesystem::path path) { | 690 | void ProcessIdsFile(std::filesystem::path path) { |
| @@ -655,6 +719,17 @@ class DataPacker { | |||
| 655 | .mutable_keyholders(keyholder_id) | 719 | .mutable_keyholders(keyholder_id) |
| 656 | ->set_ap_id(ap_id); | 720 | ->set_ap_id(ap_id); |
| 657 | } | 721 | } |
| 722 | |||
| 723 | for (const auto& [port_name, ap_id] : room.ports()) { | ||
| 724 | uint64_t port_id = container_.FindOrAddPort( | ||
| 725 | map_name, room_name, port_name, std::nullopt, std::nullopt); | ||
| 726 | container_.all_objects().mutable_ports(port_id)->set_ap_id(ap_id); | ||
| 727 | } | ||
| 728 | } | ||
| 729 | |||
| 730 | if (map.has_rte()) { | ||
| 731 | uint64_t map_id = container_.FindOrAddMap(map_name); | ||
| 732 | container_.all_objects().mutable_maps(map_id)->set_rte_ap_id(map.rte()); | ||
| 658 | } | 733 | } |
| 659 | } | 734 | } |
| 660 | 735 | ||
