Blamite Game Engine - blam!  00296.01.12.21.0102.blamite
The core library for the Blamite Game Engine.
Blam::Globals Namespace Reference

Namespace containing things relating to game engine globals. More...

Classes

struct  EngineGlobal
 Structure containing data for a game engine global. More...
 

Enumerations

enum  GvarUpdateResult {
  InvalidType, UnknownGlobal, Ok, InvalidArgs,
  OutOfBounds, GlobalIsProtected
}
 Enumerator for the result of a global update attempt. More...
 
enum  GvarType {
  Boolean, Real, Short, Long,
  Object, String, Int, Float,
  Color
}
 Enumerator for the type of global variable. More...
 

Functions

BLAM std::map< std::string, EngineGlobal > * GetGlobalsList ()
 Retrieves the list of loaded globals. More...
 
BLAM bool LoadGlobalsFromFile ()
 Loads any globals from GVARS_FILE. More...
 
BLAM std::string GetGvarTypeLabel (GvarType type)
 Retrieves a string representation of a global's type, for use in UI. More...
 
BLAM bool GlobalExists (std::string id)
 Determines whether or not a global exists. More...
 
BLAM void RegisterGvar (EngineGlobal var)
 Registers a new engine global. More...
 
BLAM void RegisterGvar (std::string name, std::string value_raw, GvarType type)
 Registers a new engine global. More...
 
BLAM void RegisterGvar (std::string name, std::string value_raw, GvarType type, std::string info)
 Registers a new engine global. More...
 
BLAM EngineGlobalGetGlobal (std::string name)
 Retrieves a global with the specified ID. More...
 
BLAM GvarUpdateResult UpdateGlobalWrap (std::string name, std::string new_value)
 Updates a global's raw value. More...
 
BLAM GvarUpdateResult UpdateGlobal (std::string name, std::string new_value)
 Updates the value of a String global. More...
 
BLAM GvarUpdateResult UpdateGlobal (std::string name, bool new_value)
 Updates the value of a Boolean global. More...
 
BLAM GvarUpdateResult UpdateGlobal (std::string name, int new_value)
 Updates the value of a Integer global. More...
 
BLAM GvarUpdateResult UpdateGlobal (std::string name, short new_value)
 Updates the value of a Short global. More...
 
BLAM GvarUpdateResult UpdateGlobal (std::string name, long new_value)
 Updates the value of a Long global. More...
 
BLAM GvarUpdateResult UpdateGlobal (std::string name, float new_value)
 Updates the value of a Float global. More...
 
BLAM GvarUpdateResult UpdateGlobal (std::string name, BlamColor new_value)
 Updates the value of a Color global. More...
 
BLAM bool * GetGlobalAsBoolean (std::string name)
 Retrieves a global's value as a boolean. More...
 
BLAM std::string * GetGlobalAsString (std::string name)
 Retrieves a global's value as a string. More...
 
BLAM short * GetGlobalAsShort (std::string name)
 Retrieves a global's value as a short. More...
 
BLAM long * GetGlobalAsLong (std::string name)
 Retrieves a global's value as a long. More...
 
BLAM int * GetGlobalAsInteger (std::string name)
 Retrieves a global's value as an int. More...
 
BLAM float * GetGlobalAsFloat (std::string name)
 Retrieves a global's value as a float. More...
 
BLAM BlamColor * GetGlobalAsColor (std::string name)
 Retrieves a global's value as a BlamColor. More...
 

Detailed Description

Namespace containing things relating to game engine globals.

Enumeration Type Documentation

◆ GvarType

Enumerator for the type of global variable.

Enumerator
Boolean 

Represents a boolean. Can be true or false.

Real 

Same as Float.

Short 

Represents a short.

Long 

Represents a long.

Object 

Unknown. Referenced within the hs_doc from Halo 2 Sapien.

String 

Represents a std::string.

Int 

Represents an int.

Float 

Represents a float.

Color 

Represents a BlamColor. See #BlamColor for details.

◆ GvarUpdateResult

Enumerator for the result of a global update attempt.

Enumerator
InvalidType 

The provided value was of an invalid type.

UnknownGlobal 

The specified global does not exist.

Ok 

The global was updated successfully.

InvalidArgs 

The provided arguments were invalid.

OutOfBounds 

The provided value was too small or too large for the globals' data type.

GlobalIsProtected 

The specified global is protected and cannot be modified during runtime.

Function Documentation

◆ GetGlobal()

EngineGlobal * Blam::Globals::GetGlobal ( std::string  name)

Retrieves a global with the specified ID.

Parameters
name- The ID of the desired global.
Returns
A pointer to the specified global, or nullptr if it could not be found.

◆ GetGlobalAsBoolean()

bool * Blam::Globals::GetGlobalAsBoolean ( std::string  name)

Retrieves a global's value as a boolean.

Parameters
name- The ID of the global to retrieve.
Returns
A pointer to the global's boolean value.

◆ GetGlobalAsColor()

BlamColor * Blam::Globals::GetGlobalAsColor ( std::string  name)

Retrieves a global's value as a BlamColor.

Parameters
name- The ID of the global to retrieve.
Returns
A pointer to the global's color information.

◆ GetGlobalAsFloat()

float * Blam::Globals::GetGlobalAsFloat ( std::string  name)

Retrieves a global's value as a float.

Parameters
name- The ID of the global to retrieve.
Returns
A pointer to the global's float value.

◆ GetGlobalAsInteger()

int * Blam::Globals::GetGlobalAsInteger ( std::string  name)

