scripts.h File Reference

Header for script parsing functions. More...

#include "common.h"
#include "../game/q_shared.h"
#include "../game/q_shared.h"
Include dependency graph for scripts.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  value_s
struct  terrainType_s
 Different terrain definitions for footsteps and particles. More...
struct  constListEntry_s
 list of script aliases to register More...

Defines

#define MEMBER_SIZEOF(TYPE, MEMBER)   sizeof(((TYPE *)0)->MEMBER)
#define V_BASETYPEMASK   0x3F
 Allow to add extra bit into the type.
#define SND_VOLUME_FOOTSTEPS   0.2f

Typedefs

typedef struct value_s value_t
typedef struct terrainType_s terrainType_t
 Different terrain definitions for footsteps and particles.
typedef struct constListEntry_s constListEntry_t
 list of script aliases to register

Enumerations

enum  valueTypes_t {
  V_NULL, V_BOOL, V_CHAR, V_INT,
  V_INT2, V_FLOAT = 5, V_POS, V_VECTOR,
  V_COLOR, V_RGBA, V_STRING = 10, V_TRANSLATION_STRING,
  V_LONGSTRING, V_ALIGN, V_BLEND, V_STYLE = 15,
  V_FADE, V_SHAPE_SMALL, V_SHAPE_BIG, V_DMGTYPE,
  V_DMGWEIGHT = 20, V_DATE, V_RELABS, V_CLIENT_HUNK,
  V_CLIENT_HUNK_STRING, V_TEAM, V_RACE, V_UFO,
  V_UFOCRASHED, V_AIRCRAFTTYPE, V_NUM_TYPES
}
 

possible values for parsing functions

More...
enum  align_t {
  ALIGN_UL, ALIGN_UC, ALIGN_UR, ALIGN_CL,
  ALIGN_CC, ALIGN_CR, ALIGN_LL, ALIGN_LC,
  ALIGN_LR, ALIGN_UL_RSL, ALIGN_UC_RSL, ALIGN_UR_RSL,
  ALIGN_CL_RSL, ALIGN_CC_RSL, ALIGN_CR_RSL, ALIGN_LL_RSL,
  ALIGN_LC_RSL, ALIGN_LR_RSL, ALIGN_LAST
}
 

We need this here for checking the boundaries from script values.

More...
enum  blend_t {
  BLEND_REPLACE, BLEND_ONE, BLEND_BLEND, BLEND_ADD,
  BLEND_FILTER, BLEND_INVFILTER, BLEND_LAST, BLEND_REPLACE,
  BLEND_ONE_PARTICLE, BLEND_BLEND, BLEND_ADD, BLEND_FILTER,
  BLEND_INVFILTER, BLEND_LAST
}
enum  style_t {
  STYLE_FACING, STYLE_ROTATED, STYLE_BEAM, STYLE_LINE,
  STYLE_AXIS, STYLE_CIRCLE, STYLE_LAST
}
enum  fade_t {
  FADE_NONE, FADE_IN, FADE_OUT, FADE_SIN,
  FADE_SAW, FADE_LAST
}
enum  ufoType_t {
  UFO_SCOUT, UFO_FIGHTER, UFO_HARVESTER, UFO_CORRUPTER,
  UFO_BOMBER, UFO_CARRIER, UFO_SUPPLY, UFO_GUNBOAT,
  UFO_RIPPER, UFO_MOTHERSHIP, UFO_MAX
}
 

All different types of UFOs.

More...
enum  resultStatus_t { RESULT_ERROR = -1, RESULT_WARNING = -2, RESULT_OK = 0 }

Functions

int Com_EParseValue (void *base, const char *token, valueTypes_t type, int ofs, size_t size)
int Com_SetValue (void *base, const void *set, valueTypes_t type, int ofs, size_t size)
void * Com_AlignPtr (void *memory, valueTypes_t type)
 Align a memory to use a natural address for the data type we will write.
const char * Com_ValueToStr (const void *base, const valueTypes_t type, const int ofs)
const char * Com_GetLastParseError (void)
int Com_ParseValue (void *base, const char *token, valueTypes_t type, int ofs, size_t size, size_t *writtenBytes)
 Parse a value from a string.
