Header file defining macros, structures, and functions for script management in a game engine. More...
Go to the source code of this file.
Classes | |
union | BehaviorAttribute |
Union representing different types of behavior attributes. More... | |
struct | Script |
Structure representing a script with a function and a name. More... | |
Macros | |
#define | NODE_FUNC_PARAMS struct Node *this, va_list args |
Macro to define the parameters for a node function. | |
#define | NODE_FUNC_RETURN void |
Macro to define the return type for a node function. | |
#define | GET_READY_PARAMETERS() float delta = (float) GET_PARAMETER(double); (void) delta |
Macro to retrieve the delta parameter from the variable argument list. | |
#define | GET_SIGNAL() Signal signal = (Signal) GET_PARAMETER(int); (void) signal |
Macro to retrieve the signal parameter from the variable argument list. | |
#define | GET_PARAMETER(type) va_arg(args, type) |
Macro to retrieve a parameter of a specified type from the variable argument list. | |
#define | GET_AREA_SIGNAL_PARAMETERS() ;int sigId = GET_PARAMETER(int); Node *other = (Node *) GET_PARAMETER(Node *); float distance = (float) GET_PARAMETER(double); float *impactPoint = (float *) GET_PARAMETER(float *); int offset = GET_PARAMETER(int); (void) sigId; (void) other; (void) distance; (void) impactPoint; (void) offset; |
Macro to retrieve parameters for an area signal from the variable argument list. | |
#define | MALLOC_ATTRIBUTE(node, x) |
Macro to allocate memory for node attributes if not already allocated. | |
#define | SET_ATTRIBUTES_COUNT(x) MALLOC_ATTRIBUTE(this, x) |
Macro to set the number of attributes for the current node. | |
#define | NEW_SCRIPT(script_name) NODE_FUNC_RETURN script_name(NODE_FUNC_PARAMS) { |
Macro to define a new script function. | |
#define | END_SCRIPT(script_name) |
Macro to end a script function and register it in the game engine. | |
Typedefs | |
typedef NODE_FUNC_RETURN(* | ScriptFunc) (NODE_FUNC_PARAMS) |
Function pointer type for script functions. | |
typedef ScriptFunc | Behavior[BEHAVIOR_SCRIPT_COUNT] |
Array of script functions for different behavior scripts. | |
Enumerations | |
enum | BehaviorScripts { BEHAVIOR_SCRIPT_READY , BEHAVIOR_SCRIPT_UPDATE , BEHAVIOR_SCRIPT_SIGNAL , BEHAVIOR_SCRIPT_COUNT } |
Enumeration of different behavior script types. More... | |
Variables | |
int | __scriptIndex__ |
Global index for tracking the number of registered scripts. | |
Header file defining macros, structures, and functions for script management in a game engine.
This file contains macros for handling script parameters, memory allocation for node attributes, and script registration. It also defines structures and types for behavior attributes, scripts, and behavior scripts enumeration.
#define NODE_FUNC_PARAMS struct Node *this, va_list args |
Macro to define the parameters for a node function.
#define NODE_FUNC_RETURN void |
Macro to define the return type for a node function.
#define GET_READY_PARAMETERS | ( | ) | float delta = (float) GET_PARAMETER(double); (void) delta |
Macro to retrieve the delta parameter from the variable argument list.
#define GET_SIGNAL | ( | ) | Signal signal = (Signal) GET_PARAMETER(int); (void) signal |
Macro to retrieve the signal parameter from the variable argument list.
#define GET_PARAMETER | ( | type | ) | va_arg(args, type) |
Macro to retrieve a parameter of a specified type from the variable argument list.
type | The type of the parameter to retrieve. |
#define GET_AREA_SIGNAL_PARAMETERS | ( | ) | ;int sigId = GET_PARAMETER(int); Node *other = (Node *) GET_PARAMETER(Node *); float distance = (float) GET_PARAMETER(double); float *impactPoint = (float *) GET_PARAMETER(float *); int offset = GET_PARAMETER(int); (void) sigId; (void) other; (void) distance; (void) impactPoint; (void) offset; |
Macro to retrieve parameters for an area signal from the variable argument list.
#define MALLOC_ATTRIBUTE | ( | node, | |
x | |||
) |
Macro to allocate memory for node attributes if not already allocated.
node | The node for which to allocate attributes. |
x | The number of attributes to allocate. |
#define SET_ATTRIBUTES_COUNT | ( | x | ) | MALLOC_ATTRIBUTE(this, x) |
Macro to set the number of attributes for the current node.
x | The number of attributes to set. |
#define NEW_SCRIPT | ( | script_name | ) | NODE_FUNC_RETURN script_name(NODE_FUNC_PARAMS) { |
Macro to define a new script function.
script_name | The name of the script function. |
#define END_SCRIPT | ( | script_name | ) |
Macro to end a script function and register it in the game engine.
script_name | The name of the script function. |
ScriptFunc |
Function pointer type for script functions.
Behavior |
Array of script functions for different behavior scripts.
enum BehaviorScripts |
|
extern |
Global index for tracking the number of registered scripts.