UFO: Alien Invasion
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
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"

Go to the source code of this file.

Data Structures

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

Typedefs

typedef struct com_constNameInt_s com_constNameInt_t
 Structure to map (script) strings and integer (enum) values. More...
 

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. More...
 
bool Com_GetConstInt (const char *name, int *value)
 Searches whether a given value was registered as a string to int mapping. More...
 
bool Com_GetConstIntFromNamespace (const char *space, const char *variable, int *value)
 Searches whether a given value was registered as a string to int mapping. More...
 
const char * Com_GetConstVariable (const char *space, int value)
 Searches the mapping variable for a given integer value and a namespace. More...
 
bool Com_UnregisterConstVariable (const char *name)
 Removes a registered constant from the script mapping hash table. More...
 
void Com_RegisterConstInt (const char *name, int value)
 Register mappings between script strings and enum values for values of the type V_INT. More...
 
bool Com_UnregisterConstList (const constListEntry_t constList[])
 Unregisters a list of string aliases. More...
 
void Com_RegisterConstList (const constListEntry_t constList[])
 Registers a list of string aliases. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
static void Com_ParseFireEffect (fireDef_t *fd, const char *name, const char **text)
 Parses the effect that is bound to a fire definitions. More...
 
static bool Com_ParseFire (const char *name, const char **text, fireDef_t *fd)
 Parses the firemode. More...
 
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. More...
 
 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. More...
 
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. More...
 
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. More...
 
void Com_GetCharacterValues (const char *teamDefition, character_t *chr)
 Assign character values, 3D models and names to a character. More...
 
static void Com_ParseActorNames (const char *name, const char **text)
 Parses "name" definition from team_* ufo script files. More...
 
static void Com_ParseActorModels (const char *name, const char **text, teamDef_t *td)
 Parses "actors" definition from team_* ufo script files. More...
 
static void Com_ParseActorSounds (const char *name, const char **text, teamDef_t *td)
 Parses "actorsounds" definition from team_* ufo script files. More...
 
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. More...
 
static void Com_ParseUGVs (const char *name, const char **text)
 Parse 2x2 units (e.g. UGVs) More...
 
static void Com_ParseCharacterTemplate (const char *name, const char **text)
 Parses character templates from scripts. More...
 
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. More...
 
static void Com_ParseTerrain (const char *name, const char **text)
 Parses "terrain" definition from script files. More...
 
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. More...
 
const char * Com_GetRandomMapAssemblyNameForCrashedCraft (const char *craftID)
 
humanAircraftType_t Com_DropShipShortNameToID (const char *token)
 Translate DropShip type to short name. More...
 
const char * Com_DropShipTypeToShortName (humanAircraftType_t type)
 Translate DropShip type to short name. More...
 
ufoType_t Com_UFOShortNameToID (const char *token)
 Translate short name to UFO type. More...
 
const char * Com_UFOTypeToShortName (ufoType_t type)
 Translate UFO type to short name. More...
 
const char * Com_UFOCrashedTypeToShortName (ufoType_t type)
 Translate UFO type to short name when UFO is crashed. More...
 
const ugv_tCom_GetUGVByIDSilent (const char *ugvID)
 Searches an UGV definition by a given script id and returns the pointer to the global data. More...
 
const ugv_tCom_GetUGVByID (const char *ugvID)
 Searches an UGV definition by a given script id and returns the pointer to the global data. More...
 
static void Com_AddObjectLinks (void)
 Creates links to other items (i.e. ammo<->weapons) More...
 
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. More...
 
static com_constNameInt_tcom_constNameInt_hash [CONSTNAMEINT_HASH_SIZE]
 Hash of all the registeres mappings. More...
 
static bool versionParsed
 
const char *const vt_names []
 possible values for parsing functions More...
 
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 More...
 
static const size_t vt_aligns []
 natural align for each targets More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
