Elaztek Developer Hub
Blamite Game Engine - blam!  00453.06.08.26.0624.blamite
The core library for the Blamite Game Engine.
test_tag.h
Go to the documentation of this file.
1 // test_tag [ttag] - Tag Definition //
3 // -------- //
4 // Author: haloman30 //
5 // Revision: 5 //
6 // -------- //
7 // Part of the Blamite Game Engine //
8 // Copyright (c) Elaztek Studios 2013 - 2023 //
10 
11 
12 #pragma once
13 
14 #include <string>
15 #include <blam/api/v1/types/tags.h>
17 
18 #ifndef BLAM
19 #define BLAM
20 #endif
21 
22 #define tag_ttag "ttag"
23 
24 
25 
26 #pragma pack(push, 1)
27 struct test_tag
28 {
32 
35  TAG_BLOCK(block_test,
36  {
37  int16_t width;
38  int16_t height;
39  int8_t depth;
40  struct bitfield8_format_flags
41  {
42  bool bit_0 : 1;
43  bool bit_1 : 1;
44  bool bit_2 : 1;
45  bool is_tiled : 1;
46  bool unused4 : 1;
47  bool unused5 : 1;
48  bool unused6 : 1;
49  bool unused7 : 1;
50  };
51 
52  bitfield8_format_flags format_flags;
53 
56  TAG_ENUM(type,
57  {
58  _2d_texture,
59  _3d_texture,
60  cubemap,
61  unknown,
62  });
63 
64  int32_t hidden_child_field;
65  });
69  TAG_BLOCK(the_go_fuck_yourself_block,
70  { struct bitfield16_extra_flags
72  {
73  bool can_you_imagine_needing_this_many_flags : 1;
74  bool yea_me_neither : 1;
75  bool unused2 : 1;
76  bool unused3 : 1;
77  bool unused4 : 1;
78  bool unused5 : 1;
79  bool unused6 : 1;
80  bool unused7 : 1;
81  bool unused8 : 1;
82  bool unused9 : 1;
83  bool unused10 : 1;
84  bool unused11 : 1;
85  bool unused12 : 1;
86  bool unused13 : 1;
87  bool unused14 : 1;
88  bool unused15 : 1;
89  };
90 
91  bitfield16_extra_flags extra_flags;
92  struct bitfield32_who_needs_this_many_fucking_flags
93  {
94  bool enable_diffusion_dithering : 1;
95  bool disable_height_map_compression : 1;
96  bool uniform_sprite_sequences : 1;
97  bool filthy_sprite_bug_fix : 1;
98  bool use_sharp_bump_filter : 1;
99  bool unused : 1;
100  bool use_clampedmirrored_bump : 1;
101  bool invert_detail_fade : 1;
102  bool swap_x_y_vector_components : 1;
103  bool convert_from_signed : 1;
104  bool convert_to_signed : 1;
105  bool import_mipmap_chains : 1;
106  bool intentionally_true_color : 1;
107  bool unused13 : 1;
108  bool unused14 : 1;
109  bool unused15 : 1;
110  bool unused16 : 1;
111  bool unused17 : 1;
112  bool unused18 : 1;
113  bool unused19 : 1;
114  bool unused20 : 1;
115  bool unused21 : 1;
116  bool unused22 : 1;
117  bool unused23 : 1;
118  bool unused24 : 1;
119  bool unused25 : 1;
120  bool unused26 : 1;
121  bool unused27 : 1;
122  bool unused28 : 1;
123  bool unused29 : 1;
124  bool unused30 : 1;
125  bool unused31 : 1;
126  };
127 
128  bitfield32_who_needs_this_many_fucking_flags who_needs_this_many_fucking_flags;
129  });
133  TAG_BLOCK(nested_block_test,
134  {
135  int32_t nested_property;
136  data_reference nested_string;
137  TAG_BLOCK(child_block,
138  {
139  int16_t please_work;
140  data_reference nested_string1;
144  TAG_ENUM(argh,
145  {
146  on_e,
147  two,
148  thr__e__e,
149  _4,
150  });
151 
152  data_reference nested_string2;
154  });
155  });
158  TAG_BLOCK(block,
159  {
160  int32_t integer;
161  data_reference dataref;
162  TAG_BLOCK(block_two,
163  {
164  int32_t integer;
165  data_reference dataref;
166  TAG_BLOCK(block_three,
167  {
168  int32_t integer;
169  data_reference dataref;
170  TAG_BLOCK(block_four,
171  {
172  int32_t integer;
173  data_reference dataref;
174  TAG_BLOCK(block_five,
175  {
176  int32_t integer;
177  data_reference dataref;
178  });
179  });
180  });
181  });
182  });
185  TAG_BLOCK(hidden_tag_block,
186  {
187  int32_t yeah;
188  });
195 };
196 #pragma pack(pop)
197 
199 {
200 public:
202  {
203  class_name_long = "test_tag";
204  class_name_short = "ttag";
205  version = 5;
206 
207  revisions = {
208  {1, "haloman30", "Initial implementation."},
209  {2, "haloman30", "Move over test fields that were in bitmap tag for some reason"},
210  {3, "haloman30", "* Added hidden tag block and hidden real fields"},
211  {4, "haloman30", "* Added hidden dataref, tagref, and color fields\n\n * Added hidden test field to "},
212  {5, "haloman30", "* Add dataref with direct editing disabled"},
213 
214  };
215 
216  tag_size = 335;
217 
218  fields =
219  {
220  new CommentField("test tag",
221  "this tag class is used for testing purposes only, do not use it for actual game data"),
222  new CommentField("Bitmap",
223  "im gonna shove a bitmap up your ass"),
224  new Int32Field("integer test", "memes"),
225  new Int16Field("short test", "A short has a length of 2 bytes."),
226  new Int8Field("byte test", "A byte has a length of 1 bytes."),
227  new BlockField(14, "block test", "*sweats nervously*",
228  {
229  new Int16Field("width", "image width"),
230  new Int16Field("height", "image height"),
231  new Int8Field("depth", "image depth"),
232  new CommentField("comment title",
233  "explanation goes here brotheR"),
234  new Bitfield8Field("format flags", "extra flags for fuck you",
235  {
236  "bit 0",
237  "bit 1",
238  "bit 2",
239  "is tiled",
240  }),
241  new Enum32Field("type", "the usage type of this bitmap",
242  {
243  "2d texture",
244  "3d texture",
245  "cubemap",
246  "unknown",
247  }),
248  new Int32Field("hidden child field", ""),
249  }),
250  new BlockField(6, "the 'go fuck yourself' block", "yea im tired leave me alone",
251  {
252  new Bitfield16Field("extra flags", "hi",
253  {
254  "can you imagine needing this many flags",
255  "yea me neither",
256  }),
257  new Bitfield32Field("who needs this many fucking flags", "apparently me because i put this shit here",
258  {
259  "enable diffusion dithering",
260  "disable height map compression",
261  "uniform sprite sequences",
262  "filthy sprite bug fix",
263  "use sharp bump filter",
264  "UNUSED",
265  "use clamped/mirrored bump",
266  "invert detail fade",
267  "swap x-y vector components",
268  "convert from signed",
269  "convert to signed",
270  "import mipmap chains",
271  "intentionally true color",
272  }),
273  }),
274  new BlockField(68, "nested block test", "testing block nesting",
275  {
276  new Int32Field("nested property", ""),
277  new DataReferenceField("nested string", ""),
278  new BlockField(102, "child block", "",
279  {
280  new Int16Field("please work", ""),
281  new DataReferenceField("nested string1", ""),
282  new Enum32Field("argh", "second enum test",
283  {
284  "ON E",
285  "tWo",
286  "thR e E",
287  "4",
288  }),
289  new DataReferenceField("nested string2", ""),
290  new DataReferenceField("test dataref", "testing data reference"),
291  }),
292  }),
293  new DataReferenceField("test dataref", "testing data reference"),
294  new CommentField("Normal Comment",
295  "normal, unstyled comment"),
296  new CommentField("Info Comment",
297  "key information"),
298  new CommentField("Warning Comment",
299  "warning message"),
300  new CommentField("Error Comment",
301  "error message"),
302  new Int32Field("int32 field 0", ""),
303  new BlockField(68, "block", "",
304  {
305  new Int32Field("integer", ""),
306  new DataReferenceField("dataref", ""),
307  new BlockField(68, "block two", "",
308  {
309  new Int32Field("integer", ""),
310  new DataReferenceField("dataref", ""),
311  new BlockField(68, "block three", "",
312  {
313  new Int32Field("integer", ""),
314  new DataReferenceField("dataref", ""),
315  new BlockField(68, "block four", "",
316  {
317  new Int32Field("integer", ""),
318  new DataReferenceField("dataref", ""),
319  new BlockField(36, "block five", "",
320  {
321  new Int32Field("integer", ""),
322  new DataReferenceField("dataref", ""),
323  }),
324  }),
325  }),
326  }),
327  }),
328  new Int32Field("another int", ""),
329  new FieldReferenceField("fieldref field 0", ""),
330  new BlockField(4, "hidden tag block", "",
331  {
332  new Int32Field("yeah", ""),
333  }),
334  new RealField("hidden real", ""),
335  new DataReferenceField("dataref field 0", ""),
336  new TagReferenceField("tagref field 1", "", { }),
337  new ColorField("color field 2", ""),
338  new ColorField("color field 1", ""),
339  new CommentField("balls",
340  ""),
341  new DataReferenceField("dataref no direct edit", ""),
342 
343  };
344  }
345 };
346 
347 namespace Blam::Content::Tags
348 {
349  BLAM test_tag* GetTestTagTag(std::string tag_path);
350 }
Int16Field
Class representing an int16 tag field.
Definition: int.h:59
test_tag.h
Blam::Content::Tags
Namespace containing functions related to tag data.
Definition: bitmap.h:181
RealField
Class representing a real tag field.
Definition: real.h:16
TestTagTagClass::TestTagTagClass
TestTagTagClass()
Definition: test_tag.h:201
test_tag::test_dataref
data_reference test_dataref
testing data reference
Definition: test_tag.h:156
color
BlamColor color
Typedef for a color field, used in tag definitions.
Definition: tags.h:447
test_tag::integer_test
int32_t integer_test
memes
Definition: test_tag.h:29
test_tag::int32_field_0
int32_t int32_field_0
Definition: test_tag.h:157
test_tag::TAG_BLOCK
TAG_BLOCK(block_test, { int16_t width;int16_t height;int8_t depth;struct bitfield8_format_flags { bool bit_0 :1;bool bit_1 :1;bool bit_2 :1;bool is_tiled :1;bool unused4 :1;bool unused5 :1;bool unused6 :1;bool unused7 :1;};bitfield8_format_flags format_flags;TAG_ENUM(type, { _2d_texture, _3d_texture, cubemap, unknown, });int32_t hidden_child_field;})
sweats nervously
DataReferenceField
Class representing a data reference, or dataref for short.
Definition: dataref.h:19
Bitfield16Field
Class representing a bitfield16 tag field.
Definition: bitfield.h:44
BLAM
#define BLAM
Definition: test_tag.h:19
TagReferenceField
Class representing a tag reference, or tagref for short.
Definition: tagref.h:20
Enum32Field
Definition: enum.h:45
Blam::API::v1::Tags::GetTagData
BLAM_EXT_API BlamTagData * GetTagData(std::string tag_path)
Retrieves information for a given tag.
Definition: api.cpp:208
int8_t
signed char int8_t
Definition: stdint.h:11
BlamTagClass::fields
std::vector< BlamTagClassField * > fields
A series of tag fields that store the layout of the tag.
Definition: tags.h:209
test_tag::hidden_real
real hidden_real
Definition: test_tag.h:189
BlamTagClass::revisions
std::vector< BlamTagClassRevision > revisions
List of all tag class revisions. Does not get written to tags, but is included in plugin files.
Definition: tags.h:208
int32_t
int int32_t
Definition: stdint.h:13
plugins.h
Int8Field
Class representing an int8 tag field.
Definition: int.h:72
BlamTagClass::class_name_short
std::string class_name_short
The short, 4-character name of the tag class.
Definition: tags.h:206
BlamTagClass::version
int version
The tag class version. Should be incremented any time a tag class is modified whatsoever.
Definition: tags.h:207
test_tag::tagref_field_1
tag_reference tagref_field_1
Definition: test_tag.h:191
tag_reference
Structure representing a tag reference.
Definition: tags.h:289
field_reference
Structure representing a field reference.
Definition: tags.h:455
test_tag::color_field_1
color color_field_1
Definition: test_tag.h:193
Bitfield32Field
Class representing a bitfield32 tag field.
Definition: bitfield.h:55
BlamTagClass::class_name_long
std::string class_name_long
The longer class name. Typically shown alongside short name for user-friendliness.
Definition: tags.h:205
real
float real
Typedef for a 'real', aka a float.
Definition: tags.h:443
tag_ttag
#define tag_ttag
Definition: test_tag.h:22
test_tag::color_field_2
color color_field_2
Definition: test_tag.h:192
test_tag::byte_test
int8_t byte_test
A byte has a length of 1 bytes.
Definition: test_tag.h:31
Int32Field
Class representing an int32 tag field.
Definition: int.h:46
Blam::Content::Tags::GetTestTagTag
BLAM test_tag * GetTestTagTag(std::string tag_path)
Definition: test_tag.cpp:16
test_tag
Definition: test_tag.h:27
data_reference
Structure representing a data reference.
Definition: tags.h:342
BlamTagClass::tag_size
int tag_size
The size of the tag's data. Used on loading/writing tag files.
Definition: tags.h:210
ColorField
Class representing a color tag field.
Definition: color.h:19
TestTagTagClass
Definition: test_tag.h:198
BlamTagData::address
void * address
The address pointing to the start of the tag's data.
Definition: tags.h:132
tags.h
test_tag::dataref_no_direct_edit
data_reference dataref_no_direct_edit
Definition: test_tag.h:194
int16_t
short int16_t
Definition: stdint.h:12
BlamTagData
Class used to contain and access tag data.
Definition: tags.h:125
FieldReferenceField
Class representing a fieldref tag field.
Definition: fieldref.h:17
CommentField
Class representing a comment field.
Definition: comment.h:29
BlockField
Class representing a tag block field, also sometimes referred to as a struct or reflexive in the modd...
Definition: block.h:19
test_tag::fieldref_field_0
field_reference fieldref_field_0
Definition: test_tag.h:184
TAG_ENUM
#define TAG_ENUM(name,...)
Macro used to aid in the creation of enums within tag structures.
Definition: tags.h:42
test_tag::another_int
int32_t another_int
Definition: test_tag.h:183
BlamTagClass
Class representing a tag class.
Definition: tags.h:202
Bitfield8Field
Class representing a bitfield8 tag field.
Definition: bitfield.h:33
test_tag::dataref_field_0
data_reference dataref_field_0
Definition: test_tag.h:190
test_tag::short_test
int16_t short_test
A short has a length of 2 bytes.
Definition: test_tag.h:30
api.h
BlamTagData::tag_class
std::string tag_class
The tag's short class name.
Definition: tags.h:146