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