qboolean Com_ParseBoolean (const char *token)
 Parses a boolean from a string.
const terrainType_tCom_GetTerrainType (const char *textureName)
 Searches the terrain definition if given.
qboolean Com_GetConstInt (const char *name, int *value)
 Searches whether a given value was registered as a string to int mapping.
qboolean 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.
qboolean 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.
void Com_RegisterConstList (const constListEntry_t constList[])
 Registers a list of string aliases.
qboolean Com_UnregisterConstList (const constListEntry_t constList[])
 Unregisters a list of string aliases.
void Com_ParseScripts (qboolean onlyServer)
const char * Com_EParse (const char **text, const char *errhead, const char *errinfo)
 Parsing function that prints an error message when there is no text in the buffer.
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.
ufoType_t Com_UFOShortNameToID (const char *token)
 Translate UFO type to short name.
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.
int Com_GetScriptChecksum (void)
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.
const char * Com_DropShipTypeToShortName (humanAircraftType_t type)
 Translate DropShip type to short name.
humanAircraftType_t Com_DropShipShortNameToID (const char *token)
 Translate DropShip type to short name.
void Com_GetCharacterValues (const char *teamDefition, character_t *chr)
 Assign character values, 3D models and names to a character.
const char * Com_GetActorSound (teamDef_t *td, int gender, actorSound_t soundType)
 Returns the actor sounds for a given category.
teamDef_tCom_GetTeamDefinitionByID (const char *team)
 Returns the teamDef pointer for the searched team id - or NULL if not found in the teamDef array.
const chrTemplate_tCom_GetCharacterTemplateByID (const char *chrTemplate)
 Returns the chrTemplate pointer for the given id - or NULL if not found in the chrTemplates array.

Variables

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 []
const char *const longlines_names []
const char *const air_slot_type_strings []
 List of valid strings for slot types.
const char *const name_strings []

Detailed Description

Header for script parsing functions.

Definition in file scripts.h.


Define Documentation

#define MEMBER_SIZEOF ( TYPE,
MEMBER   )     sizeof(((TYPE *)0)->MEMBER)

Definition at line 35 of file scripts.h.

Referenced by AIR_ParseAircraft(), and UI_GetIconByName().

#define SND_VOLUME_FOOTSTEPS   0.2f

Definition at line 209 of file scripts.h.

Referenced by Com_ParseTerrain(), and LE_PlaySoundFileForContents().

#define V_BASETYPEMASK   0x3F

Allow to add extra bit into the type.

Note:
If valueTypes_t is bigger than 63 the mask must be changed
See also:
valueTypes_t

Definition at line 42 of file scripts.h.

Referenced by UI_GetReferenceString(), UI_InitRawActionValue(), UI_NodeSetPropertyFromRAW(), and UI_ParseProperty().


Typedef Documentation

list of script aliases to register

Note:
must be terminated with a NULL ({NULL, -1}) entry!
See also:
saveEmployeeConstants[]
typedef struct terrainType_s terrainType_t

Different terrain definitions for footsteps and particles.

typedef struct value_s value_t

used e.g. in our parsers


Enumeration Type Documentation

enum align_t

We need this here for checking the boundaries from script values.

possible align values - see also align_names

Enumerator:
ALIGN_UL 
ALIGN_UC 
ALIGN_UR 
ALIGN_CL 
ALIGN_CC 
ALIGN_CR 
ALIGN_LL 
ALIGN_LC 
ALIGN_LR 
ALIGN_UL_RSL 
ALIGN_UC_RSL 
ALIGN_UR_RSL 
ALIGN_CL_RSL 
ALIGN_CC_RSL 
ALIGN_CR_RSL 
ALIGN_LL_RSL 
ALIGN_LC_RSL 
ALIGN_LR_RSL 
ALIGN_LAST 

Definition at line 93 of file scripts.h.

enum blend_t

possible blend modes - see also blend_names

Enumerator:
BLEND_REPLACE 
BLEND_ONE 
BLEND_BLEND 
BLEND_ADD 
BLEND_FILTER 
BLEND_INVFILTER 
BLEND_LAST 
BLEND_REPLACE 
BLEND_ONE_PARTICLE 
BLEND_BLEND 
BLEND_ADD 
BLEND_FILTER 
BLEND_INVFILTER 
BLEND_LAST 

