UFO: Alien Invasion
Loading...
Searching...
No Matches
scripts.cpp File Reference

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"
Include dependency graph for scripts.cpp:

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 size)
 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)
voidCom_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 size)
static short Com_GetCrashedAircraftIdNum (aircraftType_t type, const char *idString)
static void Com_GetCrashedAircraftIdStr (aircraftType_t type, short idNum, char *outStr, const size_t size)
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 size)
static void Com_GetCrashedUfoIdStr (ufoType_t idNum, char *outStr, const size_t size)
static short Com_GetHumanCraftIdNum (const char *idString)
static void Com_GetHumanCraftIdStr (short idNum, char *outStr, const size_t size)
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 size, size_t *writtenBytes)
 Parse a value from a string.
int Com_EParseValue (void *base, const char *token, valueTypes_t type, int ofs, size_t size)
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 size)
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_tCom_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 BodyDataCom_GetBodyTemplateByID (const char *id)
static const teamNames_tCom_GetNameListByID (const char *id)
static void Com_ParseTeam (const char *name, const char **text)
const chrTemplate_tCom_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_tCom_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_tCom_GetUGVByIDSilent (const char *ugvID)
 Searches an UGV definition by a given script id and returns the pointer to the global data.
const ugv_tCom_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_tCom_GetMapDefByIDX (int index)
mapDef_tCom_GetMapDefinitionByID (const char *mapDefID)
void Com_ParseScripts (bool onlyServer)
int Com_GetScriptChecksum (void)
void Com_Shutdown (void)

Variables

static com_constNameInt_tcom_constNameInt
 Linked list of all the registeres mappings.
