diff --git a/xml_converter/doc/rendering/constant_size_on_map.md b/xml_converter/doc/rendering/constant_size_on_map.md new file mode 100644 index 00000000..b73d9932 --- /dev/null +++ b/xml_converter/doc/rendering/constant_size_on_map.md @@ -0,0 +1,21 @@ +--- +name: Constant Size On Map +type: Boolean +applies_to: [Icon] +xml_fields: [ScaleOnMapWithZoom] +protobuf_field: constant_size_on_map +custom_functions: + read.xml: + function: inverted_xml_attribute_to_bool + side_effects: [] + write.xml: + function: bool_to_inverted_xml_attribute + side_effects: [] +--- +Scale the size of the object to be the same scale as the map. + +Notes +===== + +https://blishhud.com/docs/markers/attributes/scaleonmapwithzoom + diff --git a/xml_converter/doc/rendering/scale_on_map_with_zoom.md b/xml_converter/doc/rendering/scale_on_map_with_zoom.md deleted file mode 100644 index ff2d3c99..00000000 --- a/xml_converter/doc/rendering/scale_on_map_with_zoom.md +++ /dev/null @@ -1,14 +0,0 @@ ---- -name: Scale on Map With Zoom -type: Boolean -applies_to: [Icon] -xml_fields: [ScaleOnMapWithZoom] -protobuf_field: scale_on_map_with_zoom ---- -Scale the size of the object to be the same scale as the map. - -Notes -===== - -https://blishhud.com/docs/markers/attributes/scaleonmapwithzoom - diff --git a/xml_converter/integration_tests/test_cases/proto_constant_size_on_map/input/pack/markers.bin b/xml_converter/integration_tests/test_cases/proto_constant_size_on_map/input/pack/markers.bin new file mode 100644 index 00000000..3f954555 --- /dev/null +++ b/xml_converter/integration_tests/test_cases/proto_constant_size_on_map/input/pack/markers.bin @@ -0,0 +1,3 @@ + +q + My Category 2B \Ï)Cf¦RC{ÔWC 2B \Ï)Cf¦RC{ÔWC¸ 2B \Ï)Cf¦RC{ÔWC¸ 2B \Ï)Cf¦RC{ÔWCB(èÌ“^– \ No newline at end of file diff --git a/xml_converter/integration_tests/test_cases/proto_constant_size_on_map/output_proto/markers.bin b/xml_converter/integration_tests/test_cases/proto_constant_size_on_map/output_proto/markers.bin new file mode 100644 index 00000000..3f954555 --- /dev/null +++ b/xml_converter/integration_tests/test_cases/proto_constant_size_on_map/output_proto/markers.bin @@ -0,0 +1,3 @@ + +q + My Category 2B \Ï)Cf¦RC{ÔWC 2B \Ï)Cf¦RC{ÔWC¸ 2B \Ï)Cf¦RC{ÔWC¸ 2B \Ï)Cf¦RC{ÔWCB(èÌ“^– \ No newline at end of file diff --git a/xml_converter/integration_tests/test_cases/proto_constant_size_on_map/output_xml/xml_file.xml b/xml_converter/integration_tests/test_cases/proto_constant_size_on_map/output_xml/xml_file.xml new file mode 100644 index 00000000..652c2abc --- /dev/null +++ b/xml_converter/integration_tests/test_cases/proto_constant_size_on_map/output_xml/xml_file.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/xml_converter/integration_tests/test_cases/proto_constant_size_on_map/testcase.yaml b/xml_converter/integration_tests/test_cases/proto_constant_size_on_map/testcase.yaml new file mode 100644 index 00000000..d87f4066 --- /dev/null +++ b/xml_converter/integration_tests/test_cases/proto_constant_size_on_map/testcase.yaml @@ -0,0 +1,5 @@ +input_paths: + "pack": "proto" +expected_stdout: | +expected_stderr: | +expected_returncode: 0 diff --git a/xml_converter/integration_tests/test_cases/xml_scale_on_map_with_zoom/input/pack/xml_file.xml b/xml_converter/integration_tests/test_cases/xml_scale_on_map_with_zoom/input/pack/xml_file.xml new file mode 100644 index 00000000..9cee2191 --- /dev/null +++ b/xml_converter/integration_tests/test_cases/xml_scale_on_map_with_zoom/input/pack/xml_file.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/xml_converter/integration_tests/test_cases/xml_scale_on_map_with_zoom/output_proto/markers.bin b/xml_converter/integration_tests/test_cases/xml_scale_on_map_with_zoom/output_proto/markers.bin new file mode 100644 index 00000000..3f954555 --- /dev/null +++ b/xml_converter/integration_tests/test_cases/xml_scale_on_map_with_zoom/output_proto/markers.bin @@ -0,0 +1,3 @@ + +q + My Category 2B \Ï)Cf¦RC{ÔWC 2B \Ï)Cf¦RC{ÔWC¸ 2B \Ï)Cf¦RC{ÔWC¸ 2B \Ï)Cf¦RC{ÔWCB(èÌ“^– \ No newline at end of file diff --git a/xml_converter/integration_tests/test_cases/xml_scale_on_map_with_zoom/output_xml/xml_file.xml b/xml_converter/integration_tests/test_cases/xml_scale_on_map_with_zoom/output_xml/xml_file.xml new file mode 100644 index 00000000..81afab86 --- /dev/null +++ b/xml_converter/integration_tests/test_cases/xml_scale_on_map_with_zoom/output_xml/xml_file.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/xml_converter/integration_tests/test_cases/xml_scale_on_map_with_zoom/testcase.yaml b/xml_converter/integration_tests/test_cases/xml_scale_on_map_with_zoom/testcase.yaml new file mode 100644 index 00000000..9510c793 --- /dev/null +++ b/xml_converter/integration_tests/test_cases/xml_scale_on_map_with_zoom/testcase.yaml @@ -0,0 +1,5 @@ +input_paths: + "pack": "xml" +expected_stdout: | +expected_stderr: | +expected_returncode: 0 diff --git a/xml_converter/proto/waypoint.proto b/xml_converter/proto/waypoint.proto index 702e07b1..1a028d79 100644 --- a/xml_converter/proto/waypoint.proto +++ b/xml_converter/proto/waypoint.proto @@ -44,7 +44,7 @@ message Icon { int32 minimum_size_on_screen = 20; int32 map_display_size = 21; int32 maximum_size_on_screen = 22; - bool scale_on_map_with_zoom = 23; + bool constant_size_on_map = 23; string tip_description = 24; string tip_name = 25; fixed32 rgba_color = 26; diff --git a/xml_converter/src/icon_gen.cpp b/xml_converter/src/icon_gen.cpp index 13df4abb..36c87c83 100644 --- a/xml_converter/src/icon_gen.cpp +++ b/xml_converter/src/icon_gen.cpp @@ -67,6 +67,9 @@ bool Icon::init_xml_attribute(rapidxml::xml_attribute<>* attribute, vectorcolor.red), &(this->color_is_set)); } + else if (attributename == "scaleonmapwithzoom") { + inverted_xml_attribute_to_bool(attribute, errors, state, &(this->constant_size_on_map), &(this->constant_size_on_map_is_set)); + } else if (attributename == "copy") { xml_attribute_to_string(attribute, errors, state, &(this->copy_clipboard), &(this->copy_clipboard_is_set)); } @@ -202,9 +205,6 @@ bool Icon::init_xml_attribute(rapidxml::xml_attribute<>* attribute, vectorreset_length), &(this->reset_length_is_set)); } - else if (attributename == "scaleonmapwithzoom") { - xml_attribute_to_bool(attribute, errors, state, &(this->scale_on_map_with_zoom), &(this->scale_on_map_with_zoom_is_set)); - } else if (attributename == "schedule") { xml_attribute_to_string(attribute, errors, state, &(this->schedule), &(this->schedule_is_set)); } @@ -285,6 +285,9 @@ vector Icon::as_xml(XMLWriterState* state) const { if (this->color_is_set) { xml_node_contents.push_back(float_to_xml_attribute("Alpha", state, &this->color.alpha)); } + if (this->constant_size_on_map_is_set) { + xml_node_contents.push_back(bool_to_inverted_xml_attribute("ScaleOnMapWithZoom", state, &this->constant_size_on_map)); + } if (this->copy_clipboard_is_set) { xml_node_contents.push_back(string_to_xml_attribute("Copy", state, &this->copy_clipboard)); } @@ -375,9 +378,6 @@ vector Icon::as_xml(XMLWriterState* state) const { if (this->reset_length_is_set) { xml_node_contents.push_back(float_to_xml_attribute("ResetLength", state, &this->reset_length)); } - if (this->scale_on_map_with_zoom_is_set) { - xml_node_contents.push_back(bool_to_xml_attribute("ScaleOnMapWithZoom", state, &this->scale_on_map_with_zoom)); - } if (this->schedule_is_set) { xml_node_contents.push_back(string_to_xml_attribute("Schedule", state, &this->schedule)); } @@ -439,6 +439,10 @@ waypoint::Icon Icon::as_protobuf(ProtoWriterState* state) const { std::function setter = [&proto_icon](uint32_t val) { proto_icon.set_rgba_color(val); }; color_to_proto(this->color, state, setter); } + if (this->constant_size_on_map_is_set) { + std::function setter = [&proto_icon](bool val) { proto_icon.set_constant_size_on_map(val); }; + bool_to_proto(this->constant_size_on_map, state, setter); + } if (this->copy_clipboard_is_set) { std::function setter = [&proto_icon](std::string val) { proto_icon.mutable_trigger()->set_action_copy_clipboard(val); }; string_to_proto(this->copy_clipboard, state, setter); @@ -555,10 +559,6 @@ waypoint::Icon Icon::as_protobuf(ProtoWriterState* state) const { std::function setter = [&proto_icon](float val) { proto_icon.mutable_trigger()->set_reset_length(val); }; float_to_proto(this->reset_length, state, setter); } - if (this->scale_on_map_with_zoom_is_set) { - std::function setter = [&proto_icon](bool val) { proto_icon.set_scale_on_map_with_zoom(val); }; - bool_to_proto(this->scale_on_map_with_zoom, state, setter); - } if (this->schedule_is_set) { std::function setter = [&proto_icon](std::string val) { proto_icon.set_bhdraft__schedule(val); }; string_to_proto(this->schedule, state, setter); @@ -620,6 +620,9 @@ void Icon::parse_protobuf(waypoint::Icon proto_icon, ProtoReaderState* state) { if (proto_icon.rgba_color() != 0) { proto_to_color(proto_icon.rgba_color(), state, &(this->color), &(this->color_is_set)); } + if (proto_icon.constant_size_on_map() != 0) { + proto_to_bool(proto_icon.constant_size_on_map(), state, &(this->constant_size_on_map), &(this->constant_size_on_map_is_set)); + } if (proto_icon.trigger().action_copy_clipboard() != "") { proto_to_string(proto_icon.trigger().action_copy_clipboard(), state, &(this->copy_clipboard), &(this->copy_clipboard_is_set)); } @@ -707,9 +710,6 @@ void Icon::parse_protobuf(waypoint::Icon proto_icon, ProtoReaderState* state) { if (proto_icon.trigger().reset_length() != 0) { proto_to_float(proto_icon.trigger().reset_length(), state, &(this->reset_length), &(this->reset_length_is_set)); } - if (proto_icon.scale_on_map_with_zoom() != 0) { - proto_to_bool(proto_icon.scale_on_map_with_zoom(), state, &(this->scale_on_map_with_zoom), &(this->scale_on_map_with_zoom_is_set)); - } if (proto_icon.bhdraft__schedule() != "") { proto_to_string(proto_icon.bhdraft__schedule(), state, &(this->schedule), &(this->schedule_is_set)); } diff --git a/xml_converter/src/icon_gen.hpp b/xml_converter/src/icon_gen.hpp index 11177895..a49d9c44 100644 --- a/xml_converter/src/icon_gen.hpp +++ b/xml_converter/src/icon_gen.hpp @@ -35,6 +35,7 @@ class Icon : public Parseable { float bounce_height; MarkerCategory category; Color color; + bool constant_size_on_map; std::string copy_clipboard; std::string copy_message; CullChirality cull_chirality; @@ -64,7 +65,6 @@ class Icon : public Parseable { bool render_on_minimap; ResetBehavior reset_behavior; float reset_length; - bool scale_on_map_with_zoom; std::string schedule; float schedule_duration; MarkerCategory show_category; @@ -82,6 +82,7 @@ class Icon : public Parseable { bool bounce_height_is_set = false; bool category_is_set = false; bool color_is_set = false; + bool constant_size_on_map_is_set = false; bool copy_clipboard_is_set = false; bool copy_message_is_set = false; bool cull_chirality_is_set = false; @@ -111,7 +112,6 @@ class Icon : public Parseable { bool render_on_minimap_is_set = false; bool reset_behavior_is_set = false; bool reset_length_is_set = false; - bool scale_on_map_with_zoom_is_set = false; bool schedule_is_set = false; bool schedule_duration_is_set = false; bool show_category_is_set = false;