Retrieves a global's value as an int.

Parameters
name- The ID of the global to retrieve.
Returns
A pointer to the global's int value.

◆ GetGlobalAsLong()

long * Blam::Globals::GetGlobalAsLong ( std::string  name)

Retrieves a global's value as a long.

Parameters
name- The ID of the global to retrieve.
Returns
A pointer to the global's long value.

◆ GetGlobalAsShort()

short * Blam::Globals::GetGlobalAsShort ( std::string  name)

Retrieves a global's value as a short.

Parameters
name- The ID of the global to retrieve.
Returns
A pointer to the global's short value.

◆ GetGlobalAsString()

std::string * Blam::Globals::GetGlobalAsString ( std::string  name)

Retrieves a global's value as a string.

Parameters
name- The ID of the global to retrieve.
Returns
A pointer to the global's string value.

◆ GetGlobalsList()

std::map< std::string, EngineGlobal > * Blam::Globals::GetGlobalsList ( )

Retrieves the list of loaded globals.

The key is the ID of the global. The value is the global data.

Returns
A pointer to the list of loaded globals.

◆ GetGvarTypeLabel()

std::string Blam::Globals::GetGvarTypeLabel ( GvarType  type)

Retrieves a string representation of a global's type, for use in UI.

Parameters
type- The type of the global to evaluate.
Returns
The specified global type as a string.

◆ GlobalExists()

bool Blam::Globals::GlobalExists ( std::string  id)

Determines whether or not a global exists.

Parameters
id- The ID of the global to check for.
Returns
Whether or not the specified global exists.

◆ LoadGlobalsFromFile()

bool Blam::Globals::LoadGlobalsFromFile ( )

Loads any globals from GVARS_FILE.

Returns
true if the file was loaded, false if the file could not be found.

◆ RegisterGvar() [1/3]

void Blam::Globals::RegisterGvar ( EngineGlobal  var)

Registers a new engine global.

Parameters
var- The global to add to the list.

◆ RegisterGvar() [2/3]

void Blam::Globals::RegisterGvar ( std::string  name,
std::string  value_raw,
GvarType  type 
)

Registers a new engine global.

Parameters
name- The ID of the new global.
value_raw- The raw string value of the global.
type- The type of the global.

◆ RegisterGvar() [3/3]

void Blam::Globals::RegisterGvar ( std::string  name,
std::string  value_raw,
GvarType  type,
std::string  info 
)

Registers a new engine global.

Parameters
name- The ID of the new global.
value_raw- The raw string value of the global.
type- The type of the global.
info- A description of the global.

◆ UpdateGlobal() [1/7]

GvarUpdateResult Blam::Globals::UpdateGlobal ( std::string  name,
BlamColor  new_value 
)

Updates the value of a Color global.

Parameters
name- The ID of the global to update.
new_value- The new value to apply to the global.
Returns
The result of the update attempt. See #BlamScript::Globals::GvarUpdateResult for details.

◆ UpdateGlobal() [2/7]

GvarUpdateResult Blam::Globals::UpdateGlobal ( std::string  name,
bool  new_value 
)

Updates the value of a Boolean global.

Parameters
name- The ID of the global to update.
new_value- The new value to apply to the global.
Returns
The result of the update attempt. See #BlamScript::Globals::GvarUpdateResult for details.

◆ UpdateGlobal() [3/7]

GvarUpdateResult Blam::Globals::UpdateGlobal ( std::string  name,
float  new_value 
)

Updates the value of a Float global.

Parameters
name- The ID of the global to update.
new_value- The new value to apply to the global.
Returns
The result of the update attempt. See #BlamScript::Globals::GvarUpdateResult for details.

◆ UpdateGlobal() [4/7]

GvarUpdateResult Blam::Globals::UpdateGlobal ( std::string  name,
int  new_value 
)

Updates the value of a Integer global.

Parameters
name- The ID of the global to update.
new_value- The new value to apply to the global.
Returns
The result of the update attempt. See #BlamScript::Globals::GvarUpdateResult for details.

◆ UpdateGlobal() [5/7]

GvarUpdateResult Blam::Globals::UpdateGlobal ( std::string  name,
long  new_value 
)

Updates the value of a Long global.

Parameters
name- The ID of the global to update.
new_value- The new value to apply to the global.
Returns
The result of the update attempt. See #BlamScript::Globals::GvarUpdateResult for details.

◆ UpdateGlobal() [6/7]

GvarUpdateResult Blam::Globals::UpdateGlobal ( std::string  name,
short  new_value 
)

Updates the value of a Short global.

Parameters
name- The ID of the global to update.
new_value- The new value to apply to the global.
Returns
The result of the update attempt. See #BlamScript::Globals::GvarUpdateResult for details.

◆ UpdateGlobal() [7/7]

GvarUpdateResult Blam::Globals::UpdateGlobal ( std::string  name,
std::string  new_value 
)

Updates the value of a String global.

Parameters
name- The ID of the global to update.
new_value- The new value to apply to the global.
Returns
The result of the update attempt. See #BlamScript::Globals::GvarUpdateResult for details.

◆ UpdateGlobalWrap()

GvarUpdateResult Blam::Globals::UpdateGlobalWrap ( std::string  name,
std::string  new_value 
)

Updates a global's raw value.

Can be used with globals of any type.

Parameters
name- The ID of the global to update.
new_value- The new value to apply to the global.
Returns
The result of the update attempt. See #BlamScript::Globals::GvarUpdateResult for details.