1 /*
2 ===========================================================================
3 Copyright (C) 1999 - 2005, Id Software, Inc.
4 Copyright (C) 2000 - 2013, Raven Software, Inc.
5 Copyright (C) 2001 - 2013, Activision, Inc.
6 Copyright (C) 2005 - 2015, ioquake3 contributors
7 Copyright (C) 2013 - 2015, OpenJK contributors
8 
9 This file is part of the OpenJK source code.
10 
11 OpenJK is free software; you can redistribute it and/or modify it
12 under the terms of the GNU General Public License version 2 as
13 published by the Free Software Foundation.
14 
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 GNU General Public License for more details.
19 
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, see <http://www.gnu.org/licenses/>.
22 ===========================================================================
23 */
24 
25 #pragma once
26 
27 #include "qcommon/q_shared.h"
28 #include "rd-common/tr_types.h"
29 #include "game/bg_public.h"
30 #include "cg_public.h"
31 
32 // The entire cgame module is unloaded and reloaded on each level change,
33 // so there is NO persistant data between levels on the client side.
34 // If you absolutely need something stored, it can either be kept
35 // by the server in the server stored userinfos, or stashed in a cvar.
36 
37 #define	POWERUP_BLINKS		5
38 
39 #define	POWERUP_BLINK_TIME	1000
40 #define	FADE_TIME			200
41 #define	PULSE_TIME			200
42 #define	DAMAGE_DEFLECT_TIME	100
43 #define	DAMAGE_RETURN_TIME	400
44 #define DAMAGE_TIME			500
45 #define	LAND_DEFLECT_TIME	150
46 #define	LAND_RETURN_TIME	300
47 #define	STEP_TIME			200
48 #define	DUCK_TIME			100
49 #define	PAIN_TWITCH_TIME	200
50 #define	WEAPON_SELECT_TIME	1400
51 #define	ITEM_SCALEUP_TIME	1000
52 
53 // Zoom vars
54 #define	ZOOM_TIME			150		// not currently used?
55 #define MAX_ZOOM_FOV		3.0f
56 #define ZOOM_IN_TIME		1500.0f
57 #define ZOOM_OUT_TIME		100.0f
58 #define ZOOM_START_PERCENT	0.3f
59 
60 #define	ITEM_BLOB_TIME		200
61 #define	MUZZLE_FLASH_TIME	20
62 #define	SINK_TIME			1000		// time for fragments to sink into ground before going away
63 #define	ATTACKER_HEAD_TIME	10000
64 #define	REWARD_TIME			3000
65 
66 #define	PULSE_SCALE			1.5			// amount to scale up the icons when activating
67 
68 #define	MAX_STEP_CHANGE		32
69 
70 #define	MAX_VERTS_ON_POLY	10
71 #define	MAX_MARK_POLYS		256
72 
73 #define STAT_MINUS			10	// num frame for '-' stats digit
74 
75 #define	ICON_SIZE			48
76 #define	TEXT_ICON_SPACE		4
77 
78 // very large characters
79 #define	GIANT_WIDTH			32
80 #define	GIANT_HEIGHT		48
81 
82 #define NUM_FONT_BIG	1
83 #define NUM_FONT_SMALL	2
84 #define NUM_FONT_CHUNKY	3
85 
86 #define	NUM_CROSSHAIRS		9
87 
88 #define TEAM_OVERLAY_MAXNAME_WIDTH	32
89 #define TEAM_OVERLAY_MAXLOCATION_WIDTH	64
90 
91 #define	WAVE_AMPLITUDE	1
92 #define	WAVE_FREQUENCY	0.4
93 
94 typedef enum {
95 	FOOTSTEP_STONEWALK,
96 	FOOTSTEP_STONERUN,
97 	FOOTSTEP_METALWALK,
98 	FOOTSTEP_METALRUN,
99 	FOOTSTEP_PIPEWALK,
100 	FOOTSTEP_PIPERUN,
101 	FOOTSTEP_SPLASH,
102 	FOOTSTEP_WADE,
103 	FOOTSTEP_SWIM,
104 	FOOTSTEP_SNOWWALK,
105 	FOOTSTEP_SNOWRUN,
106 	FOOTSTEP_SANDWALK,
107 	FOOTSTEP_SANDRUN,
108 	FOOTSTEP_GRASSWALK,
109 	FOOTSTEP_GRASSRUN,
110 	FOOTSTEP_DIRTWALK,
111 	FOOTSTEP_DIRTRUN,
112 	FOOTSTEP_MUDWALK,
113 	FOOTSTEP_MUDRUN,
114 	FOOTSTEP_GRAVELWALK,
115 	FOOTSTEP_GRAVELRUN,
116 	FOOTSTEP_RUGWALK,
117 	FOOTSTEP_RUGRUN,
118 	FOOTSTEP_WOODWALK,
119 	FOOTSTEP_WOODRUN,
120 
121 	FOOTSTEP_TOTAL
122 } footstep_t;
123 
124 typedef enum {
125 	IMPACTSOUND_DEFAULT,
126 	IMPACTSOUND_METAL,
127 	IMPACTSOUND_FLESH
128 } impactSound_t;
129 
130 //=================================================
131 
132 // player entities need to track more information
133 // than any other type of entity.
134 
135 // note that not every player entity is a client entity,
136 // because corpses after respawn are outside the normal
137 // client numbering range
138 
139 // when changing animation, set animationTime to frameTime + lerping time
140 // The current lerp will finish out, then it will lerp to the new animation
141 typedef struct lerpFrame_s {
142 	int			oldFrame;
143 	int			oldFrameTime;		// time when ->oldFrame was exactly on
144 
145 	int			frame;
146 	int			frameTime;			// time when ->frame will be exactly on
147 
148 	float		backlerp;
149 
150 	qboolean	lastFlip; //if does not match torsoFlip/legsFlip, restart the anim.
151 
152 	int			lastForcedFrame;
153 
154 	float		yawAngle;
155 	qboolean	yawing;
156 	float		pitchAngle;
157 	qboolean	pitching;
158 
159 	float		yawSwingDif;
160 
161 	int			animationNumber;
162 	animation_t	*animation;
163 	int			animationTime;		// time when the first frame of the animation will be exact
164 
165 	float		animationSpeed;		// scale the animation speed
166 	float		animationTorsoSpeed;
167 
168 	qboolean	torsoYawing;
169 } lerpFrame_t;
170 
171 
172 typedef struct playerEntity_s {
173 	lerpFrame_t		legs, torso, flag;
174 	int				painTime;
175 	int				painDirection;	// flip from 0 to 1
176 	int				lightningFiring;
177 
178 	// machinegun spinning
179 	float			barrelAngle;
180 	int				barrelTime;
181 	qboolean		barrelSpinning;
182 } playerEntity_t;
183 
184 //=================================================
185 
186 // each client has an associated clientInfo_t
187 // that contains media references necessary to present the
188 // client model and other color coded effects
189 // this is regenerated each time a client's configstring changes,
190 // usually as a result of a userinfo (name, model, etc) change
191 #define	MAX_CUSTOM_COMBAT_SOUNDS	40
192 #define	MAX_CUSTOM_EXTRA_SOUNDS	40
193 #define	MAX_CUSTOM_JEDI_SOUNDS	40
194 // MAX_CUSTOM_SIEGE_SOUNDS defined in bg_public.h
195 #define MAX_CUSTOM_DUEL_SOUNDS	40
196 
197 #define	MAX_CUSTOM_SOUNDS	40 //rww - Note that for now these must all be the same, because of the way I am
198 							   //cycling through them and comparing for custom sounds.
199 
200 typedef struct clientInfo_s {
201 	qboolean		infoValid;
202 
203 	float			colorOverride[3];
204 
205 	saberInfo_t		saber[MAX_SABERS];
206 	void			*ghoul2Weapons[MAX_SABERS];
207 
208 	char			saberName[64];
209 	char			saber2Name[64];
210 
211 	char			name[MAX_QPATH];
212 	char			cleanname[MAX_QPATH];
213 	team_t			team;
214 
215 	int				duelTeam;
216 
217 	int				botSkill;		// -1 = not bot, 0-5 = bot
218 
219 	int				frame;
220 
221 	vec3_t			color1;
222 	vec3_t			color2;
223 
224 	int				icolor1;
225 	int				icolor2;
226 
227 	int				score;			// updated by score servercmds
228 	int				location;		// location index for team mode
229 	int				health;			// you only get this info about your teammates
230 	int				armor;
231 	int				curWeapon;
232 
233 	int				handicap;
234 	int				wins, losses;	// in tourney mode
235 
236 	int				teamTask;		// task in teamplay (offence/defence)
237 	qboolean		teamLeader;		// true when this is a team leader
238 
239 	int				powerups;		// so can display quad/flag status
240 
241 	int				medkitUsageTime;
242 
243 	int				breathPuffTime;
244 
245 	// when clientinfo is changed, the loading of models/skins/sounds
246 	// can be deferred until you are dead, to prevent hitches in
247 	// gameplay
248 	char			modelName[MAX_QPATH];
249 	char			skinName[MAX_QPATH];
250 //	char			headModelName[MAX_QPATH];
251 //	char			headSkinName[MAX_QPATH];
252 	char			forcePowers[MAX_QPATH];
253 //	char			redTeam[MAX_TEAMNAME];
254 //	char			blueTeam[MAX_TEAMNAME];
255 
256 	char			teamName[MAX_TEAMNAME];
257 
258 	int				corrTime;
259 
260 	vec3_t			lastHeadAngles;
261 	int				lookTime;
262 
263 	int				brokenLimbs;
264 
265 	qboolean		deferred;
266 
267 	qboolean		newAnims;		// true if using the new mission pack animations
268 	qboolean		fixedlegs;		// true if legs yaw is always the same as torso yaw
269 	qboolean		fixedtorso;		// true if torso never changes yaw
270 
271 	vec3_t			headOffset;		// move head in icon views
272 	//footstep_t		footsteps;
273 	gender_t		gender;			// from model
274 
275 	qhandle_t		legsModel;
276 	qhandle_t		legsSkin;
277 
278 	qhandle_t		torsoModel;
279 	qhandle_t		torsoSkin;
280 
281 	//qhandle_t		headModel;
282 	//qhandle_t		headSkin;
283 
284 	void			*ghoul2Model;
285 
286 	qhandle_t		modelIcon;
287 
288 	qhandle_t		bolt_rhand;
289 	qhandle_t		bolt_lhand;
290 
291 	qhandle_t		bolt_head;
292 
293 	qhandle_t		bolt_motion;
294 
295 	qhandle_t		bolt_llumbar;
296 
297 	int				siegeIndex;
298 	int				siegeDesiredTeam;
299 
300 	sfxHandle_t		sounds[MAX_CUSTOM_SOUNDS];
301 	sfxHandle_t		combatSounds[MAX_CUSTOM_COMBAT_SOUNDS];
302 	sfxHandle_t		extraSounds[MAX_CUSTOM_EXTRA_SOUNDS];
303 	sfxHandle_t		jediSounds[MAX_CUSTOM_JEDI_SOUNDS];
304 	sfxHandle_t		siegeSounds[MAX_CUSTOM_SIEGE_SOUNDS];
305 	sfxHandle_t		duelSounds[MAX_CUSTOM_DUEL_SOUNDS];
306 
307 	int				legsAnim;
308 	int				torsoAnim;
309 
310 	float		facial_blink;		// time before next blink. If a minus value, we are in blink mode
311 	float		facial_frown;		// time before next frown. If a minus value, we are in frown mode
312 	float		facial_aux;			// time before next aux. If a minus value, we are in aux mode
313 
314 	int			superSmoothTime; //do crazy amount of smoothing
315 
316 } clientInfo_t;
317 
318 //rww - cheap looping sound struct
319 #define MAX_CG_LOOPSOUNDS 8
320 
321 typedef struct cgLoopSound_s {
322 	int entityNum;
323 	vec3_t origin;
324 	vec3_t velocity;
325 	sfxHandle_t sfx;
326 } cgLoopSound_t;
327 
328 // centity_t have a direct corespondence with gentity_t in the game, but
329 // only the entityState_t is directly communicated to the cgame
330 typedef struct centity_s {
331 	// This comment below is correct, but now m_pVehicle is the first thing in bg shared entity, so it goes first. - AReis
332 	//rww - entstate must be first, to correspond with the bg shared entity structure
333 	entityState_t	currentState;	// from cg.frame
334 	playerState_t	*playerState;	//ptr to playerstate if applicable (for bg ents)
335 	Vehicle_t		*m_pVehicle; //vehicle data
336 	void			*ghoul2; //g2 instance
337 	int				localAnimIndex; //index locally (game/cgame) to anim data for this skel
338 	vec3_t			modelScale; //needed for g2 collision
339 
340 	//from here up must be unified with bgEntity_t -rww
341 
342 	entityState_t	nextState;		// from cg.nextFrame, if available
343 	qboolean		interpolate;	// true if next is valid to interpolate to
344 	qboolean		currentValid;	// true if cg.frame holds this entity
345 
346 	int				muzzleFlashTime;	// move to playerEntity?
347 	int				previousEvent;
348 //	int				teleportFlag;
349 
350 	int				trailTime;		// so missile trails can handle dropped initial packets
351 	int				dustTrailTime;
352 	int				miscTime;
353 
354 	vec3_t			damageAngles;
355 	int				damageTime;
356 
357 	int				snapShotTime;	// last time this entity was found in a snapshot
358 
359 	playerEntity_t	pe;
360 
361 //	int				errorTime;		// decay the error from this time
362 //	vec3_t			errorOrigin;
363 //	vec3_t			errorAngles;
364 
365 //	qboolean		extrapolated;	// false if origin / angles is an interpolation
366 //	vec3_t			rawOrigin;
367 	vec3_t			rawAngles;
368 
369 	vec3_t			beamEnd;
370 
371 	// exact interpolated position of entity on this frame
372 	vec3_t			lerpOrigin;
373 	vec3_t			lerpAngles;
374 
375 #if 0
376 	//add up bone offsets until next client frame before adding them in
377 	qboolean		hasRagOffset;
378 	vec3_t			ragOffsets;
379 	int				ragOffsetTime;
380 #endif
381 
382 	vec3_t			ragLastOrigin;
383 	int				ragLastOriginTime;
384 
385 	qboolean		noLumbar; //if true only do anims and things on model_root instead of lower_lumbar, this will be the case for some NPCs.
386 	qboolean		noFace;
387 
388 	//For keeping track of the current surface status in relation to the entitystate surface fields.
389 	int				npcLocalSurfOn;
390 	int				npcLocalSurfOff;
391 
392 	int				eventAnimIndex;
393 
394 	clientInfo_t	*npcClient; //dynamically allocated - always free it, and never stomp over it.
395 
396 	int				weapon;
397 
398 	void			*ghoul2weapon; //rww - pointer to ghoul2 instance of the current 3rd person weapon
399 
400 	float			radius;
401 	int				boltInfo;
402 
403 	//sometimes used as a bolt index, but these values are also used as generic values for clientside entities
404 	//at times
405 	int				bolt1;
406 	int				bolt2;
407 	int				bolt3;
408 	int				bolt4;
409 
410 	float			bodyHeight;
411 
412 	int				torsoBolt;
413 
414 	vec3_t			turAngles;
415 
416 	vec3_t			frame_minus1;
417 	vec3_t			frame_minus2;
418 
419 	int				frame_minus1_refreshed;
420 	int				frame_minus2_refreshed;
421 
422 	void			*frame_hold; //pointer to a ghoul2 instance
423 
424 	int				frame_hold_time;
425 	int				frame_hold_refreshed;
426 
427 	void			*grip_arm; //pointer to a ghoul2 instance
428 
429 	int				trickAlpha;
430 	int				trickAlphaTime;
431 
432 	int				teamPowerEffectTime;
433 	int				teamPowerType; //0 regen, 1 heal, 2 drain, 3 absorb
434 
435 	qboolean		isRagging;
436 	qboolean		ownerRagging;
437 	int				overridingBones;
438 
439 	int				bodyFadeTime;
440 	vec3_t			pushEffectOrigin;
441 
442 	cgLoopSound_t	loopingSound[MAX_CG_LOOPSOUNDS];
443 	int				numLoopingSounds;
444 
445 	int				serverSaberHitIndex;
446 	int				serverSaberHitTime;
447 	qboolean		serverSaberFleshImpact; //true if flesh, false if anything else.
448 
449 	qboolean		ikStatus;
450 
451 	qboolean		saberWasInFlight;
452 
453 	float			smoothYaw;
454 
455 	int				uncloaking;
456 	qboolean		cloaked;
457 
458 	int				vChatTime;
459 } centity_t;
460 
461 
462 //======================================================================
463 
464 // local entities are created as a result of events or predicted actions,
465 // and live independently from all server transmitted entities
466 
467 typedef struct markPoly_s {
468 	struct markPoly_s	*prevMark, *nextMark;
469 	int			time;
470 	qhandle_t	markShader;
471 	qboolean	alphaFade;		// fade alpha instead of rgb
472 	float		color[4];
473 	poly_t		poly;
474 	polyVert_t	verts[MAX_VERTS_ON_POLY];
475 } markPoly_t;
476 
477 
478 typedef enum {
479 	LE_MARK,
480 	LE_EXPLOSION,
481 	LE_SPRITE_EXPLOSION,
482 	LE_FADE_SCALE_MODEL, // currently only for Demp2 shock sphere
483 	LE_FRAGMENT,
484 	LE_PUFF,
485 	LE_MOVE_SCALE_FADE,
486 	LE_FALL_SCALE_FADE,
487 	LE_FADE_RGB,
488 	LE_SCALE_FADE,
489 	LE_SCOREPLUM,
490 	LE_OLINE,
491 	LE_SHOWREFENTITY,
492 	LE_LINE
493 } leType_t;
494 
495 typedef enum {
496 	LEF_PUFF_DONT_SCALE = 0x0001,			// do not scale size over time
497 	LEF_TUMBLE			= 0x0002,			// tumble over time, used for ejecting shells
498 	LEF_FADE_RGB		= 0x0004,			// explicitly fade
499 	LEF_NO_RANDOM_ROTATE= 0x0008			// MakeExplosion adds random rotate which could be bad in some cases
500 } leFlag_t;
501 
502 typedef enum {
503 	LEMT_NONE,
504 	LEMT_BURN,
505 	LEMT_BLOOD
506 } leMarkType_t;			// fragment local entities can leave marks on walls
507 
508 typedef enum {
509 	LEBS_NONE,
510 	LEBS_BLOOD,
511 	LEBS_BRASS,
512 	LEBS_METAL,
513 	LEBS_ROCK
514 } leBounceSoundType_t;	// fragment local entities can make sounds on impacts
515 
516 typedef struct localEntity_s {
517 	struct localEntity_s	*prev, *next;
518 	leType_t		leType;
519 	int				leFlags;
520 
521 	int				startTime;
522 	int				endTime;
523 	int				fadeInTime;
524 
525 	float			lifeRate;			// 1.0 / (endTime - startTime)
526 
527 	trajectory_t	pos;
528 	trajectory_t	angles;
529 
530 	float			bounceFactor;		// 0.0 = no bounce, 1.0 = perfect
531 	int				bounceSound;		// optional sound index to play upon bounce
532 
533 	float			alpha;
534 	float			dalpha;
535 
536 	int				forceAlpha;
537 
538 	float			color[4];
539 
540 	float			radius;
541 
542 	float			light;
543 	vec3_t			lightColor;
544 
545 	leMarkType_t		leMarkType;		// mark to leave on fragment impact
546 	leBounceSoundType_t	leBounceSoundType;
547 
548 	union {
549 		struct {
550 			float radius;
551 			float dradius;
552 			vec3_t startRGB;
553 			vec3_t dRGB;
554 		} sprite;
555 		struct {
556 			float width;
557 			float dwidth;
558 			float length;
559 			float dlength;
560 			vec3_t startRGB;
561 			vec3_t dRGB;
562 		} trail;
563 		struct {
564 			float width;
565 			float dwidth;
566 			// Below are bezier specific.
567 			vec3_t			control1;				// initial position of control points
568 			vec3_t			control2;
569 			vec3_t			control1_velocity;		// initial velocity of control points
570 			vec3_t			control2_velocity;
571 			vec3_t			control1_acceleration;	// constant acceleration of control points
572 			vec3_t			control2_acceleration;
573 		} line;
574 		struct {
575 			float width;
576 			float dwidth;
577 			float width2;
578 			float dwidth2;
579 			vec3_t startRGB;
580 			vec3_t dRGB;
581 		} line2;
582 		struct {
583 			float width;
584 			float dwidth;
585 			float width2;
586 			float dwidth2;
587 			float height;
588 			float dheight;
589 		} cylinder;
590 		struct {
591 			float width;
592 			float dwidth;
593 		} electricity;
594 		struct
595 		{
596 			// fight the power! open and close brackets in the same column!
597 			float radius;
598 			float dradius;
599 			qboolean (*thinkFn)(struct localEntity_s *le);
600 			vec3_t	dir;	// magnitude is 1, but this is oldpos - newpos right before the
601 							//particle is sent to the renderer
602 			// may want to add something like particle::localEntity_s *le (for the particle's think fn)
603 		} particle;
604 		struct
605 		{
606 			qboolean	dontDie;
607 			vec3_t		dir;
608 			float		variance;
609 			int			delay;
610 			int			nextthink;
611 			qboolean	(*thinkFn)(struct localEntity_s *le);
612 			int			data1;
613 			int			data2;
614 		} spawner;
615 		struct
616 		{
617 			float radius;
618 		} fragment;
619 	} data;
620 
621 	refEntity_t		refEntity;
622 } localEntity_t;
623 
624 //======================================================================
625 
626 
627 typedef struct score_s {
628 	int				client;
629 	int				score;
630 	int				ping;
631 	int				time;
632 	int				scoreFlags;
633 	int				powerUps;
634 	int				accuracy;
635 	int				impressiveCount;
636 	int				excellentCount;
637 	int				gauntletCount;
638 	int				defendCount;
639 	int				assistCount;
640 	int				captures;
641 	qboolean	perfect;
642 	int				team;
643 } score_t;
644 
645 
646 // each WP_* weapon enum has an associated weaponInfo_t
647 // that contains media references necessary to present the
648 // weapon and its effects
649 typedef struct weaponInfo_s {
650 	qboolean		registered;
651 	gitem_t			*item;
652 
653 	qhandle_t		handsModel;			// the hands don't actually draw, they just position the weapon
654 	qhandle_t		weaponModel;		// this is the pickup model
655 	qhandle_t		viewModel;			// this is the in-view model used by the player
656 	qhandle_t		barrelModel;
657 	qhandle_t		flashModel;
658 
659 	vec3_t			weaponMidpoint;		// so it will rotate centered instead of by tag
660 
661 	float			flashDlight;
662 	vec3_t			flashDlightColor;
663 
664 	qhandle_t		weaponIcon;
665 	qhandle_t		ammoIcon;
666 
667 	qhandle_t		ammoModel;
668 
669 	sfxHandle_t		flashSound[4];		// fast firing weapons randomly choose
670 	sfxHandle_t		firingSound;
671 	sfxHandle_t		chargeSound;
672 	fxHandle_t		muzzleEffect;
673 	qhandle_t		missileModel;
674 	sfxHandle_t		missileSound;
675 	void			(*missileTrailFunc)( centity_t *, const struct weaponInfo_s *wi );
676 	float			missileDlight;
677 	vec3_t			missileDlightColor;
678 	int				missileRenderfx;
679 	sfxHandle_t		missileHitSound;
680 
681 	sfxHandle_t		altFlashSound[4];
682 	sfxHandle_t		altFiringSound;
683 	sfxHandle_t		altChargeSound;
684 	fxHandle_t		altMuzzleEffect;
685 	qhandle_t		altMissileModel;
686 	sfxHandle_t		altMissileSound;
687 	void			(*altMissileTrailFunc)( centity_t *, const struct weaponInfo_s *wi );
688 	float			altMissileDlight;
689 	vec3_t			altMissileDlightColor;
690 	int				altMissileRenderfx;
691 	sfxHandle_t		altMissileHitSound;
692 
693 	sfxHandle_t		selectSound;
694 
695 	sfxHandle_t		readySound;
696 	float			trailRadius;
697 	float			wiTrailTime;
698 
699 } weaponInfo_t;
700 
701 
702 // each IT_* item has an associated itemInfo_t
703 // that constains media references necessary to present the
704 // item and its effects
705 typedef struct itemInfo_s {
706 	qboolean		registered;
707 	qhandle_t		models[MAX_ITEM_MODELS];
708 	qhandle_t		icon;
709 /*
710 Ghoul2 Insert Start
711 */
712 	void			*g2Models[MAX_ITEM_MODELS];
713 	float			radius[MAX_ITEM_MODELS];
714 /*
715 Ghoul2 Insert End
716 */
717 } itemInfo_t;
718 
719 
720 typedef struct powerupInfo_s {
721 	int				itemNum;
722 } powerupInfo_t;
723 
724 
725 #define MAX_SKULLTRAIL		10
726 
727 typedef struct skulltrail_s {
728 	vec3_t positions[MAX_SKULLTRAIL];
729 	int numpositions;
730 } skulltrail_t;
731 
732 
733 #define MAX_REWARDSTACK		10
734 #define MAX_SOUNDBUFFER		20
735 
736 //======================================================================
737 
738 // all cg.stepTime, cg.duckTime, cg.landTime, etc are set to cg.time when the action
739 // occurs, and they will have visible effects for #define STEP_TIME or whatever msec after
740 
741 #define MAX_PREDICTED_EVENTS	16
742 
743 
744 #define	MAX_CHATBOX_ITEMS		5
745 typedef struct chatBoxItem_s
746 {
747 	char	string[MAX_SAY_TEXT];
748 	int		time;
749 	int		lines;
750 } chatBoxItem_t;
751 
752 typedef struct cg_s {
753 	int			clientFrame;		// incremented each frame
754 
755 	int			clientNum;
756 
757 	qboolean	demoPlayback;
758 	qboolean	levelShot;			// taking a level menu screenshot
759 	int			deferredPlayerLoading;
760 	qboolean	loading;			// don't defer players at initial startup
761 	qboolean	intermissionStarted;	// don't play voice rewards, because game will end shortly
762 
763 	// there are only one or two snapshot_t that are relevent at a time
764 	int			latestSnapshotNum;	// the number of snapshots the client system has received
765 	int			latestSnapshotTime;	// the time from latestSnapshotNum, so we don't need to read the snapshot yet
766 
767 	snapshot_t	*snap;				// cg.snap->serverTime <= cg.time
768 	snapshot_t	*nextSnap;			// cg.nextSnap->serverTime > cg.time, or NULL
769 //	snapshot_t	activeSnapshots[2];
770 
771 	float		frameInterpolation;	// (float)( cg.time - cg.frame->serverTime ) / (cg.nextFrame->serverTime - cg.frame->serverTime)
772 
773 	qboolean	mMapChange;
774 
775 	qboolean	thisFrameTeleport;
776 	qboolean	nextFrameTeleport;
777 
778 	int			frametime;		// cg.time - cg.oldTime
779 
780 	int			time;			// this is the time value that the client
781 								// is rendering at.
782 	int			oldTime;		// time at last frame, used for missile trails and prediction checking
783 
784 	int			physicsTime;	// either cg.snap->time or cg.nextSnap->time
785 
786 	int			timelimitWarnings;	// 5 min, 1 min, overtime
787 	int			fraglimitWarnings;
788 
789 	qboolean	mapRestart;			// set on a map restart to set back the weapon
790 
791 	qboolean	renderingThirdPerson;		// during deaths, chasecams, etc
792 
793 	// prediction state
794 	qboolean	hyperspace;				// true if prediction has hit a trigger_teleport
795 	playerState_t	predictedPlayerState;
796 	playerState_t	predictedVehicleState;
797 
798 	//centity_t		predictedPlayerEntity;
799 	//rww - I removed this and made it use cg_entities[clnum] directly.
800 
801 	qboolean	validPPS;				// clear until the first call to CG_PredictPlayerState
802 	int			predictedErrorTime;
803 	vec3_t		predictedError;
804 
805 	int			eventSequence;
806 	int			predictableEvents[MAX_PREDICTED_EVENTS];
807 
808 	float		stepChange;				// for stair up smoothing
809 	int			stepTime;
810 
811 	float		duckChange;				// for duck viewheight smoothing
812 	int			duckTime;
813 
814 	float		landChange;				// for landing hard
815 	int			landTime;
816 
817 	// input state sent to server
818 	int			weaponSelect;
819 
820 	int			forceSelect;
821 	int			itemSelect;
822 
823 	// auto rotating items
824 	vec3_t		autoAngles;
825 	matrix3_t	autoAxis;
826 	vec3_t		autoAnglesFast;
827 	matrix3_t	autoAxisFast;
828 
829 	// view rendering
830 	refdef_t	refdef;
831 
832 	// zoom key
833 	qboolean	zoomed;
834 	int			zoomTime;
835 	float		zoomSensitivity;
836 
837 	// information screen text during loading
838 	char		infoScreenText[MAX_STRING_CHARS];
839 
840 	// scoreboard
841 	int			scoresRequestTime;
842 	int			numScores;
843 	int			selectedScore;
844 	int			teamScores[2];
845 	score_t		scores[MAX_CLIENTS];
846 	qboolean	showScores;
847 	qboolean	scoreBoardShowing;
848 	int			scoreFadeTime;
849 	char		killerName[MAX_NETNAME];
850 	char			spectatorList[MAX_STRING_CHARS];		// list of names
851 	int				spectatorLen;												// length of list
852 	float			spectatorWidth;											// width in device units
853 	int				spectatorTime;											// next time to offset
854 	int				spectatorPaintX;										// current paint x
855 	int				spectatorPaintX2;										// current paint x
856 	int				spectatorOffset;										// current offset from start
857 	int				spectatorPaintLen; 									// current offset from start
858 
859 	// skull trails
860 	skulltrail_t	skulltrails[MAX_CLIENTS];
861 
862 	// centerprinting
863 	int			centerPrintTime;
864 	int			centerPrintCharWidth;
865 	int			centerPrintY;
866 	char		centerPrint[1024];
867 	int			centerPrintLines;
868 
869 	int			oldammo;
870 	int			oldAmmoTime;
871 
872 	// low ammo warning state
873 	int			lowAmmoWarning;		// 1 = low, 2 = empty
874 
875 	// kill timers for carnage reward
876 	int			lastKillTime;
877 
878 	// crosshair client ID
879 	int			crosshairClientNum;
880 	int			crosshairClientTime;
881 
882 	int			crosshairVehNum;
883 	int			crosshairVehTime;
884 
885 	// powerup active flashing
886 	int			powerupActive;
887 	int			powerupTime;
888 
889 	// attacking player
890 	int			attackerTime;
891 	int			voiceTime;
892 
893 	// reward medals
894 	int			rewardStack;
895 	int			rewardTime;
896 	int			rewardCount[MAX_REWARDSTACK];
897 	qhandle_t	rewardShader[MAX_REWARDSTACK];
898 	qhandle_t	rewardSound[MAX_REWARDSTACK];
899 
900 	// sound buffer mainly for announcer sounds
901 	int			soundBufferIn;
902 	int			soundBufferOut;
903 	int			soundTime;
904 	qhandle_t	soundBuffer[MAX_SOUNDBUFFER];
905 
906 	// for voice chat buffer
907 	int			voiceChatTime;
908 	int			voiceChatBufferIn;
909 	int			voiceChatBufferOut;
910 
911 	// warmup countdown
912 	int			warmup;
913 	int			warmupCount;
914 
915 	//==========================
916 
917 	int			itemPickup;
918 	int			itemPickupTime;
919 	int			itemPickupBlendTime;	// the pulse around the crosshair is timed seperately
920 
921 	int			weaponSelectTime;
922 	int			weaponAnimation;
923 	int			weaponAnimationTime;
924 
925 	// blend blobs
926 	float		damageTime;
927 	float		damageX, damageY, damageValue;
928 
929 	// status bar head
930 	float		headYaw;
931 	float		headEndPitch;
932 	float		headEndYaw;
933 	int			headEndTime;
934 	float		headStartPitch;
935 	float		headStartYaw;
936 	int			headStartTime;
937 
938 	// view movement
939 	float		v_dmg_time;
940 	float		v_dmg_pitch;
941 	float		v_dmg_roll;
942 
943 	vec3_t		kick_angles;	// weapon kicks
944 	int			kick_time;
945 	vec3_t		kick_origin;
946 
947 	// temp working variables for player view
948 	float		bobfracsin;
949 	int			bobcycle;
950 	float		xyspeed;
951 	int     nextOrbitTime;
952 
953 	//qboolean cameraMode;		// if rendering from a loaded camera
954 	int			loadLCARSStage;
955 
956 	int			forceHUDTotalFlashTime;
957 	int			forceHUDNextFlashTime;
958 	qboolean	forceHUDActive;				// Flag to show force hud is off/on
959 
960 	// development tool
961 	refEntity_t		testModelEntity;
962 	char			testModelName[MAX_QPATH];
963 	qboolean		testGun;
964 
965 	int			VHUDFlashTime;
966 	qboolean	VHUDTurboFlag;
967 
968 	// HUD stuff
969 	float			HUDTickFlashTime;
970 	qboolean		HUDArmorFlag;
971 	qboolean		HUDHealthFlag;
972 	qboolean		iconHUDActive;
973 	float			iconHUDPercent;
974 	float			iconSelectTime;
975 	float			invenSelectTime;
976 	float			forceSelectTime;
977 
978 	vec3_t			lastFPFlashPoint;
979 
980 /*
981 Ghoul2 Insert Start
982 */
983 	int				testModel;
984 	// had to be moved so we wouldn't wipe these out with the memset - these have STL in them and shouldn't be cleared that way
985 	snapshot_t	activeSnapshots[2];
986 /*
987 Ghoul2 Insert End
988 */
989 
990 	// used for communication with the engine
991 	union {
992 		char						raw[MAX_CG_SHARED_BUFFER_SIZE];
993 		TCGPointContents			pointContents;
994 		TCGVectorData				vectorData;
995 		TCGGetBoltData				getBoltData;
996 		TCGTrace					trace;
997 		TCGG2Mark					g2Mark;
998 		TCGImpactMark				impactMark;
999 		ragCallbackDebugBox_t		rcbDebugBox;
1000 		ragCallbackDebugLine_t		rcbDebugLine;
1001 		ragCallbackBoneSnap_t		rcbBoneSnap;
1002 		ragCallbackBoneInSolid_t	rcbBoneInSolid;
1003 		ragCallbackTraceLine_t		rcbTraceLine;
1004 		TCGMiscEnt					miscEnt;
1005 		TCGIncomingConsoleCommand	icc;
1006 		autoMapInput_t				autoMapInput;
1007 		TCGCameraShake				cameraShake;
1008 	} sharedBuffer;
1009 
1010 	short				radarEntityCount;
1011 	short				radarEntities[MAX_CLIENTS+16];
1012 
1013 	short				bracketedEntityCount;
1014 	short				bracketedEntities[MAX_CLIENTS+16];
1015 
1016 	float				distanceCull;
1017 
1018 	chatBoxItem_t		chatItems[MAX_CHATBOX_ITEMS];
1019 	int					chatItemActive;
1020 
1021 #if 0
1022 	int					snapshotTimeoutTime;
1023 #endif
1024 
1025 	qboolean spawning;
1026 	int	numSpawnVars;
1027 	char *spawnVars[MAX_SPAWN_VARS][2];	// key / value pairs
1028 	int numSpawnVarChars;
1029 	char spawnVarChars[MAX_SPAWN_VARS_CHARS];
1030 
1031 } cg_t;
1032 
1033 #define MAX_TICS	14
1034 
1035 typedef struct forceTicPos_s
1036 {
1037 	int				x;
1038 	int				y;
1039 	int				width;
1040 	int				height;
1041 	char			*file;
1042 	qhandle_t		tic;
1043 } forceTicPos_t;
1044 extern forceTicPos_t forceTicPos[];
1045 extern forceTicPos_t ammoTicPos[];
1046 
1047 typedef struct cgscreffects_s
1048 {
1049 	float		FOV;
1050 	float		FOV2;
1051 
1052 	float		shake_intensity;
1053 	int			shake_duration;
1054 	int			shake_start;
1055 
1056 	float		music_volume_multiplier;
1057 	int			music_volume_time;
1058 	qboolean	music_volume_set;
1059 } cgscreffects_t;
1060 
1061 extern cgscreffects_t cgScreenEffects;
1062 
1063 void CGCam_Shake( float intensity, int duration );
1064 void CGCam_SetMusicMult( float multiplier, int duration );
1065 
1066 enum
1067 {
1068 	CHUNK_METAL1 = 0,
1069 	CHUNK_METAL2,
1070 	CHUNK_ROCK1,
1071 	CHUNK_ROCK2,
1072 	CHUNK_ROCK3,
1073 	CHUNK_CRATE1,
1074 	CHUNK_CRATE2,
1075 	CHUNK_WHITE_METAL,
1076 	NUM_CHUNK_TYPES
1077 };
1078 #define NUM_CHUNK_MODELS	4
1079 
1080 // all of the model, shader, and sound references that are
1081 // loaded at gamestate time are stored in cgMedia_t
1082 // Other media that can be tied to clients, weapons, or items are
1083 // stored in the clientInfo_t, itemInfo_t, weaponInfo_t, and powerupInfo_t
1084 typedef struct cgMedia_s {
1085 	qhandle_t	charsetShader;
1086 	qhandle_t	whiteShader;
1087 
1088 	qhandle_t	loadBarLED;
1089 	qhandle_t	loadBarLEDCap;
1090 	qhandle_t	loadBarLEDSurround;
1091 
1092 	qhandle_t	bryarFrontFlash;
1093 	qhandle_t	greenFrontFlash;
1094 	qhandle_t	lightningFlash;
1095 
1096 	qhandle_t	itemHoloModel;
1097 	qhandle_t	redFlagModel;
1098 	qhandle_t	blueFlagModel;
1099 
1100 	qhandle_t	teamStatusBar;
1101 
1102 	qhandle_t	deferShader;
1103 
1104 	qhandle_t	radarShader;
1105 	qhandle_t	siegeItemShader;
1106 	qhandle_t	mAutomapPlayerIcon;
1107 	qhandle_t	mAutomapRocketIcon;
1108 
1109 	qhandle_t	wireframeAutomapFrame_left;
1110 	qhandle_t	wireframeAutomapFrame_right;
1111 	qhandle_t	wireframeAutomapFrame_top;
1112 	qhandle_t	wireframeAutomapFrame_bottom;
1113 
1114 //Chunks
1115 	qhandle_t	chunkModels[NUM_CHUNK_TYPES][4];
1116 	sfxHandle_t	chunkSound;
1117 	sfxHandle_t	grateSound;
1118 	sfxHandle_t	rockBreakSound;
1119 	sfxHandle_t	rockBounceSound[2];
1120 	sfxHandle_t	metalBounceSound[2];
1121 	sfxHandle_t	glassChunkSound;
1122 	sfxHandle_t	crateBreakSound[2];
1123 
1124 	qhandle_t	hackerIconShader;
1125 
1126 	// Saber shaders
1127 	//-----------------------------
1128 	qhandle_t	forceCoronaShader;
1129 
1130 	qhandle_t	redSaberGlowShader;
1131 	qhandle_t	redSaberCoreShader;
1132 	qhandle_t	orangeSaberGlowShader;
1133 	qhandle_t	orangeSaberCoreShader;
1134 	qhandle_t	yellowSaberGlowShader;
1135 	qhandle_t	yellowSaberCoreShader;
1136 	qhandle_t	greenSaberGlowShader;
1137 	qhandle_t	greenSaberCoreShader;
1138 	qhandle_t	blueSaberGlowShader;
1139 	qhandle_t	blueSaberCoreShader;
1140 	qhandle_t	purpleSaberGlowShader;
1141 	qhandle_t	purpleSaberCoreShader;
1142 	qhandle_t	saberBlurShader;
1143 	qhandle_t	swordTrailShader;
1144 
1145 	qhandle_t	yellowDroppedSaberShader;
1146 
1147 	qhandle_t	rivetMarkShader;
1148 
1149 	qhandle_t	teamRedShader;
1150 	qhandle_t	teamBlueShader;
1151 
1152 	qhandle_t	powerDuelAllyShader;
1153 
1154 	qhandle_t	balloonShader;
1155 	qhandle_t	vchatShader;
1156 	qhandle_t	connectionShader;
1157 
1158 	qhandle_t	crosshairShader[NUM_CROSSHAIRS];
1159 	qhandle_t	lagometerShader;
1160 	qhandle_t	backTileShader;
1161 
1162 	qhandle_t	numberShaders[11];
1163 	qhandle_t	smallnumberShaders[11];
1164 	qhandle_t	chunkyNumberShaders[11];
1165 
1166 	qhandle_t	electricBodyShader;
1167 	qhandle_t	electricBody2Shader;
1168 
1169 	qhandle_t	fsrMarkShader;
1170 	qhandle_t	fslMarkShader;
1171 	qhandle_t	fshrMarkShader;
1172 	qhandle_t	fshlMarkShader;
1173 
1174 	qhandle_t	refractionShader;
1175 
1176 	qhandle_t	cloakedShader;
1177 
1178 	qhandle_t	boltShader;
1179 
1180 	qhandle_t	shadowMarkShader;
1181 
1182 	//glass shard shader
1183 	qhandle_t	glassShardShader;
1184 
1185 	// wall mark shaders
1186 	qhandle_t	wakeMarkShader;
1187 
1188 	// Pain view shader
1189 	qhandle_t	viewPainShader;
1190 	qhandle_t	viewPainShader_Shields;
1191 	qhandle_t	viewPainShader_ShieldsAndHealth;
1192 
1193 	qhandle_t	itemRespawningPlaceholder;
1194 	qhandle_t	itemRespawningRezOut;
1195 
1196 	qhandle_t	playerShieldDamage;
1197 	qhandle_t	protectShader;
1198 	qhandle_t	forceSightBubble;
1199 	qhandle_t	forceShell;
1200 	qhandle_t	sightShell;
1201 
1202 	// Disruptor zoom graphics
1203 	qhandle_t	disruptorMask;
1204 	qhandle_t	disruptorInsert;
1205 	qhandle_t	disruptorLight;
1206 	qhandle_t	disruptorInsertTick;
1207 	qhandle_t	disruptorChargeShader;
1208 
1209 	// Binocular graphics
1210 	qhandle_t	binocularCircle;
1211 	qhandle_t	binocularMask;
1212 	qhandle_t	binocularArrow;
1213 	qhandle_t	binocularTri;
1214 	qhandle_t	binocularStatic;
1215 	qhandle_t	binocularOverlay;
1216 
1217 	// weapon effect models
1218 	qhandle_t	lightningExplosionModel;
1219 
1220 	// explosion assets
1221 	qhandle_t	explosionModel;
1222 	qhandle_t	surfaceExplosionShader;
1223 
1224 	qhandle_t	disruptorShader;
1225 
1226 	qhandle_t	solidWhite;
1227 
1228 	qhandle_t	heartShader;
1229 
1230 	// All the player shells
1231 	qhandle_t	ysaliredShader;
1232 	qhandle_t	ysaliblueShader;
1233 	qhandle_t	ysalimariShader;
1234 	qhandle_t	boonShader;
1235 	qhandle_t	endarkenmentShader;
1236 	qhandle_t	enlightenmentShader;
1237 	qhandle_t	invulnerabilityShader;
1238 
1239 #ifdef JK2AWARDS
1240 	// medals shown during gameplay
1241 	qhandle_t	medalImpressive;
1242 	qhandle_t	medalExcellent;
1243 	qhandle_t	medalGauntlet;
1244 	qhandle_t	medalDefend;
1245 	qhandle_t	medalAssist;
1246 	qhandle_t	medalCapture;
1247 #endif
1248 
1249 	// sounds
1250 	sfxHandle_t	selectSound;
1251 	sfxHandle_t	footsteps[FOOTSTEP_TOTAL][4];
1252 
1253 	sfxHandle_t	winnerSound;
1254 	sfxHandle_t	loserSound;
1255 
1256 	sfxHandle_t crackleSound;
1257 
1258 	sfxHandle_t	grenadeBounce1;
1259 	sfxHandle_t	grenadeBounce2;
1260 
1261 	sfxHandle_t teamHealSound;
1262 	sfxHandle_t teamRegenSound;
1263 
1264 	sfxHandle_t	teleInSound;
1265 	sfxHandle_t	teleOutSound;
1266 	sfxHandle_t	respawnSound;
1267 	sfxHandle_t talkSound;
1268 	sfxHandle_t landSound;
1269 	sfxHandle_t fallSound;
1270 
1271 	sfxHandle_t oneMinuteSound;
1272 	sfxHandle_t fiveMinuteSound;
1273 
1274 	sfxHandle_t threeFragSound;
1275 	sfxHandle_t twoFragSound;
1276 	sfxHandle_t oneFragSound;
1277 
1278 #ifdef JK2AWARDS
1279 	sfxHandle_t impressiveSound;
1280 	sfxHandle_t excellentSound;
1281 	sfxHandle_t deniedSound;
1282 	sfxHandle_t humiliationSound;
1283 	sfxHandle_t defendSound;
1284 #endif
1285 
1286 	/*
1287 	sfxHandle_t takenLeadSound;
1288 	sfxHandle_t tiedLeadSound;
1289 	sfxHandle_t lostLeadSound;
1290 	*/
1291 
1292 	sfxHandle_t rollSound;
1293 
1294 	sfxHandle_t watrInSound;
1295 	sfxHandle_t watrOutSound;
1296 	sfxHandle_t watrUnSound;
1297 
1298 	sfxHandle_t noforceSound;
1299 
1300 	sfxHandle_t deploySeeker;
1301 	sfxHandle_t medkitSound;
1302 
1303 	// teamplay sounds
1304 #ifdef JK2AWARDS
1305 	sfxHandle_t captureAwardSound;
1306 #endif
1307 	sfxHandle_t redScoredSound;
1308 	sfxHandle_t blueScoredSound;
1309 	sfxHandle_t redLeadsSound;
1310 	sfxHandle_t blueLeadsSound;
1311 	sfxHandle_t teamsTiedSound;
1312 
1313 	sfxHandle_t redFlagReturnedSound;
1314 	sfxHandle_t blueFlagReturnedSound;
1315 	sfxHandle_t	redTookFlagSound;
1316 	sfxHandle_t blueTookFlagSound;
1317 
1318 	sfxHandle_t redYsalReturnedSound;
1319 	sfxHandle_t blueYsalReturnedSound;
1320 	sfxHandle_t	redTookYsalSound;
1321 	sfxHandle_t blueTookYsalSound;
1322 
1323 	sfxHandle_t	drainSound;
1324 
1325 	//music blips
1326 	sfxHandle_t	happyMusic;
1327 	sfxHandle_t dramaticFailure;
1328 
1329 	// tournament sounds
1330 	sfxHandle_t	count3Sound;
1331 	sfxHandle_t	count2Sound;
1332 	sfxHandle_t	count1Sound;
1333 	sfxHandle_t	countFightSound;
1334 
1335 	// new stuff
1336 	qhandle_t patrolShader;
1337 	qhandle_t assaultShader;
1338 	qhandle_t campShader;
1339 	qhandle_t followShader;
1340 	qhandle_t defendShader;
1341 	qhandle_t retrieveShader;
1342 	qhandle_t escortShader;
1343 
1344 	qhandle_t halfShieldModel;
1345 	qhandle_t halfShieldShader;
1346 
1347 	qhandle_t demp2Shell;
1348 	qhandle_t demp2ShellShader;
1349 
1350 	qhandle_t cursor;
1351 	qhandle_t selectCursor;
1352 	qhandle_t sizeCursor;
1353 
1354 	//weapon icons
1355 	qhandle_t weaponIcons[WP_NUM_WEAPONS];
1356 	qhandle_t weaponIcons_NA[WP_NUM_WEAPONS];
1357 
1358 	//holdable inventory item icons
1359 	qhandle_t invenIcons[HI_NUM_HOLDABLE];
1360 
1361 	//force power icons
1362 	qhandle_t forcePowerIcons[NUM_FORCE_POWERS];
1363 
1364 	qhandle_t rageRecShader;
1365 
1366 	//other HUD parts
1367 	int			currentBackground;
1368 	qhandle_t	weaponIconBackground;
1369 	qhandle_t	forceIconBackground;
1370 	qhandle_t	inventoryIconBackground;
1371 
1372 	sfxHandle_t	holocronPickup;
1373 
1374 	// Zoom
1375 	sfxHandle_t	zoomStart;
1376 	sfxHandle_t	zoomLoop;
1377 	sfxHandle_t	zoomEnd;
1378 	sfxHandle_t	disruptorZoomLoop;
1379 
1380 	qhandle_t	bdecal_bodyburn1;
1381 	qhandle_t	bdecal_saberglow;
1382 	qhandle_t	bdecal_burn1;
1383 	qhandle_t	mSaberDamageGlow;
1384 
1385 	// For vehicles only now
1386 	sfxHandle_t	noAmmoSound;
1387 
1388 } cgMedia_t;
1389 
1390 
1391 // Stored FX handles
1392 //--------------------
1393 typedef struct cgEffects_s {
1394 	//concussion
1395 	fxHandle_t	concussionShotEffect;
1396 	fxHandle_t	concussionImpactEffect;
1397 
1398 	// BRYAR PISTOL
1399 	fxHandle_t	bryarShotEffect;
1400 	fxHandle_t	bryarPowerupShotEffect;
1401 	fxHandle_t	bryarWallImpactEffect;
1402 	fxHandle_t	bryarWallImpactEffect2;
1403 	fxHandle_t	bryarWallImpactEffect3;
1404 	fxHandle_t	bryarFleshImpactEffect;
1405 	fxHandle_t	bryarDroidImpactEffect;
1406 
1407 	// BLASTER
1408 	fxHandle_t  blasterShotEffect;
1409 	fxHandle_t  blasterWallImpactEffect;
1410 	fxHandle_t  blasterFleshImpactEffect;
1411 	fxHandle_t  blasterDroidImpactEffect;
1412 
1413 	// DISRUPTOR
1414 	fxHandle_t  disruptorRingsEffect;
1415 	fxHandle_t  disruptorProjectileEffect;
1416 	fxHandle_t  disruptorWallImpactEffect;
1417 	fxHandle_t  disruptorFleshImpactEffect;
1418 	fxHandle_t  disruptorAltMissEffect;
1419 	fxHandle_t  disruptorAltHitEffect;
1420 
1421 	// BOWCASTER
1422 	fxHandle_t	bowcasterShotEffect;
1423 	fxHandle_t	bowcasterImpactEffect;
1424 
1425 	// REPEATER
1426 	fxHandle_t  repeaterProjectileEffect;
1427 	fxHandle_t  repeaterAltProjectileEffect;
1428 	fxHandle_t  repeaterWallImpactEffect;
1429 	fxHandle_t  repeaterFleshImpactEffect;
1430 	fxHandle_t  repeaterAltWallImpactEffect;
1431 
1432 	// DEMP2
1433 	fxHandle_t  demp2ProjectileEffect;
1434 	fxHandle_t  demp2WallImpactEffect;
1435 	fxHandle_t  demp2FleshImpactEffect;
1436 
1437 	// FLECHETTE
1438 	fxHandle_t	flechetteShotEffect;
1439 	fxHandle_t	flechetteAltShotEffect;
1440 	fxHandle_t	flechetteWallImpactEffect;
1441 	fxHandle_t	flechetteFleshImpactEffect;
1442 
1443 	// ROCKET
1444 	fxHandle_t  rocketShotEffect;
1445 	fxHandle_t  rocketExplosionEffect;
1446 
1447 	// THERMAL
1448 	fxHandle_t	thermalExplosionEffect;
1449 	fxHandle_t	thermalShockwaveEffect;
1450 
1451 	// TRIPMINE
1452 	fxHandle_t	tripmineLaserFX;
1453 	fxHandle_t	tripmineGlowFX;
1454 
1455 	//FORCE
1456 	fxHandle_t forceLightning;
1457 	fxHandle_t forceLightningWide;
1458 
1459 	fxHandle_t forceDrain;
1460 	fxHandle_t forceDrainWide;
1461 	fxHandle_t forceDrained;
1462 
1463 	//TURRET
1464 	fxHandle_t turretShotEffect;
1465 
1466 	//Whatever
1467 	fxHandle_t itemCone;
1468 
1469 	fxHandle_t	mSparks;
1470 	fxHandle_t	mSaberCut;
1471 	fxHandle_t	mTurretMuzzleFlash;
1472 	fxHandle_t	mSaberBlock;
1473 	fxHandle_t	mSaberBloodSparks;
1474 	fxHandle_t	mSaberBloodSparksSmall;
1475 	fxHandle_t	mSaberBloodSparksMid;
1476 	fxHandle_t	mSpawn;
1477 	fxHandle_t	mJediSpawn;
1478 	fxHandle_t	mBlasterDeflect;
1479 	fxHandle_t	mBlasterSmoke;
1480 	fxHandle_t	mForceConfustionOld;
1481 	fxHandle_t	mDisruptorDeathSmoke;
1482 	fxHandle_t	mSparkExplosion;
1483 	fxHandle_t	mTurretExplode;
1484 	fxHandle_t	mEmplacedExplode;
1485 	fxHandle_t	mEmplacedDeadSmoke;
1486 	fxHandle_t	mTripmineExplosion;
1487 	fxHandle_t	mDetpackExplosion;
1488 	fxHandle_t	mFlechetteAltBlow;
1489 	fxHandle_t	mStunBatonFleshImpact;
1490 	fxHandle_t	mAltDetonate;
1491 	fxHandle_t	mSparksExplodeNoSound;
1492 	fxHandle_t	mTripMineLaser;
1493 	fxHandle_t	mEmplacedMuzzleFlash;
1494 	fxHandle_t	mConcussionAltRing;
1495 	fxHandle_t	mHyperspaceStars;
1496 	fxHandle_t	mBlackSmoke;
1497 	fxHandle_t	mShipDestDestroyed;
1498 	fxHandle_t	mShipDestBurning;
1499 	fxHandle_t	mBobaJet;
1500 
1501 	//footstep effects
1502 	fxHandle_t footstepMud;
1503 	fxHandle_t footstepSand;
1504 	fxHandle_t footstepSnow;
1505 	fxHandle_t footstepGravel;
1506 	//landing effects
1507 	fxHandle_t landingMud;
1508 	fxHandle_t landingSand;
1509 	fxHandle_t landingDirt;
1510 	fxHandle_t landingSnow;
1511 	fxHandle_t landingGravel;
1512 	//splashes
1513 	fxHandle_t waterSplash;
1514 	fxHandle_t lavaSplash;
1515 	fxHandle_t acidSplash;
1516 } cgEffects_t;
1517 
1518 #define MAX_STATIC_MODELS 4000
1519 
1520 typedef struct cg_staticmodel_s {
1521 	qhandle_t		model;
1522 	vec3_t			org;
1523 	matrix3_t		axes;
1524 	float			radius;
1525 	float			zoffset;
1526 } cg_staticmodel_t;
1527 
1528 // The client game static (cgs) structure hold everything
1529 // loaded or calculated from the gamestate.  It will NOT
1530 // be cleared when a tournament restart is done, allowing
1531 // all clients to begin playing instantly
1532 typedef struct cgs_s {
1533 	gameState_t		gameState;			// gamestate from server
1534 	glconfig_t		glconfig;			// rendering configuration
1535 	float			screenXScale;		// derived from glconfig
1536 	float			screenYScale;
1537 	float			screenXBias;
1538 
1539 	int				serverCommandSequence;	// reliable command stream counter
1540 	int				processedSnapshotNum;// the number of snapshots cgame has requested
1541 
1542 	qboolean		localServer;		// detected on startup by checking sv_running
1543 
1544 	// parsed from serverinfo
1545 	int				siegeTeamSwitch;
1546 	int				showDuelHealths;
1547 	gametype_t		gametype;
1548 	int				debugMelee;
1549 	int				stepSlideFix;
1550 	int				noSpecMove;
1551 	int				dmflags;
1552 	int				fraglimit;
1553 	int				duel_fraglimit;
1554 	int				capturelimit;
1555 	int				timelimit;
1556 	int				maxclients;
1557 	qboolean		needpass;
1558 	qboolean		jediVmerc;
1559 	int				wDisable;
1560 	int				fDisable;
1561 
1562 	char			mapname[MAX_QPATH];
1563 	char			rawmapname[MAX_QPATH];
1564 //	char			redTeam[MAX_QPATH];
1565 //	char			blueTeam[MAX_QPATH];
1566 
1567 	int				voteTime;
1568 	int				voteYes;
1569 	int				voteNo;
1570 	qboolean		voteModified;			// beep whenever changed
1571 	char			voteString[MAX_STRING_TOKENS];
1572 
1573 	int				teamVoteTime[2];
1574 	int				teamVoteYes[2];
1575 	int				teamVoteNo[2];
1576 	qboolean		teamVoteModified[2];	// beep whenever changed
1577 	char			teamVoteString[2][MAX_STRING_TOKENS];
1578 
1579 	int				levelStartTime;
1580 
1581 	int				scores1, scores2;		// from configstrings
1582 	int				jediMaster;
1583 	int				duelWinner;
1584 	int				duelist1;
1585 	int				duelist2;
1586 	int				duelist3;
1587 // nmckenzie: DUEL_HEALTH.  hmm.
1588 	int				duelist1health;
1589 	int				duelist2health;
1590 	int				duelist3health;
1591 
1592 	int				redflag, blueflag;		// flag status from configstrings
1593 	int				flagStatus;
1594 
1595 	qboolean  newHud;
1596 
1597 	//
1598 	// locally derived information from gamestate
1599 	//
1600 	qhandle_t		gameModels[MAX_MODELS];
1601 	sfxHandle_t		gameSounds[MAX_SOUNDS];
1602 	fxHandle_t		gameEffects[MAX_FX];
1603 	qhandle_t		gameIcons[MAX_ICONS];
1604 
1605 	int				numInlineModels;
1606 	qhandle_t		inlineDrawModel[MAX_MODELS];
1607 	vec3_t			inlineModelMidpoints[MAX_MODELS];
1608 
1609 	clientInfo_t	clientinfo[MAX_CLIENTS];
1610 
1611 	int cursorX;
1612 	int cursorY;
1613 	qboolean eventHandling;
1614 	qboolean mouseCaptured;
1615 	qboolean sizingHud;
1616 	void *capturedItem;
1617 	qhandle_t activeCursor;
1618 
1619 	// media
1620 	cgMedia_t		media;
1621 
1622 	// effects
1623 	cgEffects_t		effects;
1624 
1625 	int					numMiscStaticModels;
1626 	cg_staticmodel_t	miscStaticModels[MAX_STATIC_MODELS];
1627 
1628 } cgs_t;
1629 
1630 typedef struct siegeExtended_s
1631 {
1632 	int			health;
1633 	int			maxhealth;
1634 	int			ammo;
1635 	int			weapon;
1636 	int			lastUpdated;
1637 } siegeExtended_t;
1638 
1639 //keep an entry available for each client
1640 extern siegeExtended_t cg_siegeExtendedData[MAX_CLIENTS];
1641 
1642 //==============================================================================
1643 
1644 extern	cgs_t			cgs;
1645 extern	cg_t			cg;
1646 extern	centity_t		cg_entities[MAX_GENTITIES];
1647 
1648 extern	centity_t		*cg_permanents[MAX_GENTITIES];
1649 extern	int				cg_numpermanents;
1650 
1651 extern	weaponInfo_t	cg_weapons[MAX_WEAPONS];
1652 extern	itemInfo_t		cg_items[MAX_ITEMS];
1653 extern	markPoly_t		cg_markPolys[MAX_MARK_POLYS];
1654 
1655 // cg_cvar.c
1656 #define XCVAR_PROTO
1657 	#include "cg_xcvar.h"
1658 #undef XCVAR_PROTO
1659 void CG_RegisterCvars( void );
1660 void CG_UpdateCvars( void );
1661 
1662 //
1663 // cg_main.c
1664 //
1665 const char *CG_ConfigString( int index );
1666 const char *CG_Argv( int arg );
1667 
1668 void CG_StartMusic( qboolean bForceStart );
1669 
1670 void CG_UpdateCvars( void );
1671 
1672 int CG_CrosshairPlayer( void );
1673 int CG_LastAttacker( void );
1674 void CG_LoadMenus(const char *menuFile);
1675 void CG_KeyEvent(int key, qboolean down);
1676 void CG_MouseEvent(int x, int y);
1677 void CG_EventHandling(int type);
1678 void CG_RankRunFrame( void );
1679 void CG_SetScoreSelection(void *menu);
1680 void CG_BuildSpectatorString(void);
1681 void CG_NextInventory_f(void);
1682 void CG_PrevInventory_f(void);
1683 void CG_NextForcePower_f(void);
1684 void CG_PrevForcePower_f(void);
1685 
1686 //
1687 // cg_view.c
1688 //
1689 void CG_TestModel_f (void);
1690 void CG_TestGun_f (void);
1691 void CG_TestModelNextFrame_f (void);
1692 void CG_TestModelPrevFrame_f (void);
1693 void CG_TestModelNextSkin_f (void);
1694 void CG_TestModelPrevSkin_f (void);
1695 void CG_ZoomDown_f( void );
1696 void CG_ZoomUp_f( void );
1697 void CG_AddBufferedSound( sfxHandle_t sfx);
1698 
1699 void CG_DrawActiveFrame( int serverTime, stereoFrame_t stereoView, qboolean demoPlayback );
1700 /*
1701 Ghoul2 Insert Start
1702 */
1703 
1704 void CG_TestG2Model_f (void);
1705 void CG_TestModelSurfaceOnOff_f(void);
1706 void CG_ListModelSurfaces_f (void);
1707 void CG_ListModelBones_f (void);
1708 void CG_TestModelSetAnglespre_f(void);
1709 void CG_TestModelSetAnglespost_f(void);
1710 void CG_TestModelAnimate_f(void);
1711 /*
1712 Ghoul2 Insert End
1713 */
1714 
1715 //
1716 // cg_drawtools.c
1717 //
1718 void CG_FillRect( float x, float y, float width, float height, const float *color );
1719 void CG_DrawPic( float x, float y, float width, float height, qhandle_t hShader );
1720 void CG_DrawRotatePic( float x, float y, float width, float height,float angle, qhandle_t hShader );
1721 void CG_DrawRotatePic2( float x, float y, float width, float height,float angle, qhandle_t hShader );
1722 void CG_DrawString( float x, float y, const char *string,
1723 				   float charWidth, float charHeight, const float *modulate );
1724 
1725 void CG_DrawNumField (int x, int y, int width, int value,int charWidth,int charHeight,int style,qboolean zeroFill);
1726 
1727 void CG_DrawStringExt( int x, int y, const char *string, const float *setColor,
1728 		qboolean forceColor, qboolean shadow, int charWidth, int charHeight, int maxChars );
1729 void CG_DrawBigString( int x, int y, const char *s, float alpha );
1730 void CG_DrawBigStringColor( int x, int y, const char *s, vec4_t color );
1731 void CG_DrawSmallString( int x, int y, const char *s, float alpha );
1732 void CG_DrawSmallStringColor( int x, int y, const char *s, vec4_t color );
1733 
1734 int CG_DrawStrlen( const char *str );
1735 
1736 float	*CG_FadeColor( int startMsec, int totalMsec );
1737 float *CG_TeamColor( int team );
1738 void CG_TileClear( void );
1739 void CG_ColorForHealth( vec4_t hcolor );
1740 void CG_GetColorForHealth( int health, int armor, vec4_t hcolor );
1741 
1742 void CG_DrawProportionalString( int x, int y, const char* str, int style, vec4_t color );
1743 void CG_DrawScaledProportionalString( int x, int y, const char* str, int style, vec4_t color, float scale);
1744 void CG_DrawRect( float x, float y, float width, float height, float size, const float *color );
1745 void CG_DrawSides(float x, float y, float w, float h, float size);
1746 void CG_DrawTopBottom(float x, float y, float w, float h, float size);
1747 
1748 //
1749 // cg_draw.c, cg_newDraw.c
1750 //
1751 extern	int sortedTeamPlayers[TEAM_MAXOVERLAY];
1752 extern	int	numSortedTeamPlayers;
1753 extern  char systemChat[256];
1754 
1755 void CG_AddLagometerFrameInfo( void );
1756 void CG_AddLagometerSnapshotInfo( snapshot_t *snap );
1757 void CG_CenterPrint( const char *str, int y, int charWidth );
1758 void CG_DrawHead( float x, float y, float w, float h, int clientNum, vec3_t headAngles );
1759 void CG_DrawActive( stereoFrame_t stereoView );
1760 void CG_DrawFlagModel( float x, float y, float w, float h, int team, qboolean force2D );
1761 void CG_DrawTeamBackground( int x, int y, int w, int h, float alpha, int team );
1762 void CG_OwnerDraw(float x, float y, float w, float h, float text_x, float text_y, int ownerDraw, int ownerDrawFlags, int align, float special, float scale, vec4_t color, qhandle_t shader, int textStyle,int font);
1763 void CG_Text_Paint(float x, float y, float scale, vec4_t color, const char *text, float adjust, int limit, int style, int iMenuFont);
1764 int CG_Text_Width(const char *text, float scale, int iMenuFont);
1765 int CG_Text_Height(const char *text, float scale, int iMenuFont);
1766 float CG_GetValue(int ownerDraw);
1767 qboolean CG_OwnerDrawVisible(int flags);
1768 void CG_RunMenuScript(char **args);
1769 qboolean CG_DeferMenuScript(char **args);
1770 void CG_ShowResponseHead(void);
1771 void CG_GetTeamColor(vec4_t *color);
1772 const char *CG_GetGameStatusText(void);
1773 const char *CG_GetKillerText(void);
1774 void CG_Draw3DModel( float x, float y, float w, float h, qhandle_t model, void *ghoul2, int g2radius, qhandle_t skin, vec3_t origin, vec3_t angles );
1775 void CG_Text_PaintChar(float x, float y, float width, float height, float scale, float s, float t, float s2, float t2, qhandle_t hShader);
1776 qboolean CG_YourTeamHasFlag(void);
1777 qboolean CG_OtherTeamHasFlag(void);
1778 qhandle_t CG_StatusHandle(int task);
1779 
1780 
1781 
1782 //
1783 // cg_player.c
1784 //
1785 qboolean CG_RagDoll(centity_t *cent, vec3_t forcedAngles);
1786 qboolean CG_G2TraceCollide(trace_t *tr, const vec3_t mins, const vec3_t maxs, const vec3_t lastValidStart, const vec3_t lastValidEnd);
1787 void CG_AddGhoul2Mark(int shader, float size, vec3_t start, vec3_t end, int entnum,
1788 					  vec3_t entposition, float entangle, void *ghoul2, vec3_t scale, int lifeTime);
1789 
1790 void CG_CreateNPCClient(clientInfo_t **ci);
1791 void CG_DestroyNPCClient(clientInfo_t **ci);
1792 
1793 void CG_Player( centity_t *cent );
1794 void CG_ResetPlayerEntity( centity_t *cent );
1795 void CG_AddRefEntityWithPowerups( refEntity_t *ent, entityState_t *state, int team );
1796 void CG_NewClientInfo( int clientNum, qboolean entitiesInitialized );
1797 sfxHandle_t	CG_CustomSound( int clientNum, const char *soundName );
1798 void CG_PlayerShieldHit(int entitynum, vec3_t angles, int amount);
1799 
1800 
1801 //
1802 // cg_predict.c
1803 //
1804 void CG_BuildSolidList( void );
1805 int	CG_PointContents( const vec3_t point, int passEntityNum );
1806 void CG_Trace( trace_t *result, const vec3_t start, const vec3_t mins, const vec3_t maxs, const vec3_t end,
1807 					 int skipNumber, int mask );
1808 void CG_G2Trace( trace_t *result, const vec3_t start, const vec3_t mins, const vec3_t maxs, const vec3_t end,
1809 					 int skipNumber, int mask );
1810 void CG_PredictPlayerState( void );
1811 void CG_LoadDeferredPlayers( void );
1812 
1813 
1814 //
1815 // cg_events.c
1816 //
1817 void CG_CheckEvents( centity_t *cent );
1818 const char	*CG_PlaceString( int rank );
1819 void CG_EntityEvent( centity_t *cent, vec3_t position );
1820 void CG_PainEvent( centity_t *cent, int health );
1821 void CG_ReattachLimb(centity_t *source);
1822 
1823 
1824 //
1825 // cg_ents.c
1826 //
1827 
1828 void CG_S_AddLoopingSound(int entityNum, const vec3_t origin, const vec3_t velocity, sfxHandle_t sfx);
1829 void CG_S_AddRealLoopingSound(int entityNum, const vec3_t origin, const vec3_t velocity, sfxHandle_t sfx);
1830 void CG_S_StopLoopingSound(int entityNum, sfxHandle_t sfx);
1831 void CG_S_UpdateLoopingSounds(int entityNum);
1832 
1833 void CG_SetEntitySoundPosition( centity_t *cent );
1834 void CG_AddPacketEntities( qboolean isPortal );
1835 void CG_ManualEntityRender(centity_t *cent);
1836 void CG_Beam( centity_t *cent );
1837 void CG_AdjustPositionForMover( const vec3_t in, int moverNum, int fromTime, int toTime, vec3_t out );
1838 
1839 void CG_PositionEntityOnTag( refEntity_t *entity, const refEntity_t *parent,
1840 							qhandle_t parentModel, char *tagName );
1841 void CG_PositionRotatedEntityOnTag( refEntity_t *entity, const refEntity_t *parent,
1842 							qhandle_t parentModel, char *tagName );
1843 
1844 /*
1845 Ghoul2 Insert Start
1846 */
1847 void ScaleModelAxis(refEntity_t	*ent);
1848 /*
1849 Ghoul2 Insert End
1850 */
1851 
1852 //
1853 // cg_turret.c
1854 //
1855 void TurretClientRun(centity_t *ent);
1856 
1857 //
1858 // cg_weapons.c
1859 //
1860 void CG_GetClientWeaponMuzzleBoltPoint(int clIndex, vec3_t to);
1861 
1862 void CG_NextWeapon_f( void );
1863 void CG_PrevWeapon_f( void );
1864 void CG_Weapon_f( void );
1865 void CG_WeaponClean_f( void );
1866 
1867 void CG_RegisterWeapon( int weaponNum);
1868 void CG_RegisterItemVisuals( int itemNum );
1869 
1870 void CG_FireWeapon( centity_t *cent, qboolean alt_fire );
1871 void CG_MissileHitWall(int weapon, int clientNum, vec3_t origin, vec3_t dir, impactSound_t soundType, qboolean alt_fire, int charge);
1872 void CG_MissileHitPlayer( int weapon, vec3_t origin, vec3_t dir, int entityNum, qboolean alt_fire);
1873 
1874 void CG_AddViewWeapon (playerState_t *ps);
1875 void CG_AddPlayerWeapon( refEntity_t *parent, playerState_t *ps, centity_t *cent, int team, vec3_t newAngles, qboolean thirdPerson );
1876 void CG_DrawWeaponSelect( void );
1877 void CG_DrawIconBackground(void);
1878 
1879 void CG_OutOfAmmoChange( int oldWeapon );	// should this be in pmove?
1880 
1881 //
1882 // cg_marks.c
1883 //
1884 void	CG_InitMarkPolys( void );
1885 void	CG_AddMarks( void );
1886 void	CG_ImpactMark( qhandle_t markShader,
1887 				    const vec3_t origin, const vec3_t dir,
1888 					float orientation,
1889 				    float r, float g, float b, float a,
1890 					qboolean alphaFade,
1891 					float radius, qboolean temporary );
1892 
1893 //
1894 // cg_localents.c
1895 //
1896 void	CG_InitLocalEntities( void );
1897 localEntity_t	*CG_AllocLocalEntity( void );
1898 void	CG_AddLocalEntities( void );
1899 
1900 //
1901 // cg_effects.c
1902 //
1903 localEntity_t *CG_SmokePuff( const vec3_t p,
1904 				   const vec3_t vel,
1905 				   float radius,
1906 				   float r, float g, float b, float a,
1907 				   float duration,
1908 				   int startTime,
1909 				   int fadeInTime,
1910 				   int leFlags,
1911 				   qhandle_t hShader );
1912 void CG_BubbleTrail( vec3_t start, vec3_t end, float spacing );
1913 void CG_GlassShatter(int entnum, vec3_t dmgPt, vec3_t dmgDir, float dmgRadius, int maxShards);
1914 void CG_ScorePlum( int client, vec3_t org, int score );
1915 
1916 void CG_Chunks( int owner, vec3_t origin, const vec3_t normal, const vec3_t mins, const vec3_t maxs,
1917 						float speed, int numChunks, material_t chunkType, int customChunk, float baseScale );
1918 void CG_MiscModelExplosion( vec3_t mins, vec3_t maxs, int size, material_t chunkType );
1919 
1920 localEntity_t *CG_MakeExplosion( vec3_t origin, vec3_t dir,
1921 								qhandle_t hModel, int numframes, qhandle_t shader, int msec,
1922 								qboolean isSprite, float scale, int flags );// Overloaded in single player
1923 
1924 void CG_SurfaceExplosion( vec3_t origin, vec3_t normal, float radius, float shake_speed, qboolean smoke );
1925 
1926 void CG_TestLine( vec3_t start, vec3_t end, int time, unsigned int color, int radius);
1927 
1928 void CG_InitGlass( void );
1929 
1930 //
1931 // cg_snapshot.c
1932 //
1933 void CG_ProcessSnapshots( void );
1934 
1935 //
1936 // cg_info.c
1937 //
1938 void CG_LoadingString( const char *s );
1939 void CG_LoadingItem( int itemNum );
1940 void CG_LoadingClient( int clientNum );
1941 void CG_DrawInformation( void );
1942 
1943 //
1944 // cg_spawn.c
1945 //
1946 qboolean	CG_SpawnString( const char *key, const char *defaultString, char **out );
1947 // spawn string returns a temporary reference, you must CopyString() if you want to keep it
1948 qboolean	CG_SpawnFloat( const char *key, const char *defaultString, float *out );
1949 qboolean	CG_SpawnInt( const char *key, const char *defaultString, int *out );
1950 qboolean	CG_SpawnBoolean( const char *key, const char *defaultString, qboolean *out );
1951 qboolean	CG_SpawnVector( const char *key, const char *defaultString, float *out );
1952 void		CG_ParseEntitiesFromString( void );
1953 
1954 //
1955 // cg_scoreboard.c
1956 //
1957 qboolean CG_DrawOldScoreboard( void );
1958 void CG_DrawOldTourneyScoreboard( void );
1959 
1960 //
1961 // cg_consolecmds.c
1962 //
1963 qboolean CG_ConsoleCommand( void );
1964 void CG_InitConsoleCommands( void );
1965 
1966 //
1967 // cg_servercmds.c
1968 //
1969 void CG_ExecuteNewServerCommands( int latestSequence );
1970 void CG_ParseServerinfo( void );
1971 void CG_SetConfigValues( void );
1972 void CG_ShaderStateChanged(void);
1973 
1974 //
1975 // cg_playerstate.c
1976 //
1977 int CG_IsMindTricked(int trickIndex1, int trickIndex2, int trickIndex3, int trickIndex4, int client);
1978 void CG_Respawn( void );
1979 void CG_TransitionPlayerState( playerState_t *ps, playerState_t *ops );
1980 void CG_CheckChangedPredictableEvents( playerState_t *ps );
1981 
1982 
1983 //
1984 // cg_siege.c
1985 //
1986 void CG_InitSiegeMode(void);
1987 void CG_SiegeRoundOver(centity_t *ent, int won);
1988 void CG_SiegeObjectiveCompleted(centity_t *ent, int won, int objectivenum);
1989 
1990 
1991 
1992 //===============================================
1993 
1994 void		BG_CycleInven(playerState_t *ps, int direction);
1995 int			BG_ProperForceIndex(int power);
1996 void		BG_CycleForce(playerState_t *ps, int direction);
1997 
1998 const char *CG_GetStringEdString(char *refSection, char *refName);
1999 
2000 void FX_TurretProjectileThink(  centity_t *cent, const struct weaponInfo_s *weapon );
2001 void FX_TurretHitWall( vec3_t origin, vec3_t normal );
2002 void FX_TurretHitPlayer( vec3_t origin, vec3_t normal, qboolean humanoid );
2003 
2004 void FX_ConcussionHitWall( vec3_t origin, vec3_t normal );
2005 void FX_ConcussionHitPlayer( vec3_t origin, vec3_t normal, qboolean humanoid );
2006 void FX_ConcussionProjectileThink(  centity_t *cent, const struct weaponInfo_s *weapon );
2007 void FX_ConcAltShot( vec3_t start, vec3_t end );
2008 
2009 //-----------------------------
2010 // Effects related prototypes
2011 //-----------------------------
2012 
2013 // Environmental effects
2014 void CG_Spark( vec3_t origin, vec3_t dir );
2015 
2016 // Weapon prototypes
2017 void FX_BryarHitWall( vec3_t origin, vec3_t normal );
2018 void FX_BryarAltHitWall( vec3_t origin, vec3_t normal, int power );
2019 void FX_BryarHitPlayer( vec3_t origin, vec3_t normal, qboolean humanoid );
2020 void FX_BryarAltHitPlayer( vec3_t origin, vec3_t normal, qboolean humanoid );
2021 
2022 void FX_BlasterProjectileThink( centity_t *cent, const struct weaponInfo_s *weapon );
2023 void FX_BlasterAltFireThink( centity_t *cent, const struct weaponInfo_s *weapon );
2024 void FX_BlasterWeaponHitWall( vec3_t origin, vec3_t normal );
2025 void FX_BlasterWeaponHitPlayer( vec3_t origin, vec3_t normal, qboolean humanoid );
2026 
2027 
2028 void FX_ForceDrained(vec3_t origin, vec3_t dir);
2029 
2030 
2031 //-----------------------------
2032 // Effects related prototypes
2033 //-----------------------------
2034 
2035 // Environmental effects
2036 void CG_Spark( vec3_t origin, vec3_t dir );
2037 
2038 // Weapon prototypes
2039 void FX_BryarHitWall( vec3_t origin, vec3_t normal );
2040 void FX_BryarAltHitWall( vec3_t origin, vec3_t normal, int power );
2041 void FX_BryarHitPlayer( vec3_t origin, vec3_t normal, qboolean humanoid );
2042 void FX_BryarAltHitPlayer( vec3_t origin, vec3_t normal, qboolean humanoid );
2043 
2044 void FX_BlasterProjectileThink( centity_t *cent, const struct weaponInfo_s *weapon );
2045 void FX_BlasterAltFireThink( centity_t *cent, const struct weaponInfo_s *weapon );
2046 void FX_BlasterWeaponHitWall( vec3_t origin, vec3_t normal );
2047 void FX_BlasterWeaponHitPlayer( vec3_t origin, vec3_t normal, qboolean humanoid );
2048 
2049 void		CG_Init_CG(void);
2050 void		CG_Init_CGents(void);
2051 
2052 
2053 void CG_SetGhoul2Info( refEntity_t *ent, centity_t *cent);
2054 void CG_CreateBBRefEnts(entityState_t *s1, vec3_t origin );
2055 
2056 void CG_InitG2Weapons(void);
2057 void CG_ShutDownG2Weapons(void);
2058 void CG_CopyG2WeaponInstance(centity_t *cent, int weaponNum, void *toGhoul2);
2059 void *CG_G2WeaponInstance(centity_t *cent, int weapon);
2060 void CG_CheckPlayerG2Weapons(playerState_t *ps, centity_t *cent);
2061 
2062 void CG_SetSiegeTimerCvar( int msec );
2063 
2064 void	CG_ClearLightStyles (void);
2065 void	CG_RunLightStyles (void);
2066 void	CG_SetLightstyle (int i);
2067 
2068 /*
2069 Ghoul2 Insert End
2070 */
2071 
2072 extern cgameImport_t *trap;
2073