static const value_t teamDefValues []
 possible teamdesc values (ufo-scriptfiles) More...
 
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) More...
 
static const value_t mapdef_vals []
 valid mapdef descriptors More...
 

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

#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 3072 of file scripts.cpp.

Referenced by Com_GetTerrainType(), and Com_ParseTerrain().

Typedef Documentation

Structure to map (script) strings and integer (enum) values.

Enumeration Type Documentation

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 1464 of file scripts.cpp.

Enumerator
CRAFT_DROP 
CRAFT_INTER 
CRAFT_UFO 
CRAFT_MAX 

Definition at line 451 of file scripts.cpp.

Function Documentation

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)
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 440 of file scripts.cpp.

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

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

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

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 3329 of file scripts.cpp.

References Com_ParseValue(), and V_AIRCRAFTTYPE.

Referenced by Com_ParseEquipment(), and GAME_GetImportData().

const char* Com_DropShipTypeToShortName ( humanAircraftType_t  type)

Translate DropShip type to short name.

See also
Com_DropShipShortNameToID

Definition at line 3341 of file scripts.cpp.

References Com_ValueToStr(), and V_AIRCRAFTTYPE.

Referenced by GAME_GetImportData().

int Com_EParseValue ( void base,
const char *  token,
valueTypes_t  type,
int  ofs,
size_t  size 
)
static 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().

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

Definition at line 482 of file scripts.cpp.

References type.

Referenced by Com_GetAircraftIdStr(), and Com_GetCrashedAircraftIdStr().

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

Definition at line 502 of file scripts.cpp.

References Com_GetAircraftDef(), and Com_sprintf().

Referenced by Com_GetHumanCraftIdStr(), and Com_GetUfoIdStr().

static const BodyData* Com_GetBodyTemplateByID ( const char *  id)
static

Definition at line 2675 of file scripts.cpp.

References csi_s::bodyTemplates, Com_Printf(), csi, LIST_Foreach, and Q_streq.

Referenced by Com_ParseTeam().

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 2831 of file scripts.cpp.

References csi_s::chrTemplates, Com_Printf(), csi, i, chrTemplate_s::id, csi_s::numChrTemplates, Q_streq, and Q_strnull().

Referenced by Com_ParseTeam().

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 2430 of file scripts.cpp.

References ACTOR_SIZE_INVALID, ACTOR_SIZE_NORMAL, Com_Error(), Com_GetCharacterModel(), Com_GetGender(), Com_GetTeamDefinitionByID(), Com_GiveName(), ERR_DROP, character_s::fieldSize, character_s::gender, character_s::name, NAME_LAST, Q_strcat(), Q_strncpyz(), teamDef_s::size, and character_s::teamDef.

Referenced by CL_GenerateCharacter(), and SV_InitGameProgs().

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_HashKey(), CONSTNAMEINT_HASH_SIZE, hash, com_constNameInt_s::hash_next, and Q_streq.

Referenced by 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.

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

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_s::fullname, com_constNameInt_s::name, com_constNameInt_s::next, and com_constNameInt_s::value.

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

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

Definition at line 511 of file scripts.cpp.

References AIRCRAFT_NONE, CRAFT_MAX, i, Q_streq, Q_strnull(), Q_strstart(), type, and va().

Referenced by Com_GetCrashedUfoIdNum().

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

Definition at line 523 of file scripts.cpp.

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

Referenced by Com_GetCrashedUfoIdStr().

static ufoType_t Com_GetCrashedUfoIdNum ( const char *  idString)
static

Definition at line 537 of file scripts.cpp.

References Com_GetCrashedAircraftIdNum(), and CRAFT_UFO.

Referenced by Com_ParseValue(), and Com_SetValue().

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

Definition at line 547 of file scripts.cpp.

References Com_GetCrashedAircraftIdStr(), and CRAFT_UFO.

Referenced by Com_ValueToStr().

short Com_GetDropShipIdsNum ( void  )