Definition at line 117 of file scripts.h.

enum fade_t
Enumerator:
FADE_NONE 
FADE_IN 
FADE_OUT 
FADE_SIN 
FADE_SAW 
FADE_LAST 

Definition at line 139 of file scripts.h.

Enumerator:
RESULT_ERROR 
RESULT_WARNING 
RESULT_OK 

Definition at line 182 of file scripts.h.

enum style_t
Enumerator:
STYLE_FACING 

rotates a sprint into the camera direction

STYLE_ROTATED 

use the particle angles vector

STYLE_BEAM 
STYLE_LINE 
STYLE_AXIS 
STYLE_CIRCLE 
STYLE_LAST 

Definition at line 128 of file scripts.h.

enum ufoType_t

All different types of UFOs.

Enumerator:
UFO_SCOUT 
UFO_FIGHTER 
UFO_HARVESTER 
UFO_CORRUPTER 
UFO_BOMBER 
UFO_CARRIER 
UFO_SUPPLY 
UFO_GUNBOAT 
UFO_RIPPER 
UFO_MOTHERSHIP 
UFO_MAX 

Definition at line 152 of file scripts.h.

possible values for parsing functions

See also:
vt_names
vt_sizes
Enumerator:
V_NULL 
V_BOOL 
V_CHAR 
V_INT 
V_INT2 
V_FLOAT 
V_POS 
V_VECTOR 
V_COLOR 
V_RGBA 
V_STRING 
V_TRANSLATION_STRING 

remove _ but don't translate

V_LONGSTRING 

not buffer safe - use this only for menu node data array values!

V_ALIGN 
V_BLEND 
V_STYLE 
V_FADE 
V_SHAPE_SMALL 

space a weapon allocates in the inventory shapes, w, h

V_SHAPE_BIG 

inventory shape, x, y, w, h

V_DMGTYPE 
V_DMGWEIGHT 
V_DATE 
V_RELABS 

relative (e.g. 1.50) and absolute (e.g. +15) values

V_CLIENT_HUNK 

only for client side data - not handled in Com_EParseValue

V_CLIENT_HUNK_STRING 

same as for V_CLIENT_HUNK

V_TEAM 

team string to int mapper

V_RACE 
V_UFO 

Valid ufo types.

Note:
Use the same values for the names as we are already using in the scriptfiles here, otherwise they are not translatable because they don't appear in the po files
Every ufotype (id) that doesn't have nogeoscape set to true must have an assembly in the ufocrash[dn].ump files
V_UFOCRASHED 
V_AIRCRAFTTYPE 
V_NUM_TYPES 

Definition at line 49 of file scripts.h.


Function Documentation

void* Com_AlignPtr ( 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 449 of file scripts.c.

References Sys_Error(), V_NULL, and V_NUM_TYPES.

Referenced by CL_ParsePtlCmds(), UI_InitRawActionValue(), and UI_ParseProperty().

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 3069 of file scripts.c.

References Com_ParseValue(), and V_AIRCRAFTTYPE.

Referenced by BS_AddAircraftToMarket(), BS_GetAircraftBuyingPrice(), BS_GetAircraftOnMarket(), BS_GetAircraftSellingPrice(), BS_LoadXML(), BS_RemoveAircraftFromMarket(), and Com_ParseEquipment().

const char* Com_DropShipTypeToShortName ( humanAircraftType_t  type  ) 

Translate DropShip type to short name.

See also:
Com_DropShipShortNameToID

Definition at line 3081 of file scripts.c.

References Com_ValueToStr(), and V_AIRCRAFTTYPE.

Referenced by B_SetUpFirstBase(), BS_InitMarket(), BS_SaveXML(), CL_CampaignRunMarket(), and GAME_InitMenuOptions().

const char* Com_EParse ( const char **  text,
const char *  errhead,
const char *  errinfo 
)
int Com_EParseValue ( void *  base,
const char *  token,
valueTypes_t  type,
int  ofs,
size_t  size 
)
const char* Com_GetActorSound ( teamDef_t td,
int  gender,
actorSound_t  soundType 
)

Returns the actor sounds for a given category.

Parameters:
[in] td teamDef pointer
[in] gender The gender of the actor
[in] soundType Which sound category (actorSound_t)

Definition at line 2154 of file scripts.c.

References Com_DPrintf(), linkedList_s::data, DEBUG_CLIENT, DEBUG_SOUND, teamDef_s::id, NAME_LAST, linkedList_s::next, teamDef_s::numSounds, random, and teamDef_s::sounds.

Referenced by CL_ActorPlaySound().

const chrTemplate_t* Com_GetCharacterTemplateByID ( const char *  chrTemplate  ) 

Returns the chrTemplate pointer for the given id - or NULL if not found in the chrTemplates array.

Parameters:
[in] team The character template id (given in ufo-script files)

Definition at line 2626 of file scripts.c.

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

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] teamDefition The team definition id to use to generate the character values.
[in,out] chr The character that should get the paths to the different models/skins.
See also:
Com_GiveName
Com_GiveModel

