|
UFO: Alien Invasion
|
UFO scripts used in client and server. More...
#include "scripts.h"#include "../shared/parse.h"#include "../shared/keyvaluepair.h"#include "../game/inventory.h"#include "../client/cl_screen.h"
Go to the source code of this file.
Data Structures | |
| struct | com_constNameInt_t |
| Structure to map (script) strings and integer (enum) values. More... | |
| struct | parseItemWeapon_t |
Macros | |
| #define | CONSTNAMEINT_HASH_SIZE 32 |
| #define | MAX_CONSTNAMEINT_NAME 32 |
| #define | TERRAIN_HASH_SIZE 64 |
Enumerations | |
| enum | aircraftType_t { CRAFT_DROP , CRAFT_INTER , CRAFT_UFO , CRAFT_MAX } |
| enum | { OD_WEAPON , OD_PROTECTION , OD_RATINGS } |
| The order here must be the same as in od_vals. More... | |
Functions | |
| static const char * | Com_ConstIntGetVariable (const char *name) |
| Will extract the variable from a string<=>int mapping string which contain a namespace. | |
| bool | Com_GetConstInt (const char *name, int *value) |
| Searches whether a given value was registered as a string to int mapping. | |
| bool | Com_GetConstIntFromNamespace (const char *space, const char *variable, int *value) |
| Searches whether a given value was registered as a string to int mapping. | |
| const char * | Com_GetConstVariable (const char *space, int value) |
| Searches the mapping variable for a given integer value and a namespace. | |
| bool | Com_UnregisterConstVariable (const char *name) |
| Removes a registered constant from the script mapping hash table. | |
| void | Com_RegisterConstInt (const char *name, int value) |
Register mappings between script strings and enum values for values of the type V_INT. | |
| bool | Com_UnregisterConstList (const constListEntry_t constList[]) |
| Unregisters a list of string aliases. | |
| void | Com_RegisterConstList (const constListEntry_t constList[]) |
| Registers a list of string aliases. | |
| static int | Com_FindNameType (const char *nameType) |
| const char * | Com_EParse (const char **text, const char *errhead, const char *errinfo, char *target, size_t sizesize) |
| Parsing function that prints an error message when there is no text in the buffer. | |
| static void | Com_ParseVersion (const char *version) |
| CASSERT (lengthof(vt_names)==V_NUM_TYPES) | |
| CASSERT (lengthof(align_names)==ALIGN_LAST) | |
| CASSERT (lengthof(blend_names)==BLEND_LAST) | |
| CASSERT (lengthof(style_names)==STYLE_LAST) | |
| CASSERT (lengthof(fade_names)==FADE_LAST) | |
| CASSERT (lengthof(vt_sizes)==V_NUM_TYPES) | |
| CASSERT (lengthof(vt_aligns)==V_NUM_TYPES) | |
| const char * | Com_GetLastParseError (void) |
| void * | Com_AlignPtr (const void *memory, valueTypes_t type) |
| Align a memory to use a natural address for the data type we will write. | |
| static const char * | Com_GetAircraftDef (aircraftType_t type, short idNum) |
| static short | Com_GetAircraftIdNum (aircraftType_t type, const char *idString) |
| static void | Com_GetAircraftIdStr (aircraftType_t type, short idNum, char *outStr, const size_t sizesize) |
| static short | Com_GetCrashedAircraftIdNum (aircraftType_t type, const char *idString) |
| static void | Com_GetCrashedAircraftIdStr (aircraftType_t type, short idNum, char *outStr, const size_t sizesize) |
| static ufoType_t | Com_GetUfoIdNum (const char *idString) |
| static ufoType_t | Com_GetCrashedUfoIdNum (const char *idString) |
| static void | Com_GetUfoIdStr (ufoType_t idNum, char *outStr, const size_t sizesize) |
| static void | Com_GetCrashedUfoIdStr (ufoType_t idNum, char *outStr, const size_t sizesize) |
| static short | Com_GetHumanCraftIdNum (const char *idString) |
| static void | Com_GetHumanCraftIdStr (short idNum, char *outStr, const size_t sizesize) |
| short | Com_GetUfoIdsNum (void) |
| short | Com_GetDropShipIdsNum (void) |
| short | Com_GetHumanAircraftIdsNum (void) |
| static void | Com_ParseAircraftNames (const char *const name, const char **text) |
| Parse the aircraft names from the scripts. | |
| resultStatus_t | Com_ParseValue (void *base, const char *token, valueTypes_t type, int ofs, size_t sizesize, size_t *writtenBytes) |
| Parse a value from a string. | |
| int | Com_EParseValue (void *base, const char *token, valueTypes_t type, int ofs, size_t sizesize) |
| bool | Com_ParseBoolean (const char *token) |
| Parses a boolean from a string. | |
| int | Com_SetValue (void *base, const void *set, valueTypes_t type, int ofs, size_t sizesize) |
| const char * | Com_ValueToStr (const void *base, const valueTypes_t type, const int ofs) |
| bool | Com_ParseBlockToken (const char *name, const char **text, void *base, const value_t *values, memPool_t *mempool, const char *token) |
| bool | Com_ParseList (const char **text, linkedList_t **list) |
| bool | Com_ParseBlock (const char *name, const char **text, void *base, const value_t *values, memPool_t *mempool) |
| static effectStages_t | Com_ParseItemEffect (itemEffect_t *e, const char *name, const char **text) |
| Parses the item effect. | |
| static void | Com_ParseFireEffect (fireDef_t *fd, const char *name, const char **text) |
| Parses the effect that is bound to a fire definitions. | |
| static bool | Com_ParseFire (const char *name, const char **text, fireDef_t *fd) |
| Parses the firemode. | |
| static void | Com_ParseArmourOrResistance (const char *name, const char **text, short *ad, bool rating) |
| Parses the armour definitions or the team resistance values from script files. The protection and rating values. | |
| CASSERT (lengthof(air_slot_type_strings)==MAX_ACITEMS) | |
| static void | Com_ParseFireDefinition (objDef_t *od, const char *name, const char **text) |
| static void | Com_ParseObjDefEffect (objDef_t *od, const char *name, const char **text) |
| static void | Com_ParseItem (const char *name, const char **text) |
| Parses weapon, equipment, craft items and armour. | |
| static void | Com_ParseImplant (const char *name, const char **text) |
| static void | Com_ParseInventory (const char *name, const char **text) |
| static void | Com_ParseEquipment (const char *name, const char **text) |
| static const char * | Com_GiveName (int gender, const teamDef_t *td) |
| static teamDef_t::model_t const * | Com_GiveModel (int gender, const teamDef_t *td) |
| const teamDef_t * | Com_GetTeamDefinitionByID (const char *team) |
| Returns the teamDef pointer for the searched team id - or nullptr if not found in the teamDef array. | |
| bool | Com_GetCharacterModel (character_t *chr) |
| static int | Com_GetGender (const teamDef_t *teamDef) |
| Return a random (weighted by number of models) gender for this teamDef. | |
| void | Com_GetCharacterValues (const char *teamDefition, character_t *chr) |
| Assign character values, 3D models and names to a character. | |
| static void | Com_ParseActorNames (const char *name, const char **text) |
| Parses "name" definition from team_* ufo script files. | |
| static void | Com_ParseActorModels (const char *name, const char **text, teamDef_t *td) |
| Parses "actors" definition from team_* ufo script files. | |
| static void | Com_ParseActorSounds (const char *name, const char **text, teamDef_t *td) |
| Parses "actorsounds" definition from team_* ufo script files. | |
| static const BodyData * | Com_GetBodyTemplateByID (const char *id) |
| static const teamNames_t * | Com_GetNameListByID (const char *id) |
| static void | Com_ParseTeam (const char *name, const char **text) |
| const chrTemplate_t * | Com_GetCharacterTemplateByID (const char *chrTemplate) |
| Returns the chrTemplate pointer for the given id - or nullptr if not found in the chrTemplates array. | |
| static void | Com_ParseUGVs (const char *name, const char **text) |
| Parse 2x2 units (e.g. UGVs). | |
| static void | Com_ParseCharacterTemplate (const char *name, const char **text) |
| Parses character templates from scripts. | |
| static void | Com_ParseBodyPart (const char *name, const char **text, BodyData *bd) |
| static void | Com_ParseBodyTemplate (const char *name, const char **text) |
| const terrainType_t * | Com_GetTerrainType (const char *textureName) |
| Searches the terrain definition if given. | |
| static void | Com_ParseTerrain (const char *name, const char **text) |
| Parses "terrain" definition from script files. | |
| static void | Com_ParseGameTypes (const char *name, const char **text) |
| static void | Com_ParseDamageTypes (const char *name, const char **text) |
| const char * | Com_GetRandomMapAssemblyNameForCraft (const char *craftID) |
| Returns the name of an aircraft or an ufo that is used in the ump files for the random map assembly. | |
| const char * | Com_GetRandomMapAssemblyNameForCrashedCraft (const char *craftID) |
| humanAircraftType_t | Com_DropShipShortNameToID (const char *token) |
| Translate DropShip type to short name. | |
| const char * | Com_DropShipTypeToShortName (humanAircraftType_t type) |
| Translate DropShip type to short name. | |
| ufoType_t | Com_UFOShortNameToID (const char *token) |
| Translate short name to UFO type. | |
| const char * | Com_UFOTypeToShortName (ufoType_t type) |
| Translate UFO type to short name. | |
| const char * | Com_UFOCrashedTypeToShortName (ufoType_t type) |
| Translate UFO type to short name when UFO is crashed. | |
| const ugv_t * | Com_GetUGVByIDSilent (const char *ugvID) |
| Searches an UGV definition by a given script id and returns the pointer to the global data. | |
| const ugv_t * | Com_GetUGVByID (const char *ugvID) |
| Searches an UGV definition by a given script id and returns the pointer to the global data. | |
| static void | Com_AddObjectLinks (void) |
| Creates links to other items (i.e. ammo<->weapons). | |
| static void | Com_ParseMapDefinition (const char *name, const char **text) |
| static void | Com_ParseTerrainDefinition (const char *name, const char **text) |
| int | Com_GetMapDefNumber (void) |
| mapDef_t * | Com_GetMapDefByIDX (int index) |
| mapDef_t * | Com_GetMapDefinitionByID (const char *mapDefID) |
| void | Com_ParseScripts (bool onlyServer) |
| int | Com_GetScriptChecksum (void) |
| void | Com_Shutdown (void) |
Variables | |
| static com_constNameInt_t * | com_constNameInt |
| Linked list of all the registeres mappings. | |
| static com_constNameInt_t * | com_constNameInt_hash [CONSTNAMEINT_HASH_SIZE] |
| Hash of all the registeres mappings. | |
| static bool | versionParsed |
| const char *const | vt_names [] |
| possible values for parsing functions | |
| const char *const | align_names [] |
| const char *const | blend_names [] |
| const char *const | style_names [] |
| const char *const | fade_names [] |
| static const size_t | vt_sizes [] |
| target sizes for buffer | |
| static const size_t | vt_aligns [] |
| natural align for each targets | |
| static char | parseErrorMessage [256] |
| static const char *const | craftTypeIds [CRAFT_MAX *2] |
| static const char * | ufoIdsTable [UFO_MAX] |
| Ufoai uses two types of ids for aircraft: the string is used for references in the scripts, the numeric/enum type in the code. This tables and the following functions convert these ids. | |
| static const char * | dropIdsTable [DROPSHIP_MAX] |
| static const char * | interIdsTable [INTERCEPTOR_MAX] |
| static const char **const | aircraftIdsTable [CRAFT_MAX] |
| static short | aircraftIdsNum [CRAFT_MAX] |
| static const char *const | skillNames [SKILL_NUM_TYPES+1] |
| static const value_t | od_vals [] |
| static const value_t | effect_vals [] |
| static const value_t | fdps [] |
| const char *const | air_slot_type_strings [] = AIR_SLOT_TYPE_STRINGS |
| List of valid strings for slot types. | |
| static linkedList_t * | parseItemWeapons = nullptr |
| Temporary list of weapon ids as parsed from the ufo file "weapon_mod \<id\>" in Com_ParseItem and used in Com_AddObjectLinks. | |
| static const value_t | implant_vals [] |
| static const value_t | idps [] |
| const char *const | name_strings [NAME_NUM_TYPES] |
| static const value_t | equipment_definition_vals [] |
| Valid equipment definition values from script files. | |
| static const value_t | teamDefValues [] |
| possible teamdesc values (ufo-scriptfiles) | |
| static const value_t | ugvValues [] |
| static const value_t | bodyPartValues [] |
| static const char *const | penaltyNames [MODIFIER_MAX] |
| static terrainType_t * | terrainTypesHash [TERRAIN_HASH_SIZE] |
| static const value_t | terrainTypeValues [] |
| static const value_t | gameTypeValues [] |
| possible gametype values for the gameserver (ufo-scriptfiles) | |
| static const value_t | mapdef_vals [] |
| valid mapdef descriptors | |
UFO scripts used in client and server.
Definition in file scripts.cpp.
| #define CONSTNAMEINT_HASH_SIZE 32 |
Definition at line 32 of file scripts.cpp.
Referenced by Com_GetConstInt(), Com_RegisterConstInt(), and Com_UnregisterConstVariable().
| #define MAX_CONSTNAMEINT_NAME 32 |
Definition at line 34 of file scripts.cpp.
| #define TERRAIN_HASH_SIZE 64 |
Definition at line 3050 of file scripts.cpp.
Referenced by Com_GetTerrainType(), and Com_ParseTerrain().
| anonymous enum |
The order here must be the same as in od_vals.
| Enumerator | |
|---|---|
| OD_WEAPON | parse a weapon |
| OD_PROTECTION | parse armour protection values |
| OD_RATINGS | parse rating values for displaying in the menus |
Definition at line 1442 of file scripts.cpp.
| enum aircraftType_t |
| Enumerator | |
|---|---|
| CRAFT_DROP | |
| CRAFT_INTER | |
| CRAFT_UFO | |
| CRAFT_MAX | |
Definition at line 448 of file scripts.cpp.
| CASSERT | ( | lengthof(air_slot_type_strings) | = =MAX_ACITEMS | ) |
References air_slot_type_strings, CASSERT, lengthof, and MAX_ACITEMS.
| CASSERT | ( | lengthof(align_names) | = =ALIGN_LAST | ) |
References ALIGN_LAST, align_names, CASSERT, and lengthof.
| CASSERT | ( | lengthof(blend_names) | = =BLEND_LAST | ) |
References BLEND_LAST, blend_names, CASSERT, and lengthof.
| CASSERT | ( | lengthof(fade_names) | = =FADE_LAST | ) |
References CASSERT, FADE_LAST, fade_names, and lengthof.
| CASSERT | ( | lengthof(style_names) | = =STYLE_LAST | ) |
References CASSERT, lengthof, STYLE_LAST, and style_names.
| CASSERT | ( | lengthof(vt_aligns) | = =V_NUM_TYPES | ) |
References CASSERT, lengthof, V_NUM_TYPES, and vt_aligns.
| CASSERT | ( | lengthof(vt_names) | = =V_NUM_TYPES | ) |
References CASSERT, lengthof, V_NUM_TYPES, and vt_names.
| CASSERT | ( | lengthof(vt_sizes) | = =V_NUM_TYPES | ) |
References CASSERT, lengthof, V_NUM_TYPES, and vt_sizes.
Creates links to other items (i.e. ammo<->weapons).
Definition at line 3395 of file scripts.cpp.
References AC_ITEM_WEAPON, objDef_t::ammos, Com_AddObjectLinks(), Com_DPrintf(), objDef_t::craftitem, csi, DEBUG_SHARED, i, objDef_t::id, INVSH_GetItemByID(), INVSH_GetItemByIDX(), LIST_Delete(), LIST_Foreach, MAX_AMMOS_PER_OBJDEF, Mem_Free, objDef_t::numAmmos, csi_t::numODs, objDef_t::numWeapons, csi_t::ods, parseItemWeapons, Sys_Error(), craftItem::type, objDef_t::weapon, and objDef_t::weapons.
Referenced by Com_AddObjectLinks(), and Com_ParseScripts().
| void * Com_AlignPtr | ( | const void * | memory, |
| valueTypes_t | type ) |
Align a memory to use a natural address for the data type we will write.
Definition at line 437 of file scripts.cpp.
References Com_AlignPtr(), Sys_Error(), type, V_NULL, V_NUM_TYPES, and vt_aligns.
Referenced by CL_ParsePtlCmds(), Com_AlignPtr(), Com_ParseValue(), Com_SetValue(), Com_ValueToStr(), UI_InitRawActionValue(), and UI_ParseProperty().
|
static |
Will extract the variable from a string<=>int mapping string which contain a namespace.
| name | The name of the script entry to map to an integer |
nullptr otherwise Definition at line 57 of file scripts.cpp.
References Com_ConstIntGetVariable(), and name.
Referenced by Com_ConstIntGetVariable(), Com_GetConstInt(), Com_RegisterConstInt(), and Com_UnregisterConstVariable().
| humanAircraftType_t Com_DropShipShortNameToID | ( | const char * | token | ) |
Translate DropShip type to short name.
Definition at line 3307 of file scripts.cpp.
References Com_DropShipShortNameToID(), Com_ParseValue(), and V_AIRCRAFTTYPE.
Referenced by Com_DropShipShortNameToID(), Com_ParseEquipment(), GAME_GetImportData(), and cgame_import_t::humanAircraftType_t().
| const char * Com_DropShipTypeToShortName | ( | humanAircraftType_t | type | ) |
Translate DropShip type to short name.
Definition at line 3319 of file scripts.cpp.
References Com_DropShipTypeToShortName(), Com_ValueToStr(), type, and V_AIRCRAFTTYPE.
Referenced by Com_DropShipTypeToShortName(), and GAME_GetImportData().
| const char * Com_EParse | ( | const char ** | text, |
| const char * | errhead, | ||
| const char * | errinfo, | ||
| char * | target, | ||
| size_t | size ) |
Parsing function that prints an error message when there is no text in the buffer.
Definition at line 277 of file scripts.cpp.
References Com_EParse(), Com_Parse(), and Com_Printf().
Referenced by CL_ParseLanguages(), CL_ParseMessageID(), CL_ParseParticle(), CL_ParsePtlCmds(), CL_ParseSequence(), Com_EParse(), Com_EParse_(), Com_ParseActorModels(), Com_ParseActorNames(), Com_ParseActorSounds(), Com_ParseAircraftNames(), Com_ParseArmourOrResistance(), Com_ParseBlock(), Com_ParseBlockToken(), Com_ParseBodyPart(), Com_ParseBodyTemplate(), Com_ParseCharacterTemplate(), Com_ParseDamageTypes(), Com_ParseEquipment(), Com_ParseFire(), Com_ParseFireDefinition(), Com_ParseGameTypes(), Com_ParseImplant(), Com_ParseItem(), Com_ParseMapDefinition(), Com_ParseTeam(), Com_ParseTerrainDefinition(), SV_GetCvarToken(), SV_GetTileFromTileSet(), SV_GetTilesFromTileSet(), SV_ParseAssembly(), SV_ParseAssemblySeeds(), SV_ParseMapTile(), SV_ParseMapTileSet(), UI_ParseActionList(), UI_ParseCallAction(), UI_ParseComponent(), UI_ParseEventProperty(), UI_ParseExcludeRect(), UI_ParseFont(), UI_ParseNode(), UI_ParseNodeBody(), UI_ParseNodeProperties(), UI_ParseProperty(), UI_ParseSetAction(), and UI_ParseUIModel().
| int Com_EParseValue | ( | void * | base, |
| const char * | token, | ||
| valueTypes_t | type, | ||
| int | ofs, | ||
| size_t | size ) |
Definition at line 964 of file scripts.cpp.
References Com_EParseValue(), Com_ParseValue(), Com_Printf(), parseErrorMessage, RESULT_ERROR, RESULT_OK, RESULT_WARNING, Sys_Error(), and type.
Referenced by CL_ParseMapParticle(), CL_ParsePtlCmds(), CL_SpawnParseEntitystring(), Com_EParseValue(), Com_ParseBlockToken(), Com_ParseBodyPart(), Com_ParseCharacterTemplate(), GAME_GetImportData(), cgame_import_t::int(), SEQ_ExecuteCamera(), SEQ_ExecuteModel(), SEQ_ExecuteObj2D(), UI_InitRawActionValue(), UI_ParseExcludeRect(), UI_ParseFont(), UI_ParseUIModel(), and WEB_ListCGameFilesCallback().
|
static |
Find name type id by is name
Definition at line 263 of file scripts.cpp.
References Com_FindNameType(), i, NAME_NUM_TYPES, name_strings, and Q_streq.
Referenced by Com_FindNameType(), Com_ParseActorModels(), and Com_ParseActorNames().
|
static |
Definition at line 479 of file scripts.cpp.
References aircraftIdsNum, aircraftIdsTable, Com_GetAircraftDef(), and type.
Referenced by Com_GetAircraftDef(), Com_GetAircraftIdStr(), and Com_GetCrashedAircraftIdStr().
|
static |
Definition at line 487 of file scripts.cpp.
References AIRCRAFT_NONE, aircraftIdsNum, aircraftIdsTable, Com_GetAircraftIdNum(), craftTypeIds, i, Q_streq, Q_strnull(), Q_strstart(), type, and va().
Referenced by Com_GetAircraftIdNum(), Com_GetHumanCraftIdNum(), Com_GetUfoIdNum(), and Com_ParseAircraftNames().
|
static |
Definition at line 499 of file scripts.cpp.
References Com_GetAircraftDef(), Com_GetAircraftIdStr(), Com_sprintf(), craftTypeIds, and type.
Referenced by Com_GetAircraftIdStr(), Com_GetHumanCraftIdStr(), and Com_GetUfoIdStr().
|
static |
Definition at line 2653 of file scripts.cpp.
References csi_t::bodyTemplates, Com_GetBodyTemplateByID(), Com_Printf(), csi, LIST_Foreach, and Q_streq.
Referenced by Com_GetBodyTemplateByID(), and Com_ParseTeam().
| bool Com_GetCharacterModel | ( | character_t * | chr | ) |
Definition at line 2358 of file scripts.cpp.
References character_t::body, teamDef_t::model_t::body, character_t::bodySkin, teamDef_t::model_t::bodySkin, Com_GetCharacterModel(), Com_GiveModel(), character_t::gender, character_t::head, teamDef_t::model_t::head, character_t::headSkin, teamDef_t::model_t::headSkin, character_t::path, teamDef_t::model_t::path, Q_strncpyz(), and character_t::teamDef.
Referenced by Com_GetCharacterModel(), Com_GetCharacterValues(), and GAME_LoadCharacter().
| const chrTemplate_t * Com_GetCharacterTemplateByID | ( | const char * | chrTemplate | ) |
Returns the chrTemplate pointer for the given id - or nullptr if not found in the chrTemplates array.
| [in] | chrTemplate | The character template id (given in ufo-script files) |
Definition at line 2809 of file scripts.cpp.
References csi_t::chrTemplates, Com_GetCharacterTemplateByID(), Com_Printf(), csi, i, chrTemplate_t::id, csi_t::numChrTemplates, Q_streq, and Q_strnull().
Referenced by Com_GetCharacterTemplateByID(), and Com_ParseTeam().
| void Com_GetCharacterValues | ( | const char * | teamDefition, |
| character_t * | chr ) |
Assign character values, 3D models and names to a character.
| [in] | teamDefition | The team definition id to use to generate the character values. |
| [in,out] | chr | The character that should get the paths to the different models/skins. |
Definition at line 2408 of file scripts.cpp.
References ACTOR_SIZE_INVALID, ACTOR_SIZE_NORMAL, Com_Error(), Com_GetCharacterModel(), Com_GetCharacterValues(), Com_GetGender(), Com_GetTeamDefinitionByID(), Com_GiveName(), ERR_DROP, character_t::fieldSize, character_t::gender, character_t::name, NAME_LAST, Q_strcat(), Q_strncpyz(), teamDef_t::size, and character_t::teamDef.
Referenced by CL_GenerateCharacter(), Com_GetCharacterValues(), and SV_InitGameProgs().
| bool Com_GetConstInt | ( | const char * | name, |
| int * | value ) |
Searches whether a given value was registered as a string to int mapping.
| [in] | name | The name of the string mapping (maybe including a namespace) |
| [out] | value | The mapped integer if found, not touched if the given string was found in the registered values. |
Definition at line 74 of file scripts.cpp.
References Com_ConstIntGetVariable(), com_constNameInt_hash, Com_GetConstInt(), Com_HashKey(), CONSTNAMEINT_HASH_SIZE, com_constNameInt_t::hash_next, name, and Q_streq.
Referenced by cgame_import_t::bool(), Com_GetConstInt(), Com_GetConstIntFromNamespace(), Com_ParseValue(), GAME_GetImportData(), SV_InitGameProgs(), and TEST_F().
| bool Com_GetConstIntFromNamespace | ( | const char * | space, |
| const char * | variable, | ||
| int * | value ) |
Searches whether a given value was registered as a string to int mapping.
| [in] | space | The namespace of the mapping variable |
| [in] | variable | The name of the string mapping |
| [out] | value | The mapped integer if found, not touched if the given string was found in the registered values. |
Definition at line 103 of file scripts.cpp.
References Com_GetConstInt(), Com_GetConstIntFromNamespace(), Q_strnull(), and va().
Referenced by cgame_import_t::bool(), Com_GetConstIntFromNamespace(), GAME_GetImportData(), GAME_LoadCharacter(), and SV_InitGameProgs().
| const char * Com_GetConstVariable | ( | const char * | space, |
| int | value ) |
Searches the mapping variable for a given integer value and a namespace.
| [in] | space | The namespace to search in - might not be nullptr or empty. |
| [in] | value | The mapped integer |
Definition at line 122 of file scripts.cpp.
References com_constNameInt, Com_GetConstVariable(), com_constNameInt_t::fullname, com_constNameInt_t::name, com_constNameInt_t::next, and com_constNameInt_t::value.
Referenced by Com_GetConstVariable(), GAME_GetImportData(), GAME_SaveCharacter(), SV_InitGameProgs(), and TEST_F().
|
static |
Definition at line 508 of file scripts.cpp.
References AIRCRAFT_NONE, aircraftIdsNum, aircraftIdsTable, Com_GetCrashedAircraftIdNum(), CRAFT_MAX, craftTypeIds, i, Q_streq, Q_strnull(), Q_strstart(), type, and va().
Referenced by Com_GetCrashedAircraftIdNum(), and Com_GetCrashedUfoIdNum().
|
static |
Definition at line 520 of file scripts.cpp.
References Com_GetAircraftDef(), Com_GetCrashedAircraftIdStr(), Com_sprintf(), CRAFT_MAX, craftTypeIds, and type.
Referenced by Com_GetCrashedAircraftIdStr(), and Com_GetCrashedUfoIdStr().
|
static |
Definition at line 534 of file scripts.cpp.
References Com_GetCrashedAircraftIdNum(), Com_GetCrashedUfoIdNum(), and CRAFT_UFO.
Referenced by Com_GetCrashedUfoIdNum(), Com_ParseValue(), and Com_SetValue().
Definition at line 544 of file scripts.cpp.
References Com_GetCrashedAircraftIdStr(), Com_GetCrashedUfoIdStr(), and CRAFT_UFO.
Referenced by Com_GetCrashedUfoIdStr(), and Com_ValueToStr().
| short Com_GetDropShipIdsNum | ( | void | ) |
Definition at line 576 of file scripts.cpp.
References aircraftIdsNum, Com_GetDropShipIdsNum(), and CRAFT_DROP.
Referenced by Com_GetDropShipIdsNum(), GAME_GetImportData(), and cgame_import_t::short().
Return a random (weighted by number of models) gender for this teamDef.
| [in] | teamDef | pointer to the teamDef to get the gender for. |
Definition at line 2382 of file scripts.cpp.
References Com_Error(), Com_GetGender(), ERR_DROP, teamDef_t::name, NAME_LAST, teamDef_t::numModels, and teamDef_t::numNames.
Referenced by Com_GetCharacterValues(), and Com_GetGender().
| short Com_GetHumanAircraftIdsNum | ( | void | ) |
Definition at line 581 of file scripts.cpp.
References aircraftIdsNum, Com_GetHumanAircraftIdsNum(), CRAFT_DROP, and CRAFT_INTER.
Referenced by Com_GetHumanAircraftIdsNum(), GAME_GetImportData(), and cgame_import_t::short().
|
static |
Definition at line 549 of file scripts.cpp.
References AIRCRAFT_NONE, aircraftIdsNum, Com_GetAircraftIdNum(), Com_GetHumanCraftIdNum(), CRAFT_DROP, and CRAFT_INTER.
Referenced by Com_GetHumanCraftIdNum(), Com_ParseValue(), and Com_SetValue().
|
static |
Definition at line 562 of file scripts.cpp.
References aircraftIdsNum, Com_GetAircraftIdStr(), Com_GetHumanCraftIdStr(), CRAFT_DROP, and CRAFT_INTER.
Referenced by Com_GetHumanCraftIdStr(), and Com_ValueToStr().
| const char * Com_GetLastParseError | ( | void | ) |
Returns the last error message
Definition at line 428 of file scripts.cpp.
References Com_GetLastParseError(), and parseErrorMessage.
Referenced by Com_GetLastParseError(), UI_NodeSetProperty(), and UI_ParseProperty().
Definition at line 3593 of file scripts.cpp.
References Com_GetMapDefByIDX(), csi, index, and csi_t::mds.
| mapDef_t * Com_GetMapDefinitionByID | ( | const char * | mapDefID | ) |
Definition at line 3598 of file scripts.cpp.
References Com_DPrintf(), Com_GetMapDefinitionByID(), DEBUG_SHARED, mapDef_t::id, MapDef_Foreach, and Q_streq.
Referenced by Com_GetMapDefinitionByID(), GAME_GetImportData(), and TEST_F().
Definition at line 3588 of file scripts.cpp.
References Com_GetMapDefNumber(), csi, and csi_t::numMDs.
|
static |
Definition at line 2662 of file scripts.cpp.
References csi_t::actorNames, Com_GetNameListByID(), Com_Printf(), csi, LIST_Foreach, and Q_streq.
Referenced by Com_GetNameListByID(), and Com_ParseTeam().
| const char * Com_GetRandomMapAssemblyNameForCraft | ( | const char * | craftID | ) |
Returns the name of an aircraft or an ufo that is used in the ump files for the random map assembly.
Definition at line 3277 of file scripts.cpp.
References Com_GetRandomMapAssemblyNameForCraft(), and va().
Referenced by Com_GetRandomMapAssemblyNameForCraft(), GAME_GetImportData(), TEST_F(), GameTest::testCountSpawnpointsForMapWithAssembly(), and GameTest::testCountSpawnpointsForMapWithAssemblyAndAircraft().
| const char * Com_GetRandomMapAssemblyNameForCrashedCraft | ( | const char * | craftID | ) |
Definition at line 3285 of file scripts.cpp.
References Com_GetRandomMapAssemblyNameForCrashedCraft(), and Q_streq.
Referenced by Com_GetRandomMapAssemblyNameForCrashedCraft(), and GAME_GetImportData().
Definition at line 3717 of file scripts.cpp.
References Com_BlockChecksum(), Com_GetScriptChecksum(), FS_GetFileData(), and LittleLong.
Referenced by CL_CanMultiplayerStart(), Com_GetScriptChecksum(), and SV_Map().
| const teamDef_t * Com_GetTeamDefinitionByID | ( | const char * | team | ) |
Returns the teamDef pointer for the searched team id - or nullptr if not found in the teamDef array.
| [in] | team | The team id (given in ufo-script files) |
Definition at line 2345 of file scripts.cpp.
References Com_GetTeamDefinitionByID(), Com_Printf(), csi, i, teamDef_t::id, csi_t::numTeamDefs, Q_streq, and csi_t::teamDef.
Referenced by Com_GetCharacterValues(), Com_GetTeamDefinitionByID(), GAME_GetImportData(), GAME_ItemIsUseable(), GAME_LoadCharacter(), TEST_F(), and TEST_F().
| const terrainType_t * Com_GetTerrainType | ( | const char * | textureName | ) |
Searches the terrain definition if given.
| [in] | textureName | The terrain definition id from script files which is the texture name relative to base/textures |
Definition at line 3067 of file scripts.cpp.
References Com_GetTerrainType(), Com_HashKey(), terrainType_t::hash_next, Q_streq, TERRAIN_HASH_SIZE, and terrainTypesHash.
Referenced by Com_GetTerrainType(), Com_ParseTerrain(), LE_PlaySoundFileAndParticleForSurface(), SV_GetBounceFraction(), and SV_GetFootstepSound().
|
static |
Definition at line 529 of file scripts.cpp.
References Com_GetAircraftIdNum(), Com_GetUfoIdNum(), and CRAFT_UFO.
Referenced by Com_GetUfoIdNum(), Com_ParseValue(), and Com_SetValue().
| short Com_GetUfoIdsNum | ( | void | ) |
Definition at line 571 of file scripts.cpp.
References aircraftIdsNum, Com_GetUfoIdsNum(), and CRAFT_UFO.
Referenced by Com_GetUfoIdsNum(), GAME_GetImportData(), and TEST_F().
Definition at line 539 of file scripts.cpp.
References Com_GetAircraftIdStr(), Com_GetUfoIdStr(), and CRAFT_UFO.
Referenced by Com_GetUfoIdStr(), and Com_ValueToStr().
| const ugv_t * Com_GetUGVByID | ( | const char * | ugvID | ) |
Searches an UGV definition by a given script id and returns the pointer to the global data.
| [in] | ugvID | The script id of the UGV definition you are looking for |
Definition at line 3381 of file scripts.cpp.
References Com_GetUGVByID(), Com_GetUGVByIDSilent(), Com_Printf(), csi, and csi_t::numUGV.
Referenced by Com_GetUGVByID(), GAME_GetImportData(), and TEST_F().
| const ugv_t * Com_GetUGVByIDSilent | ( | const char * | ugvID | ) |
Searches an UGV definition by a given script id and returns the pointer to the global data.
| [in] | ugvID | The script id of the UGV definition you are looking for |
Definition at line 3362 of file scripts.cpp.
References Com_GetUGVByIDSilent(), csi, i, ugv_t::id, csi_t::numUGV, Q_streq, and csi_t::ugvs.
Referenced by Com_GetUGVByID(), Com_GetUGVByIDSilent(), GAME_AppendTeamMember(), and GAME_GetImportData().
|
static |
| [in] | gender | 1 (female) or 2 (male) |
| [in] | td | The team definition |
Definition at line 2318 of file scripts.cpp.
References Com_GiveModel(), Com_Printf(), linkedList_t::data, teamDef_t::id, teamDef_t::models, linkedList_t::next, and teamDef_t::numModels.
Referenced by Com_GetCharacterModel(), and Com_GiveModel().
| [in] | gender | 1 (female) or 2 (male) |
| [in] | td | The team definition to get the name from |
Definition at line 2283 of file scripts.cpp.
References Com_DPrintf(), Com_GiveName(), linkedList_t::data, DEBUG_ENGINE, teamDef_t::id, name, NAME_NUM_TYPES, teamDef_t::names, linkedList_t::next, teamDef_t::numNames, and Sys_Error().
Referenced by Com_GetCharacterValues(), and Com_GiveName().
Parses "actors" definition from team_* ufo script files.
Definition at line 2528 of file scripts.cpp.
References teamDef_t::model_t::body, teamDef_t::model_t::bodySkin, Com_EParse(), Com_Error(), Com_FindNameType(), Com_Parse(), Com_ParseActorModels(), Com_ParseList(), Com_Printf(), linkedList_t::data, ERR_DROP, teamDef_t::model_t::head, teamDef_t::model_t::headSkin, teamDef_t::id, LIST_Add(), LIST_Count(), LIST_Delete(), Mem_StrDup, teamDef_t::models, name, linkedList_t::next, teamDef_t::numModels, and teamDef_t::model_t::path.
Referenced by Com_ParseActorModels(), and Com_ParseTeam().
|
static |
Parses "name" definition from team_* ufo script files.
Definition at line 2452 of file scripts.cpp.
References csi_t::actorNames, Com_EParse(), Com_Error(), Com_FindNameType(), Com_Parse(), Com_ParseActorNames(), Com_ParseList(), Com_Printf(), csi, ERR_DROP, i, teamNames_t::id, LIST_Add(), LIST_AddString(), LIST_Delete(), LIST_Foreach, name, NAME_FEMALE, NAME_FEMALE_LAST, NAME_LAST, NAME_MALE, NAME_MALE_LAST, NAME_NEUTRAL, NAME_NUM_TYPES, teamNames_t::names, linkedList_t::next, teamNames_t::numNames, OBJZERO, Q_streq, Q_strncpyz(), and Sys_Error().
Referenced by Com_ParseActorNames(), and Com_ParseScripts().
Parses "actorsounds" definition from team_* ufo script files.
Definition at line 2592 of file scripts.cpp.
References Com_EParse(), Com_Parse(), Com_ParseActorSounds(), Com_Printf(), i, LIST_AddString(), name, NAME_LAST, NAME_NUM_TYPES, name_strings, teamDef_t::numSounds, Q_streq, SND_DEATH, SND_HURT, and teamDef_t::sounds.
Referenced by Com_ParseActorSounds(), and Com_ParseTeam().
|
static |
Parse the aircraft names from the scripts.
Definition at line 589 of file scripts.cpp.
References AIRCRAFT_NONE, aircraftIdsNum, aircraftIdsTable, Com_EParse(), Com_GetAircraftIdNum(), Com_Parse(), Com_ParseAircraftNames(), Com_Printf(), CRAFT_DROP, CRAFT_INTER, CRAFT_MAX, CRAFT_UFO, craftTypeIds, DROPSHIP_MAX, i, INTERCEPTOR_MAX, Mem_StrDup, name, Q_streq, UFO_MAX, and va().
Referenced by Com_ParseAircraftNames(), and Com_ParseScripts().
|
static |
Parses the armour definitions or the team resistance values from script files. The protection and rating values.
Definition at line 1747 of file scripts.cpp.
References Com_EParse(), Com_Parse(), Com_ParseArmourOrResistance(), Com_Printf(), csi, csi_t::dts, i, damageType_t::id, name, csi_t::numDTs, Q_streq, damageType_t::showInMenu, and Sys_Error().
Referenced by Com_ParseArmourOrResistance(), Com_ParseItem(), and Com_ParseTeam().
| bool Com_ParseBlock | ( | const char * | name, |
| const char ** | text, | ||
| void * | base, | ||
| const value_t * | values, | ||
| memPool_t * | mempool ) |
Definition at line 1393 of file scripts.cpp.
References Com_EParse(), Com_Parse(), Com_ParseBlock(), Com_ParseBlockToken(), Com_Printf(), and name.
Referenced by CL_ParseActorSkin(), Com_ParseBlock(), Com_ParseInventory(), Com_ParseTerrain(), Com_ParseUGVs(), GAME_GetImportData(), GAME_ParseModes(), and TUT_ParseTutorials().
| bool Com_ParseBlockToken | ( | const char * | name, |
| const char ** | text, | ||
| void * | base, | ||
| const value_t * | values, | ||
| memPool_t * | mempool, | ||
| const char * | token ) |
Definition at line 1311 of file scripts.cpp.
References Com_EParse(), Com_EParseValue(), Com_GetValue(), Com_ParseBlockToken(), Com_ParseList(), Com_Printf(), Com_UnParseLastToken(), Mem_PoolStrDupTo, name, Q_streq, v, V_HUNK_STRING, V_LIST, and V_TRANSLATION_STRING.
Referenced by cgame_import_t::bool(), Com_ParseBlock(), Com_ParseBlockToken(), Com_ParseBodyPart(), Com_ParseEquipment(), Com_ParseFire(), Com_ParseGameTypes(), Com_ParseImplant(), Com_ParseItem(), Com_ParseItemEffect(), Com_ParseMapDefinition(), Com_ParseTeam(), and GAME_GetImportData().
Definition at line 2933 of file scripts.cpp.
References BodyData::addBodyPart(), BODYPART_MAXTYPE, bodyPartValues, Com_EParse(), Com_EParseValue(), Com_Error(), Com_Parse(), Com_ParseBlockToken(), Com_ParseBodyPart(), Com_ParseList(), Com_Printf(), linkedList_t::data, ERR_DROP, i, BodyData::id(), BodyPartData::id, LIST_Count(), LIST_Delete(), MODIFIER_MAX, name, linkedList_t::next, BodyData::numBodyParts(), OBJZERO, BodyPartData::penalties, penaltyNames, Q_streq, Q_strncpyz(), and V_INT.
Referenced by Com_ParseBodyPart(), and Com_ParseBodyTemplate().
|
static |
Definition at line 2999 of file scripts.cpp.
References csi_t::bodyTemplates, Com_EParse(), Com_Parse(), Com_ParseBodyPart(), Com_ParseBodyTemplate(), Com_Printf(), csi, LIST_Add(), LIST_Foreach, name, BodyData::numBodyParts(), Q_streq, and BodyData::setId().
Referenced by Com_ParseBodyTemplate(), and Com_ParseScripts().
| bool Com_ParseBoolean | ( | const char * | token | ) |
Parses a boolean from a string.
| token | The token to convert into a boolean |
false if the string could not get parsed Definition at line 986 of file scripts.cpp.
References Com_ParseBoolean(), Com_ParseValue(), RESULT_ERROR, and V_BOOL.
Referenced by cgame_import_t::bool(), Com_ParseBoolean(), GAME_GetImportData(), and HUD_RemainingTUs_f().
|
static |
Parses character templates from scripts.
Definition at line 2865 of file scripts.cpp.
References csi_t::chrTemplates, Com_EParse(), Com_EParseValue(), Com_Parse(), Com_ParseCharacterTemplate(), Com_Printf(), csi, i, chrTemplate_t::id, MAX_CHARACTER_TEMPLATES, name, csi_t::numChrTemplates, OBJZERO, Q_streq, Q_strncpyz(), chrTemplate_t::rate, SKILL_NUM_TYPES, skillNames, chrTemplate_t::skills, Sys_Error(), and V_INT2.
Referenced by Com_ParseCharacterTemplate(), and Com_ParseScripts().
|
static |
Definition at line 3194 of file scripts.cpp.
References Com_EParse(), Com_Parse(), Com_ParseDamageTypes(), Com_Printf(), csi, csi_t::damBlast, csi_t::damFire, csi_t::damIncendiary, csi_t::damLaser, csi_t::damNormal, csi_t::damParticle, csi_t::damPlasma, csi_t::damShock, csi_t::damSmoke, csi_t::damStunElectro, csi_t::damStunGas, csi_t::dts, i, damageType_t::id, MAX_DAMAGETYPES, name, csi_t::numDTs, Q_streq, Q_strncpyz(), damageType_t::showInMenu, and Sys_Error().
Referenced by Com_ParseDamageTypes(), and Com_ParseScripts().
|
static |
Definition at line 2180 of file scripts.cpp.
References Com_DropShipShortNameToID(), Com_EParse(), Com_Error(), com_genericPool, Com_Parse(), Com_ParseBlockToken(), Com_ParseEquipment(), Com_ParseList(), Com_Printf(), csi, linkedList_t::data, csi_t::eds, equipment_definition_vals, ERR_DROP, i, equipDef_t::id, objDef_t::id, objDef_t::idx, INVSH_GetItemByID(), LIST_Count(), LIST_Delete(), MAX_EQUIPDEFS, equipDef_t::name, name, linkedList_t::next, equipDef_t::numAircraft, csi_t::numEDs, equipDef_t::numItems, OBJZERO, Q_streq, Q_strncpyz(), Sys_Error(), and type.
Referenced by Com_ParseEquipment(), and Com_ParseScripts().
|
static |
Parses the firemode.
| [in] | name | Already parsed name of the weapon, used for error messages |
| [in,out] | text | The string which is to be parsed |
| [in,out] | fd | The fire definition to fill |
Definition at line 1668 of file scripts.cpp.
References ABILITY_NUM_TYPES, Com_EParse(), com_genericPool, Com_Parse(), Com_ParseBlockToken(), Com_ParseFire(), Com_ParseFireEffect(), Com_Printf(), fireDef_t::delayBetweenShots, fdps, fireDef_t::fireAttenuation, fireDef_t::impactAttenuation, fireDef_t::name, name, Q_streq, fireDef_t::range, fireDef_t::shots, SKILL_NUM_TYPES, skillNames, SOUND_ATTN_MAX, SOUND_ATTN_NONE, fireDef_t::splrad, UNIT_SIZE, and fireDef_t::weaponSkill.
Referenced by Com_ParseFire(), and Com_ParseFireDefinition().
Definition at line 1806 of file scripts.cpp.
References Com_EParse(), Com_Parse(), Com_ParseFire(), Com_ParseFireDefinition(), Com_Printf(), objDef_t::fd, fireDef_t::fdIdx, fireDef_t::fireAttenuation, fireDef_t::impactAttenuation, LIST_Add(), MAX_FIREDEFS_PER_WEAPON, MAX_WEAPONS_PER_OBJDEF, Mem_StrDup, name, objDef_t::numFiredefs, objDef_t::numWeapons, parseItemWeapon_t::numWeapons, parseItemWeapon_t::od, parseItemWeapons, Q_streq, SOUND_ATTN_NORM, Sys_Error(), parseItemWeapon_t::token, and fireDef_t::weapFdsIdx.
Referenced by Com_ParseFireDefinition(), and Com_ParseItem().
Parses the effect that is bound to a fire definitions.
| [in,out] | fd | The fire definition to add the effect to |
| [in] | name | Already parsed name of the weapon, used for error messages |
| [in,out] | text | The string which is to be parsed |
Definition at line 1620 of file scripts.cpp.
References fireDef_t::activeEffect, Com_ParseFireEffect(), Com_ParseItemEffect(), Com_Printf(), fireDef_t::deactiveEffect, EFFECT_ACTIVE, EFFECT_INACTIVE, EFFECT_MAX, EFFECT_OVERDOSE, EFFECT_STRENGTHEN, Mem_AllocType, Mem_Free, name, and fireDef_t::overdoseEffect.
Referenced by Com_ParseFire(), and Com_ParseFireEffect().
|
static |
Definition at line 3119 of file scripts.cpp.
References Com_EParse(), Com_Parse(), Com_ParseBlockToken(), Com_ParseGameTypes(), Com_Printf(), Com_SkipBlock(), csi, gametype_t::cvars, gameTypeValues, csi_t::gts, i, gametype_t::id, MAX_CVARLISTINGAMETYPE, MAX_GAMETYPES, MAX_VAR, cvarlist_t::name, name, gametype_t::num_cvars, csi_t::numGTs, OBJZERO, Q_streq, Q_strncpyz(), Sys_Error(), and cvarlist_t::value.
Referenced by Com_ParseGameTypes(), and Com_ParseScripts().
|
static |
Definition at line 2018 of file scripts.cpp.
References Com_DPrintf(), Com_EParse(), com_genericPool, Com_Parse(), Com_ParseBlockToken(), Com_ParseImplant(), Com_Printf(), csi, DEBUG_SHARED, implantDef_t::id, implantDef_t::idx, implant_vals, csi_t::implants, INVSH_GetItemByID(), INVSH_GetItemByIDSilent(), implantDef_t::item, MAX_IMPLANTS, Mem_StrDup, name, csi_t::numImplants, OBJZERO, Q_streq, Q_strnull(), and Sys_Error().
Referenced by Com_ParseImplant(), and Com_ParseScripts().
|
static |
Definition at line 2107 of file scripts.cpp.
References CID_ARMOUR, CID_BACKPACK, CID_BELT, CID_EQUIP, CID_FLOOR, CID_HEADGEAR, CID_HOLSTER, CID_IMPLANT, CID_LEFT, CID_RIGHT, Com_ParseBlock(), Com_ParseInventory(), Com_Printf(), csi, id, idps, csi_t::ids, invDef_t::name, name, csi_t::numIDs, OBJZERO, Q_streq, Q_strncpyz(), and Sys_Error().
Referenced by Com_ParseInventory(), and Com_ParseScripts().
|
static |
Parses weapon, equipment, craft items and armour.
Definition at line 1888 of file scripts.cpp.
References air_slot_type_strings, objDef_t::ammo, objDef_t::armourPath, Com_DPrintf(), Com_EParse(), com_genericPool, Com_Parse(), Com_ParseArmourOrResistance(), Com_ParseBlockToken(), Com_ParseFireDefinition(), Com_ParseItem(), Com_ParseObjDefEffect(), Com_Printf(), objDef_t::craftitem, csi, DEBUG_SHARED, objDef_t::deplete, i, objDef_t::id, objDef_t::idx, objDef_t::image, objDef_t::implant, INVSH_GetItemByIDSilent(), objDef_t::isAmmo(), objDef_t::isArmour(), objDef_t::isVirtual, LIST_Add(), MAX_ACITEMS, MAX_OBJDEFS, MAX_WEAPONS_PER_OBJDEF, Mem_StrDup, objDef_t::model, name, objDef_t::name, csi_t::numODs, objDef_t::numWeapons, parseItemWeapon_t::numWeapons, OBJZERO, parseItemWeapon_t::od, od_vals, csi_t::ods, objDef_t::oneshot, parseItemWeapons, objDef_t::price, objDef_t::productionCost, objDef_t::protection, Q_streq, Q_strnull(), objDef_t::ratings, objDef_t::reloadAttenuation, objDef_t::reloadSound, objDef_t::shape, SHAPE_SMALL_MAX_HEIGHT, SHAPE_SMALL_MAX_WIDTH, SOUND_ATTN_IDLE, SOUND_ATTN_MAX, SOUND_ATTN_NONE, objDef_t::sx, objDef_t::sy, Sys_Error(), objDef_t::thrown, parseItemWeapon_t::token, craftItem::type, objDef_t::type, and objDef_t::weapon.
Referenced by Com_ParseItem(), and Com_ParseScripts().
|
static |
Parses the item effect.
| [in,out] | e | The item effect that is filled in here. |
| [in] | name | Already parsed name of the weapon, used for error messages |
| [in,out] | text | The string which is to be parsed |
Definition at line 1563 of file scripts.cpp.
References com_genericPool, Com_Parse(), Com_ParseBlockToken(), Com_ParseItemEffect(), Com_Printf(), Com_SkipBlock(), EFFECT_ACTIVE, EFFECT_INACTIVE, EFFECT_MAX, EFFECT_OVERDOSE, EFFECT_STRENGTHEN, effect_vals, name, and Q_streq.
Referenced by Com_ParseFireEffect(), Com_ParseItemEffect(), and Com_ParseObjDefEffect().
| bool Com_ParseList | ( | const char ** | text, |
| linkedList_t ** | list ) |
Parse tokens between '(' and ')' and return them into a linked list. It the list is not well formed, the returned list is null.
| [in] | text | Pointer to a token stream |
| [out] | list | list to return |
Definition at line 1363 of file scripts.cpp.
References Com_GetToken(), Com_NextToken(), Com_ParseList(), Com_Printf(), LIST_AddString(), LIST_Delete(), TT_BEGIN_LIST, TT_CONTENT, TT_END_LIST, TT_EOF, and type.
Referenced by cgame_import_t::bool(), CL_ParseLanguages(), CL_ParseSequence(), Com_ParseActorModels(), Com_ParseActorNames(), Com_ParseBlockToken(), Com_ParseBodyPart(), Com_ParseEquipment(), Com_ParseList(), Com_ParseMapDefinition(), Com_ParseTeam(), GAME_GetImportData(), M_ParseMusic(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), and TEST_F().
|
static |
Definition at line 3473 of file scripts.cpp.
References mapDef_t::campaign, Com_DPrintf(), Com_EParse(), com_genericPool, Com_GetMapDefByIDX(), Com_Parse(), Com_ParseBlockToken(), Com_ParseList(), Com_ParseMapDefinition(), Com_Printf(), csi, DEBUG_SHARED, mapDef_t::description, hwclass, mapDef_t::hwclass, mapDef_t::id, cvar_t::integer, lengthof, mapdef_vals, mapDef_t::mapTheme, mapDef_t::maxAliens, csi_t::mds, Mem_PoolStrDup, mapDef_t::multiplayer, name, csi_t::numMDs, OBJZERO, mapDef_t::params, Q_streq, mapDef_t::singleplayer, and Sys_Error().
Referenced by Com_ParseMapDefinition(), and Com_ParseScripts().
Definition at line 1867 of file scripts.cpp.
References Com_ParseItemEffect(), Com_ParseObjDefEffect(), Com_Printf(), EFFECT_STRENGTHEN, Mem_AllocType, Mem_Free, name, and objDef_t::strengthenEffect.
Referenced by Com_ParseItem(), and Com_ParseObjDefEffect().
| void Com_ParseScripts | ( | bool | onlyServer | ) |
Definition at line 3619 of file scripts.cpp.
References aircraftIdsNum, CL_ParseClientData(), Com_AddObjectLinks(), Com_ParseActorNames(), Com_ParseAircraftNames(), Com_ParseBodyTemplate(), Com_ParseCharacterTemplate(), Com_ParseDamageTypes(), Com_ParseEquipment(), Com_ParseGameTypes(), Com_ParseImplant(), Com_ParseInventory(), Com_ParseItem(), Com_ParseMapDefinition(), Com_ParseScripts(), Com_ParseTeam(), Com_ParseTerrain(), Com_ParseTerrainDefinition(), Com_ParseUGVs(), Com_ParseVersion(), Com_Printf(), csi, csi_t::damBlast, csi_t::damFire, csi_t::damIncendiary, csi_t::damLaser, csi_t::damNormal, csi_t::damParticle, csi_t::damPlasma, csi_t::damShock, csi_t::damSmoke, csi_t::damStunElectro, csi_t::damStunGas, dropIdsTable, FS_BuildFileList(), FS_NextScriptHeader(), interIdsTable, INVSH_InitCSI(), name, NONE, csi_t::numDTs, csi_t::numEDs, csi_t::numIDs, csi_t::numODs, csi_t::numTeamDefs, OBJZERO, Q_streq, Sys_Error(), type, ufoIdsTable, and versionParsed.
Referenced by Com_ParseScripts(), Qcommon_Init(), CampaignTest::SetUpTestCase(), CharacterTest::SetUpTestCase(), FootStepTest::SetUpTestCase(), GameTest::SetUpTestCase(), InventoryTest::SetUpTestCase(), MapDefMassRMATest::SetUpTestCase(), MapDefStatsTest::SetUpTestCase(), MapDefTest::SetUpTestCase(), ParticleTest::SetUpTestCase(), RandomMapAssemblyTest::SetUpTestCase(), RoutingTest::SetUpTestCase(), ScriptTest::SetUpTestCase(), and WebApiTest::SetUpTestCase().
|
static |
Definition at line 2687 of file scripts.cpp.
References teamDef_t::armour, teamDef_t::bodyTemplate, teamDef_t::characterTemplates, Com_DPrintf(), Com_EParse(), Com_Error(), Com_GetBodyTemplateByID(), Com_GetCharacterTemplateByID(), Com_GetNameListByID(), Com_Parse(), Com_ParseActorModels(), Com_ParseActorSounds(), Com_ParseArmourOrResistance(), Com_ParseBlockToken(), Com_ParseList(), Com_ParseTeam(), Com_Printf(), Com_SkipBlock(), csi, teamDef_t::deathTextureName, DEBUG_CLIENT, ERR_DROP, i, chrTemplate_t::id, teamDef_t::id, teamDef_t::idx, INVSH_GetItemByID(), LIST_Delete(), MAX_DEATH, MAX_TEAMDEFS, name, teamDef_t::names, teamNames_t::names, linkedList_t::next, teamDef_t::numNames, teamNames_t::numNames, csi_t::numTeamDefs, teamDef_t::numTemplates, OBJZERO, teamDef_t::onlyWeapon, Q_streq, Q_strncpyz(), teamDef_t::resistance, Sys_Error(), csi_t::teamDef, teamDefValues, va(), and teamDef_t::weapons.
Referenced by Com_ParseScripts(), and Com_ParseTeam().
|
static |
Parses "terrain" definition from script files.
Definition at line 3084 of file scripts.cpp.
References terrainType_t::bounceFraction, com_genericPool, Com_GetTerrainType(), Com_HashKey(), Com_ParseBlock(), Com_ParseTerrain(), Com_Printf(), terrainType_t::footstepVolume, terrainType_t::hash_next, Mem_Free, Mem_PoolAllocType, Mem_PoolStrDup, name, SND_VOLUME_FOOTSTEPS, TERRAIN_HASH_SIZE, terrainTypesHash, terrainTypeValues, and terrainType_t::texture.
Referenced by Com_ParseScripts(), and Com_ParseTerrain().
|
static |
Definition at line 3535 of file scripts.cpp.
References TerrainDefs::add(), KeyValuePair::asFloat(), KeyValuePair::asInt(), Com_EParse(), Com_Parse(), Com_ParseTerrainDefinition(), Com_Printf(), csi, KeyValuePair::isKey(), MAX_VAR, name, Q_strncpyz(), TerrainDef::rainChance, TerrainDef::rgbBlue, TerrainDef::rgbGreen, TerrainDef::rgbRed, TerrainDef::snowChance, TerrainDef::survivalChance, csi_t::terrainDefs, and TerrainDef::terrainName.
Referenced by Com_ParseScripts(), and Com_ParseTerrainDefinition().
|
static |
Parse 2x2 units (e.g. UGVs).
Definition at line 2837 of file scripts.cpp.
References com_genericPool, Com_ParseBlock(), Com_ParseUGVs(), Com_Printf(), csi, i, ugv_t::id, ugv_t::idx, MAX_UGV, Mem_PoolStrDup, name, csi_t::numUGV, OBJZERO, Q_streq, csi_t::ugvs, and ugvValues.
Referenced by Com_ParseScripts(), and Com_ParseUGVs().
| resultStatus_t Com_ParseValue | ( | void * | base, |
| const char * | token, | ||
| valueTypes_t | type, | ||
| int | ofs, | ||
| size_t | size, | ||
| size_t * | writtenBytes ) |
Parse a value from a string.
| [in] | base | The start pointer to a given data type (typedef, struct) where the parsed data is stored |
| [in] | token | The data which should be parsed |
| [in] | type | The data type that should be parsed |
| [in] | ofs | The offset for the value |
| [in] | size | The expected size of the data type. If 0, no checks are done |
| [out] | writtenBytes |
Definition at line 656 of file scripts.cpp.
References AIRCRAFT_NONE, ALIGN_LAST, align_names, BLEND_LAST, blend_names, Com_AlignPtr(), Com_GetConstInt(), Com_GetCrashedUfoIdNum(), Com_GetHumanCraftIdNum(), Com_GetUfoIdNum(), Com_ParseValue(), Com_Printf(), csi, csi_t::dts, f, FADE_LAST, fade_names, damageType_t::id, int(), MAX_VAR, csi_t::numDTs, parseErrorMessage, Q_streq, Q_strncpyz(), RESULT_ERROR, RESULT_OK, RESULT_WARNING, SHAPE_BIG_MAX_HEIGHT, SHAPE_BIG_MAX_WIDTH, SHAPE_SMALL_MAX_HEIGHT, SHAPE_SMALL_MAX_WIDTH, STYLE_LAST, style_names, Sys_Error(), TEAM_ALIEN, TEAM_CIVILIAN, TEAM_PHALANX, type, UFO_NONE, UFO_SIZE_T, V_AIRCRAFTTYPE, V_ALIGN, V_BLEND, V_BOOL, V_CHAR, V_COLOR, V_DAMAGE, V_FADE, V_FLOAT, V_HUNK_STRING, V_INT, V_INT2, V_LONGSTRING, V_NULL, V_POS, V_RELABS, V_SHAPE_BIG, V_SHAPE_SMALL, V_STRING, V_STYLE, V_TEAM, V_TRANSLATION_STRING, V_UFO, V_UFOCRASHED, V_VECTOR, vt_aligns, and vt_sizes.
Referenced by Com_DropShipShortNameToID(), Com_EParseValue(), Com_ParseBoolean(), Com_ParseValue(), Com_UFOShortNameToID(), TEST_F(), UI_MaterialEditorChangeValue_f(), UI_NodeSetProperty(), UI_ParseProperty(), and UI_PushDropDownWindow_f().
|
static |
Definition at line 294 of file scripts.cpp.
References Com_ParseVersion(), Q_streq, Sys_Error(), UFO_VERSION, and versionParsed.
Referenced by Com_ParseScripts(), and Com_ParseVersion().
Register mappings between script strings and enum values for values of the type V_INT.
| name | The name of the script entry to map to an integer. This can also include a namespace prefix for the case we want to map back an integer to a string from a specific namespace. In case this string is equipped with a namespace, the string is in the form "namespace::variable" |
| value | The value to map the given name to |
Definition at line 198 of file scripts.cpp.
References com_aliasSysPool, Com_ConstIntGetVariable(), com_constNameInt, com_constNameInt_hash, Com_HashKey(), Com_Printf(), Com_RegisterConstInt(), CONSTNAMEINT_HASH_SIZE, com_constNameInt_t::fullname, com_constNameInt_t::hash_next, Mem_PoolAllocType, Mem_StrDup, com_constNameInt_t::name, name, com_constNameInt_t::next, Q_streq, Q_strncpyz(), and com_constNameInt_t::value.
Referenced by Com_RegisterConstInt(), Com_RegisterConstList(), GAME_GetImportData(), SV_InitGameProgs(), TEST_F(), UI_RegisterAbstractNode(), UI_RegisterBaseInventoryNode(), UI_RegisterPanelNode(), UI_RegisterSpinnerNode(), and UI_RegisterTextNode().
| void Com_RegisterConstList | ( | const constListEntry_t | constList[] | ) |
Registers a list of string aliases.
| [in] | constList | Array of string => int mappings. Must be terminated with a nullptr string ({nullptr, -1}) line |
Definition at line 253 of file scripts.cpp.
References Com_RegisterConstInt(), Com_RegisterConstList(), i, constListEntry_t::name, and name.
Referenced by Com_RegisterConstList(), GAME_GetImportData(), GAME_LoadCharacter(), GAME_SaveCharacter(), TEST_F(), and cgame_import_t::void().
| int Com_SetValue | ( | void * | base, |
| const void * | set, | ||
| valueTypes_t | type, | ||
| int | ofs, | ||
| size_t | size ) |
| [in] | base | The start pointer to a given data type (typedef, struct) |
| [in] | set | The data which should be parsed |
| [in] | type | The data type that should be parsed |
| [in] | ofs | The offset for the value |
| [in] | size | The expected size of the data type. If 0, no checks are done |
Definition at line 1009 of file scripts.cpp.
References AIRCRAFT_NONE, Com_AlignPtr(), Com_GetCrashedUfoIdNum(), Com_GetHumanCraftIdNum(), Com_GetUfoIdNum(), Com_Printf(), Com_SetValue(), int(), len, MAX_VAR, Q_streq, Q_strncpyz(), SHAPE_BIG_MAX_HEIGHT, SHAPE_SMALL_MAX_HEIGHT, Sys_Backtrace(), Sys_Error(), TEAM_ALIEN, TEAM_CIVILIAN, TEAM_PHALANX, type, UFO_NONE, UFO_SIZE_T, V_AIRCRAFTTYPE, V_ALIGN, V_BLEND, V_BOOL, V_CHAR, V_COLOR, V_DAMAGE, V_FADE, V_FLOAT, V_INT, V_INT2, V_LONGSTRING, V_NULL, V_POS, V_SHAPE_BIG, V_SHAPE_SMALL, V_STRING, V_STYLE, V_TEAM, V_UFO, V_UFOCRASHED, V_VECTOR, vt_aligns, and vt_sizes.
Referenced by CL_ParticleFunction(), Com_SetValue(), and UI_NodeSetPropertyFromRAW().
Definition at line 3732 of file scripts.cpp.
References com_constNameInt, com_constNameInt_hash, Com_Shutdown(), OBJZERO, terrainTypesHash, and versionParsed.
Referenced by Com_Shutdown(), Qcommon_Shutdown(), and TEST_Shutdown().
| const char * Com_UFOCrashedTypeToShortName | ( | ufoType_t | type | ) |
Translate UFO type to short name when UFO is crashed.
Definition at line 3351 of file scripts.cpp.
References Com_UFOCrashedTypeToShortName(), Com_ValueToStr(), type, and V_UFOCRASHED.
Referenced by Com_UFOCrashedTypeToShortName(), and GAME_GetImportData().
| ufoType_t Com_UFOShortNameToID | ( | const char * | token | ) |
Translate short name to UFO type.
Definition at line 3329 of file scripts.cpp.
References Com_ParseValue(), Com_UFOShortNameToID(), and V_UFO.
Referenced by Com_UFOShortNameToID(), GAME_GetImportData(), and cgame_import_t::ufoType_t().
| const char * Com_UFOTypeToShortName | ( | ufoType_t | type | ) |
Translate UFO type to short name.
Definition at line 3342 of file scripts.cpp.
References Com_UFOTypeToShortName(), Com_ValueToStr(), type, and V_UFO.
Referenced by Com_UFOTypeToShortName(), and GAME_GetImportData().
| bool Com_UnregisterConstList | ( | const constListEntry_t | constList[] | ) |
Unregisters a list of string aliases.
| [in] | constList | Array of string => int mappings. Must be terminated with a nullptr string ({nullptr, -1}) line |
Definition at line 237 of file scripts.cpp.
References Com_UnregisterConstList(), Com_UnregisterConstVariable(), i, constListEntry_t::name, and name.
Referenced by cgame_import_t::bool(), Com_UnregisterConstList(), GAME_GetImportData(), GAME_LoadCharacter(), GAME_SaveCharacter(), and TEST_F().
| bool Com_UnregisterConstVariable | ( | const char * | name | ) |
Removes a registered constant from the script mapping hash table.
| name | The name of the script entry to remove out of the const int hash. In case this string is equipped with a namespace, the string is in the form "namespace::variable". If you try to unregister a variable that was registered with a namespace, this namespace must be included in the given name, too. |
Definition at line 147 of file scripts.cpp.
References Com_ConstIntGetVariable(), com_constNameInt, com_constNameInt_hash, Com_HashKey(), Com_UnregisterConstVariable(), CONSTNAMEINT_HASH_SIZE, com_constNameInt_t::fullname, com_constNameInt_t::hash_next, Mem_Free, name, com_constNameInt_t::next, and Q_streq.
Referenced by cgame_import_t::bool(), Com_UnregisterConstList(), Com_UnregisterConstVariable(), GAME_GetImportData(), SV_InitGameProgs(), and TEST_F().
| const char * Com_ValueToStr | ( | const void * | base, |
| const valueTypes_t | type, | ||
| const int | ofs ) |
| [in] | base | The start pointer to a given data type (typedef, struct) |
| [in] | type | The data type that should be parsed |
| [in] | ofs | The offset for the value |
Definition at line 1171 of file scripts.cpp.
References ALIGN_LAST, align_names, BLEND_LAST, blend_names, Com_AlignPtr(), Com_GetCrashedUfoIdStr(), Com_GetHumanCraftIdStr(), Com_GetUfoIdStr(), Com_Printf(), Com_sprintf(), Com_ValueToStr(), csi, csi_t::dts, FADE_LAST, fade_names, MAX_DAMAGETYPES, MAX_VAR, Q_strncpyz(), STYLE_LAST, style_names, Sys_Backtrace(), Sys_Error(), TEAM_ALIEN, TEAM_CIVILIAN, TEAM_PHALANX, type, UFO_SIZE_T, V_AIRCRAFTTYPE, V_ALIGN, V_BLEND, V_BOOL, V_CHAR, V_COLOR, V_DAMAGE, V_FADE, V_FLOAT, V_HUNK_STRING, V_INT, V_INT2, V_LONGSTRING, V_NULL, V_POS, V_RELABS, V_SHAPE_BIG, V_SHAPE_SMALL, V_STRING, V_STYLE, V_TEAM, V_TRANSLATION_STRING, V_UFO, V_UFOCRASHED, V_VECTOR, and vt_aligns.
Referenced by Com_DropShipTypeToShortName(), Com_UFOCrashedTypeToShortName(), Com_UFOTypeToShortName(), Com_ValueToStr(), GAME_GetImportData(), and UI_GetStringFromNodeProperty().
| const char* const air_slot_type_strings[] = AIR_SLOT_TYPE_STRINGS |
List of valid strings for slot types.
Definition at line 1791 of file scripts.cpp.
|
static |
Definition at line 477 of file scripts.cpp.
Referenced by Com_GetAircraftDef(), Com_GetAircraftIdNum(), Com_GetCrashedAircraftIdNum(), Com_GetDropShipIdsNum(), Com_GetHumanAircraftIdsNum(), Com_GetHumanCraftIdNum(), Com_GetHumanCraftIdStr(), Com_GetUfoIdsNum(), Com_ParseAircraftNames(), and Com_ParseScripts().
|
static |
Definition at line 472 of file scripts.cpp.
Referenced by Com_GetAircraftDef(), Com_GetAircraftIdNum(), Com_GetCrashedAircraftIdNum(), and Com_ParseAircraftNames().
| const char* const align_names[] |
Definition at line 340 of file scripts.cpp.
Referenced by CASSERT(), Com_ParseValue(), and Com_ValueToStr().
| const char* const blend_names[] |
Definition at line 345 of file scripts.cpp.
Referenced by CASSERT(), Com_ParseValue(), and Com_ValueToStr().
|
static |
Definition at line 2920 of file scripts.cpp.
Referenced by Com_ParseBodyPart().
|
static |
Linked list of all the registeres mappings.
Definition at line 48 of file scripts.cpp.
Referenced by Com_GetConstVariable(), Com_RegisterConstInt(), Com_Shutdown(), and Com_UnregisterConstVariable().
|
static |
Hash of all the registeres mappings.
Definition at line 50 of file scripts.cpp.
Referenced by Com_GetConstInt(), Com_RegisterConstInt(), Com_Shutdown(), and Com_UnregisterConstVariable().
|
static |
Definition at line 455 of file scripts.cpp.
Referenced by Com_GetAircraftIdNum(), Com_GetAircraftIdStr(), Com_GetCrashedAircraftIdNum(), Com_GetCrashedAircraftIdStr(), and Com_ParseAircraftNames().
|
static |
Definition at line 470 of file scripts.cpp.
Referenced by Com_ParseScripts().
|
static |
Definition at line 1505 of file scripts.cpp.
Referenced by Com_ParseItemEffect().
|
static |
Valid equipment definition values from script files.
Definition at line 2172 of file scripts.cpp.
Referenced by Com_ParseEquipment().
| const char* const fade_names[] |
Definition at line 355 of file scripts.cpp.
Referenced by CASSERT(), Com_ParseValue(), and Com_ValueToStr().
|
static |
Definition at line 1521 of file scripts.cpp.
Referenced by Com_ParseFire().
|
static |
possible gametype values for the gameserver (ufo-scriptfiles)
Definition at line 3114 of file scripts.cpp.
Referenced by Com_ParseGameTypes().
|
static |
Definition at line 2082 of file scripts.cpp.
Referenced by Com_ParseInventory().
|
static |
Definition at line 2011 of file scripts.cpp.
Referenced by Com_ParseImplant().
|
static |
Definition at line 471 of file scripts.cpp.
Referenced by Com_ParseScripts().
|
static |
valid mapdef descriptors
Definition at line 3442 of file scripts.cpp.
Referenced by Com_ParseMapDefinition().
| const char* const name_strings[NAME_NUM_TYPES] |
Definition at line 2162 of file scripts.cpp.
Referenced by Com_FindNameType(), and Com_ParseActorSounds().
|
static |
Definition at line 1448 of file scripts.cpp.
Referenced by Com_ParseItem().
|
static |
Definition at line 422 of file scripts.cpp.
Referenced by Com_EParseValue(), Com_GetLastParseError(), and Com_ParseValue().
|
static |
Temporary list of weapon ids as parsed from the ufo file "weapon_mod \<id\>" in Com_ParseItem and used in Com_AddObjectLinks.
Definition at line 1798 of file scripts.cpp.
Referenced by Com_AddObjectLinks(), Com_ParseFireDefinition(), and Com_ParseItem().
|
static |
Definition at line 2929 of file scripts.cpp.
Referenced by Com_ParseBodyPart().
|
static |
Definition at line 1425 of file scripts.cpp.
Referenced by Com_ParseCharacterTemplate(), and Com_ParseFire().
| const char* const style_names[] |
Definition at line 350 of file scripts.cpp.
Referenced by CASSERT(), Com_ParseValue(), and Com_ValueToStr().
|
static |
possible teamdesc values (ufo-scriptfiles)
Definition at line 2672 of file scripts.cpp.
Referenced by Com_ParseTeam().
|
static |
Definition at line 3051 of file scripts.cpp.
Referenced by Com_GetTerrainType(), Com_ParseTerrain(), and Com_Shutdown().
|
static |
Definition at line 3053 of file scripts.cpp.
Referenced by Com_ParseTerrain().
|
static |
Ufoai uses two types of ids for aircraft: the string is used for references in the scripts, the numeric/enum type in the code. This tables and the following functions convert these ids.
Definition at line 469 of file scripts.cpp.
Referenced by Com_ParseScripts().
|
static |
Definition at line 2823 of file scripts.cpp.
Referenced by Com_ParseUGVs().
|
static |
Definition at line 292 of file scripts.cpp.
Referenced by Com_ParseScripts(), Com_ParseVersion(), and Com_Shutdown().
|
static |
natural align for each targets
Definition at line 392 of file scripts.cpp.
Referenced by CASSERT(), Com_AlignPtr(), Com_ParseValue(), Com_SetValue(), and Com_ValueToStr().
| const char* const vt_names[] |
possible values for parsing functions
Definition at line 310 of file scripts.cpp.
Referenced by CASSERT(), CL_ParsePtlCmds(), and CL_ParticleFunction().
|
static |
target sizes for buffer
Definition at line 361 of file scripts.cpp.
Referenced by CASSERT(), Com_ParseValue(), and Com_SetValue().