Definition at line 579 of file scripts.cpp.

References CRAFT_DROP.

Referenced by GAME_GetImportData().

static 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 2404 of file scripts.cpp.

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

Referenced by Com_GetCharacterValues().

short Com_GetHumanAircraftIdsNum ( void  )

Definition at line 584 of file scripts.cpp.

References CRAFT_DROP, and CRAFT_INTER.

Referenced by GAME_GetImportData().

static short Com_GetHumanCraftIdNum ( const char *  idString)
static

Definition at line 552 of file scripts.cpp.

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

Referenced by Com_ParseValue(), and Com_SetValue().

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

Definition at line 565 of file scripts.cpp.

References Com_GetAircraftIdStr(), CRAFT_DROP, and CRAFT_INTER.

Referenced by Com_ValueToStr().

const char* Com_GetLastParseError ( void  )

Returns the last error message

Returns
string that contains the last error message

Definition at line 431 of file scripts.cpp.

References parseErrorMessage.

Referenced by UI_NodeSetProperty(), and UI_ParseProperty().

mapDef_t* Com_GetMapDefByIDX ( int  index)

Definition at line 3615 of file scripts.cpp.

References cgi, csi, cgame_import_s::csi, index, and csi_s::mds.

Referenced by Com_ParseMapDefinition().

mapDef_t* Com_GetMapDefinitionByID ( const char *  mapDefID)

Definition at line 3620 of file scripts.cpp.

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

Referenced by GAME_GetImportData(), and TEST_F().

int Com_GetMapDefNumber ( void  )

Definition at line 3610 of file scripts.cpp.

References cgi, csi, cgame_import_s::csi, and csi_s::numMDs.

static const teamNames_t* Com_GetNameListByID ( const char *  id)
static

Definition at line 2684 of file scripts.cpp.

References csi_s::actorNames, Com_Printf(), csi, LIST_Foreach, and Q_streq.

Referenced by 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.

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 3299 of file scripts.cpp.

References va().

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

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

Definition at line 3307 of file scripts.cpp.

References Q_streq.

Referenced by GAME_GetImportData().

int Com_GetScriptChecksum ( void  )

Definition at line 3739 of file scripts.cpp.

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

Referenced by CL_CanMultiplayerStart(), 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.

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

Definition at line 2367 of file scripts.cpp.

References Com_Printf(), csi, i, teamDef_s::id, csi_s::numTeamDefs, Q_streq, and csi_s::teamDef.

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

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 3089 of file scripts.cpp.

References Com_HashKey(), hash, terrainType_s::hash_next, Q_streq, and TERRAIN_HASH_SIZE.

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

static ufoType_t Com_GetUfoIdNum ( const char *  idString)
static

Definition at line 532 of file scripts.cpp.

References Com_GetAircraftIdNum(), and CRAFT_UFO.

Referenced by Com_ParseValue(), and Com_SetValue().

short Com_GetUfoIdsNum ( void  )

Definition at line 574 of file scripts.cpp.

References CRAFT_UFO.

Referenced by GAME_GetImportData(), and TEST_F().

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

Definition at line 542 of file scripts.cpp.

References Com_GetAircraftIdStr(), and CRAFT_UFO.

Referenced by 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.

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 3403 of file scripts.cpp.

References Com_GetUGVByIDSilent(), Com_Printf(), csi, and csi_s::numUGV.

Referenced by 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.

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 3384 of file scripts.cpp.

References csi, i, ugv_s::id, csi_s::numUGV, Q_streq, and csi_s::ugvs.

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

static 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 2340 of file scripts.cpp.

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

Referenced by Com_GetCharacterModel().

static 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 2305 of file scripts.cpp.

References Com_DPrintf(), linkedList_t::data, DEBUG_ENGINE, teamDef_s::id, name, NAME_NUM_TYPES, teamDef_s::names, linkedList_t::next, teamDef_s::numNames, and Sys_Error().

