Elaztek Developer Hub
Blamite Game Engine - Guerilla (Library)  00370.03.08.23.1431.blamite
The tag editor for the Blamite Game Engine.
fields.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <string>
4 #include <vector>
5 
6 #ifndef GUERILLA_LIB_INTERNAL
7 #define GUERILLA_LIB_INTERNAL
8 #endif
9 
10 #ifdef GUERILLA_LIB_EXPORTS
11 #define GUERILLA_LIB_API __declspec(dllexport)
12 #else
13 #define GUERILLA_LIB_API __declspec(dllimport)
14 #endif
15 
19 struct bitfield8
20 {
21  bool flag0 : 1;
22  bool flag1 : 1;
23  bool flag2 : 1;
24  bool flag3 : 1;
25  bool flag4 : 1;
26  bool flag5 : 1;
27  bool flag6 : 1;
28  bool flag7 : 1;
29 };
30 
34 struct bitfield16
35 {
36  bool flag0 : 1;
37  bool flag1 : 1;
38  bool flag2 : 1;
39  bool flag3 : 1;
40  bool flag4 : 1;
41  bool flag5 : 1;
42  bool flag6 : 1;
43  bool flag7 : 1;
44 
45  bool flag8 : 1;
46  bool flag9 : 1;
47  bool flag10 : 1;
48  bool flag11 : 1;
49  bool flag12 : 1;
50  bool flag13 : 1;
51  bool flag14 : 1;
52  bool flag15 : 1;
53 };
54 
58 struct bitfield32
59 {
60  bool flag0 : 1;
61  bool flag1 : 1;
62  bool flag2 : 1;
63  bool flag3 : 1;
64  bool flag4 : 1;
65  bool flag5 : 1;
66  bool flag6 : 1;
67  bool flag7 : 1;
68 
69  bool flag8 : 1;
70  bool flag9 : 1;
71  bool flag10 : 1;
72  bool flag11 : 1;
73  bool flag12 : 1;
74  bool flag13 : 1;
75  bool flag14 : 1;
76  bool flag15 : 1;
77 
78  bool flag16 : 1;
79  bool flag17 : 1;
80  bool flag18 : 1;
81  bool flag19 : 1;
82  bool flag20 : 1;
83  bool flag21 : 1;
84  bool flag22 : 1;
85  bool flag23 : 1;
86 
87  bool flag24 : 1;
88  bool flag25 : 1;
89  bool flag26 : 1;
90  bool flag27 : 1;
91  bool flag28 : 1;
92  bool flag29 : 1;
93  bool flag30 : 1;
94  bool flag31 : 1;
95 };
96 
97 class BlamTag;
98 class BlamPlugin;
99 
104 {
105  Ascii,
106  StringId,
107  Int8,
108  Int16,
109  Int32,
110  Int64,
111  Real,
112  Bitfield8,
113  Bitfield16,
114  Bitfield32,
115  Enum8,
116  Enum16,
117  Enum32,
118  Block,
119  Dataref,
120  Tagref,
121  Comment,
122  Color,
123  Vector2,
124  Vector3,
125  Vector4,
126 
127  Unspecified
128 };
129 
130 class BlamTagField;
131 
140 {
141 private:
143  BlamPlugin* plugin = nullptr;
144 
145 public:
146  int offset = 0x0;
147  int length = 0x0;
148  bool visible = true;
149  std::string display_name = "";
150  std::string description = "";
151  std::string field_id = "";
152  std::string input_hint = "";
153  bool require_unused_visible = false;
154 
162 
168  BlamPluginField(BlamPluginField* _old_field);
169 
175  BlamTagFieldType GetType();
176 
183 
193  virtual BlamTagField* GenerateTagField(BlamTag* tag);
194 
204  virtual BlamTagField* GenerateTagField(BlamTagField* existing_tag_field);
205 
217  virtual BlamTagField* GenerateTagField(BlamTag* tag, void* address);
218 };
219 
227 {
228 private:
230  BlamTag* tag = nullptr;
231 
232 public:
233  int c_entry_index = 0;
234  int c_entry_size = 0;
235 
236  BlamPluginField* plugin_field = nullptr;
237  std::string field_id = "";
238 
245  BlamTagField(BlamTag* _tag, BlamTagFieldType _type);
246 
252  virtual std::string GenerateXMLString();
253 
259  virtual std::vector<char> GetValueAsBytes();
260 
266  BlamTagFieldType GetType();
267 
273  BlamTag* GetTag();
274 
280  BlamPluginField* GetPluginField();
281 
287  bool HasPluginField();
288 };
289 
294 {
303 
312 
321 }
BlamTagField
Class representing a tag field.
Definition: fields.h:226
BlamTagFieldType::Int16
@ Int16
Indicates that the field is a 16-bit integer.
bitfield32::flag6
bool flag6
Definition: fields.h:66
bitfield32::flag1
bool flag1
Definition: fields.h:61
bitfield32::flag13
bool flag13
Definition: fields.h:74
bitfield32::flag4
bool flag4
Definition: fields.h:64
BlamTagFieldType::Real
@ Real
Indicates that the field is a Float32.
bitfield32::flag31
bool flag31
Definition: fields.h:94
bitfield16::flag0
bool flag0
Definition: fields.h:36
BlamTagFieldType::Int32
@ Int32
Indicates that the field is a 32-bit integer.
bitfield8::flag5
bool flag5
Definition: fields.h:26
bitfield32::flag11
bool flag11
Definition: fields.h:72
bitfield32::flag8
bool flag8
Definition: fields.h:69
Guerilla::Tags::Fields
Namespace containing functions relating to tag fields.
Definition: fields.h:293
BlamTagFieldType::Enum8
@ Enum8
Indicates that the field is an Enum8.
bitfield32::flag19
bool flag19
Definition: fields.h:81
BlamTagFieldType::Vector4
@ Vector4
Indicates that the field is a vector4.
bitfield32::flag27
bool flag27
Definition: fields.h:90
bitfield32::flag0
bool flag0
Definition: fields.h:60
bitfield32
Typedef for a bitfield32 field, used in tag data definitions.
Definition: fields.h:58
bitfield32::flag7
bool flag7
Definition: fields.h:67
BlamTagFieldType::Block
@ Block
Indicates that the field is a tag block.
bitfield16::flag12
bool flag12
Definition: fields.h:49
bitfield32::flag15
bool flag15
Definition: fields.h:76
bitfield16::flag8
bool flag8
Definition: fields.h:45
bitfield16::flag14
bool flag14
Definition: fields.h:51
bitfield32::flag9
bool flag9
Definition: fields.h:70
BlamTagFieldType::Ascii
@ Ascii
Indicates that the field is a string of text.
bitfield8::flag2
bool flag2
Definition: fields.h:23
bitfield32::flag29
bool flag29
Definition: fields.h:92
BlamTagFieldType::Dataref
@ Dataref
Indicates that the field is a data reference.
BlamTagFieldType::Enum16
@ Enum16
Indicates that the field is an Enum16.
bitfield16::flag5
bool flag5
Definition: fields.h:41
bitfield16::flag11
bool flag11
Definition: fields.h:48
bitfield32::flag28
bool flag28
Definition: fields.h:91
BlamTagFieldType::Bitfield16
@ Bitfield16
Indicates that the field is a Bitfield16.
bitfield16::flag3
bool flag3
Definition: fields.h:39
BlamTagFieldType
BlamTagFieldType
Enumerator containing all possible tag field types.
Definition: fields.h:103
Guerilla::Tags::GetPlugin
GUERILLA_LIB_API BlamPlugin * GetPlugin(std::string class_name)
Retrieves a plugin based on its name.
Definition: plugins.cpp:93
BlamTagFieldType::Int8
@ Int8
Indicates that the field is an 8-bit integer.
bitfield32::flag17
bool flag17
Definition: fields.h:79
bitfield16::flag9
bool flag9
Definition: fields.h:46
bitfield32::flag30
bool flag30
Definition: fields.h:93
bitfield32::flag26
bool flag26
Definition: fields.h:89
bitfield8
Typedef for a bitfield8 field, used in tag data definitions.
Definition: fields.h:19
BlamTagFieldType::Color
@ Color
Indicates that the field is a color.
BlamTagFieldType::Comment
@ Comment
Indicates that the field is a comment. These do not store any tag data.
bitfield32::flag18
bool flag18
Definition: fields.h:80
bitfield16::flag13
bool flag13
Definition: fields.h:50
Guerilla::Tags::Fields::GetFieldTypeName
GUERILLA_LIB_API std::string GetFieldTypeName(BlamTagFieldType type)
Generates a string name based on the provided tag field type.
Definition: fields.cpp:190
bitfield32::flag25
bool flag25
Definition: fields.h:88
bitfield8::flag6
bool flag6
Definition: fields.h:27
BlamPluginField
Class representing a plugin field.
Definition: fields.h:139
bitfield32::flag3
bool flag3
Definition: fields.h:63
BlamTag
Class representing a Tag.
Definition: tags.h:152
bitfield8::flag7
bool flag7
Definition: fields.h:28
bitfield32::flag24
bool flag24
Definition: fields.h:87
bitfield32::flag16
bool flag16
Definition: fields.h:78
BlamTagFieldType::Int64
@ Int64
Indicates that the field is a 32-bit integer.
bitfield32::flag20
bool flag20
Definition: fields.h:82
bitfield8::flag4
bool flag4
Definition: fields.h:25
BlamTagFieldType::Tagref
@ Tagref
Indicates that the field is a tag reference.
bitfield32::flag21
bool flag21
Definition: fields.h:83
BlamTagFieldType::Vector3
@ Vector3
Indicates that the field is a vector3.
bitfield32::flag2
bool flag2
Definition: fields.h:62
bitfield8::flag1
bool flag1
Definition: fields.h:22
Guerilla::Tags::Fields::DetermineFieldType
GUERILLA_LIB_API BlamTagFieldType DetermineFieldType(std::string node_name)
Determines the field type from a string, used to determine the field type when parsing XML tags and p...
Definition: fields.cpp:98
bitfield16::flag7
bool flag7
Definition: fields.h:43
BlamPlugin
Class representing a Plugin.
Definition: tags.h:42
bitfield16::flag15
bool flag15
Definition: fields.h:52
BlamTagFieldType::Bitfield8
@ Bitfield8
Indicates that the field is a Bitfield8.
bitfield16
Typedef for a bitfield16 field, used in tag data definitions.
Definition: fields.h:34
bitfield16::flag6
bool flag6
Definition: fields.h:42
Guerilla::Tags::Fields::GetStandardFieldLength
GUERILLA_LIB_API int GetStandardFieldLength(BlamTagFieldType type)
Retrieves the length of a tag field.
Definition: fields.cpp:7
bitfield16::flag1
bool flag1
Definition: fields.h:37
bitfield16::flag10
bool flag10
Definition: fields.h:47
bitfield32::flag5
bool flag5
Definition: fields.h:65
bitfield32::flag14
bool flag14
Definition: fields.h:75
bitfield8::flag0
bool flag0
Definition: fields.h:21
BlamTagFieldType::Unspecified
@ Unspecified
Indicates that the field's type is not specified. Fields with this type should be considered invalid.
bitfield8::flag3
bool flag3
Definition: fields.h:24
BlamTagFieldType::StringId
@ StringId
Indicates that the field is a String ID.
bitfield16::flag4
bool flag4
Definition: fields.h:40
bitfield32::flag12
bool flag12
Definition: fields.h:73
bitfield32::flag22
bool flag22
Definition: fields.h:84
BlamTagFieldType::Bitfield32
@ Bitfield32
Indicates that the field is a Bitfield32.
BlamTagFieldType::Vector2
@ Vector2
Indicates that the field is a vector2.
GUERILLA_LIB_API
#define GUERILLA_LIB_API
Definition: fields.h:13
bitfield32::flag23
bool flag23
Definition: fields.h:85
BlamTagFieldType::Enum32
@ Enum32
Indicates that the field is an Enum32.
bitfield16::flag2
bool flag2
Definition: fields.h:38
bitfield32::flag10
bool flag10
Definition: fields.h:71