Definition at line 2208 of file scripts.c.

References ACTOR_SIZE_INVALID, ACTOR_SIZE_NORMAL, character_s::body, Com_Error(), Com_GetTeamDefinitionByID(), Com_GiveModel(), Com_GiveName(), ERR_DROP, character_s::fieldSize, character_s::gender, character_s::head, MODEL_BODY, MODEL_HEAD, MODEL_PATH, MODEL_SKIN, character_s::name, NAME_LAST, character_s::path, Q_strcat(), Q_strncpyz(), teamDef_s::size, character_s::skin, and character_s::teamDef.

Referenced by CL_GenerateCharacter(), and SV_InitGameProgs().

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

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

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

Definition at line 70 of file scripts.c.

References Com_ConstIntGetVariable(), Com_HashKey(), CONSTNAMEINT_HASH_SIZE, com_constNameInt_s::fullname, hash(), com_constNameInt_s::hash_next, com_constNameInt_s::name, qfalse, qtrue, and com_constNameInt_s::value.

Referenced by Com_GetConstIntFromNamespace(), Com_ParseValue(), CP_LoadInterestsXML(), SV_InitGameProgs(), and testConstInt().

qboolean 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] space The namespace of the mapping variable
[in] variable The name of the string mapping
[out] value The mapped integer if found, not touched if the given string was found in the registered values.
Returns:
True if the value is found.
See also:
Com_RegisterConstInt
Com_ParseValue
Com_GetConstInt

Definition at line 103 of file scripts.c.

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

Referenced by AIR_LoadAircraftXML(), B_LoadXML(), CL_LoadCharacterXML(), CP_LoadMissionsXML(), E_LoadXML(), INS_LoadXML(), MS_LoadXML(), RS_LoadXML(), SV_InitGameProgs(), and US_LoadXML().

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

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

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

Definition at line 122 of file scripts.c.

References com_constNameInt_s::fullname, com_constNameInt_s::name, com_constNameInt_s::next, and com_constNameInt_s::value.

Referenced by AIR_SaveAircraftXML(), B_SaveXML(), CL_SaveCharacterXML(), CP_SaveInterestsXML(), CP_SaveMissionsXML(), E_SaveXML(), INS_SaveXML(), MS_MessageSaveXML(), RS_SaveXML(), SV_InitGameProgs(), testConstInt(), and US_SaveXML().

const char* Com_GetLastParseError ( void   ) 

Returns the last error message

Returns:
string that contains the last error message

Definition at line 440 of file scripts.c.

Referenced by UI_NodeSetProperty(), and UI_ParseProperty().

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
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 3058 of file scripts.c.

References va().

Referenced by CP_CreateBattleParameters(), GAME_InitMenuOptions(), GAME_SK_HideDropships(), and GAME_SK_HideUFOs().

int Com_GetScriptChecksum ( void   ) 

Definition at line 3298 of file scripts.c.

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

Referenced by CL_CanMultiplayerStart(), and SV_Map().

teamDef_t* Com_GetTeamDefinitionByID ( const char *  team  ) 

Returns the teamDef pointer for the searched team id - or NULL if not found in the teamDef array.

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

Definition at line 2188 of file scripts.c.

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