Referenced by Com_GetCharacterValues().

static void Com_ParseActorModels ( const char *  name,
const char **  text,
teamDef_t td 
)
static
static void Com_ParseActorNames ( const char *  name,
const char **  text 
)
static
static 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 2614 of file scripts.cpp.

References Com_EParse(), Com_Parse(), Com_Printf(), i, LIST_AddString(), NAME_LAST, NAME_NUM_TYPES, teamDef_s::numSounds, Q_streq, SND_DEATH, SND_HURT, and teamDef_s::sounds.

Referenced by Com_ParseTeam().

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

Parse the aircraft names from the scripts.

Definition at line 592 of file scripts.cpp.

References AIRCRAFT_NONE, Com_EParse(), Com_GetAircraftIdNum(), Com_Parse(), Com_Printf(), CRAFT_DROP, CRAFT_INTER, CRAFT_MAX, CRAFT_UFO, DROPSHIP_MAX, i, INTERCEPTOR_MAX, Mem_StrDup, Q_streq, UFO_MAX, and va().

Referenced by Com_ParseScripts().

static 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 1769 of file scripts.cpp.

References Com_EParse(), Com_Parse(), Com_Printf(), csi, csi_s::dts, i, damageType_s::id, csi_s::numDTs, Q_streq, damageType_s::showInMenu, and Sys_Error().

Referenced by Com_ParseItem(), and Com_ParseTeam().

bool Com_ParseBlock ( const char *  name,
const char **  text,
void base,
const value_t values,
memPool_t mempool 
)
static void Com_ParseBodyTemplate ( const char *  name,
const char **  text 
)
static
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 1000 of file scripts.cpp.

References Com_ParseValue(), RESULT_ERROR, and V_BOOL.

Referenced by GAME_GetImportData(), and HUD_RemainingTUs_f().

static void Com_ParseCharacterTemplate ( const char *  name,
const char **  text 
)
static
static 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 1690 of file scripts.cpp.

References ABILITY_NUM_TYPES, Com_EParse(), com_genericPool, Com_Parse(), Com_ParseBlockToken(), Com_ParseFireEffect(), Com_Printf(), fireDef_s::delayBetweenShots, fireDef_s::fireAttenuation, fireDef_s::impactAttenuation, fireDef_s::name, Q_streq, fireDef_s::range, fireDef_s::shots, SKILL_NUM_TYPES, SOUND_ATTN_MAX, SOUND_ATTN_NONE, fireDef_s::splrad, UNIT_SIZE, and fireDef_s::weaponSkill.

Referenced by Com_ParseFireDefinition().

static 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 1642 of file scripts.cpp.

References fireDef_s::activeEffect, Com_ParseItemEffect(), Com_Printf(), fireDef_s::deactiveEffect, EFFECT_ACTIVE, EFFECT_INACTIVE, EFFECT_MAX, EFFECT_OVERDOSE, EFFECT_STRENGTHEN, Mem_AllocType, Mem_Free, and fireDef_s::overdoseEffect.

Referenced by Com_ParseFire().

static void Com_ParseInventory ( const char *  name,
const char **  text 
)
static
static 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 1585 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, and Q_streq.

Referenced by Com_ParseFireEffect(), 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.

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

Definition at line 1385 of file scripts.cpp.

References Com_GetToken(), Com_NextToken(), Com_Printf(), LIST_AddString(), LIST_Delete(), TT_BEGIN_LIST, TT_CONTENT, TT_END_LIST, and TT_EOF.

Referenced by CL_ParseLanguages(), CL_ParseSequence(), Com_ParseActorModels(), Com_ParseActorNames(), Com_ParseBlockToken(), Com_ParseBodyPart(), Com_ParseEquipment(), Com_ParseMapDefinition(), Com_ParseTeam(), GAME_GetImportData(), M_ParseMusic(), and TEST_F().

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

