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