Referenced by AC_LoadXML(), AIR_LoadAircraftXML(), CL_LoadCharacterXML(), CL_ParseAlienTeam(), Com_GetCharacterValues(), GAME_ItemIsUseable(), and RS_AssignTechLinks().

const terrainType_t* Com_GetTerrainType ( const char *  textureName  ) 

Searches the terrain definition if given.

Parameters:
[in] textureName The terrain definition id from script files which is the texture name relative to base/textures

Definition at line 2792 of file scripts.c.

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

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

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] ugvID The script id of the UGV definition you are looking for
Returns:
ugv_t pointer or NULL if not found.

Definition at line 3144 of file scripts.c.

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

Referenced by E_InitialEmployees().

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] ugvID The script id of the UGV definition you are looking for
Returns:
ugv_t pointer or NULL if not found.
Note:
This function gives no warning on null name or if no ugv found

Definition at line 3124 of file scripts.c.

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

Referenced by Com_GetUGVByID(), E_LoadXML(), and UP_Article().

qboolean Com_ParseBoolean ( const char *  token  ) 

Parses a boolean from a string.

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

Definition at line 895 of file scripts.c.

References Com_ParseValue(), qfalse, RESULT_ERROR, and V_BOOL.

Referenced by GAME_CP_Results_f(), and HUD_RemainingTUs_f().

void Com_ParseScripts ( qboolean  onlyServer  ) 
int 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] base The start pointer to a given data type (typedef, struct) where the parsed data is stored
[in] token The data which should be parsed
[in] type The data type that should be parsed
[in] ofs The offset for the value
[in] size The expected size of the data type. If 0, no checks are done
[out] writtenBytes 
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 472 of file scripts.c.

References ALIGN_LAST, BLEND_LAST, byte, Com_GetConstInt(), csi, DAYS_PER_YEAR, DROPSHIP_FIREBIRD, DROPSHIP_HERAKLES, DROPSHIP_RAPTOR, csi_s::dts, f, FADE_LAST, i, damageType_s::id, int(), INTERCEPTOR_DRAGON, INTERCEPTOR_SARACEN, INTERCEPTOR_STARCHASER, INTERCEPTOR_STILETTO, INTERCEPTOR_STINGRAY, MAX_VAR, csi_s::numDTs, Q_strncpyz(), qfalse, qtrue, RACE_BLOODSPIDER, RACE_CIVILIAN, RACE_ORTNOK, RACE_PHALANX_HUMAN, RACE_ROBOT, RACE_SHEVAAR, RACE_TAMAN, 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, UFO_BOMBER, UFO_CARRIER, UFO_CORRUPTER, UFO_FIGHTER, UFO_GUNBOAT, UFO_HARVESTER, UFO_MOTHERSHIP, UFO_RIPPER, UFO_SCOUT, UFO_SIZE_T, UFO_SUPPLY, V_AIRCRAFTTYPE, V_ALIGN, V_BLEND, V_BOOL, V_CHAR, V_CLIENT_HUNK, V_CLIENT_HUNK_STRING, V_COLOR, V_DATE, V_DMGTYPE, V_DMGWEIGHT, V_FADE, V_FLOAT, V_INT, V_INT2, V_LONGSTRING, V_NULL, V_POS, V_RACE, V_RELABS, V_RGBA, 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(), UI_MaterialEditorChangeValue_f(), UI_NodeSetProperty(), UI_ParseProperty(), and UI_PushDropDownWindow_f().

void Com_RegisterConstInt ( const char *  name,
int  value 
)

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

Parameters:
name The name of the script entry to map to an integer. This can also include a namespace prefix for the case we want to map back an integer to a string from a specific namespace. In case this string is equipped with a namespace, the string is in the form "namespace::variable"
value The value to map the given name to
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 204 of file scripts.c.

References com_aliasSysPool, Com_ConstIntGetVariable(), Com_HashKey(), Com_Printf(), CONSTNAMEINT_HASH_SIZE, com_constNameInt_s::fullname, hash(), com_constNameInt_s::hash_next, Mem_PoolAlloc, Mem_StrDup, com_constNameInt_s::name, com_constNameInt_s::next, Q_strncpyz(), and com_constNameInt_s::value.

