00001
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 #ifndef GAME_Q_SHARED_H
00032 #define GAME_Q_SHARED_H
00033
00034 #include "../shared/ufotypes.h"
00035 #include "../shared/byte.h"
00036 #include "../shared/shared.h"
00037 #include "../shared/mathlib.h"
00038 #include "../shared/defines.h"
00039 #include "../common/list.h"
00040
00041 #include "inv_shared.h"
00042 #include "chr_shared.h"
00043
00044 #ifdef DEDICATED_ONLY
00045
00046 # define _(String) String
00047 # define ngettext(x, y, cnt) x
00048 #endif
00049
00050
00051
00052
00053
00054
00055
00056
00057 void Sys_Error(const char *error, ...) __attribute__((noreturn, format(printf, 1, 2)));
00058 void Com_Printf(const char *msg, ...) __attribute__((format(printf, 1, 2)));
00059 void Com_DPrintf(int level, const char *msg, ...) __attribute__((format(printf, 2, 3)));
00060
00061 #define TEAM_NO_ACTIVE -1
00062 #define TEAM_CIVILIAN 0
00063 #define TEAM_PHALANX 1
00064 #define TEAM_ALIEN 7
00065 #define TEAM_MAX_HUMAN TEAM_ALIEN - 1
00066
00067
00068
00069
00070
00071
00072
00074 #define EVENT_INSTANTLY 0x80
00075
00081 typedef enum {
00082 EV_NULL,
00083 EV_RESET,
00084 EV_START,
00085 EV_ENDROUND,
00086 EV_ENDROUNDANNOUNCE,
00087
00088 EV_RESULTS,
00089 EV_CENTERVIEW,
00090
00091 EV_ENT_APPEAR,
00092 EV_ENT_PERISH,
00094 EV_ENT_DESTROY,
00095 EV_ADD_BRUSH_MODEL,
00096 EV_ADD_EDICT,
00097
00098 EV_ACTOR_APPEAR,
00099 EV_ACTOR_ADD,
00100 EV_ACTOR_TURN,
00101 EV_ACTOR_MOVE,
00102 EV_ACTOR_REACTIONFIRECHANGE,
00103
00104 EV_ACTOR_START_SHOOT,
00105 EV_ACTOR_SHOOT,
00106 EV_ACTOR_SHOOT_HIDDEN,
00107 EV_ACTOR_THROW,
00108
00109 EV_ACTOR_DIE,
00110 EV_ACTOR_REVITALISED,
00111 EV_ACTOR_STATS,
00112 EV_ACTOR_STATECHANGE,
00113 EV_ACTOR_RESERVATIONCHANGE,
00114
00115 EV_INV_ADD,
00116 EV_INV_DEL,
00117 EV_INV_AMMO,
00118 EV_INV_RELOAD,
00119 EV_INV_TRANSFER,
00120
00121
00122 EV_MODEL_EXPLODE,
00123 EV_MODEL_EXPLODE_TRIGGERED,
00125 EV_PARTICLE_APPEAR,
00126 EV_PARTICLE_SPAWN,
00127
00128 EV_DOOR_OPEN,
00129 EV_DOOR_CLOSE,
00130 EV_DOOR_ACTION,
00131 EV_RESET_CLIENT_ACTION,
00132
00133 EV_NUM_EVENTS
00134 } event_t;
00135
00136 typedef enum {
00137 ET_NULL,
00138 ET_ACTORSPAWN,
00139 ET_ACTOR,
00140 ET_ITEM,
00141 ET_BREAKABLE,
00142 ET_TRIGGER,
00143 ET_TRIGGER_HURT,
00144 ET_TRIGGER_TOUCH,
00145 ET_TRIGGER_RESCUE,
00146 ET_DOOR,
00147 ET_ROTATING,
00148 ET_ACTOR2x2SPAWN,
00149 ET_ACTOR2x2,
00150 ET_CIVILIANTARGET,
00151 ET_MISSION,
00152 ET_ACTORHIDDEN,
00153 ET_PARTICLE,
00154 ET_SOUND,
00155 ET_SOLID,
00156 ET_MESSAGE,
00157
00158 ENTITY_TYPE_ENSURE_32BIT = 0x7FFFFFFF
00159 } entity_type_t;
00160
00161 #define DOOR_ROTATION_ANGLE 90
00162
00163 typedef enum {
00164 PA_NULL,
00165 PA_TURN,
00166 PA_MOVE,
00167 PA_STATE,
00168 PA_SHOOT,
00169 PA_USE_DOOR,
00170 PA_INVMOVE,
00171 PA_REACT_SELECT,
00172 PA_RESERVE_STATE,
00173
00174 PA_NUM_EVENTS
00175 } player_action_t;
00176
00177 extern const char *pa_format[PA_NUM_EVENTS];
00178
00180 typedef int32_t shoot_types_t;
00185 #define ST_RIGHT 0
00186
00190 #define ST_RIGHT_REACTION 1
00191
00195 #define ST_LEFT 2
00196
00200 #define ST_LEFT_REACTION 3
00201
00205 #define ST_HEADGEAR 4
00206
00210 #define ST_NUM_SHOOT_TYPES 5
00211
00213 #define IS_SHOT_REACTION(x) ((x) == ST_RIGHT_REACTION || (x) == ST_LEFT_REACTION)
00214
00215 #define IS_SHOT_LEFT(x) ((x) == ST_LEFT || (x) == ST_LEFT_REACTION)
00216
00217 #define IS_SHOT_RIGHT(x) ((x) == ST_RIGHT || (x) == ST_RIGHT_REACTION)
00218
00219 #define IS_SHOT_HEADGEAR(x) ((x) == ST_HEADGEAR)
00220
00221 #define SHOULD_USE_AUTOSTAND(length) ((float) (2.0f * TU_CROUCH) * TU_CROUCH_MOVING_FACTOR / (TU_CROUCH_MOVING_FACTOR - 1.0f) < (float) (length))
00222
00223
00224 #define SF_IMPACT 1
00225 #define SF_BODY 2
00226 #define SF_BOUNCING 4
00227 #define SF_BOUNCED 8
00229
00230
00231 #define SKIP_LOCAL_ENTITY (-1)
00232
00233 #define MAX_DEATH 3
00235
00236
00237 #define STATE_PUBLIC 0x00FF
00238 #define STATE_DEAD 0x0003
00239 #define STATE_CROUCHED 0x0004
00240 #define STATE_PANIC 0x0008
00241
00242 #define STATE_RAGE 0x0010
00243 #define STATE_INSANE 0x0030
00244 #define STATE_STUN 0x0043
00245 #define STATE_DAZED 0x0080
00247
00248 #define STATE_REACTION_ONCE 0x0100
00249 #define STATE_REACTION_MANY 0x0200
00250 #define STATE_REACTION 0x0300
00251 #define STATE_SHAKEN 0x0400
00252 #define STATE_XVI 0x0800
00254
00255 #define EYE_STAND 15
00256 #define EYE_CROUCH 3
00257 #define PLAYER_STAND 20
00258 #define PLAYER_CROUCH 5
00259 #define PLAYER_DEAD -12
00260 #define PLAYER_MIN -24
00261 #define PLAYER_WIDTH 9
00262
00263 #define PLAYER_STANDING_HEIGHT (PLAYER_STAND - PLAYER_MIN)
00264 #define PLAYER_CROUCHING_HEIGHT (PLAYER_CROUCH - PLAYER_MIN)
00265
00266 #if 0
00267 #define EYE2x2_STAND 15
00268 #define EYE2x2_CROUCH 3
00269 #define PLAYER2x2_STAND 20
00270 #define PLAYER2x2_CROUCH 5
00271 #define PLAYER2x2_DEAD -12
00272 #define PLAYER2x2_MIN -24
00273 #endif
00274 #define PLAYER2x2_WIDTH 18
00276
00277 #define BOX_DELTA_WIDTH 11
00278 #define BOX_DELTA_LENGTH 11
00279 #define BOX_DELTA_HEIGHT 27
00280
00281 #define GRAVITY 500.0
00282
00283 #define MAX_SKILL 100
00284
00285 #define GET_HP( ab ) (min((80 + (ab) * 90/MAX_SKILL), 255))
00286 #define GET_INJURY_MULT( mind, hp, hpmax ) ((float)(hp) / (float)(hpmax) > 0.5f ? 1.0f : 1.0f + INJURY_BALANCE * ((1.0f / ((float)(hp) / (float)(hpmax) + INJURY_THRESHOLD)) -1.0f)* (float)MAX_SKILL / (float)(mind))
00287
00288 #define GET_ACC( ab, sk ) ((1 - ((float)(ab)/MAX_SKILL + (float)(sk)/MAX_SKILL) / 2))
00289 #define GET_TU( ab ) (min((27 + (ab) * 20/MAX_SKILL), 255))
00290 #define GET_MORALE( ab ) (min((100 + (ab) * 150/MAX_SKILL), 255))
00291
00296 #define CS_NAME 0
00297 #define CS_MAPTITLE 1
00298 #define CS_MAXCLIENTS 2
00299 #define CS_MAPCHECKSUM 3
00300 #define CS_MAXSOLDIERSPERTEAM 4
00301 #define CS_MAXSOLDIERSPERPLAYER 5
00302 #define CS_ENABLEMORALE 6
00303 #define CS_MAXTEAMS 7
00304 #define CS_PLAYERCOUNT 8
00305 #define CS_VERSION 9
00306 #define CS_UFOCHECKSUM 10
00307 #define CS_OBJECTAMOUNT 11
00308 #define CS_LIGHTMAP 12
00310 #define CS_TILES 16
00311 #define CS_POSITIONS (CS_TILES+MAX_TILESTRINGS)
00312 #define CS_MODELS (CS_POSITIONS+MAX_TILESTRINGS)
00313 #define CS_PLAYERNAMES (CS_MODELS+MAX_MODELS)
00314 #define CS_GENERAL (CS_PLAYERNAMES+MAX_CLIENTS)
00315 #define MAX_CONFIGSTRINGS (CS_GENERAL+MAX_GENERAL)
00316
00317 #define MAX_FORBIDDENLIST (MAX_EDICTS * 4)
00318
00324 typedef struct csi_s {
00326 objDef_t ods[MAX_OBJDEFS];
00327 int numODs;
00328
00330 invDef_t ids[MAX_INVDEFS];
00331 int numIDs;
00332
00334 containerIndex_t idRight, idLeft, idExtension;
00335 containerIndex_t idHeadgear, idBackpack, idBelt, idHolster;
00336 containerIndex_t idArmour, idFloor, idEquip;
00337
00339 int damNormal, damBlast, damFire;
00340 int damShock;
00343 int damLaser, damPlasma, damParticle;
00344 int damStunGas;
00346 int damStunElectro;
00349 equipDef_t eds[MAX_EQUIPDEFS];
00350 int numEDs;
00351
00353 damageType_t dts[MAX_DAMAGETYPES];
00354 int numDTs;
00355
00357 teamDef_t teamDef[MAX_TEAMDEFS];
00358 int numTeamDefs;
00359
00361 const teamDef_t* alienTeams[MAX_TEAMS_PER_MISSION];
00362 int numAlienTeams;
00363
00365 chrTemplate_t chrTemplates[MAX_CHARACTER_TEMPLATES];
00366 int numChrTemplates;
00367
00368 ugv_t ugvs[MAX_UGV];
00369 int numUGV;
00370 } csi_t;
00371
00372 extern csi_t csi;
00373
00375 #define REJ_PASSWORD_REQUIRED_OR_INCORRECT "Password required or incorrect."
00376 #define REJ_BANNED "Banned."
00377
00378 #endif