|
Dumb-ways-to-memorize
2D game
|
Include dependency graph for ai_interpret.h:
This graph shows which files directly or indirectly include this file:Go to the source code of this file.
Data Structures | |
| struct | ai_function_t |
Macros | |
| #define | MAX_AI 255 |
| #define | AI_PATH "AI/" |
| #define | AI_FUNCTION_OBJECT "Think" |
| #define | AI_VAR_G_STR "Variables" |
| #define | AI_TYPE_STR "AI_Type" |
| #define | AI_TYPE_PRESET_STR "preset" |
| #define | AI_TYPE_VARIABLE_STR "variable" |
| #define | AI_TYPE_RECURSIVE_STR "AI_Recursive" |
| #define | AI_VAR_GRAVITY_STR "gravity" |
| #define | AI_VAR_STR "variables" |
| #define | AI_CHECK_STR "condition" |
| #define | AI_BASE_JUMP -5 |
| #define | AI_BASE_SPEED 1 |
| #define | AI_BASE_THINK_FRAMES 1 |
| #define | AI_BASE_DAMAGE 5 |
Enumerations | |
| enum | ai_type_t { AI_TYPE_NULL, AI_TYPE_PRESET = 0x1, AI_TYPE_VARIABLE, AI_TYPE_RECURSIVE } |
| enum | ai_variables_t { AI_VAR_SPEED, AI_VAR_FRAMES, AI_VAR_TIME, AI_VAR_DAMAGE, AI_VAR_DIR_X, AI_VAR_DIR_Y, AI_VAR_CHECK, AI_VAR_MAX } |
| enum | ai_flags_t { AI_FLAG_CHECK_PLAYER = 0x1, AI_FLAG_CHECK_OBJECT = 0x2, AI_FLAG_GRAVITY = 0x4 } |
| enum | ai_actions_t { AI_ACTION_NOTHING, AI_ACTION_MOVE, AI_ACTION_WALK, AI_ACTION_JUMP, AI_ACTION_ATTACK, AI_ACTION_MAX } |
| enum | ai_conditions_t { AI_CONDITION_PLAYER_DISTANCE, AI_CONDITION_OBJECT_DISTANCE, AI_CONDITION_OBJECT_NAME, AI_CONDITION_LINK_AI, AI_CONDITION_LINK_ACTION, AI_CONDITION_MAX } |
Functions | |
| ai_function_t * | ParseAI (object_t *obj, char *g_str, char **variables) |
| ai_function_t * | ParsePresetAI (object_t *obj, char *g_str) |
| void | SetAI_Var (ai_function_t *function, char *data_str, ai_variables_t var_type) |
| void | SetAI_Action (ai_function_t *function, object_t *obj, jsmntok_t *tok, char *g_str, ai_actions_t action_type) |
| void | SetAI_Check (ai_function_t *function, char **variables_str, char *data_str, ai_conditions_t condition) |
| int | InitAISystem () |
| void | ShutdownAISystem () |
| ai_type_t | StrToAI_Type (const char *str) |
| ai_actions_t | StrToAI_Action (const char *str) |
| ai_conditions_t | StrToAI_Condition (const char *str) |
| ai_variables_t | StrToVariableType (const char *str) |
Variables | |
| char * | gAI_Variables [] |
| char * | gAI_Actions [] |
| char * | gAI_Conditions [] |
| ai_function_t * | gVariableAIs |
| ai_function_t * | gPresetAIs |
| #define AI_BASE_DAMAGE 5 |
Definition at line 29 of file ai_interpret.h.
Referenced by SetAI_Var().
| #define AI_BASE_JUMP -5 |
Definition at line 26 of file ai_interpret.h.
Referenced by SetAI_Action().
| #define AI_BASE_SPEED 1 |
Definition at line 27 of file ai_interpret.h.
Referenced by SetAI_Var().
| #define AI_BASE_THINK_FRAMES 1 |
Definition at line 28 of file ai_interpret.h.
Referenced by SetAI_Var().
| #define AI_CHECK_STR "condition" |
Definition at line 23 of file ai_interpret.h.
| #define AI_FUNCTION_OBJECT "Think" |
Definition at line 10 of file ai_interpret.h.
Referenced by ParseAI(), and ParsePresetAI().
| #define AI_PATH "AI/" |
Definition at line 9 of file ai_interpret.h.
| #define AI_TYPE_PRESET_STR "preset" |
Definition at line 13 of file ai_interpret.h.
Referenced by StrToAI_Type().
| #define AI_TYPE_RECURSIVE_STR "AI_Recursive" |
Definition at line 15 of file ai_interpret.h.
| #define AI_TYPE_STR "AI_Type" |
Definition at line 12 of file ai_interpret.h.
Referenced by ParseAI(), and ParsePresetAI().
| #define AI_TYPE_VARIABLE_STR "variable" |
Definition at line 14 of file ai_interpret.h.
Referenced by StrToAI_Type().
| #define AI_VAR_G_STR "Variables" |
Definition at line 11 of file ai_interpret.h.
| #define AI_VAR_GRAVITY_STR "gravity" |
Definition at line 16 of file ai_interpret.h.
| #define AI_VAR_STR "variables" |
Definition at line 18 of file ai_interpret.h.
Referenced by ParseAI(), and ParsePresetAI().
| #define MAX_AI 255 |
Definition at line 8 of file ai_interpret.h.
Referenced by InitAISystem().
| enum ai_actions_t |
Defines the enum for action types
| Enumerator | |
|---|---|
| AI_ACTION_NOTHING | |
| AI_ACTION_MOVE | |
| AI_ACTION_WALK | |
| AI_ACTION_JUMP | |
| AI_ACTION_ATTACK | |
| AI_ACTION_MAX | |
Definition at line 64 of file ai_interpret.h.
| enum ai_conditions_t |
| Enumerator | |
|---|---|
| AI_CONDITION_PLAYER_DISTANCE | |
| AI_CONDITION_OBJECT_DISTANCE | |
| AI_CONDITION_OBJECT_NAME | |
| AI_CONDITION_LINK_AI | |
| AI_CONDITION_LINK_ACTION | |
| AI_CONDITION_MAX | |
Definition at line 75 of file ai_interpret.h.
| enum ai_flags_t |
Defines the enum for what flags are set on the ai
| Enumerator | |
|---|---|
| AI_FLAG_CHECK_PLAYER | |
| AI_FLAG_CHECK_OBJECT | |
| AI_FLAG_GRAVITY | |
Definition at line 55 of file ai_interpret.h.
| enum ai_type_t |
Defines the enum for ai_types
Definition at line 32 of file ai_interpret.h.
| enum ai_variables_t |
Defines the enum for the variables in mVariables
Definition at line 41 of file ai_interpret.h.
| int InitAISystem | ( | ) |
Init AI system, similar to Entity init, for now....
Definition at line 646 of file ai_interpret.c.
References gPresetAIs, gVariableAIs, MAX_AI, and ShutdownAISystem().
Referenced by Setup().
| ai_function_t* ParseAI | ( | object_t * | obj, |
| char * | g_str, | ||
| char ** | variables | ||
| ) |
Parses AI behavior using the variables given and the AI obj/file specified.
| [in,out] | obj | If non-null, the object. |
| [in,out] | g_str | If non-null, the string. |
| [in,out] | variables | If non-null, the variables. |
Definition at line 261 of file ai_interpret.c.
References AI_CONDITION_OBJECT_NAME, AI_FLAG_CHECK_OBJECT, AI_FLAG_GRAVITY, AI_FUNCTION_OBJECT, AI_TYPE_STR, AI_VAR_STR, CountMem(), CountObjectMembers(), FindKey(), FindObject(), FindValue(), gAI_Actions, gAI_Conditions, gAI_Variables, JsmnToString(), SetAI_Action(), SetAI_Check(), SetAI_Var(), StrToAI_Type(), and StrToInt().
Referenced by LoadLevel(), and SetAI_Check().
| ai_function_t* ParsePresetAI | ( | object_t * | obj, |
| char * | g_str | ||
| ) |
Parse a preset AI, with values determined by whats in the file.
| [in,out] | obj | If non-null, the object. |
| [in,out] | g_str | If non-null, the string. |
Definition at line 374 of file ai_interpret.c.
References AI_CONDITION_OBJECT_NAME, AI_FLAG_CHECK_OBJECT, AI_FLAG_GRAVITY, AI_FUNCTION_OBJECT, AI_TYPE_STR, AI_VAR_STR, CountMem(), CountObjectMembers(), FindKey(), FindObject(), FindValue(), gAI_Actions, gAI_Conditions, gAI_Variables, JsmnToString(), SetAI_Action(), SetAI_Check(), SetAI_Var(), and StrToAI_Type().
Referenced by LoadLevel().
| void SetAI_Action | ( | ai_function_t * | function, |
| object_t * | obj, | ||
| jsmntok_t * | tok, | ||
| char * | g_str, | ||
| ai_actions_t | action_type | ||
| ) |
Sets AI action defined in ai_actions to the ai_function
| [in,out] | function | If non-null, the function. |
| [in,out] | obj | If non-null, the object. |
| [in,out] | tok | If non-null, the tok. |
| [in,out] | g_str | If non-null, the string. |
| [in,out] | action_type | If non-null, the action type. |
Definition at line 516 of file ai_interpret.c.
References AI_ACTION_ATTACK, AI_ACTION_JUMP, AI_ACTION_MOVE, AI_ACTION_NOTHING, AI_ACTION_WALK, AI_BASE_JUMP, AI_VAR_DIR_X, AI_VAR_DIR_Y, JsmnToString(), ParseToVec2(), vec2_t::x, and vec2_t::y.
Referenced by ParseAI(), and ParsePresetAI().
| void SetAI_Check | ( | ai_function_t * | function, |
| char ** | variables_str, | ||
| char * | data_str, | ||
| ai_conditions_t | condition | ||
| ) |
Sets checks that need to occur for the ai_function to be called.
| [in,out] | function | If non-null, the function. |
| [in,out] | variables_str | If non-null, the variables string. |
| [in,out] | data_str | If non-null, the data string. |
| [in,out] | check_str | If non-null, the condition type. |
Definition at line 601 of file ai_interpret.c.
References AI_CONDITION_LINK_ACTION, AI_CONDITION_LINK_AI, AI_CONDITION_OBJECT_DISTANCE, AI_CONDITION_PLAYER_DISTANCE, AI_FLAG_CHECK_OBJECT, AI_FLAG_CHECK_PLAYER, AI_VAR_CHECK, ConvertFileToUseable(), ParseAI(), ParseToObject(), and StrToInt().
Referenced by ParseAI(), and ParsePresetAI().
| void SetAI_Var | ( | ai_function_t * | function, |
| char * | data_str, | ||
| ai_variables_t | var_type | ||
| ) |
Sets AI variables in ai_function->mVariables.
| [in,out] | function | If non-null, the function. |
| [in,out] | data_str | If non-null, the data string. |
| [in,out] | var_type | If non-null, the variable type. |
Definition at line 481 of file ai_interpret.c.
References AI_BASE_DAMAGE, AI_BASE_SPEED, AI_BASE_THINK_FRAMES, AI_VAR_DAMAGE, AI_VAR_FRAMES, AI_VAR_SPEED, AI_VAR_TIME, and StrToInt().
Referenced by ParseAI(), and ParsePresetAI().
| void ShutdownAISystem | ( | ) |
Shutdown AI system, just frees the global variables simple.
Definition at line 668 of file ai_interpret.c.
References gPresetAIs, and gVariableAIs.
Referenced by InitAISystem().
| ai_actions_t StrToAI_Action | ( | const char * | str | ) |
Definition at line 691 of file ai_interpret.c.
References AI_ACTION_MAX, and gAI_Actions.
| ai_conditions_t StrToAI_Condition | ( | const char * | str | ) |
Definition at line 704 of file ai_interpret.c.
References AI_CONDITION_MAX, and gAI_Conditions.
| ai_type_t StrToAI_Type | ( | const char * | str | ) |
Converts a str to an AI type.
| str | The string. |
Definition at line 679 of file ai_interpret.c.
References AI_TYPE_NULL, AI_TYPE_PRESET, AI_TYPE_PRESET_STR, AI_TYPE_VARIABLE, and AI_TYPE_VARIABLE_STR.
Referenced by ParseAI(), and ParsePresetAI().
| ai_variables_t StrToVariableType | ( | const char * | str | ) |
Definition at line 717 of file ai_interpret.c.
References AI_VAR_MAX, and gAI_Variables.
| char* gAI_Actions[] |
The actions that are related to ai functions
Definition at line 13 of file ai_interpret.c.
Referenced by ParseAI(), ParsePresetAI(), and StrToAI_Action().
| char* gAI_Conditions[] |
The conditions for the ai function to be executed
Definition at line 14 of file ai_interpret.c.
Referenced by ParseAI(), ParsePresetAI(), and StrToAI_Condition().
| char* gAI_Variables[] |
The variables to be parsed for ai data
Definition at line 12 of file ai_interpret.c.
Referenced by ParseAI(), ParsePresetAI(), and StrToVariableType().
| ai_function_t* gPresetAIs |
The AI's of type preset
Definition at line 10 of file ai_interpret.c.
Referenced by InitAISystem(), and ShutdownAISystem().
| ai_function_t* gVariableAIs |
The AI's of type variable
Definition at line 9 of file ai_interpret.c.
Referenced by InitAISystem(), and ShutdownAISystem().
1.8.11