q_shared.h 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191
  1. // Copyright (c) ZeniMax Media Inc.
  2. // Licensed under the GNU General Public License 2.0.
  3. // q_shared.h -- included first by ALL program modules
  4. #ifdef _WIN32
  5. // unknown pragmas are SUPPOSED to be ignored, but....
  6. #pragma warning(disable : 4244) // MIPS
  7. #pragma warning(disable : 4136) // X86
  8. #pragma warning(disable : 4051) // ALPHA
  9. #pragma warning(disable : 4018) // signed/unsigned mismatch
  10. #pragma warning(disable : 4305) // truncation from const double to float
  11. #endif
  12. #include <assert.h>
  13. #include <math.h>
  14. #include <stdio.h>
  15. #include <stdarg.h>
  16. #include <string.h>
  17. #include <stdlib.h>
  18. #include <time.h>
  19. #if (defined _M_IX86 || defined __i386__) && !defined C_ONLY && !defined __sun__
  20. #define id386 1
  21. #else
  22. #define id386 0
  23. #endif
  24. #if defined _M_ALPHA && !defined C_ONLY
  25. #define idaxp 1
  26. #else
  27. #define idaxp 0
  28. #endif
  29. typedef unsigned char byte;
  30. typedef enum {false, true} qboolean;
  31. #ifndef NULL
  32. #define NULL ((void *)0)
  33. #endif
  34. // angle indexes
  35. #define PITCH 0 // up / down
  36. #define YAW 1 // left / right
  37. #define ROLL 2 // fall over
  38. #define MAX_STRING_CHARS 1024 // max length of a string passed to Cmd_TokenizeString
  39. #define MAX_STRING_TOKENS 80 // max tokens resulting from Cmd_TokenizeString
  40. #define MAX_TOKEN_CHARS 128 // max length of an individual token
  41. #define MAX_QPATH 64 // max length of a quake game pathname
  42. #define MAX_OSPATH 128 // max length of a filesystem pathname
  43. //
  44. // per-level limits
  45. //
  46. #define MAX_CLIENTS 256 // absolute limit
  47. #define MAX_EDICTS 1024 // must change protocol to increase more
  48. #define MAX_LIGHTSTYLES 256
  49. #define MAX_MODELS 256 // these are sent over the net as bytes
  50. #define MAX_SOUNDS 256 // so they cannot be blindly increased
  51. #define MAX_IMAGES 256
  52. #define MAX_ITEMS 256
  53. #define MAX_GENERAL (MAX_CLIENTS*2) // general config strings
  54. // game print flags
  55. #define PRINT_LOW 0 // pickup messages
  56. #define PRINT_MEDIUM 1 // death messages
  57. #define PRINT_HIGH 2 // critical messages
  58. #define PRINT_CHAT 3 // chat messages
  59. #define ERR_FATAL 0 // exit the entire game with a popup window
  60. #define ERR_DROP 1 // print to console and disconnect from game
  61. #define ERR_DISCONNECT 2 // don't kill server
  62. #define PRINT_ALL 0
  63. #define PRINT_DEVELOPER 1 // only print when "developer 1"
  64. #define PRINT_ALERT 2
  65. // destination class for gi.multicast()
  66. typedef enum
  67. {
  68. MULTICAST_ALL,
  69. MULTICAST_PHS,
  70. MULTICAST_PVS,
  71. MULTICAST_ALL_R,
  72. MULTICAST_PHS_R,
  73. MULTICAST_PVS_R
  74. } multicast_t;
  75. /*
  76. ==============================================================
  77. MATHLIB
  78. ==============================================================
  79. */
  80. typedef float vec_t;
  81. typedef vec_t vec3_t[3];
  82. typedef vec_t vec5_t[5];
  83. typedef int fixed4_t;
  84. typedef int fixed8_t;
  85. typedef int fixed16_t;
  86. #ifndef M_PI
  87. #define M_PI 3.14159265358979323846 // matches value in gcc v2 math.h
  88. #endif
  89. struct cplane_s;
  90. extern vec3_t vec3_origin;
  91. #define nanmask (255<<23)
  92. #define IS_NAN(x) (((*(int *)&x)&nanmask)==nanmask)
  93. // microsoft's fabs seems to be ungodly slow...
  94. //float Q_fabs (float f);
  95. //#define fabs(f) Q_fabs(f)
  96. #if !defined C_ONLY && !defined __linux__ && !defined __sgi
  97. extern long Q_ftol( float f );
  98. #else
  99. #define Q_ftol( f ) ( long ) (f)
  100. #endif
  101. #define DotProduct(x,y) (x[0]*y[0]+x[1]*y[1]+x[2]*y[2])
  102. #define VectorSubtract(a,b,c) (c[0]=a[0]-b[0],c[1]=a[1]-b[1],c[2]=a[2]-b[2])
  103. #define VectorAdd(a,b,c) (c[0]=a[0]+b[0],c[1]=a[1]+b[1],c[2]=a[2]+b[2])
  104. #define VectorCopy(a,b) (b[0]=a[0],b[1]=a[1],b[2]=a[2])
  105. #define VectorClear(a) (a[0]=a[1]=a[2]=0)
  106. #define VectorNegate(a,b) (b[0]=-a[0],b[1]=-a[1],b[2]=-a[2])
  107. #define VectorSet(v, x, y, z) (v[0]=(x), v[1]=(y), v[2]=(z))
  108. void VectorMA (vec3_t veca, float scale, vec3_t vecb, vec3_t vecc);
  109. // just in case you do't want to use the macros
  110. vec_t _DotProduct (vec3_t v1, vec3_t v2);
  111. void _VectorSubtract (vec3_t veca, vec3_t vecb, vec3_t out);
  112. void _VectorAdd (vec3_t veca, vec3_t vecb, vec3_t out);
  113. void _VectorCopy (vec3_t in, vec3_t out);
  114. void ClearBounds (vec3_t mins, vec3_t maxs);
  115. void AddPointToBounds (vec3_t v, vec3_t mins, vec3_t maxs);
  116. int VectorCompare (vec3_t v1, vec3_t v2);
  117. vec_t VectorLength (vec3_t v);
  118. void CrossProduct (vec3_t v1, vec3_t v2, vec3_t cross);
  119. vec_t VectorNormalize (vec3_t v); // returns vector length
  120. vec_t VectorNormalize2 (vec3_t v, vec3_t out);
  121. void VectorInverse (vec3_t v);
  122. void VectorScale (vec3_t in, vec_t scale, vec3_t out);
  123. int Q_log2(int val);
  124. void R_ConcatRotations (float in1[3][3], float in2[3][3], float out[3][3]);
  125. void R_ConcatTransforms (float in1[3][4], float in2[3][4], float out[3][4]);
  126. void AngleVectors (vec3_t angles, vec3_t forward, vec3_t right, vec3_t up);
  127. int BoxOnPlaneSide (vec3_t emins, vec3_t emaxs, struct cplane_s *plane);
  128. float anglemod(float a);
  129. float LerpAngle (float a1, float a2, float frac);
  130. #define BOX_ON_PLANE_SIDE(emins, emaxs, p) \
  131. (((p)->type < 3)? \
  132. ( \
  133. ((p)->dist <= (emins)[(p)->type])? \
  134. 1 \
  135. : \
  136. ( \
  137. ((p)->dist >= (emaxs)[(p)->type])?\
  138. 2 \
  139. : \
  140. 3 \
  141. ) \
  142. ) \
  143. : \
  144. BoxOnPlaneSide( (emins), (emaxs), (p)))
  145. void ProjectPointOnPlane( vec3_t dst, const vec3_t p, const vec3_t normal );
  146. void PerpendicularVector( vec3_t dst, const vec3_t src );
  147. void RotatePointAroundVector( vec3_t dst, const vec3_t dir, const vec3_t point, float degrees );
  148. //=============================================
  149. char *COM_SkipPath (char *pathname);
  150. void COM_StripExtension (char *in, char *out);
  151. void COM_FileBase (char *in, char *out);
  152. void COM_FilePath (char *in, char *out);
  153. void COM_DefaultExtension (char *path, char *extension);
  154. char *COM_Parse (char **data_p);
  155. // data is an in/out parm, returns a parsed out token
  156. void Com_sprintf (char *dest, int size, char *fmt, ...);
  157. void Com_PageInMemory (byte *buffer, int size);
  158. //=============================================
  159. // portable case insensitive compare
  160. int Q_stricmp (char *s1, char *s2);
  161. int Q_strcasecmp (char *s1, char *s2);
  162. int Q_strncasecmp (char *s1, char *s2, int n);
  163. //=============================================
  164. short BigShort(short l);
  165. short LittleShort(short l);
  166. int BigLong (int l);
  167. int LittleLong (int l);
  168. float BigFloat (float l);
  169. float LittleFloat (float l);
  170. void Swap_Init (void);
  171. char *va(char *format, ...);
  172. //=============================================
  173. //
  174. // key / value info strings
  175. //
  176. #define MAX_INFO_KEY 64
  177. #define MAX_INFO_VALUE 64
  178. #define MAX_INFO_STRING 512
  179. char *Info_ValueForKey (char *s, char *key);
  180. void Info_RemoveKey (char *s, char *key);
  181. void Info_SetValueForKey (char *s, char *key, char *value);
  182. qboolean Info_Validate (char *s);
  183. /*
  184. ==============================================================
  185. SYSTEM SPECIFIC
  186. ==============================================================
  187. */
  188. extern int curtime; // time returned by last Sys_Milliseconds
  189. int Sys_Milliseconds (void);
  190. void Sys_Mkdir (char *path);
  191. // large block stack allocation routines
  192. void *Hunk_Begin (int maxsize);
  193. void *Hunk_Alloc (int size);
  194. void Hunk_Free (void *buf);
  195. int Hunk_End (void);
  196. // directory searching
  197. #define SFF_ARCH 0x01
  198. #define SFF_HIDDEN 0x02
  199. #define SFF_RDONLY 0x04
  200. #define SFF_SUBDIR 0x08
  201. #define SFF_SYSTEM 0x10
  202. /*
  203. ** pass in an attribute mask of things you wish to REJECT
  204. */
  205. char *Sys_FindFirst (char *path, unsigned musthave, unsigned canthave );
  206. char *Sys_FindNext ( unsigned musthave, unsigned canthave );
  207. void Sys_FindClose (void);
  208. // this is only here so the functions in q_shared.c and q_shwin.c can link
  209. void Sys_Error (char *error, ...);
  210. void Com_Printf (char *msg, ...);
  211. /*
  212. ==========================================================
  213. CVARS (console variables)
  214. ==========================================================
  215. */
  216. #ifndef CVAR
  217. #define CVAR
  218. #define CVAR_ARCHIVE 1 // set to cause it to be saved to vars.rc
  219. #define CVAR_USERINFO 2 // added to userinfo when changed
  220. #define CVAR_SERVERINFO 4 // added to serverinfo when changed
  221. #define CVAR_NOSET 8 // don't allow change from console at all,
  222. // but can be set from the command line
  223. #define CVAR_LATCH 16 // save changes until server restart
  224. // nothing outside the Cvar_*() functions should modify these fields!
  225. typedef struct cvar_s
  226. {
  227. char *name;
  228. char *string;
  229. char *latched_string; // for CVAR_LATCH vars
  230. int flags;
  231. qboolean modified; // set each time the cvar is changed
  232. float value;
  233. struct cvar_s *next;
  234. } cvar_t;
  235. #endif // CVAR
  236. /*
  237. ==============================================================
  238. COLLISION DETECTION
  239. ==============================================================
  240. */
  241. // lower bits are stronger, and will eat weaker brushes completely
  242. #define CONTENTS_SOLID 1 // an eye is never valid in a solid
  243. #define CONTENTS_WINDOW 2 // translucent, but not watery
  244. #define CONTENTS_AUX 4
  245. #define CONTENTS_LAVA 8
  246. #define CONTENTS_SLIME 16
  247. #define CONTENTS_WATER 32
  248. #define CONTENTS_MIST 64
  249. #define LAST_VISIBLE_CONTENTS 64
  250. // remaining contents are non-visible, and don't eat brushes
  251. #define CONTENTS_AREAPORTAL 0x8000
  252. #define CONTENTS_PLAYERCLIP 0x10000
  253. #define CONTENTS_MONSTERCLIP 0x20000
  254. // currents can be added to any other contents, and may be mixed
  255. #define CONTENTS_CURRENT_0 0x40000
  256. #define CONTENTS_CURRENT_90 0x80000
  257. #define CONTENTS_CURRENT_180 0x100000
  258. #define CONTENTS_CURRENT_270 0x200000
  259. #define CONTENTS_CURRENT_UP 0x400000
  260. #define CONTENTS_CURRENT_DOWN 0x800000
  261. #define CONTENTS_ORIGIN 0x1000000 // removed before bsping an entity
  262. #define CONTENTS_MONSTER 0x2000000 // should never be on a brush, only in game
  263. #define CONTENTS_DEADMONSTER 0x4000000
  264. #define CONTENTS_DETAIL 0x8000000 // brushes to be added after vis leafs
  265. #define CONTENTS_TRANSLUCENT 0x10000000 // auto set if any surface has trans
  266. #define CONTENTS_LADDER 0x20000000
  267. #define SURF_LIGHT 0x1 // value will hold the light strength
  268. #define SURF_SLICK 0x2 // effects game physics
  269. #define SURF_SKY 0x4 // don't draw, but add to skybox
  270. #define SURF_WARP 0x8 // turbulent water warp
  271. #define SURF_TRANS33 0x10
  272. #define SURF_TRANS66 0x20
  273. #define SURF_FLOWING 0x40 // scroll towards angle
  274. #define SURF_NODRAW 0x80 // don't bother referencing the texture
  275. // content masks
  276. #define MASK_ALL (-1)
  277. #define MASK_SOLID (CONTENTS_SOLID|CONTENTS_WINDOW)
  278. #define MASK_PLAYERSOLID (CONTENTS_SOLID|CONTENTS_PLAYERCLIP|CONTENTS_WINDOW|CONTENTS_MONSTER)
  279. #define MASK_DEADSOLID (CONTENTS_SOLID|CONTENTS_PLAYERCLIP|CONTENTS_WINDOW)
  280. #define MASK_MONSTERSOLID (CONTENTS_SOLID|CONTENTS_MONSTERCLIP|CONTENTS_WINDOW|CONTENTS_MONSTER)
  281. #define MASK_WATER (CONTENTS_WATER|CONTENTS_LAVA|CONTENTS_SLIME)
  282. #define MASK_OPAQUE (CONTENTS_SOLID|CONTENTS_SLIME|CONTENTS_LAVA)
  283. #define MASK_SHOT (CONTENTS_SOLID|CONTENTS_MONSTER|CONTENTS_WINDOW|CONTENTS_DEADMONSTER)
  284. #define MASK_CURRENT (CONTENTS_CURRENT_0|CONTENTS_CURRENT_90|CONTENTS_CURRENT_180|CONTENTS_CURRENT_270|CONTENTS_CURRENT_UP|CONTENTS_CURRENT_DOWN)
  285. // gi.BoxEdicts() can return a list of either solid or trigger entities
  286. // FIXME: eliminate AREA_ distinction?
  287. #define AREA_SOLID 1
  288. #define AREA_TRIGGERS 2
  289. // plane_t structure
  290. // !!! if this is changed, it must be changed in asm code too !!!
  291. typedef struct cplane_s
  292. {
  293. vec3_t normal;
  294. float dist;
  295. byte type; // for fast side tests
  296. byte signbits; // signx + (signy<<1) + (signz<<1)
  297. byte pad[2];
  298. } cplane_t;
  299. // structure offset for asm code
  300. #define CPLANE_NORMAL_X 0
  301. #define CPLANE_NORMAL_Y 4
  302. #define CPLANE_NORMAL_Z 8
  303. #define CPLANE_DIST 12
  304. #define CPLANE_TYPE 16
  305. #define CPLANE_SIGNBITS 17
  306. #define CPLANE_PAD0 18
  307. #define CPLANE_PAD1 19
  308. typedef struct cmodel_s
  309. {
  310. vec3_t mins, maxs;
  311. vec3_t origin; // for sounds or lights
  312. int headnode;
  313. } cmodel_t;
  314. typedef struct csurface_s
  315. {
  316. char name[16];
  317. int flags;
  318. int value;
  319. } csurface_t;
  320. typedef struct mapsurface_s // used internally due to name len probs //ZOID
  321. {
  322. csurface_t c;
  323. char rname[32];
  324. } mapsurface_t;
  325. // a trace is returned when a box is swept through the world
  326. typedef struct
  327. {
  328. qboolean allsolid; // if true, plane is not valid
  329. qboolean startsolid; // if true, the initial point was in a solid area
  330. float fraction; // time completed, 1.0 = didn't hit anything
  331. vec3_t endpos; // final position
  332. cplane_t plane; // surface normal at impact
  333. csurface_t *surface; // surface hit
  334. int contents; // contents on other side of surface hit
  335. struct edict_s *ent; // not set by CM_*() functions
  336. } trace_t;
  337. // pmove_state_t is the information necessary for client side movement
  338. // prediction
  339. typedef enum
  340. {
  341. // can accelerate and turn
  342. PM_NORMAL,
  343. PM_SPECTATOR,
  344. // no acceleration or turning
  345. PM_DEAD,
  346. PM_GIB, // different bounding box
  347. PM_FREEZE
  348. } pmtype_t;
  349. // pmove->pm_flags
  350. #define PMF_DUCKED 1
  351. #define PMF_JUMP_HELD 2
  352. #define PMF_ON_GROUND 4
  353. #define PMF_TIME_WATERJUMP 8 // pm_time is waterjump
  354. #define PMF_TIME_LAND 16 // pm_time is time before rejump
  355. #define PMF_TIME_TELEPORT 32 // pm_time is non-moving time
  356. #define PMF_NO_PREDICTION 64 // temporarily disables prediction (used for grappling hook)
  357. // this structure needs to be communicated bit-accurate
  358. // from the server to the client to guarantee that
  359. // prediction stays in sync, so no floats are used.
  360. // if any part of the game code modifies this struct, it
  361. // will result in a prediction error of some degree.
  362. typedef struct
  363. {
  364. pmtype_t pm_type;
  365. short origin[3]; // 12.3
  366. short velocity[3]; // 12.3
  367. byte pm_flags; // ducked, jump_held, etc
  368. byte pm_time; // each unit = 8 ms
  369. short gravity;
  370. short delta_angles[3]; // add to command angles to get view direction
  371. // changed by spawns, rotating objects, and teleporters
  372. } pmove_state_t;
  373. //
  374. // button bits
  375. //
  376. #define BUTTON_ATTACK 1
  377. #define BUTTON_USE 2
  378. #define BUTTON_ANY 128 // any key whatsoever
  379. // usercmd_t is sent to the server each client frame
  380. typedef struct usercmd_s
  381. {
  382. byte msec;
  383. byte buttons;
  384. short angles[3];
  385. short forwardmove, sidemove, upmove;
  386. byte impulse; // remove?
  387. byte lightlevel; // light level the player is standing on
  388. } usercmd_t;
  389. #define MAXTOUCH 32
  390. typedef struct
  391. {
  392. // state (in / out)
  393. pmove_state_t s;
  394. // command (in)
  395. usercmd_t cmd;
  396. qboolean snapinitial; // if s has been changed outside pmove
  397. // results (out)
  398. int numtouch;
  399. struct edict_s *touchents[MAXTOUCH];
  400. vec3_t viewangles; // clamped
  401. float viewheight;
  402. vec3_t mins, maxs; // bounding box size
  403. struct edict_s *groundentity;
  404. int watertype;
  405. int waterlevel;
  406. // callbacks to test the world
  407. trace_t (*trace) (vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end);
  408. int (*pointcontents) (vec3_t point);
  409. } pmove_t;
  410. // entity_state_t->effects
  411. // Effects are things handled on the client side (lights, particles, frame animations)
  412. // that happen constantly on the given entity.
  413. // An entity that has effects will be sent to the client
  414. // even if it has a zero index model.
  415. #define EF_ROTATE 0x00000001 // rotate (bonus items)
  416. #define EF_GIB 0x00000002 // leave a trail
  417. #define EF_BLASTER 0x00000008 // redlight + trail
  418. #define EF_ROCKET 0x00000010 // redlight + trail
  419. #define EF_GRENADE 0x00000020
  420. #define EF_HYPERBLASTER 0x00000040
  421. #define EF_BFG 0x00000080
  422. #define EF_COLOR_SHELL 0x00000100
  423. #define EF_POWERSCREEN 0x00000200
  424. #define EF_ANIM01 0x00000400 // automatically cycle between frames 0 and 1 at 2 hz
  425. #define EF_ANIM23 0x00000800 // automatically cycle between frames 2 and 3 at 2 hz
  426. #define EF_ANIM_ALL 0x00001000 // automatically cycle through all frames at 2hz
  427. #define EF_ANIM_ALLFAST 0x00002000 // automatically cycle through all frames at 10hz
  428. #define EF_FLIES 0x00004000
  429. #define EF_QUAD 0x00008000
  430. #define EF_PENT 0x00010000
  431. #define EF_TELEPORTER 0x00020000 // particle fountain
  432. #define EF_FLAG1 0x00040000
  433. #define EF_FLAG2 0x00080000
  434. // RAFAEL
  435. #define EF_IONRIPPER 0x00100000
  436. #define EF_GREENGIB 0x00200000
  437. #define EF_BLUEHYPERBLASTER 0x00400000
  438. #define EF_SPINNINGLIGHTS 0x00800000
  439. #define EF_PLASMA 0x01000000
  440. #define EF_TRAP 0x02000000
  441. //ROGUE
  442. #define EF_TRACKER 0x04000000
  443. #define EF_DOUBLE 0x08000000
  444. #define EF_SPHERETRANS 0x10000000
  445. #define EF_TAGTRAIL 0x20000000
  446. #define EF_HALF_DAMAGE 0x40000000
  447. #define EF_TRACKERTRAIL 0x80000000
  448. //ROGUE
  449. // entity_state_t->renderfx flags
  450. #define RF_MINLIGHT 1 // allways have some light (viewmodel)
  451. #define RF_VIEWERMODEL 2 // don't draw through eyes, only mirrors
  452. #define RF_WEAPONMODEL 4 // only draw through eyes
  453. #define RF_FULLBRIGHT 8 // allways draw full intensity
  454. #define RF_DEPTHHACK 16 // for view weapon Z crunching
  455. #define RF_TRANSLUCENT 32
  456. #define RF_FRAMELERP 64
  457. #define RF_BEAM 128
  458. #define RF_CUSTOMSKIN 256 // skin is an index in image_precache
  459. #define RF_GLOW 512 // pulse lighting for bonus items
  460. #define RF_SHELL_RED 1024
  461. #define RF_SHELL_GREEN 2048
  462. #define RF_SHELL_BLUE 4096
  463. //ROGUE
  464. #define RF_IR_VISIBLE 0x00008000 // 32768
  465. #define RF_SHELL_DOUBLE 0x00010000 // 65536
  466. #define RF_SHELL_HALF_DAM 0x00020000
  467. #define RF_USE_DISGUISE 0x00040000
  468. //ROGUE
  469. // player_state_t->refdef flags
  470. #define RDF_UNDERWATER 1 // warp the screen as apropriate
  471. #define RDF_NOWORLDMODEL 2 // used for player configuration screen
  472. //ROGUE
  473. #define RDF_IRGOGGLES 4
  474. #define RDF_UVGOGGLES 8
  475. //ROGUE
  476. //
  477. // muzzle flashes / player effects
  478. //
  479. #define MZ_BLASTER 0
  480. #define MZ_MACHINEGUN 1
  481. #define MZ_SHOTGUN 2
  482. #define MZ_CHAINGUN1 3
  483. #define MZ_CHAINGUN2 4
  484. #define MZ_CHAINGUN3 5
  485. #define MZ_RAILGUN 6
  486. #define MZ_ROCKET 7
  487. #define MZ_GRENADE 8
  488. #define MZ_LOGIN 9
  489. #define MZ_LOGOUT 10
  490. #define MZ_RESPAWN 11
  491. #define MZ_BFG 12
  492. #define MZ_SSHOTGUN 13
  493. #define MZ_HYPERBLASTER 14
  494. #define MZ_ITEMRESPAWN 15
  495. // RAFAEL
  496. #define MZ_IONRIPPER 16
  497. #define MZ_BLUEHYPERBLASTER 17
  498. #define MZ_PHALANX 18
  499. #define MZ_SILENCED 128 // bit flag ORed with one of the above numbers
  500. //ROGUE
  501. #define MZ_ETF_RIFLE 30
  502. #define MZ_UNUSED 31
  503. #define MZ_SHOTGUN2 32
  504. #define MZ_HEATBEAM 33
  505. #define MZ_BLASTER2 34
  506. #define MZ_TRACKER 35
  507. #define MZ_NUKE1 36
  508. #define MZ_NUKE2 37
  509. #define MZ_NUKE4 38
  510. #define MZ_NUKE8 39
  511. //ROGUE
  512. //
  513. // monster muzzle flashes
  514. //
  515. #define MZ2_TANK_BLASTER_1 1
  516. #define MZ2_TANK_BLASTER_2 2
  517. #define MZ2_TANK_BLASTER_3 3
  518. #define MZ2_TANK_MACHINEGUN_1 4
  519. #define MZ2_TANK_MACHINEGUN_2 5
  520. #define MZ2_TANK_MACHINEGUN_3 6
  521. #define MZ2_TANK_MACHINEGUN_4 7
  522. #define MZ2_TANK_MACHINEGUN_5 8
  523. #define MZ2_TANK_MACHINEGUN_6 9
  524. #define MZ2_TANK_MACHINEGUN_7 10
  525. #define MZ2_TANK_MACHINEGUN_8 11
  526. #define MZ2_TANK_MACHINEGUN_9 12
  527. #define MZ2_TANK_MACHINEGUN_10 13
  528. #define MZ2_TANK_MACHINEGUN_11 14
  529. #define MZ2_TANK_MACHINEGUN_12 15
  530. #define MZ2_TANK_MACHINEGUN_13 16
  531. #define MZ2_TANK_MACHINEGUN_14 17
  532. #define MZ2_TANK_MACHINEGUN_15 18
  533. #define MZ2_TANK_MACHINEGUN_16 19
  534. #define MZ2_TANK_MACHINEGUN_17 20
  535. #define MZ2_TANK_MACHINEGUN_18 21
  536. #define MZ2_TANK_MACHINEGUN_19 22
  537. #define MZ2_TANK_ROCKET_1 23
  538. #define MZ2_TANK_ROCKET_2 24
  539. #define MZ2_TANK_ROCKET_3 25
  540. #define MZ2_INFANTRY_MACHINEGUN_1 26
  541. #define MZ2_INFANTRY_MACHINEGUN_2 27
  542. #define MZ2_INFANTRY_MACHINEGUN_3 28
  543. #define MZ2_INFANTRY_MACHINEGUN_4 29
  544. #define MZ2_INFANTRY_MACHINEGUN_5 30
  545. #define MZ2_INFANTRY_MACHINEGUN_6 31
  546. #define MZ2_INFANTRY_MACHINEGUN_7 32
  547. #define MZ2_INFANTRY_MACHINEGUN_8 33
  548. #define MZ2_INFANTRY_MACHINEGUN_9 34
  549. #define MZ2_INFANTRY_MACHINEGUN_10 35
  550. #define MZ2_INFANTRY_MACHINEGUN_11 36
  551. #define MZ2_INFANTRY_MACHINEGUN_12 37
  552. #define MZ2_INFANTRY_MACHINEGUN_13 38
  553. #define MZ2_SOLDIER_BLASTER_1 39
  554. #define MZ2_SOLDIER_BLASTER_2 40
  555. #define MZ2_SOLDIER_SHOTGUN_1 41
  556. #define MZ2_SOLDIER_SHOTGUN_2 42
  557. #define MZ2_SOLDIER_MACHINEGUN_1 43
  558. #define MZ2_SOLDIER_MACHINEGUN_2 44
  559. #define MZ2_GUNNER_MACHINEGUN_1 45
  560. #define MZ2_GUNNER_MACHINEGUN_2 46
  561. #define MZ2_GUNNER_MACHINEGUN_3 47
  562. #define MZ2_GUNNER_MACHINEGUN_4 48
  563. #define MZ2_GUNNER_MACHINEGUN_5 49
  564. #define MZ2_GUNNER_MACHINEGUN_6 50
  565. #define MZ2_GUNNER_MACHINEGUN_7 51
  566. #define MZ2_GUNNER_MACHINEGUN_8 52
  567. #define MZ2_GUNNER_GRENADE_1 53
  568. #define MZ2_GUNNER_GRENADE_2 54
  569. #define MZ2_GUNNER_GRENADE_3 55
  570. #define MZ2_GUNNER_GRENADE_4 56
  571. #define MZ2_CHICK_ROCKET_1 57
  572. #define MZ2_FLYER_BLASTER_1 58
  573. #define MZ2_FLYER_BLASTER_2 59
  574. #define MZ2_MEDIC_BLASTER_1 60
  575. #define MZ2_GLADIATOR_RAILGUN_1 61
  576. #define MZ2_HOVER_BLASTER_1 62
  577. #define MZ2_ACTOR_MACHINEGUN_1 63
  578. #define MZ2_SUPERTANK_MACHINEGUN_1 64
  579. #define MZ2_SUPERTANK_MACHINEGUN_2 65
  580. #define MZ2_SUPERTANK_MACHINEGUN_3 66
  581. #define MZ2_SUPERTANK_MACHINEGUN_4 67
  582. #define MZ2_SUPERTANK_MACHINEGUN_5 68
  583. #define MZ2_SUPERTANK_MACHINEGUN_6 69
  584. #define MZ2_SUPERTANK_ROCKET_1 70
  585. #define MZ2_SUPERTANK_ROCKET_2 71
  586. #define MZ2_SUPERTANK_ROCKET_3 72
  587. #define MZ2_BOSS2_MACHINEGUN_L1 73
  588. #define MZ2_BOSS2_MACHINEGUN_L2 74
  589. #define MZ2_BOSS2_MACHINEGUN_L3 75
  590. #define MZ2_BOSS2_MACHINEGUN_L4 76
  591. #define MZ2_BOSS2_MACHINEGUN_L5 77
  592. #define MZ2_BOSS2_ROCKET_1 78
  593. #define MZ2_BOSS2_ROCKET_2 79
  594. #define MZ2_BOSS2_ROCKET_3 80
  595. #define MZ2_BOSS2_ROCKET_4 81
  596. #define MZ2_FLOAT_BLASTER_1 82
  597. #define MZ2_SOLDIER_BLASTER_3 83
  598. #define MZ2_SOLDIER_SHOTGUN_3 84
  599. #define MZ2_SOLDIER_MACHINEGUN_3 85
  600. #define MZ2_SOLDIER_BLASTER_4 86
  601. #define MZ2_SOLDIER_SHOTGUN_4 87
  602. #define MZ2_SOLDIER_MACHINEGUN_4 88
  603. #define MZ2_SOLDIER_BLASTER_5 89
  604. #define MZ2_SOLDIER_SHOTGUN_5 90
  605. #define MZ2_SOLDIER_MACHINEGUN_5 91
  606. #define MZ2_SOLDIER_BLASTER_6 92
  607. #define MZ2_SOLDIER_SHOTGUN_6 93
  608. #define MZ2_SOLDIER_MACHINEGUN_6 94
  609. #define MZ2_SOLDIER_BLASTER_7 95
  610. #define MZ2_SOLDIER_SHOTGUN_7 96
  611. #define MZ2_SOLDIER_MACHINEGUN_7 97
  612. #define MZ2_SOLDIER_BLASTER_8 98
  613. #define MZ2_SOLDIER_SHOTGUN_8 99
  614. #define MZ2_SOLDIER_MACHINEGUN_8 100
  615. // --- Xian shit below ---
  616. #define MZ2_MAKRON_BFG 101
  617. #define MZ2_MAKRON_BLASTER_1 102
  618. #define MZ2_MAKRON_BLASTER_2 103
  619. #define MZ2_MAKRON_BLASTER_3 104
  620. #define MZ2_MAKRON_BLASTER_4 105
  621. #define MZ2_MAKRON_BLASTER_5 106
  622. #define MZ2_MAKRON_BLASTER_6 107
  623. #define MZ2_MAKRON_BLASTER_7 108
  624. #define MZ2_MAKRON_BLASTER_8 109
  625. #define MZ2_MAKRON_BLASTER_9 110
  626. #define MZ2_MAKRON_BLASTER_10 111
  627. #define MZ2_MAKRON_BLASTER_11 112
  628. #define MZ2_MAKRON_BLASTER_12 113
  629. #define MZ2_MAKRON_BLASTER_13 114
  630. #define MZ2_MAKRON_BLASTER_14 115
  631. #define MZ2_MAKRON_BLASTER_15 116
  632. #define MZ2_MAKRON_BLASTER_16 117
  633. #define MZ2_MAKRON_BLASTER_17 118
  634. #define MZ2_MAKRON_RAILGUN_1 119
  635. #define MZ2_JORG_MACHINEGUN_L1 120
  636. #define MZ2_JORG_MACHINEGUN_L2 121
  637. #define MZ2_JORG_MACHINEGUN_L3 122
  638. #define MZ2_JORG_MACHINEGUN_L4 123
  639. #define MZ2_JORG_MACHINEGUN_L5 124
  640. #define MZ2_JORG_MACHINEGUN_L6 125
  641. #define MZ2_JORG_MACHINEGUN_R1 126
  642. #define MZ2_JORG_MACHINEGUN_R2 127
  643. #define MZ2_JORG_MACHINEGUN_R3 128
  644. #define MZ2_JORG_MACHINEGUN_R4 129
  645. #define MZ2_JORG_MACHINEGUN_R5 130
  646. #define MZ2_JORG_MACHINEGUN_R6 131
  647. #define MZ2_JORG_BFG_1 132
  648. #define MZ2_BOSS2_MACHINEGUN_R1 133
  649. #define MZ2_BOSS2_MACHINEGUN_R2 134
  650. #define MZ2_BOSS2_MACHINEGUN_R3 135
  651. #define MZ2_BOSS2_MACHINEGUN_R4 136
  652. #define MZ2_BOSS2_MACHINEGUN_R5 137
  653. //ROGUE
  654. #define MZ2_CARRIER_MACHINEGUN_L1 138
  655. #define MZ2_CARRIER_MACHINEGUN_R1 139
  656. #define MZ2_CARRIER_GRENADE 140
  657. #define MZ2_TURRET_MACHINEGUN 141
  658. #define MZ2_TURRET_ROCKET 142
  659. #define MZ2_TURRET_BLASTER 143
  660. #define MZ2_STALKER_BLASTER 144
  661. #define MZ2_DAEDALUS_BLASTER 145
  662. #define MZ2_MEDIC_BLASTER_2 146
  663. #define MZ2_CARRIER_RAILGUN 147
  664. #define MZ2_WIDOW_DISRUPTOR 148
  665. #define MZ2_WIDOW_BLASTER 149
  666. #define MZ2_WIDOW_RAIL 150
  667. #define MZ2_WIDOW_PLASMABEAM 151 // PMM - not used
  668. #define MZ2_CARRIER_MACHINEGUN_L2 152
  669. #define MZ2_CARRIER_MACHINEGUN_R2 153
  670. #define MZ2_WIDOW_RAIL_LEFT 154
  671. #define MZ2_WIDOW_RAIL_RIGHT 155
  672. #define MZ2_WIDOW_BLASTER_SWEEP1 156
  673. #define MZ2_WIDOW_BLASTER_SWEEP2 157
  674. #define MZ2_WIDOW_BLASTER_SWEEP3 158
  675. #define MZ2_WIDOW_BLASTER_SWEEP4 159
  676. #define MZ2_WIDOW_BLASTER_SWEEP5 160
  677. #define MZ2_WIDOW_BLASTER_SWEEP6 161
  678. #define MZ2_WIDOW_BLASTER_SWEEP7 162
  679. #define MZ2_WIDOW_BLASTER_SWEEP8 163
  680. #define MZ2_WIDOW_BLASTER_SWEEP9 164
  681. #define MZ2_WIDOW_BLASTER_100 165
  682. #define MZ2_WIDOW_BLASTER_90 166
  683. #define MZ2_WIDOW_BLASTER_80 167
  684. #define MZ2_WIDOW_BLASTER_70 168
  685. #define MZ2_WIDOW_BLASTER_60 169
  686. #define MZ2_WIDOW_BLASTER_50 170
  687. #define MZ2_WIDOW_BLASTER_40 171
  688. #define MZ2_WIDOW_BLASTER_30 172
  689. #define MZ2_WIDOW_BLASTER_20 173
  690. #define MZ2_WIDOW_BLASTER_10 174
  691. #define MZ2_WIDOW_BLASTER_0 175
  692. #define MZ2_WIDOW_BLASTER_10L 176
  693. #define MZ2_WIDOW_BLASTER_20L 177
  694. #define MZ2_WIDOW_BLASTER_30L 178
  695. #define MZ2_WIDOW_BLASTER_40L 179
  696. #define MZ2_WIDOW_BLASTER_50L 180
  697. #define MZ2_WIDOW_BLASTER_60L 181
  698. #define MZ2_WIDOW_BLASTER_70L 182
  699. #define MZ2_WIDOW_RUN_1 183
  700. #define MZ2_WIDOW_RUN_2 184
  701. #define MZ2_WIDOW_RUN_3 185
  702. #define MZ2_WIDOW_RUN_4 186
  703. #define MZ2_WIDOW_RUN_5 187
  704. #define MZ2_WIDOW_RUN_6 188
  705. #define MZ2_WIDOW_RUN_7 189
  706. #define MZ2_WIDOW_RUN_8 190
  707. #define MZ2_CARRIER_ROCKET_1 191
  708. #define MZ2_CARRIER_ROCKET_2 192
  709. #define MZ2_CARRIER_ROCKET_3 193
  710. #define MZ2_CARRIER_ROCKET_4 194
  711. #define MZ2_WIDOW2_BEAMER_1 195
  712. #define MZ2_WIDOW2_BEAMER_2 196
  713. #define MZ2_WIDOW2_BEAMER_3 197
  714. #define MZ2_WIDOW2_BEAMER_4 198
  715. #define MZ2_WIDOW2_BEAMER_5 199
  716. #define MZ2_WIDOW2_BEAM_SWEEP_1 200
  717. #define MZ2_WIDOW2_BEAM_SWEEP_2 201
  718. #define MZ2_WIDOW2_BEAM_SWEEP_3 202
  719. #define MZ2_WIDOW2_BEAM_SWEEP_4 203
  720. #define MZ2_WIDOW2_BEAM_SWEEP_5 204
  721. #define MZ2_WIDOW2_BEAM_SWEEP_6 205
  722. #define MZ2_WIDOW2_BEAM_SWEEP_7 206
  723. #define MZ2_WIDOW2_BEAM_SWEEP_8 207
  724. #define MZ2_WIDOW2_BEAM_SWEEP_9 208
  725. #define MZ2_WIDOW2_BEAM_SWEEP_10 209
  726. #define MZ2_WIDOW2_BEAM_SWEEP_11 210
  727. // ROGUE
  728. extern vec3_t monster_flash_offset [];
  729. // temp entity events
  730. //
  731. // Temp entity events are for things that happen
  732. // at a location seperate from any existing entity.
  733. // Temporary entity messages are explicitly constructed
  734. // and broadcast.
  735. typedef enum
  736. {
  737. TE_GUNSHOT,
  738. TE_BLOOD,
  739. TE_BLASTER,
  740. TE_RAILTRAIL,
  741. TE_SHOTGUN,
  742. TE_EXPLOSION1,
  743. TE_EXPLOSION2,
  744. TE_ROCKET_EXPLOSION,
  745. TE_GRENADE_EXPLOSION,
  746. TE_SPARKS,
  747. TE_SPLASH,
  748. TE_BUBBLETRAIL,
  749. TE_SCREEN_SPARKS,
  750. TE_SHIELD_SPARKS,
  751. TE_BULLET_SPARKS,
  752. TE_LASER_SPARKS,
  753. TE_PARASITE_ATTACK,
  754. TE_ROCKET_EXPLOSION_WATER,
  755. TE_GRENADE_EXPLOSION_WATER,
  756. TE_MEDIC_CABLE_ATTACK,
  757. TE_BFG_EXPLOSION,
  758. TE_BFG_BIGEXPLOSION,
  759. TE_BOSSTPORT, // used as '22' in a map, so DON'T RENUMBER!!!
  760. TE_BFG_LASER,
  761. TE_GRAPPLE_CABLE,
  762. TE_WELDING_SPARKS,
  763. TE_GREENBLOOD,
  764. TE_BLUEHYPERBLASTER,
  765. TE_PLASMA_EXPLOSION,
  766. TE_TUNNEL_SPARKS,
  767. //ROGUE
  768. TE_BLASTER2,
  769. TE_RAILTRAIL2,
  770. TE_FLAME,
  771. TE_LIGHTNING,
  772. TE_DEBUGTRAIL,
  773. TE_PLAIN_EXPLOSION,
  774. TE_FLASHLIGHT,
  775. TE_FORCEWALL,
  776. TE_HEATBEAM,
  777. TE_MONSTER_HEATBEAM,
  778. TE_STEAM,
  779. TE_BUBBLETRAIL2,
  780. TE_MOREBLOOD,
  781. TE_HEATBEAM_SPARKS,
  782. TE_HEATBEAM_STEAM,
  783. TE_CHAINFIST_SMOKE,
  784. TE_ELECTRIC_SPARKS,
  785. TE_TRACKER_EXPLOSION,
  786. TE_TELEPORT_EFFECT,
  787. TE_DBALL_GOAL,
  788. TE_WIDOWBEAMOUT,
  789. TE_NUKEBLAST,
  790. TE_WIDOWSPLASH,
  791. TE_EXPLOSION1_BIG,
  792. TE_EXPLOSION1_NP,
  793. TE_FLECHETTE
  794. //ROGUE
  795. } temp_event_t;
  796. #define SPLASH_UNKNOWN 0
  797. #define SPLASH_SPARKS 1
  798. #define SPLASH_BLUE_WATER 2
  799. #define SPLASH_BROWN_WATER 3
  800. #define SPLASH_SLIME 4
  801. #define SPLASH_LAVA 5
  802. #define SPLASH_BLOOD 6
  803. // sound channels
  804. // channel 0 never willingly overrides
  805. // other channels (1-7) allways override a playing sound on that channel
  806. #define CHAN_AUTO 0
  807. #define CHAN_WEAPON 1
  808. #define CHAN_VOICE 2
  809. #define CHAN_ITEM 3
  810. #define CHAN_BODY 4
  811. // modifier flags
  812. #define CHAN_NO_PHS_ADD 8 // send to all clients, not just ones in PHS (ATTN 0 will also do this)
  813. #define CHAN_RELIABLE 16 // send by reliable message, not datagram
  814. // sound attenuation values
  815. #define ATTN_NONE 0 // full volume the entire level
  816. #define ATTN_NORM 1
  817. #define ATTN_IDLE 2
  818. #define ATTN_STATIC 3 // diminish very rapidly with distance
  819. // player_state->stats[] indexes
  820. #define STAT_HEALTH_ICON 0
  821. #define STAT_HEALTH 1
  822. #define STAT_AMMO_ICON 2
  823. #define STAT_AMMO 3
  824. #define STAT_ARMOR_ICON 4
  825. #define STAT_ARMOR 5
  826. #define STAT_SELECTED_ICON 6
  827. #define STAT_PICKUP_ICON 7
  828. #define STAT_PICKUP_STRING 8
  829. #define STAT_TIMER_ICON 9
  830. #define STAT_TIMER 10
  831. #define STAT_HELPICON 11
  832. #define STAT_SELECTED_ITEM 12
  833. #define STAT_LAYOUTS 13
  834. #define STAT_FRAGS 14
  835. #define STAT_FLASHES 15 // cleared each frame, 1 = health, 2 = armor
  836. #define STAT_CHASE 16
  837. #define STAT_SPECTATOR 17
  838. #define MAX_STATS 32
  839. // dmflags->value flags
  840. #define DF_NO_HEALTH 0x00000001 // 1
  841. #define DF_NO_ITEMS 0x00000002 // 2
  842. #define DF_WEAPONS_STAY 0x00000004 // 4
  843. #define DF_NO_FALLING 0x00000008 // 8
  844. #define DF_INSTANT_ITEMS 0x00000010 // 16
  845. #define DF_SAME_LEVEL 0x00000020 // 32
  846. #define DF_SKINTEAMS 0x00000040 // 64
  847. #define DF_MODELTEAMS 0x00000080 // 128
  848. #define DF_NO_FRIENDLY_FIRE 0x00000100 // 256
  849. #define DF_SPAWN_FARTHEST 0x00000200 // 512
  850. #define DF_FORCE_RESPAWN 0x00000400 // 1024
  851. #define DF_NO_ARMOR 0x00000800 // 2048
  852. #define DF_ALLOW_EXIT 0x00001000 // 4096
  853. #define DF_INFINITE_AMMO 0x00002000 // 8192
  854. #define DF_QUAD_DROP 0x00004000 // 16384
  855. #define DF_FIXED_FOV 0x00008000 // 32768
  856. // RAFAEL
  857. #define DF_QUADFIRE_DROP 0x00010000 // 65536
  858. //ROGUE
  859. #define DF_NO_MINES 0x00020000
  860. #define DF_NO_STACK_DOUBLE 0x00040000
  861. #define DF_NO_NUKES 0x00080000
  862. #define DF_NO_SPHERES 0x00100000
  863. //ROGUE
  864. /*
  865. ROGUE - VERSIONS
  866. 1234 08/13/1998 Activision
  867. 1235 08/14/1998 Id Software
  868. 1236 08/15/1998 Steve Tietze
  869. 1237 08/15/1998 Phil Dobranski
  870. 1238 08/15/1998 John Sheley
  871. 1239 08/17/1998 Barrett Alexander
  872. 1230 08/17/1998 Brandon Fish
  873. 1245 08/17/1998 Don MacAskill
  874. 1246 08/17/1998 David "Zoid" Kirsch
  875. 1247 08/17/1998 Manu Smith
  876. 1248 08/17/1998 Geoff Scully
  877. 1249 08/17/1998 Andy Van Fossen
  878. 1240 08/20/1998 Activision Build 2
  879. 1256 08/20/1998 Ranger Clan
  880. 1257 08/20/1998 Ensemble Studios
  881. 1258 08/21/1998 Robert Duffy
  882. 1259 08/21/1998 Stephen Seachord
  883. 1250 08/21/1998 Stephen Heaslip
  884. 1267 08/21/1998 Samir Sandesara
  885. 1268 08/21/1998 Oliver Wyman
  886. 1269 08/21/1998 Steven Marchegiano
  887. 1260 08/21/1998 Build #2 for Nihilistic
  888. 1278 08/21/1998 Build #2 for Ensemble
  889. 1279 08/26/1998 Build for Ron Solo - DEFUNCT
  890. 1270 08/26/1998 Build #3 for Activision
  891. 1289 08/26/1998 Build for Don MacAskill
  892. 1280 08/26/1998 Build for Robert Duffy
  893. 1290 08/26/1998 Build #2 for Rangers
  894. 1345 08/28/1998 Build #4 for Activision
  895. 2345 08/26/1998 Build for Zoid
  896. 9999 08/20/1998 Internal Use
  897. */
  898. //#define ROGUE_VERSION_ID 1345
  899. //#define ROGUE_VERSION_STRING "08/29/1998 Beta 4 for Activision"
  900. // ROGUE
  901. /*
  902. ==========================================================
  903. ELEMENTS COMMUNICATED ACROSS THE NET
  904. ==========================================================
  905. */
  906. #define ANGLE2SHORT(x) ((int)((x)*65536/360) & 65535)
  907. #define SHORT2ANGLE(x) ((x)*(360.0/65536))
  908. //
  909. // config strings are a general means of communication from
  910. // the server to all connected clients.
  911. // Each config string can be at most MAX_QPATH characters.
  912. //
  913. #define CS_NAME 0
  914. #define CS_CDTRACK 1
  915. #define CS_SKY 2
  916. #define CS_SKYAXIS 3 // %f %f %f format
  917. #define CS_SKYROTATE 4
  918. #define CS_STATUSBAR 5 // display program string
  919. #define CS_AIRACCEL 29 // air acceleration control
  920. #define CS_MAXCLIENTS 30
  921. #define CS_MAPCHECKSUM 31 // for catching cheater maps
  922. #define CS_MODELS 32
  923. #define CS_SOUNDS (CS_MODELS+MAX_MODELS)
  924. #define CS_IMAGES (CS_SOUNDS+MAX_SOUNDS)
  925. #define CS_LIGHTS (CS_IMAGES+MAX_IMAGES)
  926. #define CS_ITEMS (CS_LIGHTS+MAX_LIGHTSTYLES)
  927. #define CS_PLAYERSKINS (CS_ITEMS+MAX_ITEMS)
  928. #define CS_GENERAL (CS_PLAYERSKINS+MAX_CLIENTS)
  929. #define MAX_CONFIGSTRINGS (CS_GENERAL+MAX_GENERAL)
  930. //==============================================
  931. // entity_state_t->event values
  932. // ertity events are for effects that take place reletive
  933. // to an existing entities origin. Very network efficient.
  934. // All muzzle flashes really should be converted to events...
  935. typedef enum
  936. {
  937. EV_NONE,
  938. EV_ITEM_RESPAWN,
  939. EV_FOOTSTEP,
  940. EV_FALLSHORT,
  941. EV_FALL,
  942. EV_FALLFAR,
  943. EV_PLAYER_TELEPORT,
  944. EV_OTHER_TELEPORT
  945. } entity_event_t;
  946. // entity_state_t is the information conveyed from the server
  947. // in an update message about entities that the client will
  948. // need to render in some way
  949. typedef struct entity_state_s
  950. {
  951. int number; // edict index
  952. vec3_t origin;
  953. vec3_t angles;
  954. vec3_t old_origin; // for lerping
  955. int modelindex;
  956. int modelindex2, modelindex3, modelindex4; // weapons, CTF flags, etc
  957. int frame;
  958. int skinnum;
  959. unsigned int effects; // PGM - we're filling it, so it needs to be unsigned
  960. int renderfx;
  961. int solid; // for client side prediction, 8*(bits 0-4) is x/y radius
  962. // 8*(bits 5-9) is z down distance, 8(bits10-15) is z up
  963. // gi.linkentity sets this properly
  964. int sound; // for looping sounds, to guarantee shutoff
  965. int event; // impulse events -- muzzle flashes, footsteps, etc
  966. // events only go out for a single frame, they
  967. // are automatically cleared each frame
  968. } entity_state_t;
  969. //==============================================
  970. // player_state_t is the information needed in addition to pmove_state_t
  971. // to rendered a view. There will only be 10 player_state_t sent each second,
  972. // but the number of pmove_state_t changes will be reletive to client
  973. // frame rates
  974. typedef struct
  975. {
  976. pmove_state_t pmove; // for prediction
  977. // these fields do not need to be communicated bit-precise
  978. vec3_t viewangles; // for fixed views
  979. vec3_t viewoffset; // add to pmovestate->origin
  980. vec3_t kick_angles; // add to view direction to get render angles
  981. // set by weapon kicks, pain effects, etc
  982. vec3_t gunangles;
  983. vec3_t gunoffset;
  984. int gunindex;
  985. int gunframe;
  986. float blend[4]; // rgba full screen effect
  987. float fov; // horizontal field of view
  988. int rdflags; // refdef flags
  989. short stats[MAX_STATS]; // fast status bar updates
  990. } player_state_t;
  991. // ==================
  992. // PGM
  993. #define VIDREF_GL 1
  994. #define VIDREF_SOFT 2
  995. #define VIDREF_OTHER 3
  996. extern int vidref_val;
  997. // PGM
  998. // ==================