Elaztek Developer Hub
Blamite Game Engine - blam!  00398.09.22.23.2015.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>
18 
19 #ifndef BLAM
20 #define BLAM
21 #endif
22 
23 
24 
25 #pragma pack(push, 1)
26 struct scenario
27 {
28  TAG_ENUM(type,
29  {
30  solo,
31  multiplayer,
32  main_menu,
33  multiplayer_shared,
34  singleplayer_shared,
35  });
36 
40  TAG_BLOCK(project_folders,
41  {
42  bitfield8 flags;
43  int32_t folder_id;
44  int32_t parent_folder_id;
45  ascii folder_name;
46  });
50  TAG_BLOCK(primitives,
51  {
52  int32_t folder_id;
53  ascii name;
54  ascii description;
55 
58  TAG_ENUM(type,
59  {
60  cuboid,
61  cylinder,
62  });
63 
64  tag_reference material_override;
65  //POSITION
66 
67  vector3 position;
68  vector3 rotation;
69  vector3 scale;
70  //cylinder specific properties
71 
72  vector2 cylinder_radius;
73  int32_t cylinder_resolution;
74  });
75 };
76 #pragma pack(pop)
77 
79 {
80 public:
82  {
83  class_name_long = "scenario";
84  class_name_short = "scnr";
85  version = 4;
86 
87  revisions = {
88  {1, "haloman30", "Initial implementation."},
89  {2, "haloman30", "Added 'project folders' block."},
90  {3, "haloman30", "Replaced several real values with vectors."},
91  {4, "haloman30", "Add support for material overrides for primitives"},
92 
93  };
94 
95  tag_size = 68;
96 
97  fields =
98  {
99  new Enum32Field("type", "",
100  {
101  "solo",
102  "multiplayer",
103  "main menu",
104  "multiplayer shared",
105  "singleplayer shared",
106  }),
107  new BlockField(137, "project folders", "Contains information about project folders. Only used within the editor.",
108  {
109  new Bitfield8Field("flags", "List of flags that apply to this folder.",
110  {
111  "has parent folder",
112  }),
113  new Int32Field("folder id", "The ID of this folder."),
114  new Int32Field("parent folder id", "The ID of this folder's parent folder, if applicable."),
115  new AsciiField("folder name", "The display name of the folder."),
116  }),
117  new BlockField(344, "primitives", "List of primitive objects contained within the scenario.",
118  {
119  new Int32Field("folder id", "the folder id that this primitive exists within. set to -1 to have no parent"),
120  new AsciiField("name", "custom display name for the object"),
121  new AsciiField("description", "custom description for the object"),
122  new Enum32Field("type", "The type of this primitive.",
123  {
124  "cuboid",
125  "cylinder",
126  }),
127  new TagReferenceField("material override", "", { }),
128  new CommentField("POSITION",
129  ""),
130  new Vector3Field("position", ""),
131  new Vector3Field("rotation", ""),
132  new Vector3Field("scale", ""),
133  new CommentField("cylinder specific properties",
134  ""),
135  new Vector2Field("radius", ""),
136  new Int32Field("cylinder resolution", ""),
137  }),
138 
139  };
140  }
141 };
142 
143 namespace Blam::Content::Tags
144 {
145  BLAM scenario* GetScenarioTag(std::string tag_path);
146 }
scenario::TAG_ENUM
TAG_ENUM(type, { solo, multiplayer, main_menu, multiplayer_shared, singleplayer_shared, })
Blam::World::GetWorldState
BLAM_EXT_API 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:47
tag_io.h
BlamWorldState::AddObject
void AddObject(BlamWorldObject *object)
Definition: BlamWorldState.cpp:70
BLAM
#define BLAM
Definition: scenario.h:20
BlamWorldObject::name
std::string name
The unique name of this object.
Definition: world_objects.h:45
Blam::Content::Tags
Namespace containing functions related to tag data.
Definition: bitmap.h:196
ScenarioTagClass::ScenarioTagClass
ScenarioTagClass()
Definition: scenario.h:81
BlamWorldObject::position
BlamVector3 position
The position of this object in world space.
Definition: world_objects.h:51
Blam::Logger::LogEvent
BLAM void LogEvent(std::string message)
Logs a message to the log and/or console.
Definition: aliases.cpp:142
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:357
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:353
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:84
BlamWorldObject::rotation
BlamVector3 rotation
The rotation of this object in world space.
Definition: world_objects.h:52
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:78
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:26
TagReferenceField
Class representing a tag reference, or tagref for short.
Definition: tagref.h:20
Enum32Field
Definition: enum.h:46
BlamTagClass::fields
std::vector< BlamTagClassField * > fields
A series of tag fields that store the layout of the tag.
Definition: tags.h:138
bitfield8
Typedef for a bitfield8 field, used in tag data definitions.
Definition: tags.h:275
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:137
int32_t
int int32_t
Definition: stdint.h:13
Blam3DPrimitiveType::Cuboid
@ Cuboid
BlamTagClass::class_name_short
std::string class_name_short
The short, 4-character name of the tag class.
Definition: tags.h:135
BlamTagClass::version
int version
The tag class version. Should be incremented any time a tag class is modified whatsoever.
Definition: tags.h:136
main_menu
BlamDebugMenu * main_menu
The debug menu data.
Definition: debug_menu.cpp:15
tag_reference
Structure representing a tag reference.
Definition: tags.h:215
BlamTagClass::class_name_long
std::string class_name_long
The longer class name. Typically shown alongside short name for user-friendliness.
Definition: tags.h:134
BlamWorldObject::scale
BlamVector3 scale
The scale/size of the object.
Definition: world_objects.h:53
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:103
Blam::Content::Tags::LoadScenarioTag
BLAM_EXT_API void LoadScenarioTag(std::string tag_path)
Loads a new scenario tag.
Definition: scenario.cpp:77
fields.h
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:139
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:125
vector2
BlamVector2 vector2
Typedef for a vector2 field, used in tag definitions.
Definition: tags.h:356
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:71
tagclass.h
BlamWorldObject_Primitive::radius_0
float radius_0
The radius of the primitive. Only used in cylinders.
Definition: world_objects.h:124
BlamWorldObject_Primitive::resolution
int resolution
The level of detail to use for the primitive. Only used in cylinders.
Definition: world_objects.h:126
tags.h
tags.h
BlamTagData
Class used to contain and access tag data.
Definition: tags.h:68
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:21
BlamWorldState
Class representing a world state.
Definition: world_objects.h:149
BlamTagClass
Class representing a tag class.
Definition: tags.h:131
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:46
Bitfield8Field
Class representing a bitfield8 tag field.
Definition: bitfield.h:33