Parses "terrain" definition from script files.

Note
Terrain definitions are used for footstep sounds and terrain particles
See also
Com_ParseScripts

Definition at line 3106 of file scripts.cpp.

References terrainType_s::bounceFraction, com_genericPool, Com_GetTerrainType(), Com_HashKey(), Com_ParseBlock(), Com_Printf(), terrainType_s::footstepVolume, hash, terrainType_s::hash_next, Mem_Free, Mem_PoolAllocType, Mem_PoolStrDup, SND_VOLUME_FOOTSTEPS, TERRAIN_HASH_SIZE, and terrainType_s::texture.

Referenced by Com_ParseScripts().

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

Parse 2x2 units (e.g. UGVs)

See also
CL_ParseClientData

Definition at line 2859 of file scripts.cpp.

References com_genericPool, Com_ParseBlock(), Com_Printf(), csi, i, ugv_s::id, ugv_s::idx, MAX_UGV, Mem_PoolStrDup, csi_s::numUGV, OBJZERO, Q_streq, and csi_s::ugvs.

Referenced by Com_ParseScripts().

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 659 of file scripts.cpp.

References AIRCRAFT_NONE, ALIGN_LAST, BLEND_LAST, Com_AlignPtr(), Com_GetConstInt(), Com_GetCrashedUfoIdNum(), Com_GetHumanCraftIdNum(), Com_GetUfoIdNum(), Com_Printf(), csi, DAYS_PER_YEAR, csi_s::dts, f, FADE_LAST, damageType_s::id, int(), MAX_VAR, csi_s::numDTs, Q_streq, Q_strncpyz(), RESULT_ERROR, RESULT_OK, RESULT_WARNING, SECONDS_PER_HOUR, SHAPE_BIG_MAX_HEIGHT, SHAPE_BIG_MAX_WIDTH, SHAPE_SMALL_MAX_HEIGHT, SHAPE_SMALL_MAX_WIDTH, STYLE_LAST, 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_DATE, 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, and V_VECTOR.

Referenced by Com_DropShipShortNameToID(), Com_EParseValue(), Com_ParseBoolean(), Com_UFOShortNameToID(), TEST_F(), UI_MaterialEditorChangeValue_f(), UI_NodeSetProperty(), UI_ParseProperty(), and UI_PushDropDownWindow_f().

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

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_HashKey(), Com_Printf(), CONSTNAMEINT_HASH_SIZE, com_constNameInt_s::fullname, hash, com_constNameInt_s::hash_next, Mem_PoolAllocType, Mem_StrDup, com_constNameInt_s::name, com_constNameInt_s::next, Q_streq, Q_strncpyz(), and com_constNameInt_s::value.

Referenced by 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.

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, name, constListEntry_s::name, and com_constNameInt_s::value.

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

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 1023 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, UFO_NONE, UFO_SIZE_T, V_AIRCRAFTTYPE, V_ALIGN, V_BLEND, V_BOOL, V_CHAR, V_COLOR, V_DAMAGE, V_DATE, 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, and V_VECTOR.

Referenced by CL_ParticleFunction(), and UI_NodeSetPropertyFromRAW().

void Com_Shutdown ( void  )

Definition at line 3754 of file scripts.cpp.

References OBJZERO, and versionParsed.

Referenced by Qcommon_Shutdown(), and TEST_Shutdown().

const char* Com_UFOCrashedTypeToShortName ( ufoType_t  type)

Translate UFO type to short name when UFO is crashed.

See also
Com_UFOTypeToShortName

Definition at line 3373 of file scripts.cpp.

References Com_ValueToStr(), and V_UFOCRASHED.

Referenced by GAME_GetImportData().

ufoType_t Com_UFOShortNameToID ( const char *  token)

Translate short name to UFO type.

See also
UFO_TypeToName
Com_UFOTypeToShortName

Definition at line 3351 of file scripts.cpp.

