Blamite Game Engine - Blam (Core)
BlamScript::Globals Namespace Reference

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

Classes

struct  ScriptGlobal
 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

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

Unknown. Referenced within the hs_doc from Halo 2 Sapien.

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()

ScriptGlobal * BlamScript::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 * BlamScript::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 * BlamScript::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 * BlamScript::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 * BlamScript::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 * BlamScript::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 * BlamScript::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 * BlamScript::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, ScriptGlobal > * BlamScript::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 BlamScript::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 BlamScript::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 BlamScript::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 BlamScript::Globals::RegisterGvar ( ScriptGlobal  var)

Registers a new engine global.

Parameters
var- The global to add to the list.

◆ RegisterGvar() [2/3]

void BlamScript::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 BlamScript::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 BlamScript::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 BlamScript::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 BlamScript::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 BlamScript::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 BlamScript::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 BlamScript::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 BlamScript::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 BlamScript::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.