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