References Com_ParseValue(), and V_UFO.

Referenced by GAME_GetImportData().

const char* Com_UFOTypeToShortName ( ufoType_t  type)

Translate UFO type to short name.

See also
UFO_TypeToName
Com_UFOShortNameToID

Definition at line 3364 of file scripts.cpp.

References Com_ValueToStr(), and V_UFO.

Referenced by GAME_GetImportData().

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, name, and constListEntry_s::name.

Referenced by 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.

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_HashKey(), CONSTNAMEINT_HASH_SIZE, com_constNameInt_s::fullname, hash, com_constNameInt_s::hash_next, Mem_Free, com_constNameInt_s::next, and Q_streq.

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

const char* Com_ValueToStr ( const void base,
const valueTypes_t  type,
const int  ofs 
)

Variable Documentation

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 1813 of file scripts.cpp.

short aircraftIdsNum[CRAFT_MAX]
static

Definition at line 480 of file scripts.cpp.

const char** const aircraftIdsTable[CRAFT_MAX]
static
Initial value:
= {
}
static const char * dropIdsTable[DROPSHIP_MAX]
Definition: scripts.cpp:473
static const char * interIdsTable[INTERCEPTOR_MAX]
Definition: scripts.cpp:474
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:472

Definition at line 475 of file scripts.cpp.

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 341 of file scripts.cpp.

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

Definition at line 346 of file scripts.cpp.

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}
}
Definition: scripts.h:49
QGL_EXTERN GLuint GLsizei GLsizei GLint GLenum GLchar * name
Definition: r_gl.h:110
#define MEMBER_SIZEOF(TYPE, MEMBER)
Definition: scripts.h:34
Definition: scripts.h:52

Definition at line 2942 of file scripts.cpp.

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(), and Com_UnregisterConstVariable().

com_constNameInt_t* com_constNameInt_hash[CONSTNAMEINT_HASH_SIZE]
static

Hash of all the registeres mappings.

Definition at line 50 of file scripts.cpp.

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

Definition at line 458 of file scripts.cpp.

const char* dropIdsTable[DROPSHIP_MAX]
static

Definition at line 473 of file scripts.cpp.

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}
}
Definition: scripts.h:49
Definition: scripts.h:50
#define MEMBER_SIZEOF(TYPE, MEMBER)
Definition: scripts.h:34
Definition: scripts.h:52

Definition at line 1527 of file scripts.cpp.

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}
}
Definition: scripts.h:49
QGL_EXTERN GLuint GLsizei GLsizei GLint GLenum GLchar * name
Definition: r_gl.h:110
#define MEMBER_SIZEOF(TYPE, MEMBER)
Definition: scripts.h:34
Definition: scripts.h:52

Valid equipment definition values from script files.

Definition at line 2194 of file scripts.cpp.

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

Definition at line 356 of file scripts.cpp.

const value_t fdps[]
static

Definition at line 1543 of file scripts.cpp.

const value_t gameTypeValues[]
static
Initial value:
= {
{"name", V_TRANSLATION_STRING, offsetof(gametype_t, name), 0},
{nullptr, V_NULL, 0, 0}
}
Definition: scripts.h:49
QGL_EXTERN GLuint GLsizei GLsizei GLint GLenum GLchar * name
Definition: r_gl.h:110

possible gametype values for the gameserver (ufo-scriptfiles)

Definition at line 3136 of file scripts.cpp.

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}
}
Definition: scripts.h:49
Definition: scripts.h:50
#define MEMBER_SIZEOF(TYPE, MEMBER)
Definition: scripts.h:34
inventory definition for our menus
Definition: inv_shared.h:371
Definition: scripts.h:52

Definition at line 2104 of file scripts.cpp.

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: scripts.h:49
Definition: scripts.h:52

Definition at line 2033 of file scripts.cpp.

const char* interIdsTable[INTERCEPTOR_MAX]
static

