Elaztek Developer Hub
Blamite Game Engine - blam!  00406.12.10.23.1457.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  ascii folder_name;
45  });
49  TAG_BLOCK(primitives,
50  {
51  int32_t folder_id;
52  ascii name;
53  ascii 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 };
75 #pragma pack(pop)
76 
78 {
79 public:
81  {
82  class_name_long = "scenario";
83  class_name_short = "scnr";
84  version = 4;
85 
86  revisions = {
87  {1, "haloman30", "Initial implementation."},
88  {2, "haloman30", "Added 'project folders' block."},
89  {3, "haloman30", "Replaced several real values with vectors."},
90  {4, "haloman30", "Add support for material overrides for primitives"},
91 
92  };
93 
94  tag_size = 68;
95 
96  fields =
97  {
98  new Enum32Field("type", "",
99  {
100  "solo",
101  "multiplayer",
102  "main menu",
103  "multiplayer shared",
104  "singleplayer shared",
105  }),
106  new BlockField(137, "project folders", "Contains information about project folders. Only used within the editor.",
107  {
108  new Bitfield8Field("flags", "List of flags that apply to this folder.",
109  {
110  "has parent folder",
111  }),
112  new Int32Field("folder id", "The ID of this folder."),
113  new Int32Field("parent folder id", "The ID of this folder's parent folder, if applicable."),
114  new AsciiField("folder name", "The display name of the folder."),
115  }),
116  new BlockField(344, "primitives", "List of primitive objects contained within the scenario.",
117  {
118  new Int32Field("folder id", "the folder id that this primitive exists within. set to -1 to have no parent"),
119  new AsciiField("name", "custom display name for the object"),
120  new AsciiField("description", "custom description for the object"),
121  new Enum32Field("type", "The type of this primitive.",
122  {
123  "cuboid",
124  "cylinder",
125  }),
126  new TagReferenceField("material override", "", { }),
127  new CommentField("POSITION",
128  ""),
129  new Vector3Field("position", ""),
130  new Vector3Field("rotation", ""),
131  new Vector3Field("scale", ""),
132  new CommentField("cylinder specific properties",
133  ""),
134  new Vector2Field("radius", ""),
135  new Int32Field("cylinder resolution", ""),
136  }),
137 
138  };
139  }
140 };
141 
142 namespace Blam::Content::Tags
143 {
144  BLAM scenario* GetScenarioTag(std::string tag_path);
145 }
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:44
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:54
tag_io.h
BlamWorldState::AddObject
void AddObject(BlamWorldObject *object)
Definition: BlamWorldState.cpp:70
BLAM
#define BLAM
Definition: scenario.h:19
BlamWorldObject::name
std::string name
The unique name of this object.
Definition: world_objects.h:52
Blam::Content::Tags
Namespace containing functions related to tag data.
Definition: bitmap.h:195
ScenarioTagClass::ScenarioTagClass
ScenarioTagClass()
Definition: scenario.h:80
BlamWorldObject::position
BlamVector3 position
The position of this object in world space.
Definition: world_objects.h:58
Blam::Logger::LogEvent
BLAM void LogEvent(std::string message)
Logs a message to the log and/or console.
Definition: aliases.cpp:130
scenario::TAG_BLOCK
TAG_BLOCK(project_folders, { bitfield8 flags;int32_t folder_id;int32_t parent_folder_id;ascii folder_name;})
Contains information about project folders.
logger.h
vector3
BlamVector3 vector3
Typedef for a vector3 field, used in tag definitions.
Definition: tags.h:414
AsciiField
Class representing an ascii tag field.
Definition: ascii.h:18
ascii
char ascii[128]
Typedef for an ascii field, used in tag data definitions.
Definition: tags.h:410
active_scenario_tag_data
BlamTagData * active_scenario_tag_data
Definition: scenario.cpp:10
Vector2Field
Class representing a vector2 tag field.
Definition: vector.h:34
BlamTagData::path
char path[256]
The tag's path.
Definition: tags.h:141
BlamWorldObject::rotation
BlamVector3 rotation
The rotation of this object in world space.
Definition: world_objects.h:59
world.h
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:317
Vector3Field
Class representing a vector3 tag field.
Definition: vector.h:47
ScenarioTagClass
Definition: scenario.h:77
scenario.h
Blam::Content::Tags::GetActiveScenarioTag
BLAM_EXT_API scenario * GetActiveScenarioTag()
Retrieves the currently loaded scenario tag.
Definition: scenario.cpp:72
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:34
BlamTagClass::fields
std::vector< BlamTagClassField * > fields
A series of tag fields that store the layout of the tag.
Definition: tags.h:195
bitfield8
Typedef for a bitfield8 field, used in tag data definitions.
Definition: tags.h:332
active_scenario_tag
scenario * active_scenario_tag
Definition: scenario.cpp:9
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:194
int32_t
int int32_t
Definition: stdint.h:13
Blam3DPrimitiveType::Cuboid
@ Cuboid
plugins.h
BlamTagClass::class_name_short
std::string class_name_short
The short, 4-character name of the tag class.
Definition: tags.h:192
BlamTagClass::version
int version
The tag class version. Should be incremented any time a tag class is modified whatsoever.
Definition: tags.h:193
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:272
BlamTagClass::class_name_long
std::string class_name_long
The longer class name. Typically shown alongside short name for user-friendliness.
Definition: tags.h:191
BlamWorldObject::scale
BlamVector3 scale
The scale/size of the object.
Definition: world_objects.h:60
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:110
Blam::Content::Tags::LoadScenarioTag
BLAM_EXT_API void LoadScenarioTag(std::string tag_path)
Loads a new scenario tag.
Definition: scenario.cpp:77
Blam3DPrimitiveType::Cylinder
@ Cylinder
Int32Field
Class representing an int32 tag field.
Definition: int.h:46
BlamTagClass::tag_size
int tag_size
The size of the tag's data. Used on loading/writing tag files.
Definition: tags.h:196
Blam::World::InitializeEmptyWorldState
BLAM void InitializeEmptyWorldState()
Initializes a new world state with no default objects.
Definition: world.cpp:23
BlamWorldObject_Primitive::radius_1
float radius_1
A secondary radius of the primitive. Only used in cylinders.
Definition: world_objects.h:132
vector2
BlamVector2 vector2
Typedef for a vector2 field, used in tag definitions.
Definition: tags.h:413
Blam::Content::Tags::CleanupTagData
BLAM void CleanupTagData()
Releases all memory used by tags.
Definition: tags.cpp:130
BlamTagData::address
void * address
The address pointing to the start of the tag's data.
Definition: tags.h:128
BlamWorldObject_Primitive::radius_0
float radius_0
The radius of the primitive. Only used in cylinders.
Definition: world_objects.h:131
BlamWorldObject_Primitive::resolution
int resolution
The level of detail to use for the primitive. Only used in cylinders.
Definition: world_objects.h:133
tags.h
tags.h
BlamTagData
Class used to contain and access tag data.
Definition: tags.h:125
PrepareNewWorldState
void PrepareNewWorldState()
Prepares a new world state.
Definition: scenario.cpp:17
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
BlamWorldState
Class representing a world state.
Definition: world_objects.h:156
BlamTagClass
Class representing a tag class.
Definition: tags.h:188
name
ARPHIC PUBLIC LICENSE Ltd Yung Chi Taiwan All rights reserved except as specified below Everyone is permitted to copy and distribute verbatim copies of this license but changing it is forbidden Preamble The licenses for most software are designed to take away your freedom to share and change it By the ARPHIC PUBLIC LICENSE specifically permits and encourages you to use this provided that you give the recipients all the rights that we gave you and make sure they can get the modifications of this software Legal Terms Font means the TrueType fonts AR PL Mingti2L AR PL KaitiM AR PL KaitiM and the derivatives of those fonts created through any modification including modifying reordering converting changing font name
Definition: ARPHICPL.TXT:16
BlamWorldObject::description
std::string description
An optional description of this object.
Definition: world_objects.h:53
Bitfield8Field
Class representing a bitfield8 tag field.
Definition: bitfield.h:33
api.h