Elaztek Developer Hub
Blamite Game Engine - blam!  00423.10.27.24.0533.blamite
The core library for the Blamite Game Engine.
scenario.h
Go to the documentation of this file.
1 // scenario [scnr] - Tag Definition //
3 // -------- //
4 // Author: haloman30 //
5 // Revision: 4 //
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 
23 
24 #pragma pack(push, 1)
25 struct scenario
26 {
27  TAG_ENUM(type,
28  {
29  solo,
30  multiplayer,
31  main_menu,
32  multiplayer_shared,
33  singleplayer_shared,
34  });
35 
39  TAG_BLOCK(project_folders,
40  {
41  bitfield8 flags;
42  int32_t folder_id;
43  int32_t parent_folder_id;
44  data_reference folder_name;
45  });
49  TAG_BLOCK(primitives,
50  {
51  int32_t folder_id;
52  data_reference name;
53  data_reference description;
54 
57  TAG_ENUM(type,
58  {
59  cuboid,
60  cylinder,
61  });
62 
63  tag_reference material_override;
64  //POSITION
65 
66  vector3 position;
67  vector3 rotation;
68  vector3 scale;
69  //cylinder specific properties
70 
71  vector2 cylinder_radius;
72  int32_t cylinder_resolution;
73  });
74  TAG_BLOCK(render_models,
75  {
76  int32_t palette_index;
77  int32_t folder_index;
78  data_reference name;
79  bitfield16 placement_flags;
80  vector3 transform;
81  vector3 rotation;
82  vector3 scale;
83  });
84  TAG_BLOCK(render_models_palette,
85  {
86  tag_reference tag;
87  });
88  TAG_BLOCK(lights,
89  {
90  int32_t palette_index;
91  int32_t folder_index;
92  data_reference name;
93  bitfield16 placement_flags;
94  vector3 transform;
95  vector3 rotation;
96  vector3 scale;
97  });
98  TAG_BLOCK(lights_palette,
99  {
100  tag_reference tag;
101  });
102 };
103 #pragma pack(pop)
104 
106 {
107 public:
109  {
110  class_name_long = "scenario";
111  class_name_short = "scnr";
112  version = 4;
113 
114  revisions = {
115  {1, "haloman30", "Initial implementation."},
116  {2, "haloman30", "Added 'project folders' block."},
117  {3, "haloman30", "Replaced several real values with vectors."},
118  {4, "haloman30", "Add support for material overrides for primitives"},
119 
120  };
121 
122  tag_size = 196;
123 
124  fields =
125  {
126  new Enum32Field("type", "",
127  {
128  "solo",
129  "multiplayer",
130  "main menu",
131  "multiplayer shared",
132  "singleplayer shared",
133  }),
134  new BlockField(41, "project folders", "Contains information about project folders. Only used within the editor.",
135  {
136  new Bitfield8Field("flags", "List of flags that apply to this folder.",
137  {
138  "has parent folder",
139  }),
140  new Int32Field("folder id", "The ID of this folder."),
141  new Int32Field("parent folder id", "The ID of this folder's parent folder, if applicable."),
142  new DataReferenceField("folder name", "The display name of the folder."),
143  }),
144  new BlockField(152, "primitives", "List of primitive objects contained within the scenario.",
145  {
146  new Int32Field("folder id", "the folder id that this primitive exists within. set to -1 to have no parent"),
147  new DataReferenceField("name", "custom display name for the object"),
148  new DataReferenceField("description", "custom description for the object"),
149  new Enum32Field("type", "The type of this primitive.",
150  {
151  "cuboid",
152  "cylinder",
153  }),
154  new TagReferenceField("material override", "", { }),
155  new CommentField("POSITION",
156  ""),
157  new Vector3Field("position", ""),
158  new Vector3Field("rotation", ""),
159  new Vector3Field("scale", ""),
160  new CommentField("cylinder specific properties",
161  ""),
162  new Vector2Field("radius", ""),
163  new Int32Field("cylinder resolution", ""),
164  }),
165  new BlockField(78, "render models", "",
166  {
167  new Int32Field("palette index", ""),
168  new Int32Field("folder index", ""),
169  new DataReferenceField("name", ""),
170  new Bitfield16Field("placement flags", "",
171  {
172  }),
173  new Vector3Field("transform", ""),
174  new Vector3Field("rotation", ""),
175  new Vector3Field("scale", ""),
176  }),
177  new BlockField(32, "render models palette", "",
178  {
179  new TagReferenceField("tag", "", { }),
180  }),
181  new BlockField(78, "lights", "",
182  {
183  new Int32Field("palette index", ""),
184  new Int32Field("folder index", ""),
185  new DataReferenceField("name", ""),
186  new Bitfield16Field("placement flags", "",
187  {
188  }),
189  new Vector3Field("transform", ""),
190  new Vector3Field("rotation", ""),
191  new Vector3Field("scale", ""),
192  }),
193  new BlockField(32, "lights palette", "",
194  {
195  new TagReferenceField("tag", "", { }),
196  }),
197 
198  };
199  }
200 };
201 
202 namespace Blam::Content::Tags
203 {
204  BLAM scenario* GetScenarioTag(std::string tag_path);
205 }
scenario::TAG_ENUM
TAG_ENUM(type, { solo, multiplayer, main_menu, multiplayer_shared, singleplayer_shared, })
Blam::World::GetWorldState
BLAM BlamWorldState * GetWorldState()
Retrieves the current world state.
Definition: world.cpp:40
BlamWorldObject::editor_folder_id
int editor_folder_id
The editor folder that this object exists within. Only used within the editing kit.
Definition: world_objects.h:140
tag_io.h
BlamWorldState::AddObject
void AddObject(BlamWorldObject *object)
Definition: BlamWorldState.cpp:85
BLAM
#define BLAM
Definition: scenario.h:19
Blam::Content::Tags
Namespace containing functions related to tag data.
Definition: bitmap.h:197
ScenarioTagClass::ScenarioTagClass
ScenarioTagClass()
Definition: scenario.h:108
Blam::Logger::LogEvent
BLAM void LogEvent(std::string message)
Logs a message to the log and/or console.
Definition: aliases.cpp:130
logger.h
vector3
BlamVector3 vector3
Typedef for a vector3 field, used in tag definitions.
Definition: tags.h:426
tag_reference::GetTagPath
std::string GetTagPath()
Retrieves the path of the tag that this tagref refers to.
Definition: tag_reference.cpp:52
active_scenario_tag_data
BlamTagData * active_scenario_tag_data
Definition: scenario.cpp:10
Vector2Field
Class representing a vector2 tag field.
Definition: vector.h:34
BlamWorldObject_PrimitiveCylinder::radius_0
float radius_0
The radius of the primitive. Only used in cylinders.
Definition: world_objects.h:373
BlamTagData::path
char path[256]
The tag's path.
Definition: tags.h:143
world.h
BlamWorldObject::SetName
void SetName(std::string name)
Definition: BlamWorldObject.cpp:248
Blam::Content::Tags::LoadTagFromFile
BLAM BlamResult LoadTagFromFile(std::string tag_path, bool reload_if_already_loaded=true)
Loads a tag from the engine's tag directory (default is '.
Definition: tag_io.cpp:319
DataReferenceField
Class representing a data reference, or dataref for short.
Definition: dataref.h:19
Vector3Field
Class representing a vector3 tag field.
Definition: vector.h:47
ScenarioTagClass
Definition: scenario.h:105
Bitfield16Field
Class representing a bitfield16 tag field.
Definition: bitfield.h:44
scenario.h
Blam::Content::Tags::GetActiveScenarioTag
BLAM scenario * GetActiveScenarioTag()
Retrieves the currently loaded scenario tag.
Definition: scenario.cpp:140
scenario
Definition: scenario.h:25
TagReferenceField
Class representing a tag reference, or tagref for short.
Definition: tagref.h:20
Enum32Field
Definition: enum.h:46
Blam::API::v1::Tags::GetTagData
BLAM_EXT_API BlamTagData * GetTagData(std::string tag_path)
Retrieves information for a given tag.
Definition: api.cpp:197
BlamWorldObject_Tag
Class representing a tag-based world object.
Definition: world_objects.h:223
BlamTagClass::fields
std::vector< BlamTagClassField * > fields
A series of tag fields that store the layout of the tag.
Definition: tags.h:200
bitfield8
Typedef for a bitfield8 field, used in tag data definitions.
Definition: tags.h:344
active_scenario_tag
scenario * active_scenario_tag
Definition: scenario.cpp:9
Blam::Content::Tags::NeedsWorldStateUpdate
BLAM bool NeedsWorldStateUpdate()
Checks if the world state needs to be re-prepared.
Definition: scenario.cpp:13
BlamWorldObject_PrimitiveCylinder::resolution
int resolution
The level of detail to use for the primitive. Only used in cylinders.
Definition: world_objects.h:375
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:199
int32_t
int int32_t
Definition: stdint.h:13
plugins.h
BlamWorldObject_PrimitiveCylinder
Definition: world_objects.h:361
BlamWorldObject_PrimitiveCylinder::radius_1
float radius_1
A secondary radius of the primitive. Only used in cylinders.
Definition: world_objects.h:374
BlamTagClass::class_name_short
std::string class_name_short
The short, 4-character name of the tag class.
Definition: tags.h:197
BlamTagClass::version
int version
The tag class version. Should be incremented any time a tag class is modified whatsoever.
Definition: tags.h:198
main_menu
BlamDebugMenu * main_menu
The current debug menu information.
Definition: debug_menu.cpp:15
tag_reference
Structure representing a tag reference.
Definition: tags.h:277
BlamTagClass::class_name_long
std::string class_name_long
The longer class name. Typically shown alongside short name for user-friendliness.
Definition: tags.h:196
Blam::Content::Tags::GetTagData
BLAM BlamTagData * GetTagData(std::string tag_path)
Retrieves information for a given tag.
Definition: tags.cpp:80
BlamWorldObject_Primitive
Class representing a primitive-based world object.
Definition: world_objects.h:268
Blam::Content::Tags::LoadScenarioTag
BLAM void LoadScenarioTag(std::string tag_path)
Loads a new scenario tag.
Definition: scenario.cpp:145
BlamWorldObject_PrimitiveCuboid
Definition: world_objects.h:321
Int32Field
Class representing an int32 tag field.
Definition: int.h:46
bitfield16
Typedef for a bitfield16 field, used in tag data definitions.
Definition: tags.h:359
data_reference
Structure representing a data reference.
Definition: tags.h:323
Blam::Content::Tags::PrepareNewWorldState
BLAM void PrepareNewWorldState()
Prepares a new world state.
Definition: scenario.cpp:18
tag_reference::HasReference
bool HasReference()
Checks if a tag reference has a tag specified or not.
Definition: tag_reference.cpp:76
BlamWorldObject::SetPosition
void SetPosition(BlamVector3 position)
Definition: BlamWorldObject.cpp:189
BlamTagClass::tag_size
int tag_size
The size of the tag's data. Used on loading/writing tag files.
Definition: tags.h:201
Blam::World::InitializeEmptyWorldState
BLAM void InitializeEmptyWorldState()
Initializes a new world state with no default objects.
Definition: world.cpp:19
vector2
BlamVector2 vector2
Typedef for a vector2 field, used in tag definitions.
Definition: tags.h:425
BlamWorldObject::SetScale
void SetScale(BlamVector3 scale)
Definition: BlamWorldObject.cpp:205
Blam::Content::Tags::CleanupTagData
BLAM void CleanupTagData()
Releases all memory used by tags.
Definition: tags.cpp:135
BlamTagData::address
void * address
The address pointing to the start of the tag's data.
Definition: tags.h:130
scenario::TAG_BLOCK
TAG_BLOCK(project_folders, { bitfield8 flags;int32_t folder_id;int32_t parent_folder_id;data_reference folder_name;})
Contains information about project folders.
tags.h
tags.h
BlamTagData
Class used to contain and access tag data.
Definition: tags.h:124
CommentField
Class representing a comment field.
Definition: comment.h:29
Blam::Content::Tags::GetScenarioTag
BLAM scenario * GetScenarioTag(std::string tag_path)
Definition: scenario.cpp:16
BlockField
Class representing a tag block field, also sometimes referred to as a struct or reflexive in the modd...
Definition: block.h:19
BlamWorldObject::SetRotation
void SetRotation(BlamVector3 _rotation, bool local_axes=false)
Definition: BlamWorldObject.cpp:151
BlamWorldState
Class representing a world state.
Definition: world_objects.h:540
needs_new_world_state
bool needs_new_world_state
Definition: scenario.cpp:11
BlamTagClass
Class representing a tag class.
Definition: tags.h:193
BlamWorldObject::description
std::string description
An optional description of this object.
Definition: world_objects.h:139
Bitfield8Field
Class representing a bitfield8 tag field.
Definition: bitfield.h:33
api.h