Elaztek Developer Hub
Blamite Game Engine - Guerilla (Library)  00385.05.12.23.0209.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 #include <blam/api/v1/types/tags.h>
6 
7 #ifndef GUERILLA_LIB_INTERNAL
8 #define GUERILLA_LIB_INTERNAL
9 #endif
10 
11 #ifdef GUERILLA_LIB_EXPORTS
12 #define GUERILLA_LIB_API __declspec(dllexport)
13 #else
14 #define GUERILLA_LIB_API __declspec(dllimport)
15 #endif
16 
17 class BlamTag;
18 class BlamPlugin;
19 
23 enum class BlamTagFieldType
24 {
25  Ascii,
26  StringId,
27  Int8,
28  Int16,
29  Int32,
30  Int64,
31  Real,
32  Bitfield8,
33  Bitfield16,
34  Bitfield32,
35  Enum8,
36  Enum16,
37  Enum32,
38  Block,
39  Dataref,
40  Tagref,
41  Comment,
42  Color,
43  Vector2,
44  Vector3,
45  Vector4,
46 
48 };
49 
50 class BlamTagField;
51 
60 {
61 private:
63  BlamPlugin* plugin = nullptr;
64 
65 public:
66  int offset = 0x0;
67  int length = 0x0;
68  bool visible = true;
69  std::string display_name = "";
70  std::string description = "";
71  std::string field_id = "";
72  std::string input_hint = "";
73  bool require_unused_visible = false;
74 
82 
88  BlamPluginField(BlamPluginField* _old_field);
89 
95  BlamTagFieldType GetType();
96 
103 
113  virtual BlamTagField* GenerateTagField(BlamTag* tag);
114 
124  virtual BlamTagField* GenerateTagField(BlamTagField* existing_tag_field);
125 
137  virtual BlamTagField* GenerateTagField(BlamTag* tag, void* address);
138 
144  virtual std::string GenerateXMLString();
145 
155  virtual void UpdateOffsetData(int new_offset);
156 };
157 
165 {
166 private:
168  BlamTag* tag = nullptr;
169 
170 public:
171  int c_entry_index = 0;
172  int c_entry_size = 0;
173 
174  BlamPluginField* plugin_field = nullptr;
175  std::string field_id = "";
176 
183  BlamTagField(BlamTag* _tag, BlamTagFieldType _type);
184 
190  virtual std::string GenerateXMLString();
191 
197  virtual std::vector<char> GetValueAsBytes();
198 
204  BlamTagFieldType GetType();
205 
211  BlamTag* GetTag();
212 
218  BlamPluginField* GetPluginField();
219 
225  bool HasPluginField();
226 };
227 
232 {
241 
250 
259 }
BlamTagField
Class representing a tag field.
Definition: fields.h:164
BlamTagFieldType::Int16
@ Int16
Indicates that the field is a 16-bit integer.
BlamTagFieldType::Real
@ Real
Indicates that the field is a Float32.
BlamTagFieldType::Int32
@ Int32
Indicates that the field is a 32-bit integer.
Guerilla::Tags::Fields
Namespace containing functions relating to tag fields.
Definition: fields.h:231
BlamTagFieldType::Enum8
@ Enum8
Indicates that the field is an Enum8.
BlamTagFieldType::Vector4
@ Vector4
Indicates that the field is a vector4.
BlamTagFieldType::Block
@ Block
Indicates that the field is a tag block.
BlamTagFieldType::Ascii
@ Ascii
Indicates that the field is a string of text.
BlamTagFieldType::Dataref
@ Dataref
Indicates that the field is a data reference.
BlamTagFieldType::Enum16
@ Enum16
Indicates that the field is an Enum16.
BlamTagFieldType::Bitfield16
@ Bitfield16
Indicates that the field is a Bitfield16.
BlamTagFieldType
BlamTagFieldType
Enumerator containing all possible tag field types.
Definition: fields.h:23
Guerilla::Tags::GetPlugin
GUERILLA_LIB_API BlamPlugin * GetPlugin(std::string class_name)
Retrieves a plugin based on its name.
Definition: plugins.cpp:136
BlamTagFieldType::Int8
@ Int8
Indicates that the field is an 8-bit integer.
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.
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
BlamPluginField
Class representing a plugin field.
Definition: fields.h:59
BlamTag
Class representing a Tag.
Definition: tags.h:210
BlamTagFieldType::Int64
@ Int64
Indicates that the field is a 32-bit integer.
BlamTagFieldType::Tagref
@ Tagref
Indicates that the field is a tag reference.
BlamTagFieldType::Vector3
@ Vector3
Indicates that the field is a vector3.
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
BlamPlugin
Class representing a Plugin.
Definition: tags.h:79
fields.h
BlamTagFieldType::Bitfield8
@ Bitfield8
Indicates that the field is a Bitfield8.
Guerilla::Tags::Fields::GetStandardFieldLength
GUERILLA_LIB_API int GetStandardFieldLength(BlamTagFieldType type)
Retrieves the length of a tag field.
Definition: fields.cpp:7
BlamTagFieldType::Unspecified
@ Unspecified
Indicates that the field's type is not specified. Fields with this type should be considered invalid.
BlamTagFieldType::StringId
@ StringId
Indicates that the field is a String ID.
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:14
BlamTagFieldType::Enum32
@ Enum32
Indicates that the field is an Enum32.