summary refs log tree commit diff stats
path: root/tools/datapacker/main.cpp
diff options
context:
space:
mode:
authorStar Rauchenberger <fefferburbia@gmail.com>2025-08-12 16:55:17 -0400
committerStar Rauchenberger <fefferburbia@gmail.com>2025-08-12 16:55:17 -0400
commit4c8a38dfc0121343396d2a0d734cf1445d05b60c (patch)
treeccaf6dd1dc6fee60ced5ae19c5d0bb5db1217fcb /tools/datapacker/main.cpp
parent447a222b57e498f7904033c59e68d21d6a246abd (diff)
downloadlingo2-archipelago-4c8a38dfc0121343396d2a0d734cf1445d05b60c.tar.gz
lingo2-archipelago-4c8a38dfc0121343396d2a0d734cf1445d05b60c.tar.bz2
lingo2-archipelago-4c8a38dfc0121343396d2a0d734cf1445d05b60c.zip
Converted to proto2
This will let us use an older version of protobuf in Python, and allows
us to use the Godot protobuf implementation at all. Scalar fields with
custom defaults in data.proto were changed to not have a default,
because Godot doesn't handle it properly. The equivalent fields in
human.proto still have the defaults, and datapacker copies the default
value in if necessary. The Panel message in data.proto was also renamed
to PanelData because otherwise it conflicts with the native Godot class
named Panel. The double field in Letter was renamed to level2, because
Godot couldn't handle it well. Finally, common.proto was removed and
its contents were moved into data.proto, which allows us to generate
code for Python without needing to edit it.

NOTE: I had to slightly modify the Godot protobuf code generator. I'll
need to upload that somewhere.
Diffstat (limited to 'tools/datapacker/main.cpp')
-rw-r--r--tools/datapacker/main.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/tools/datapacker/main.cpp b/tools/datapacker/main.cpp index d3908b4..8b87ab1 100644 --- a/tools/datapacker/main.cpp +++ b/tools/datapacker/main.cpp
@@ -122,7 +122,7 @@ class DataPacker {
122 uint64_t panel_id = 122 uint64_t panel_id =
123 container_.FindOrAddPanel(current_map_name, current_room_name, 123 container_.FindOrAddPanel(current_map_name, current_room_name,
124 h_panel.name(), std::nullopt, std::nullopt); 124 h_panel.name(), std::nullopt, std::nullopt);
125 Panel& panel = *container_.all_objects().mutable_panels(panel_id); 125 PanelData& panel = *container_.all_objects().mutable_panels(panel_id);
126 126
127 panel.set_path(h_panel.path()); 127 panel.set_path(h_panel.path());
128 panel.set_clue(h_panel.clue()); 128 panel.set_clue(h_panel.clue());
@@ -169,9 +169,9 @@ class DataPacker {
169 painting.set_display_name(h_painting.display_name()); 169 painting.set_display_name(h_painting.display_name());
170 painting.set_orientation(h_painting.orientation()); 170 painting.set_orientation(h_painting.orientation());
171 171
172 if (h_painting.has_gravity()) { 172 // Setting this explicitly because the Godot protobuf doesn't support
173 painting.set_gravity(h_painting.gravity()); 173 // custom defaults.
174 } 174 painting.set_gravity(h_painting.gravity());
175 175
176 if (h_painting.has_move()) { 176 if (h_painting.has_move()) {
177 painting.set_move(h_painting.move()); 177 painting.set_move(h_painting.move());
@@ -208,9 +208,9 @@ class DataPacker {
208 port.set_path(h_port.path()); 208 port.set_path(h_port.path());
209 port.set_orientation(h_port.orientation()); 209 port.set_orientation(h_port.orientation());
210 210
211 if (h_port.has_gravity()) { 211 // Setting this explicitly because the Godot protobuf doesn't support
212 port.set_gravity(h_port.gravity()); 212 // custom defaults.
213 } 213 port.set_gravity(h_port.gravity());
214 214
215 if (h_port.has_required_door()) { 215 if (h_port.has_required_door()) {
216 std::optional<std::string> map_name = 216 std::optional<std::string> map_name =
@@ -228,7 +228,7 @@ class DataPacker {
228 const std::string& current_map_name, 228 const std::string& current_map_name,
229 const std::string& current_room_name) { 229 const std::string& current_room_name) {
230 uint64_t letter_id = 230 uint64_t letter_id =
231 container_.FindOrAddLetter(h_letter.key(), h_letter.double_()); 231 container_.FindOrAddLetter(h_letter.key(), h_letter.level2());
232 Letter& letter = *container_.all_objects().mutable_letters(letter_id); 232 Letter& letter = *container_.all_objects().mutable_letters(letter_id);
233 233
234 letter.set_room_id(container_.FindOrAddRoom( 234 letter.set_room_id(container_.FindOrAddRoom(