00001
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #ifndef SCRIPTS_H
00027 #define SCRIPTS_H
00028
00029 #include "common.h"
00030
00031 #ifndef ALIGN_PTR
00032 #define ALIGN_PTR(value,size) (void*)(((uintptr_t)value + (size - 1)) & (~(size - 1)))
00033 #endif
00034
00035 #define MEMBER_SIZEOF(TYPE, MEMBER) sizeof(((TYPE *)0)->MEMBER)
00036
00042 #define V_BASETYPEMASK 0x3F
00043
00049 typedef enum {
00050 V_NULL,
00051 V_BOOL,
00052 V_CHAR,
00053 V_INT,
00054 V_INT2,
00055 V_FLOAT = 5,
00056 V_POS,
00057 V_VECTOR,
00058 V_COLOR,
00059 V_RGBA,
00060 V_STRING = 10,
00061 V_TRANSLATION_STRING,
00062 V_LONGSTRING,
00063 V_ALIGN,
00064 V_BLEND,
00065 V_STYLE = 15,
00066 V_FADE,
00067 V_SHAPE_SMALL,
00068 V_SHAPE_BIG,
00069 V_DMGTYPE,
00070 V_DMGWEIGHT = 20,
00071 V_DATE,
00072 V_RELABS,
00073 V_CLIENT_HUNK,
00074 V_CLIENT_HUNK_STRING,
00075 V_TEAM,
00076 V_RACE,
00077 V_UFO,
00082 V_UFOCRASHED,
00083 V_AIRCRAFTTYPE,
00084
00085 V_NUM_TYPES
00086 } valueTypes_t;
00087
00088 extern const char *const vt_names[];
00089
00093 typedef enum {
00094 ALIGN_UL,
00095 ALIGN_UC,
00096 ALIGN_UR,
00097 ALIGN_CL,
00098 ALIGN_CC,
00099 ALIGN_CR,
00100 ALIGN_LL,
00101 ALIGN_LC,
00102 ALIGN_LR,
00103 ALIGN_UL_RSL,
00104 ALIGN_UC_RSL,
00105 ALIGN_UR_RSL,
00106 ALIGN_CL_RSL,
00107 ALIGN_CC_RSL,
00108 ALIGN_CR_RSL,
00109 ALIGN_LL_RSL,
00110 ALIGN_LC_RSL,
00111 ALIGN_LR_RSL,
00112
00113 ALIGN_LAST
00114 } align_t;
00115
00117 typedef enum {
00118 BLEND_REPLACE,
00119 BLEND_ONE,
00120 BLEND_BLEND,
00121 BLEND_ADD,
00122 BLEND_FILTER,
00123 BLEND_INVFILTER,
00124
00125 BLEND_LAST
00126 } blend_t;
00127
00128 typedef enum {
00129 STYLE_FACING,
00130 STYLE_ROTATED,
00131 STYLE_BEAM,
00132 STYLE_LINE,
00133 STYLE_AXIS,
00134 STYLE_CIRCLE,
00135
00136 STYLE_LAST
00137 } style_t;
00138
00139 typedef enum {
00140 FADE_NONE,
00141 FADE_IN,
00142 FADE_OUT,
00143 FADE_SIN,
00144 FADE_SAW,
00145
00146 FADE_LAST
00147 } fade_t;
00148
00152 typedef enum {
00153 UFO_SCOUT,
00154 UFO_FIGHTER,
00155 UFO_HARVESTER,
00156 UFO_CORRUPTER,
00157 UFO_BOMBER,
00158 UFO_CARRIER,
00159 UFO_SUPPLY,
00160 UFO_GUNBOAT,
00161 UFO_RIPPER,
00162 UFO_MOTHERSHIP,
00163
00164 UFO_MAX
00165 } ufoType_t;
00166
00167 extern const char *const align_names[];
00168 extern const char *const blend_names[];
00169 extern const char *const style_names[];
00170 extern const char *const fade_names[];
00171 extern const char *const longlines_names[];
00172 extern const char *const air_slot_type_strings[];
00173
00175 typedef struct value_s {
00176 const char *string;
00177 const int type;
00178 const size_t ofs;
00179 const size_t size;
00180 } value_t;
00181
00182 typedef enum {
00183 RESULT_ERROR = -1,
00184 RESULT_WARNING = -2,
00185 RESULT_OK = 0
00186 } resultStatus_t;
00187
00188 #ifdef DEBUG
00189 int Com_EParseValueDebug(void *base, const char *token, valueTypes_t type, int ofs, size_t size, const char* file, int line);
00190 int Com_SetValueDebug(void *base, const void *set, valueTypes_t type, int ofs, size_t size, const char* file, int line);
00191 #define Com_SetValue(base, set, type, ofs, size) Com_SetValueDebug(base, set, type, ofs, size, __FILE__, __LINE__)
00192 #define Com_EParseValue(base, token, type, ofs, size) Com_EParseValueDebug(base, token, type, ofs, size, __FILE__, __LINE__)
00193 #else
00194 int Com_EParseValue(void *base, const char *token, valueTypes_t type, int ofs, size_t size);
00195 int Com_SetValue(void *base, const void *set, valueTypes_t type, int ofs, size_t size);
00196 #endif
00197 void* Com_AlignPtr(void *memory, valueTypes_t type);
00198 const char *Com_ValueToStr(const void *base, const valueTypes_t type, const int ofs);
00199 const char *Com_GetLastParseError(void);
00200 int Com_ParseValue(void *base, const char *token, valueTypes_t type, int ofs, size_t size, size_t *writtenBytes);
00201 qboolean Com_ParseBoolean(const char *token);
00202
00203
00204
00205
00206
00207 extern const char *const name_strings[];
00208
00209 #define SND_VOLUME_FOOTSTEPS 0.2f
00210
00212 typedef struct terrainType_s {
00213 const char *texture;
00214 const char *footStepSound;
00215 const char *particle;
00216 float bounceFraction;
00217 float footStepVolume;
00218 struct terrainType_s *hash_next;
00219 } terrainType_t;
00220
00221 const terrainType_t* Com_GetTerrainType(const char *textureName);
00222
00228 typedef struct constListEntry_s {
00229 char *name;
00230 int value;
00231 } constListEntry_t;
00232
00233 qboolean Com_GetConstInt(const char *name, int *value);
00234 qboolean Com_GetConstIntFromNamespace(const char *space, const char *variable, int *value);
00235 const char* Com_GetConstVariable(const char *space, int value);
00236 qboolean Com_UnregisterConstVariable(const char *name);
00237 void Com_RegisterConstInt(const char *name, int value);
00238 void Com_RegisterConstList(const constListEntry_t constList[]);
00239 qboolean Com_UnregisterConstList(const constListEntry_t constList[]);
00240
00241 void Com_ParseScripts(qboolean onlyServer);
00242 const char *Com_EParse(const char **text, const char *errhead, const char *errinfo);
00243 const char *Com_GetRandomMapAssemblyNameForCraft(const char *craftID);
00244 ufoType_t Com_UFOShortNameToID(const char *token);
00245 const char* Com_UFOTypeToShortName(ufoType_t type);
00246 const char* Com_UFOCrashedTypeToShortName(ufoType_t type);
00247 int Com_GetScriptChecksum(void);
00248
00249 #include "../game/q_shared.h"
00250
00251 const ugv_t *Com_GetUGVByIDSilent(const char *ugvID);
00252 const ugv_t *Com_GetUGVByID(const char *ugvID);
00253 const char* Com_DropShipTypeToShortName(humanAircraftType_t type);
00254 humanAircraftType_t Com_DropShipShortNameToID(const char *token);
00255 void Com_GetCharacterValues(const char *teamDefition, character_t * chr);
00256 const char* Com_GetActorSound(teamDef_t* td, int gender, actorSound_t soundType);
00257 teamDef_t* Com_GetTeamDefinitionByID(const char *team);
00258 const chrTemplate_t* Com_GetCharacterTemplateByID(const char *chrTemplate);
00259
00260 #endif
00261