From 53618cb21b641e560556b875f43ecd9f04974140 Mon Sep 17 00:00:00 2001 From: Asher Glick Date: Tue, 21 May 2024 09:25:51 -0500 Subject: [PATCH] adding more examples to the documentation --- .../doc/acheivement/achievement_id.md | 2 + xml_converter/doc/category/category.md | 4 + xml_converter/doc/fade/distance_fade_end.md | 5 + xml_converter/doc/fade/distance_fade_start.md | 5 + xml_converter/doc/map_id/map_id.md | 4 + xml_converter/doc/menu/display_name.md | 3 + xml_converter/doc/menu/menu_id.md | 5 + xml_converter/doc/menu/name.md | 3 + xml_converter/doc/position/height_offset.md | 2 + xml_converter/doc/trail_data/byte layout.svg | 593 ++++++++++++++++++ xml_converter/doc/trail_data/trail_data.md | 3 + xml_converter/generators/main.py | 8 +- 12 files changed, 635 insertions(+), 2 deletions(-) create mode 100644 xml_converter/doc/trail_data/byte layout.svg diff --git a/xml_converter/doc/acheivement/achievement_id.md b/xml_converter/doc/acheivement/achievement_id.md index 8b9a8d49..5935436c 100644 --- a/xml_converter/doc/acheivement/achievement_id.md +++ b/xml_converter/doc/acheivement/achievement_id.md @@ -4,6 +4,8 @@ type: Int32 applies_to: [Icon, Trail] xml_fields: ["AchievementId"] protobuf_field: achievement_id +examples: + - "2655" --- An achivement that, if completed, will hide this marker diff --git a/xml_converter/doc/category/category.md b/xml_converter/doc/category/category.md index f8453815..438044d7 100644 --- a/xml_converter/doc/category/category.md +++ b/xml_converter/doc/category/category.md @@ -5,6 +5,10 @@ class: MarkerCategory applies_to: [Icon, Trail] xml_fields: [Type, Category] protobuf_field: category +examples: + - "mycategory" + - "mycategory.subcategory" + - "mycategory.subcategory.subsubcategory" custom_functions: read.proto: function: do_nothing diff --git a/xml_converter/doc/fade/distance_fade_end.md b/xml_converter/doc/fade/distance_fade_end.md index 4a40019b..ca4508fb 100644 --- a/xml_converter/doc/fade/distance_fade_end.md +++ b/xml_converter/doc/fade/distance_fade_end.md @@ -4,8 +4,13 @@ type: Float32 applies_to: [Icon, Trail] xml_fields: [FadeFar, DistanceFadeEnd] protobuf_field: distance_fade_end +examples: + - "850" + - "600" + - "1100" --- Any part of the object that is farther then this value will be at 0 alpha. +Defaults to 900 Notes ===== diff --git a/xml_converter/doc/fade/distance_fade_start.md b/xml_converter/doc/fade/distance_fade_start.md index 24dbc293..78a1bea5 100644 --- a/xml_converter/doc/fade/distance_fade_start.md +++ b/xml_converter/doc/fade/distance_fade_start.md @@ -4,8 +4,13 @@ type: Float32 applies_to: [Icon, Trail] xml_fields: [FadeNear, DistanceFadeStart] protobuf_field: distance_fade_start +examples: + - "650" + - "400" + - "900" --- Any part of the object that is farther then this value will begin to alpha fade gradually until it reaches 0 alpha at Distance Fade End. +Defaults to 700 Notes ===== diff --git a/xml_converter/doc/map_id/map_id.md b/xml_converter/doc/map_id/map_id.md index fe64cc21..58b4ccda 100644 --- a/xml_converter/doc/map_id/map_id.md +++ b/xml_converter/doc/map_id/map_id.md @@ -4,6 +4,10 @@ type: Int32 applies_to: [Icon, Trail] xml_fields: [MapID] protobuf_field: map_id +examples: + - "24" + - "50" + - "1509" --- The Map which this marker should be displayed on. diff --git a/xml_converter/doc/menu/display_name.md b/xml_converter/doc/menu/display_name.md index d998a215..291f2ffb 100644 --- a/xml_converter/doc/menu/display_name.md +++ b/xml_converter/doc/menu/display_name.md @@ -4,6 +4,9 @@ type: String applies_to: [Category] xml_fields: [DisplayName] protobuf_field: name +examples: + - "My Category" + - "Tribulation Mode 203" custom_functions: read.proto: function: proto_display_name_to_display_name_and_name diff --git a/xml_converter/doc/menu/menu_id.md b/xml_converter/doc/menu/menu_id.md index ae312b8a..b097093c 100644 --- a/xml_converter/doc/menu/menu_id.md +++ b/xml_converter/doc/menu/menu_id.md @@ -5,6 +5,11 @@ class: UniqueId xml_fields: [ID, MenuID] applies_to: [Category] protobuf_field: id +examples: + - "KOjMBsKTXpY=" + - "LJKn7WpADjo=" + - "uJrcuLd4as8=" + - "cCxU1IXfiKQ=" --- Notes diff --git a/xml_converter/doc/menu/name.md b/xml_converter/doc/menu/name.md index f0c161be..e62e87b3 100644 --- a/xml_converter/doc/menu/name.md +++ b/xml_converter/doc/menu/name.md @@ -4,6 +4,9 @@ type: String applies_to: [Category] xml_fields: [Name] protobuf_field: name +examples: + - "mycategory" + - "tribulationmode203" custom_functions: read.proto: function: do_nothing diff --git a/xml_converter/doc/position/height_offset.md b/xml_converter/doc/position/height_offset.md index aca77314..b0f2823f 100644 --- a/xml_converter/doc/position/height_offset.md +++ b/xml_converter/doc/position/height_offset.md @@ -4,6 +4,8 @@ type: Float32 applies_to: ["Icon"] xml_fields: ["HeightOffset", "BHHeightOffset"] protobuf_field: height_offset +examples: + - "0" --- A vertical offset of the object from the recorded position. diff --git a/xml_converter/doc/trail_data/byte layout.svg b/xml_converter/doc/trail_data/byte layout.svg new file mode 100644 index 00000000..a24d038a --- /dev/null +++ b/xml_converter/doc/trail_data/byte layout.svg @@ -0,0 +1,593 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + X6 + + Y6 + + Z6 + + X7 + + Y7 + + Z7 + + Version + Map ID + X1 + Y1 + Z1 + X2 + Y2 + Z2 + X3 + Y3 + Z3 + X4 + Y4 + Z4 + ... + X5 + Y5 + Z5 + + + + + + + + + + + + + + + + + + + diff --git a/xml_converter/doc/trail_data/trail_data.md b/xml_converter/doc/trail_data/trail_data.md index 35ad1556..a3414ce9 100644 --- a/xml_converter/doc/trail_data/trail_data.md +++ b/xml_converter/doc/trail_data/trail_data.md @@ -6,6 +6,9 @@ xml_fields: ["TrailData"] uses_file_path: true protobuf_field: trail_data applies_to: [Trail] +examples: + - "trails/my_trail.trl" + - "jumping_puzzle_path.trl" custom_functions: read.xml: function: xml_attribute_to_trail_data diff --git a/xml_converter/generators/main.py b/xml_converter/generators/main.py index 10d78096..aa67b681 100644 --- a/xml_converter/generators/main.py +++ b/xml_converter/generators/main.py @@ -107,8 +107,11 @@ def get_examples(self, field_type: str, field_key: str) -> List[str]: if len(field_examples) > 0: return [f'"{x}"' for x in field_examples] - # TODO: Type Examples + # Type Examples + if field_type == "Boolean": + return ["\"True\"", "\"False\""] + print(" Unknown Examples for {} {}".format(field_type, field_key)) return ["???"] def get_fixed_option_examples(self, field_type: str, pairings: Any) -> List[str]: @@ -201,7 +204,7 @@ def generate_auto_docs(self, metadata: Dict[str, MetadataType], content: Dict[st valid_values += "" elif fieldval.variable_type == "CompoundValue": - + print(" Unknown examples for {} {}".format(fieldval.variable_type, fieldkey)) example = self.build_example( type=fieldval.variable_type, applies_to=fieldval.applies_to_as_str(), @@ -255,6 +258,7 @@ def generate_auto_docs(self, metadata: Dict[str, MetadataType], content: Dict[st # different messages have differing types. This will be caught # in the cpp code regardless. + print(" Unknown examples for {} {}".format(fieldval.variable_type, fieldkey)) field_rows.append(FieldRow( name=component_field.name, xml_attribute=component_field.xml_fields[0],