Definition at line 474 of file scripts.cpp.

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}
}
GLsizei size
Definition: r_gl.h:152
Definition: scripts.h:79
cvar_t * hwclass
Definition: common.cpp:62
Definition: scripts.h:49
Definition: scripts.h:50
#define MEMBER_SIZEOF(TYPE, MEMBER)
Definition: scripts.h:34
Definition: scripts.h:52

valid mapdef descriptors

Definition at line 3464 of file scripts.cpp.

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

Definition at line 2184 of file scripts.cpp.

Referenced by Com_FindNameType().

const value_t od_vals[]
static

Definition at line 1470 of file scripts.cpp.

char parseErrorMessage[256]
static

Definition at line 425 of file scripts.cpp.

Referenced by Com_GetLastParseError().

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 1820 of file scripts.cpp.

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

Definition at line 2951 of file scripts.cpp.

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 1447 of file scripts.cpp.

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

Definition at line 351 of file scripts.cpp.

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}
}
Definition: scripts.h:71
GLsizei size
Definition: r_gl.h:152
Definition: scripts.h:49
Definition: scripts.h:50
QGL_EXTERN GLuint GLsizei GLsizei GLint GLenum GLchar * name
Definition: r_gl.h:110
#define MEMBER_SIZEOF(TYPE, MEMBER)
Definition: scripts.h:34
Definition: scripts.h:52

possible teamdesc values (ufo-scriptfiles)

Definition at line 2694 of file scripts.cpp.

terrainType_t* terrainTypesHash[TERRAIN_HASH_SIZE]
static

Definition at line 3073 of file scripts.cpp.

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}
}
Definition: scripts.h:49
Different terrain definitions for footsteps and particles.
Definition: scripts.h:216

Definition at line 3075 of file scripts.cpp.

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 472 of file scripts.cpp.

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:234
Definition: scripts.h:49
#define MEMBER_SIZEOF(TYPE, MEMBER)
Definition: scripts.h:34
Definition: scripts.h:52

Definition at line 2845 of file scripts.cpp.

bool versionParsed
static

Definition at line 292 of file scripts.cpp.

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

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(date_t),
sizeof(float),
sizeof(char),
sizeof(int),
sizeof(ufoType_t),
sizeof(ufoType_t),
sizeof(void*)
}
struct date_s date_t
Engine-side time information in the game.
short humanAircraftType_t
Definition: inv_shared.h:28
float vec_t
Definition: ufotypes.h:37
short ufoType_t
Definition: scripts.h:146
typedef int(ZCALLBACK *close_file_func) OF((voidpf opaque
align_t
We need this here for checking the boundaries from script values.
Definition: scripts.h:90
blend_t
Definition: scripts.h:114
fade_t
Definition: scripts.h:136
style_t
Definition: scripts.h:125
uint8_t byte
Definition: ufotypes.h:34

natural align for each targets

Definition at line 394 of file scripts.cpp.

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",
"date",
"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 CL_ParsePtlCmds(), and CL_ParticleFunction().

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),
0,
sizeof(float),
0,
sizeof(int),
sizeof(ufoType_t),
sizeof(ufoType_t),
0
}
short humanAircraftType_t
Definition: inv_shared.h:28
short ufoType_t
Definition: scripts.h:146
typedef int(ZCALLBACK *close_file_func) OF((voidpf opaque
align_t
We need this here for checking the boundaries from script values.
Definition: scripts.h:90
blend_t
Definition: scripts.h:114
fade_t
Definition: scripts.h:136
style_t
Definition: scripts.h:125
vec_t vec3_t[3]
Definition: ufotypes.h:39
vec_t vec2_t[2]
Definition: ufotypes.h:38
uint8_t byte
Definition: ufotypes.h:34
vec_t vec4_t[4]
Definition: ufotypes.h:40

target sizes for buffer

Definition at line 362 of file scripts.cpp.