Referenced by Com_RegisterConstList(), SV_InitGameProgs(), testConstInt(), UI_RegisterAbstractNode(), UI_RegisterBaseInventoryNode(), UI_RegisterPanelNode(), and UI_RegisterTextNode().

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

Definition at line 918 of file scripts.c.

References byte, Com_Printf(), DROPSHIP_FIREBIRD, DROPSHIP_HERAKLES, DROPSHIP_RAPTOR, int(), INTERCEPTOR_DRAGON, INTERCEPTOR_SARACEN, INTERCEPTOR_STARCHASER, INTERCEPTOR_STILETTO, INTERCEPTOR_STINGRAY, len, MAX_VAR, Q_strncpyz(), qfalse, qtrue, RACE_BLOODSPIDER, RACE_CIVILIAN, RACE_ORTNOK, RACE_PHALANX_HUMAN, RACE_ROBOT, RACE_SHEVAAR, RACE_TAMAN, SHAPE_BIG_MAX_HEIGHT, SHAPE_SMALL_MAX_HEIGHT, Sys_Error(), TEAM_ALIEN, TEAM_CIVILIAN, TEAM_PHALANX, UFO_BOMBER, UFO_CARRIER, UFO_CORRUPTER, UFO_FIGHTER, UFO_GUNBOAT, UFO_HARVESTER, UFO_MOTHERSHIP, UFO_RIPPER, UFO_SCOUT, UFO_SIZE_T, UFO_SUPPLY, V_AIRCRAFTTYPE, V_ALIGN, V_BLEND, V_BOOL, V_CHAR, V_COLOR, V_DATE, V_DMGTYPE, V_DMGWEIGHT, V_FADE, V_FLOAT, V_INT, V_INT2, V_LONGSTRING, V_NULL, V_POS, V_RACE, V_RGBA, 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().

const char* Com_UFOCrashedTypeToShortName ( ufoType_t  type  ) 

Translate UFO type to short name when UFO is crashed.

See also:
Com_UFOTypeToShortName

Definition at line 3113 of file scripts.c.

References Com_ValueToStr(), and V_UFOCRASHED.

Referenced by CP_CreateBattleParameters(), CP_MapIsSelectable(), and GAME_InitMenuOptions().

ufoType_t Com_UFOShortNameToID ( const char *  token  ) 

Translate UFO type to short name.

See also:
UFO_TypeToName
Com_UFOTypeToShortName

Definition at line 3091 of file scripts.c.

References Com_ParseValue(), and V_UFO.

Referenced by AIR_ParseAircraft().

const char* Com_UFOTypeToShortName ( ufoType_t  type  ) 
qboolean Com_UnregisterConstList ( const constListEntry_t  constList[]  ) 
qboolean Com_UnregisterConstVariable ( const char *  name  ) 

Removes a registered constant from the script mapping hash table.

Parameters:
name The name of the script entry to remove out of the const int hash. In case this string is equipped with a namespace, the string is in the form "namespace::variable". If you try to unregister a variable that was registered with a namespace, this namespace must be included in the given name, too.
See also:
Com_RegisterConstInt
Com_GetConstVariable

Definition at line 148 of file scripts.c.

References Com_ConstIntGetVariable(), Com_HashKey(), CONSTNAMEINT_HASH_SIZE, com_constNameInt_s::fullname, hash(), com_constNameInt_s::hash_next, Mem_Free, com_constNameInt_s::next, qfalse, and qtrue.

Referenced by Com_UnregisterConstList(), SV_InitGameProgs(), and testConstInt().

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

Variable Documentation

const char* const 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 1621 of file scripts.c.

Referenced by AIR_ParseAircraft().

const char* const align_names[]

Definition at line 344 of file scripts.c.

const char* const blend_names[]

Definition at line 349 of file scripts.c.

const char* const fade_names[]

Definition at line 359 of file scripts.c.

const char* const longlines_names[]
const char* const name_strings[]

Definition at line 1958 of file scripts.c.

const char* const style_names[]

Definition at line 354 of file scripts.c.

const char* const vt_names[]

possible values for parsing functions

See also:
valueTypes_t

Definition at line 310 of file scripts.c.

Referenced by CL_ParsePtlCmds(), and CL_ParticleFunction().


Generated by  doxygen 1.6.2