static com_constNameInt_tcom_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_tparseItemWeapons = 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_tterrainTypesHash [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

Detailed Description

UFO scripts used in client and server.

Note
interpreters for: object, inventory, equipment, name and team, damage

Definition in file scripts.cpp.

Macro Definition Documentation

◆ CONSTNAMEINT_HASH_SIZE

#define CONSTNAMEINT_HASH_SIZE   32

Definition at line 32 of file scripts.cpp.

Referenced by Com_GetConstInt(), Com_RegisterConstInt(), and Com_UnregisterConstVariable().

◆ MAX_CONSTNAMEINT_NAME

#define MAX_CONSTNAMEINT_NAME   32

Definition at line 34 of file scripts.cpp.

◆ TERRAIN_HASH_SIZE

#define TERRAIN_HASH_SIZE   64

Definition at line 3050 of file scripts.cpp.

Referenced by Com_GetTerrainType(), and Com_ParseTerrain().

Enumeration Type Documentation

◆ anonymous enum

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.

◆ aircraftType_t

Enumerator
CRAFT_DROP 
CRAFT_INTER 
CRAFT_UFO 
CRAFT_MAX 

Definition at line 448 of file scripts.cpp.

Function Documentation

◆ CASSERT() [1/8]

◆ CASSERT() [2/8]

References ALIGN_LAST, and align_names.

◆ CASSERT() [3/8]

References BLEND_LAST, and blend_names.

◆ CASSERT() [4/8]

CASSERT ( lengthof(fade_names) = =FADE_LAST)

References FADE_LAST, and fade_names.

◆ CASSERT() [5/8]

References STYLE_LAST, and style_names.

◆ CASSERT() [6/8]

CASSERT ( lengthof(vt_aligns) = =V_NUM_TYPES)

References V_NUM_TYPES, and vt_aligns.

◆ CASSERT() [7/8]

CASSERT ( lengthof(vt_names) = =V_NUM_TYPES)

References V_NUM_TYPES, and vt_names.

◆ CASSERT() [8/8]

CASSERT ( lengthof(vt_sizes) = =V_NUM_TYPES)

References V_NUM_TYPES, and vt_sizes.

◆ Com_AddObjectLinks()

◆ Com_AlignPtr()

void * Com_AlignPtr ( const void * memory,
valueTypes_t type )

Align a memory to use a natural address for the data type we will write.

Note
it speed up data read, and fix crash on PPC processors

Definition at line 437 of file scripts.cpp.

References Sys_Error(), type, V_NULL, V_NUM_TYPES, and vt_aligns.

Referenced by CL_ParsePtlCmds(), Com_ParseValue(), Com_SetValue(), Com_ValueToStr(), UI_InitRawActionValue(), and UI_ParseProperty().

◆ Com_ConstIntGetVariable()

const char * Com_ConstIntGetVariable ( const char * name)
static

Will extract the variable from a string<=>int mapping string which contain a namespace.

Parameters
nameThe name of the script entry to map to an integer
Returns
The namespace in case one was found, nullptr otherwise

Definition at line 57 of file scripts.cpp.

References name.

Referenced by Com_GetConstInt(), Com_RegisterConstInt(), and Com_UnregisterConstVariable().

◆ Com_DropShipShortNameToID()

humanAircraftType_t Com_DropShipShortNameToID ( const char * token)

Translate DropShip type to short name.

Returns
Will always return a valid human aircraft type or errors out if the given token can't be mapped to an human aircraft type
See also
Com_DropShipTypeToShortName

Definition at line 3307 of file scripts.cpp.

References Com_ParseValue(), and V_AIRCRAFTTYPE.

Referenced by Com_ParseEquipment(), GAME_GetImportData(), and cgame_import_t::humanAircraftType_t().

◆ Com_DropShipTypeToShortName()

const char * Com_DropShipTypeToShortName ( humanAircraftType_t type)

Translate DropShip type to short name.

See also
Com_DropShipShortNameToID

Definition at line 3319 of file scripts.cpp.

References Com_ValueToStr(), type, and V_AIRCRAFTTYPE.

Referenced by GAME_GetImportData().

◆ Com_EParse()

◆ Com_EParseValue()

◆ Com_FindNameType()

int Com_FindNameType ( const char * nameType)
static

Find name type id by is name

Returns
id of the name type, else -1 if not found

Definition at line 263 of file scripts.cpp.

References i, NAME_NUM_TYPES, name_strings, and Q_streq.

Referenced by Com_ParseActorModels(), and Com_ParseActorNames().

◆ Com_GetAircraftDef()

const char * Com_GetAircraftDef ( aircraftType_t type,
short idNum )
static

Definition at line 479 of file scripts.cpp.

References aircraftIdsNum, aircraftIdsTable, and type.

Referenced by Com_GetAircraftIdStr(), and Com_GetCrashedAircraftIdStr().

◆ Com_GetAircraftIdNum()

short Com_GetAircraftIdNum ( aircraftType_t type,
const char * idString )
static

◆ Com_GetAircraftIdStr()

void Com_GetAircraftIdStr ( aircraftType_t type,
short idNum,
char * outStr,
const size_t size )
static

Definition at line 499 of file scripts.cpp.

References Com_GetAircraftDef(), Com_sprintf(), craftTypeIds, and type.

Referenced by Com_GetHumanCraftIdStr(), and Com_GetUfoIdStr().

◆ Com_GetBodyTemplateByID()

const BodyData * Com_GetBodyTemplateByID ( const char * id)
static

Definition at line 2653 of file scripts.cpp.

References Com_Printf(), csi, LIST_Foreach, and Q_streq.

Referenced by Com_ParseTeam().

◆ Com_GetCharacterModel()

◆ Com_GetCharacterTemplateByID()

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.

Parameters
[in]chrTemplateThe character template id (given in ufo-script files)

Definition at line 2809 of file scripts.cpp.

References Com_Printf(), csi, i, Q_streq, and Q_strnull().

Referenced by Com_ParseTeam().

◆ Com_GetCharacterValues()

void Com_GetCharacterValues ( const char * teamDefition,
character_t * chr )

Assign character values, 3D models and names to a character.

Parameters
[in]teamDefitionThe team definition id to use to generate the character values.
[in,out]chrThe character that should get the paths to the different models/skins.
See also
Com_GiveName
Com_GiveModel

Definition at line 2408 of file scripts.cpp.

References ACTOR_SIZE_INVALID, ACTOR_SIZE_NORMAL, Com_Error(), Com_GetCharacterModel(), 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(), and SV_InitGameProgs().

◆ Com_GetConstInt()

bool Com_GetConstInt ( const char * name,
int * value )

Searches whether a given value was registered as a string to int mapping.

Parameters
[in]nameThe name of the string mapping (maybe including a namespace)
[out]valueThe mapped integer if found, not touched if the given string was found in the registered values.
Returns
True if the value is found.
See also
Com_RegisterConstInt
Com_ParseValue

Definition at line 74 of file scripts.cpp.

References Com_ConstIntGetVariable(), com_constNameInt_hash, Com_HashKey(), CONSTNAMEINT_HASH_SIZE, hash, name, and Q_streq.

Referenced by cgame_import_t::bool(), Com_GetConstIntFromNamespace(), Com_ParseValue(), GAME_GetImportData(), SV_InitGameProgs(), and TEST_F().

◆ Com_GetConstIntFromNamespace()

bool Com_GetConstIntFromNamespace ( const char * space,
const char * variable,
int * value )

Searches whether a given value was registered as a string to int mapping.

Parameters
[in]spaceThe namespace of the mapping variable
[in]variableThe name of the string mapping
[out]valueThe mapped integer if found, not touched if the given string was found in the registered values.
Returns
True if the value is found.
See also
Com_RegisterConstInt
Com_ParseValue
Com_GetConstInt

Definition at line 103 of file scripts.cpp.

References Com_GetConstInt(), Q_strnull(), and va().

Referenced by cgame_import_t::bool(), GAME_GetImportData(), GAME_LoadCharacter(), and SV_InitGameProgs().

◆ Com_GetConstVariable()

const char * Com_GetConstVariable ( const char * space,
int value )

Searches the mapping variable for a given integer value and a namespace.

Parameters
[in]spaceThe namespace to search in - might not be nullptr or empty.
[in]valueThe mapped integer
Note
only variables with a namespace given are found here
See also
Com_RegisterConstInt
Com_ParseValue

Definition at line 122 of file scripts.cpp.

References com_constNameInt, com_constNameInt_t::fullname, com_constNameInt_t::name, com_constNameInt_t::next, and com_constNameInt_t::value.

Referenced by GAME_GetImportData(), GAME_SaveCharacter(), SV_InitGameProgs(), and TEST_F().

◆ Com_GetCrashedAircraftIdNum()

short Com_GetCrashedAircraftIdNum ( aircraftType_t type,
const char * idString )
static

◆ Com_GetCrashedAircraftIdStr()

void Com_GetCrashedAircraftIdStr ( aircraftType_t type,
short idNum,
char * outStr,
const size_t size )
static

Definition at line 520 of file scripts.cpp.

References Com_GetAircraftDef(), Com_sprintf(), CRAFT_MAX, craftTypeIds, and type.

Referenced by Com_GetCrashedUfoIdStr().

◆ Com_GetCrashedUfoIdNum()

ufoType_t Com_GetCrashedUfoIdNum ( const char * idString)
static

Definition at line 534 of file scripts.cpp.

References Com_GetCrashedAircraftIdNum(), and CRAFT_UFO.

Referenced by Com_ParseValue(), and Com_SetValue().

◆ Com_GetCrashedUfoIdStr()

void Com_GetCrashedUfoIdStr ( ufoType_t idNum,
char * outStr,
const size_t size )
static

Definition at line 544 of file scripts.cpp.

References Com_GetCrashedAircraftIdStr(), and CRAFT_UFO.

Referenced by Com_ValueToStr().

◆ Com_GetDropShipIdsNum()

short Com_GetDropShipIdsNum ( void )

Definition at line 576 of file scripts.cpp.

References aircraftIdsNum, and CRAFT_DROP.

Referenced by GAME_GetImportData(), and cgame_import_t::short().

◆ Com_GetGender()

int Com_GetGender ( const teamDef_t * teamDef)
static

Return a random (weighted by number of models) gender for this teamDef.

Parameters
[in]teamDefpointer to the teamDef to get the gender for.
Returns
A valid gender for the teamDef.

Definition at line 2382 of file scripts.cpp.

References Com_Error(), ERR_DROP, teamDef_t::name, NAME_LAST, teamDef_t::numModels, and teamDef_t::numNames.

Referenced by Com_GetCharacterValues().

◆ Com_GetHumanAircraftIdsNum()

short Com_GetHumanAircraftIdsNum ( void )

Definition at line 581 of file scripts.cpp.

References aircraftIdsNum, CRAFT_DROP, and CRAFT_INTER.

Referenced by GAME_GetImportData(), and cgame_import_t::short().

◆ Com_GetHumanCraftIdNum()

short Com_GetHumanCraftIdNum ( const char * idString)
static

Definition at line 549 of file scripts.cpp.

References AIRCRAFT_NONE, aircraftIdsNum, Com_GetAircraftIdNum(), CRAFT_DROP, and CRAFT_INTER.

Referenced by Com_ParseValue(), and Com_SetValue().

◆ Com_GetHumanCraftIdStr()

void Com_GetHumanCraftIdStr ( short idNum,
char * outStr,
const size_t size )
static

Definition at line 562 of file scripts.cpp.

References aircraftIdsNum, Com_GetAircraftIdStr(), CRAFT_DROP, and CRAFT_INTER.

Referenced by Com_ValueToStr().

◆ Com_GetLastParseError()

const char * Com_GetLastParseError ( void )

Returns the last error message

Returns
string that contains the last error message

Definition at line 428 of file scripts.cpp.

References parseErrorMessage.

Referenced by UI_NodeSetProperty(), and UI_ParseProperty().

◆ Com_GetMapDefByIDX()

mapDef_t * Com_GetMapDefByIDX ( int index)

Definition at line 3593 of file scripts.cpp.

References csi, and index.

Referenced by Com_ParseMapDefinition().

◆ Com_GetMapDefinitionByID()

mapDef_t * Com_GetMapDefinitionByID ( const char * mapDefID)

Definition at line 3598 of file scripts.cpp.

References Com_DPrintf(), DEBUG_SHARED, mapDef_t::id, MapDef_Foreach, and Q_streq.

Referenced by GAME_GetImportData(), and TEST_F().

◆ Com_GetMapDefNumber()

int Com_GetMapDefNumber ( void )

Definition at line 3588 of file scripts.cpp.

References csi.

◆ Com_GetNameListByID()

const teamNames_t * Com_GetNameListByID ( const char * id)
static

Definition at line 2662 of file scripts.cpp.

References Com_Printf(), csi, LIST_Foreach, and Q_streq.

Referenced by Com_ParseTeam().

◆ Com_GetRandomMapAssemblyNameForCraft()

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.

See also
cvar rm_drop, rm_ufo, rm_crashed
Note
Uses a static buffer - so after you got the name you should ensure that you put it into a proper location. Otherwise it will get overwritten with the next call of this function.

Definition at line 3277 of file scripts.cpp.

References va().

Referenced by GAME_GetImportData(), TEST_F(), GameTest::testCountSpawnpointsForMapWithAssembly(), and GameTest::testCountSpawnpointsForMapWithAssemblyAndAircraft().

◆ Com_GetRandomMapAssemblyNameForCrashedCraft()

const char * Com_GetRandomMapAssemblyNameForCrashedCraft ( const char * craftID)
Todo
implement this in a better way

Definition at line 3285 of file scripts.cpp.

References Q_streq.

Referenced by GAME_GetImportData().

◆ Com_GetScriptChecksum()

int Com_GetScriptChecksum ( void )

Definition at line 3717 of file scripts.cpp.

References Com_BlockChecksum(), FS_GetFileData(), and LittleLong.

Referenced by CL_CanMultiplayerStart(), and SV_Map().

◆ Com_GetTeamDefinitionByID()

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.

Parameters
[in]teamThe team id (given in ufo-script files)

Definition at line 2345 of file scripts.cpp.

References Com_Printf(), csi, i, teamDef_t::id, and Q_streq.

Referenced by Com_GetCharacterValues(), GAME_GetImportData(), GAME_ItemIsUseable(), GAME_LoadCharacter(), TEST_F(), and TEST_F().

◆ Com_GetTerrainType()

const terrainType_t * Com_GetTerrainType ( const char * textureName)

Searches the terrain definition if given.

Parameters
[in]textureNameThe 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_HashKey(), hash, Q_streq, TERRAIN_HASH_SIZE, and terrainTypesHash.

Referenced by Com_ParseTerrain(), LE_PlaySoundFileAndParticleForSurface(), SV_GetBounceFraction(), and SV_GetFootstepSound().

◆ Com_GetUfoIdNum()

ufoType_t Com_GetUfoIdNum ( const char * idString)
static

Definition at line 529 of file scripts.cpp.

References Com_GetAircraftIdNum(), and CRAFT_UFO.

Referenced by Com_ParseValue(), and Com_SetValue().

◆ Com_GetUfoIdsNum()

short Com_GetUfoIdsNum ( void )

Definition at line 571 of file scripts.cpp.

References aircraftIdsNum, and CRAFT_UFO.

Referenced by GAME_GetImportData(), and TEST_F().

◆ Com_GetUfoIdStr()

void Com_GetUfoIdStr ( ufoType_t idNum,
char * outStr,
const size_t size )
static

Definition at line 539 of file scripts.cpp.

References Com_GetAircraftIdStr(), and CRAFT_UFO.

Referenced by Com_ValueToStr().

◆ Com_GetUGVByID()

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.

Parameters
[in]ugvIDThe script id of the UGV definition you are looking for
Returns
ugv_t pointer or nullptr if not found.

Definition at line 3381 of file scripts.cpp.

References Com_GetUGVByIDSilent(), Com_Printf(), and csi.

Referenced by GAME_GetImportData(), and TEST_F().

◆ Com_GetUGVByIDSilent()

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.

Parameters
[in]ugvIDThe script id of the UGV definition you are looking for
Returns
ugv_t pointer or nullptr if not found.
Note
This function gives no warning on null name or if no ugv found

Definition at line 3362 of file scripts.cpp.

References csi, i, ugv_t::id, and Q_streq.

Referenced by Com_GetUGVByID(), GAME_AppendTeamMember(), and GAME_GetImportData().

◆ Com_GiveModel()

teamDef_t::model_t const * Com_GiveModel ( int gender,
const teamDef_t * td )
static
Parameters
[in]gender1 (female) or 2 (male)
[in]tdThe team definition
See also
Com_GetCharacterValues

Definition at line 2318 of file scripts.cpp.

References Com_Printf(), linkedList_t::data, teamDef_t::id, teamDef_t::models, linkedList_t::next, and teamDef_t::numModels.

Referenced by Com_GetCharacterModel().

◆ Com_GiveName()

const char * Com_GiveName ( int gender,
const teamDef_t * td )
static
Parameters
[in]gender1 (female) or 2 (male)
[in]tdThe team definition to get the name from
See also
Com_GetCharacterValues

Definition at line 2283 of file scripts.cpp.

References Com_DPrintf(), 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().

◆ Com_ParseActorModels()

◆ Com_ParseActorNames()

void Com_ParseActorNames ( const char * name,
const char ** text )
static

◆ Com_ParseActorSounds()

void Com_ParseActorSounds ( const char * name,
const char ** text,
teamDef_t * td )
static

Parses "actorsounds" definition from team_* ufo script files.

See also
Com_ParseNames
Com_ParseScripts

Definition at line 2592 of file scripts.cpp.

References Com_EParse(), Com_Parse(), 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_ParseTeam().

◆ Com_ParseAircraftNames()

void Com_ParseAircraftNames ( const char *const name,
const char ** text )
static

◆ Com_ParseArmourOrResistance()

void Com_ParseArmourOrResistance ( const char * name,
const char ** text,
short * ad,
bool rating )
static

Parses the armour definitions or the team resistance values from script files. The protection and rating values.

Note
The rating values are just for menu displaying
See also
Com_ParseItem

Definition at line 1747 of file scripts.cpp.

References Com_EParse(), Com_Parse(), Com_Printf(), csi, i, damageType_t::id, name, Q_streq, damageType_t::showInMenu, and Sys_Error().

Referenced by Com_ParseItem(), and Com_ParseTeam().

◆ Com_ParseBlock()

bool Com_ParseBlock ( const char * name,
const char ** text,
void * base,
const value_t * values,
memPool_t * mempool )

◆ Com_ParseBlockToken()

◆ Com_ParseBodyPart()

◆ Com_ParseBodyTemplate()

void Com_ParseBodyTemplate ( const char * name,
const char ** text )
static

◆ Com_ParseBoolean()

bool Com_ParseBoolean ( const char * token)

Parses a boolean from a string.

Parameters
tokenThe token to convert into a boolean
Returns
false if the string could not get parsed

Definition at line 986 of file scripts.cpp.

References Com_ParseValue(), RESULT_ERROR, and V_BOOL.

Referenced by cgame_import_t::bool(), GAME_GetImportData(), and HUD_RemainingTUs_f().

◆ Com_ParseCharacterTemplate()

void Com_ParseCharacterTemplate ( const char * name,
const char ** text )
static

◆ Com_ParseDamageTypes()

void Com_ParseDamageTypes ( const char * name,
const char ** text )
static

Definition at line 3194 of file scripts.cpp.

References Com_EParse(), Com_Parse(), Com_Printf(), csi, i, MAX_DAMAGETYPES, name, Q_streq, Q_strncpyz(), and Sys_Error().

Referenced by Com_ParseScripts().

◆ Com_ParseEquipment()

◆ Com_ParseFire()

bool Com_ParseFire ( const char * name,
const char ** text,
fireDef_t * fd )
static

Parses the firemode.

Parameters
[in]nameAlready parsed name of the weapon, used for error messages
[in,out]textThe string which is to be parsed
[in,out]fdThe 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_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_ParseFireDefinition().

◆ Com_ParseFireDefinition()

◆ Com_ParseFireEffect()

void Com_ParseFireEffect ( fireDef_t * fd,
const char * name,
const char ** text )
static

Parses the effect that is bound to a fire definitions.

Parameters
[in,out]fdThe fire definition to add the effect to
[in]nameAlready parsed name of the weapon, used for error messages
[in,out]textThe string which is to be parsed

Definition at line 1620 of file scripts.cpp.

References fireDef_t::activeEffect, 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().

◆ Com_ParseGameTypes()

◆ Com_ParseImplant()

◆ Com_ParseInventory()

void Com_ParseInventory ( const char * name,
const char ** text )
static

◆ Com_ParseItem()

◆ Com_ParseItemEffect()

effectStages_t Com_ParseItemEffect ( itemEffect_t * e,
const char * name,
const char ** text )
static

Parses the item effect.

Parameters
[in,out]eThe item effect that is filled in here.
[in]nameAlready parsed name of the weapon, used for error messages
[in,out]textThe string which is to be parsed

Definition at line 1563 of file scripts.cpp.

References com_genericPool, Com_Parse(), Com_ParseBlockToken(), Com_Printf(), Com_SkipBlock(), EFFECT_ACTIVE, EFFECT_INACTIVE, EFFECT_MAX, EFFECT_OVERDOSE, EFFECT_STRENGTHEN, effect_vals, name, and Q_streq.

Referenced by Com_ParseFireEffect(), and Com_ParseObjDefEffect().

◆ Com_ParseList()

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.

Parameters
[in]textPointer to a token stream
[out]listlist to return
Returns
True if the list is well formed, else false.

Definition at line 1363 of file scripts.cpp.

References Com_GetToken(), Com_NextToken(), 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_ParseMapDefinition(), Com_ParseTeam(), GAME_GetImportData(), M_ParseMusic(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), and TEST_F().

◆ Com_ParseMapDefinition()

◆ Com_ParseObjDefEffect()

void Com_ParseObjDefEffect ( objDef_t * od,
const char * name,
const char ** text )
static

◆ Com_ParseScripts()

◆ Com_ParseTeam()

◆ Com_ParseTerrain()

void Com_ParseTerrain ( const char * name,
const char ** text )
static

◆ Com_ParseTerrainDefinition()

◆ Com_ParseUGVs()

void Com_ParseUGVs ( const char * name,
const char ** text )
static

Parse 2x2 units (e.g. UGVs).

See also
CL_ParseClientData

Definition at line 2837 of file scripts.cpp.

References com_genericPool, Com_ParseBlock(), Com_Printf(), csi, i, ugv_t::id, ugv_t::idx, MAX_UGV, Mem_PoolStrDup, name, OBJZERO, Q_streq, and ugvValues.

Referenced by Com_ParseScripts().

◆ Com_ParseValue()

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.

Parameters
[in]baseThe start pointer to a given data type (typedef, struct) where the parsed data is stored
[in]tokenThe data which should be parsed
[in]typeThe data type that should be parsed
[in]ofsThe offset for the value
[in]sizeThe expected size of the data type. If 0, no checks are done
[out]writtenBytes
Returns
A resultStatus_t value
Note
instead of , this function separate error message and write byte result
Todo
This function has much in common with Com_SetValue. Refactor them !

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_Printf(), csi, f, FADE_LAST, fade_names, int(), MAX_VAR, 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_UFOShortNameToID(), TEST_F(), UI_MaterialEditorChangeValue_f(), UI_NodeSetProperty(), UI_ParseProperty(), and UI_PushDropDownWindow_f().

◆ Com_ParseVersion()

void Com_ParseVersion ( const char * version)
static

Definition at line 294 of file scripts.cpp.

References Q_streq, Sys_Error(), UFO_VERSION, and versionParsed.

Referenced by Com_ParseScripts().

◆ Com_RegisterConstInt()

void Com_RegisterConstInt ( const char * name,
int value )

Register mappings between script strings and enum values for values of the type V_INT.

Parameters
nameThe 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"
valueThe value to map the given name to
Note
You still can't register the same name twice even if you put it into different namespaces (yet). The namespaces are only for converting an integer back into a string.
See also
Com_GetConstInt
Com_UnregisterConstVariable

Definition at line 198 of file scripts.cpp.

References com_aliasSysPool, Com_ConstIntGetVariable(), com_constNameInt, com_constNameInt_hash, Com_HashKey(), Com_Printf(), CONSTNAMEINT_HASH_SIZE, com_constNameInt_t::fullname, hash, 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_RegisterConstList(), GAME_GetImportData(), SV_InitGameProgs(), TEST_F(), UI_RegisterAbstractNode(), UI_RegisterBaseInventoryNode(), UI_RegisterPanelNode(), UI_RegisterSpinnerNode(), and UI_RegisterTextNode().

◆ Com_RegisterConstList()

void Com_RegisterConstList ( const constListEntry_t constList[])

Registers a list of string aliases.

Parameters
[in]constListArray of string => int mappings. Must be terminated with a nullptr string ({nullptr, -1}) line
See also
constListEntry_t

Definition at line 253 of file scripts.cpp.

References Com_RegisterConstInt(), i, constListEntry_t::name, and name.

Referenced by GAME_GetImportData(), GAME_LoadCharacter(), GAME_SaveCharacter(), TEST_F(), and cgame_import_t::void().

◆ Com_SetValue()

int Com_SetValue ( void * base,
const void * set,
valueTypes_t type,
int ofs,
size_t size )
Parameters
[in]baseThe start pointer to a given data type (typedef, struct)
[in]setThe data which should be parsed
[in]typeThe data type that should be parsed
[in]ofsThe offset for the value
[in]sizeThe expected size of the data type. If 0, no checks are done
See also
Com_ValueToStr
Note
The offset is most likely given by the offsetof macro

Definition at line 1009 of file scripts.cpp.

References AIRCRAFT_NONE, Com_AlignPtr(), Com_GetCrashedUfoIdNum(), Com_GetHumanCraftIdNum(), Com_GetUfoIdNum(), Com_Printf(), 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(), and UI_NodeSetPropertyFromRAW().

◆ Com_Shutdown()

void Com_Shutdown ( void )

◆ Com_UFOCrashedTypeToShortName()

const char * Com_UFOCrashedTypeToShortName ( ufoType_t type)

Translate UFO type to short name when UFO is crashed.

See also
Com_UFOTypeToShortName

Definition at line 3351 of file scripts.cpp.

References Com_ValueToStr(), type, and V_UFOCRASHED.

Referenced by GAME_GetImportData().

◆ Com_UFOShortNameToID()

ufoType_t Com_UFOShortNameToID ( const char * token)

Translate short name to UFO type.

See also
UFO_TypeToName
Com_UFOTypeToShortName

Definition at line 3329 of file scripts.cpp.

References Com_ParseValue(), and V_UFO.

Referenced by GAME_GetImportData(), and cgame_import_t::ufoType_t().

◆ Com_UFOTypeToShortName()

const char * Com_UFOTypeToShortName ( ufoType_t type)

Translate UFO type to short name.

See also
UFO_TypeToName
Com_UFOShortNameToID

Definition at line 3342 of file scripts.cpp.

References Com_ValueToStr(), type, and V_UFO.

Referenced by GAME_GetImportData().

◆ Com_UnregisterConstList()

bool Com_UnregisterConstList ( const constListEntry_t constList[])

Unregisters a list of string aliases.

Parameters
[in]constListArray of string => int mappings. Must be terminated with a nullptr string ({nullptr, -1}) line
See also
constListEntry_t

Definition at line 237 of file scripts.cpp.

References Com_UnregisterConstVariable(), i, constListEntry_t::name, and name.

Referenced by cgame_import_t::bool(), GAME_GetImportData(), GAME_LoadCharacter(), GAME_SaveCharacter(), and TEST_F().

◆ Com_UnregisterConstVariable()

bool Com_UnregisterConstVariable ( const char * name)

Removes a registered constant from the script mapping hash table.

Parameters
nameThe 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.
See also
Com_RegisterConstInt
Com_GetConstVariable

Definition at line 147 of file scripts.cpp.

References Com_ConstIntGetVariable(), com_constNameInt, com_constNameInt_hash, Com_HashKey(), CONSTNAMEINT_HASH_SIZE, com_constNameInt_t::fullname, hash, com_constNameInt_t::hash_next, Mem_Free, name, com_constNameInt_t::next, and Q_streq.

Referenced by cgame_import_t::bool(), Com_UnregisterConstList(), GAME_GetImportData(), SV_InitGameProgs(), and TEST_F().

◆ Com_ValueToStr()

Variable Documentation

◆ air_slot_type_strings

const char* const air_slot_type_strings[] = AIR_SLOT_TYPE_STRINGS

List of valid strings for slot types.

Note
slot names are the same as the item types (and must be in the same order)

Definition at line 1791 of file scripts.cpp.

◆ aircraftIdsNum

◆ aircraftIdsTable

const char** const aircraftIdsTable[CRAFT_MAX]
static
Initial value:
= {
}
static const char * dropIdsTable[DROPSHIP_MAX]
Definition scripts.cpp:470
static const char * interIdsTable[INTERCEPTOR_MAX]
Definition scripts.cpp:471
static const char * ufoIdsTable[UFO_MAX]
Ufoai uses two types of ids for aircraft: the string is used for references in the scripts,...
Definition scripts.cpp:469

Definition at line 472 of file scripts.cpp.

Referenced by Com_GetAircraftDef(), Com_GetAircraftIdNum(), Com_GetCrashedAircraftIdNum(), and Com_ParseAircraftNames().

◆ align_names

const char* const align_names[]
Initial value:
= {
"ul", "uc", "ur", "cl", "cc", "cr", "ll", "lc", "lr", "ul_rsl", "uc_rsl", "ur_rsl", "cl_rsl", "cc_rsl", "cr_rsl", "ll_rsl", "lc_rsl", "lr_rsl"
}

Definition at line 340 of file scripts.cpp.

Referenced by CASSERT(), Com_ParseValue(), and Com_ValueToStr().

◆ blend_names

const char* const blend_names[]
Initial value:
= {
"replace", "one", "blend", "add", "filter", "invfilter"
}

Definition at line 345 of file scripts.cpp.

Referenced by CASSERT(), Com_ParseValue(), and Com_ValueToStr().

◆ bodyPartValues

const value_t bodyPartValues[]
static
Initial value:
= {
{"name", V_TRANSLATION_STRING, offsetof(BodyPartData, name), 0},
{"hit_area", V_COLOR, offsetof(BodyPartData, shape), MEMBER_SIZEOF(BodyPartData, shape)},
{"bleeding_rate", V_INT, offsetof(BodyPartData, bleedingFactor), MEMBER_SIZEOF(BodyPartData, bleedingFactor)},
{"wound_threshold", V_INT, offsetof(BodyPartData, woundThreshold), MEMBER_SIZEOF(BodyPartData, woundThreshold)},
{nullptr, V_NULL, 0, 0}
}
QGL_EXTERN GLuint GLsizei GLsizei GLint GLenum GLchar * name
Definition r_gl.h:110
@ V_TRANSLATION_STRING
Definition scripts.h:59
@ V_NULL
Definition scripts.h:49
@ V_INT
Definition scripts.h:52
@ V_COLOR
Definition scripts.h:57
#define MEMBER_SIZEOF(TYPE, MEMBER)
Definition scripts.h:34

Definition at line 2920 of file scripts.cpp.

Referenced by Com_ParseBodyPart().

◆ com_constNameInt

com_constNameInt_t* com_constNameInt
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().

◆ com_constNameInt_hash

com_constNameInt_t* com_constNameInt_hash[CONSTNAMEINT_HASH_SIZE]
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().

◆ craftTypeIds

const char* const craftTypeIds[CRAFT_MAX *2]
static
Initial value:
= {
"drop",
"inter",
"ufo",
"crash_drop",
"crash_inter",
"crash"
}

Definition at line 455 of file scripts.cpp.

Referenced by Com_GetAircraftIdNum(), Com_GetAircraftIdStr(), Com_GetCrashedAircraftIdNum(), Com_GetCrashedAircraftIdStr(), and Com_ParseAircraftNames().

◆ dropIdsTable

const char* dropIdsTable[DROPSHIP_MAX]
static

Definition at line 470 of file scripts.cpp.

Referenced by Com_ParseScripts().

◆ effect_vals

const value_t effect_vals[]
static
Initial value:
= {
{"period", V_INT, offsetof(itemEffect_t, period), MEMBER_SIZEOF(itemEffect_t, period)},
{"duration", V_INT, offsetof(itemEffect_t, duration), MEMBER_SIZEOF(itemEffect_t, duration)},
{"permanent", V_BOOL, offsetof(itemEffect_t, isPermanent), MEMBER_SIZEOF(itemEffect_t, isPermanent)},
{"accuracy", V_FLOAT, offsetof(itemEffect_t, accuracy), MEMBER_SIZEOF(itemEffect_t, accuracy)},
{"tu", V_FLOAT, offsetof(itemEffect_t, TUs), MEMBER_SIZEOF(itemEffect_t, TUs)},
{"power", V_FLOAT, offsetof(itemEffect_t, power), MEMBER_SIZEOF(itemEffect_t, power)},
{"mind", V_FLOAT, offsetof(itemEffect_t, mind), MEMBER_SIZEOF(itemEffect_t, mind)},
{"morale", V_FLOAT, offsetof(itemEffect_t, morale), MEMBER_SIZEOF(itemEffect_t, morale)},
{nullptr, V_NULL, 0, 0}
}
@ V_BOOL
Definition scripts.h:50
@ V_FLOAT
Definition scripts.h:54

Definition at line 1505 of file scripts.cpp.

Referenced by Com_ParseItemEffect().

◆ equipment_definition_vals

const value_t equipment_definition_vals[]
static
Initial value:
= {
{"mininterest", V_INT, offsetof(equipDef_t, minInterest), MEMBER_SIZEOF(equipDef_t, minInterest)},
{"maxinterest", V_INT, offsetof(equipDef_t, maxInterest), MEMBER_SIZEOF(equipDef_t, maxInterest)},
{"name", V_TRANSLATION_STRING, offsetof(equipDef_t, name), 0},
{nullptr, V_NULL, 0, 0}
}

Valid equipment definition values from script files.

Definition at line 2172 of file scripts.cpp.

Referenced by Com_ParseEquipment().

◆ fade_names

const char* const fade_names[]
Initial value:
= {
"none", "in", "out", "sin", "saw"
}

Definition at line 355 of file scripts.cpp.

Referenced by CASSERT(), Com_ParseValue(), and Com_ValueToStr().

◆ fdps

const value_t fdps[]
static

Definition at line 1521 of file scripts.cpp.

Referenced by Com_ParseFire().

◆ gameTypeValues

const value_t gameTypeValues[]
static
Initial value:
= {
{"name", V_TRANSLATION_STRING, offsetof(gametype_t, name), 0},
{nullptr, V_NULL, 0, 0}
}

possible gametype values for the gameserver (ufo-scriptfiles)

Definition at line 3114 of file scripts.cpp.

Referenced by Com_ParseGameTypes().

◆ idps

const value_t idps[]
static
Initial value:
= {
{"shape", V_SHAPE_BIG, offsetof(invDef_t, shape), 0},
{"single", V_BOOL, offsetof(invDef_t, single), MEMBER_SIZEOF(invDef_t, single)},
{"scroll", V_BOOL, offsetof(invDef_t, scroll), MEMBER_SIZEOF(invDef_t, scroll)},
{"implant", V_BOOL, offsetof(invDef_t, implant), MEMBER_SIZEOF(invDef_t, implant)},
{"armour", V_BOOL, offsetof(invDef_t, armour), MEMBER_SIZEOF(invDef_t, armour)},
{"headgear", V_BOOL, offsetof(invDef_t, headgear), MEMBER_SIZEOF(invDef_t, headgear)},
{"all", V_BOOL, offsetof(invDef_t, all), MEMBER_SIZEOF(invDef_t, all)},
{"unique", V_BOOL, offsetof(invDef_t, unique), MEMBER_SIZEOF(invDef_t, unique)},
{"temp", V_BOOL, offsetof(invDef_t, temp), MEMBER_SIZEOF(invDef_t, temp)},
{"in", V_INT, offsetof(invDef_t, in), MEMBER_SIZEOF(invDef_t, in)},
{"out", V_INT, offsetof(invDef_t, out), MEMBER_SIZEOF(invDef_t, out)},
{nullptr, V_NULL, 0, 0}
}
@ V_SHAPE_BIG
Definition scripts.h:66
inventory definition for our menus
Definition inv_shared.h:371

Definition at line 2082 of file scripts.cpp.

Referenced by Com_ParseInventory().

◆ implant_vals

const value_t implant_vals[]
static
Initial value:
= {
{"installationtime", V_INT, offsetof(implantDef_t, installationTime), 0},
{"removetime", V_INT, offsetof(implantDef_t, removeTime), 0},
{nullptr, V_NULL, 0, 0}
}

Definition at line 2011 of file scripts.cpp.

Referenced by Com_ParseImplant().

◆ interIdsTable

const char* interIdsTable[INTERCEPTOR_MAX]
static

Definition at line 471 of file scripts.cpp.

Referenced by Com_ParseScripts().

◆ mapdef_vals

const value_t mapdef_vals[]
static
Initial value:
= {
{"description", V_TRANSLATION_STRING, offsetof(mapDef_t, description), 0},
{"victorycondition", V_TRANSLATION_STRING, offsetof(mapDef_t, victoryCondition), 0},
{"victorybonusperalien", V_FLOAT, offsetof(mapDef_t, victoryBonusPerAlien), MEMBER_SIZEOF(mapDef_t, victoryBonusPerAlien)},
{"missionbriefing", V_TRANSLATION_STRING, offsetof(mapDef_t, missionBriefing), 0},
{"map", V_HUNK_STRING, offsetof(mapDef_t, mapTheme), 0},
{"size", V_HUNK_STRING, offsetof(mapDef_t, size), 0},
{"civilianteam", V_HUNK_STRING, offsetof(mapDef_t, civTeam), 0},
{"maxaliens", V_INT, offsetof(mapDef_t, maxAliens), MEMBER_SIZEOF(mapDef_t, maxAliens)},
{"hwclass", V_INT, offsetof(mapDef_t, hwclass), MEMBER_SIZEOF(mapDef_t, hwclass)},
{"storyrelated", V_BOOL, offsetof(mapDef_t, storyRelated), MEMBER_SIZEOF(mapDef_t, storyRelated)},
{"teams", V_INT, offsetof(mapDef_t, teams), MEMBER_SIZEOF(mapDef_t, teams)},
{"multiplayer", V_BOOL, offsetof(mapDef_t, multiplayer), MEMBER_SIZEOF(mapDef_t, multiplayer)},
{"singleplayer", V_BOOL, offsetof(mapDef_t, singleplayer), MEMBER_SIZEOF(mapDef_t, singleplayer)},
{"campaign", V_BOOL, offsetof(mapDef_t, campaign), MEMBER_SIZEOF(mapDef_t, campaign)},
{"onwin", V_HUNK_STRING, offsetof(mapDef_t, onwin), 0},
{"onlose", V_HUNK_STRING, offsetof(mapDef_t, onlose), 0},
{"ufos", V_LIST, offsetof(mapDef_t, ufos), 0},
{"aircraft", V_LIST, offsetof(mapDef_t, aircraft), 0},
{"terrains", V_LIST, offsetof(mapDef_t, terrains), 0},
{"populations", V_LIST, offsetof(mapDef_t, populations), 0},
{"cultures", V_LIST, offsetof(mapDef_t, cultures), 0},
{"gametypes", V_LIST, offsetof(mapDef_t, gameTypes), 0},
{nullptr, V_NULL, 0, 0}
}
cvar_t * hwclass
Definition common.cpp:62
voidpf void uLong size
Definition ioapi.h:42
@ V_HUNK_STRING
Definition scripts.h:69
@ V_LIST
Definition scripts.h:78

valid mapdef descriptors

Definition at line 3442 of file scripts.cpp.

Referenced by Com_ParseMapDefinition().

◆ name_strings

const char* const name_strings[NAME_NUM_TYPES]
Initial value:
= {
"neutral",
"female",
"male",
"lastname",
"female_lastname",
"male_lastname"
}

Definition at line 2162 of file scripts.cpp.

Referenced by Com_FindNameType(), and Com_ParseActorSounds().

◆ od_vals

const value_t od_vals[]
static

Definition at line 1448 of file scripts.cpp.

Referenced by Com_ParseItem().

◆ parseErrorMessage

char parseErrorMessage[256]
static

Definition at line 422 of file scripts.cpp.

Referenced by Com_EParseValue(), Com_GetLastParseError(), and Com_ParseValue().

◆ parseItemWeapons

linkedList_t* parseItemWeapons = nullptr
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().

◆ penaltyNames

const char* const penaltyNames[MODIFIER_MAX]
static
Initial value:
= {
"accuracy", "shooting_tu", "movement_tu", "detection", "reaction_time", "max_tu"
}

Definition at line 2929 of file scripts.cpp.

Referenced by Com_ParseBodyPart().

◆ skillNames

const char* const skillNames[SKILL_NUM_TYPES+1]
static
Initial value:
= {
"strength",
"speed",
"accuracy",
"mind",
"close",
"heavy",
"assault",
"sniper",
"explosive",
"piloting",
"targeting",
"evading",
"health"
}

Definition at line 1425 of file scripts.cpp.

Referenced by Com_ParseCharacterTemplate(), and Com_ParseFire().

◆ style_names

const char* const style_names[]
Initial value:
= {
"facing", "rotated", "beam", "line", "axis", "circle"
}

Definition at line 350 of file scripts.cpp.

Referenced by CASSERT(), Com_ParseValue(), and Com_ValueToStr().

◆ teamDefValues

const value_t teamDefValues[]
static
Initial value:
= {
{"tech", V_STRING, offsetof(teamDef_t, tech), 0},
{"footstepsound", V_STRING, offsetof(teamDef_t, footstepSound), 0},
{"name", V_TRANSLATION_STRING, offsetof(teamDef_t, name), 0},
{"armour", V_BOOL, offsetof(teamDef_t, armour), MEMBER_SIZEOF(teamDef_t, armour)},
{"weapons", V_BOOL, offsetof(teamDef_t, weapons), MEMBER_SIZEOF(teamDef_t, weapons)},
{"size", V_INT, offsetof(teamDef_t, size), MEMBER_SIZEOF(teamDef_t, size)},
{"hit_particle", V_STRING, offsetof(teamDef_t, hitParticle), 0},
{"death_texture", V_STRING, offsetof(teamDef_t, deathTextureName), 0},
{"team", V_TEAM, offsetof(teamDef_t, team), MEMBER_SIZEOF(teamDef_t, team)},
{"robot", V_BOOL, offsetof(teamDef_t, robot), MEMBER_SIZEOF(teamDef_t, robot)},
{nullptr, V_NULL, 0, 0}
}
@ V_STRING
Definition scripts.h:58
@ V_TEAM
Definition scripts.h:70

possible teamdesc values (ufo-scriptfiles)

Definition at line 2672 of file scripts.cpp.

Referenced by Com_ParseTeam().

◆ terrainTypesHash

terrainType_t* terrainTypesHash[TERRAIN_HASH_SIZE]
static

Definition at line 3051 of file scripts.cpp.

Referenced by Com_GetTerrainType(), Com_ParseTerrain(), and Com_Shutdown().

◆ terrainTypeValues

const value_t terrainTypeValues[]
static
Initial value:
= {
{"footstepsound", V_HUNK_STRING, offsetof(terrainType_t, footstepSound), 0},
{"particle", V_HUNK_STRING, offsetof(terrainType_t, particle), 0},
{"footstepvolume", V_FLOAT, offsetof(terrainType_t, footstepVolume), 0},
{"bouncefraction", V_FLOAT, offsetof(terrainType_t, bounceFraction), 0},
{nullptr, V_NULL, 0, 0}
}
Different terrain definitions for footsteps and particles.
Definition scripts.h:215

Definition at line 3053 of file scripts.cpp.

Referenced by Com_ParseTerrain().

◆ ufoIdsTable

const char* ufoIdsTable[UFO_MAX]
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().

◆ ugvValues

const value_t ugvValues[]
static
Initial value:
= {
{"tu", V_INT, offsetof(ugv_t, tu), MEMBER_SIZEOF(ugv_t, tu)},
{"weapon", V_STRING, offsetof(ugv_t, weapon), 0},
{"armour", V_STRING, offsetof(ugv_t, armour), 0},
{"actors", V_STRING, offsetof(ugv_t, actors), 0},
{"price", V_INT, offsetof(ugv_t, price), 0},
{nullptr, V_NULL, 0, 0}
}
Defines a type of UGV/Robot.
Definition chr_shared.h:245

Definition at line 2823 of file scripts.cpp.

Referenced by Com_ParseUGVs().

◆ versionParsed

bool versionParsed
static

Definition at line 292 of file scripts.cpp.

Referenced by Com_ParseScripts(), Com_ParseVersion(), and Com_Shutdown().

◆ vt_aligns

const size_t vt_aligns[]
static
Initial value:
= {
0,
sizeof(bool),
sizeof(char),
sizeof(int),
sizeof(int),
sizeof(float),
sizeof(vec_t),
sizeof(vec_t),
sizeof(vec_t),
sizeof(char),
sizeof(char),
sizeof(char),
sizeof(align_t),
sizeof(blend_t),
sizeof(style_t),
sizeof(fade_t),
sizeof(int),
sizeof(uint32_t),
sizeof(byte),
sizeof(float),
sizeof(char),
sizeof(int),
sizeof(ufoType_t),
sizeof(ufoType_t),
sizeof(void*)
}
short humanAircraftType_t
Definition inv_shared.h:31
typedef int(ZCALLBACK *close_file_func) OF((voidpf opaque
style_t
Definition scripts.h:124
align_t
We need this here for checking the boundaries from script values.
Definition scripts.h:89
blend_t
Definition scripts.h:113
fade_t
Definition scripts.h:135
short ufoType_t
Definition scripts.h:145
float vec_t
Definition ufotypes.h:37

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

◆ vt_names

const char* const vt_names[]
Initial value:
= {
"",
"bool",
"char",
"int",
"int2",
"float",
"pos",
"vector",
"color",
"string",
"translation_string",
"longstring",
"align",
"blend",
"style",
"fade",
"shapes",
"shapeb",
"damage",
"relabs",
"hunk_string",
"team",
"ufo",
"ufocrashed",
"aircrafttype",
"list"
}

possible values for parsing functions

See also
valueTypes_t

Definition at line 310 of file scripts.cpp.

Referenced by CASSERT(), CL_ParsePtlCmds(), and CL_ParticleFunction().

◆ vt_sizes

const size_t vt_sizes[]
static
Initial value:
= {
0,
sizeof(bool),
sizeof(char),
sizeof(int),
2 * sizeof(int),
sizeof(float),
sizeof(vec2_t),
sizeof(vec3_t),
sizeof(vec4_t),
0,
0,
0,
sizeof(align_t),
sizeof(blend_t),
sizeof(style_t),
sizeof(fade_t),
sizeof(int),
0,
sizeof(byte),
sizeof(float),
0,
sizeof(int),
sizeof(ufoType_t),
sizeof(ufoType_t),
0
}
vec_t vec3_t[3]
Definition ufotypes.h:39
vec_t vec4_t[4]
Definition ufotypes.h:40
vec_t vec2_t[2]
Definition ufotypes.h:38

target sizes for buffer

Definition at line 361 of file scripts.cpp.

Referenced by CASSERT(), Com_ParseValue(), and Com_SetValue().