1 /*
2 ===========================================================================
3 
4 Return to Castle Wolfenstein multiplayer GPL Source Code
5 Copyright (C) 1999-2010 id Software LLC, a ZeniMax Media company.
6 
7 This file is part of the Return to Castle Wolfenstein multiplayer GPL Source Code (“RTCW MP Source Code”).
8 
9 RTCW MP Source Code is free software: you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation, either version 3 of the License, or
12 (at your option) any later version.
13 
14 RTCW MP Source Code is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 GNU General Public License for more details.
18 
19 You should have received a copy of the GNU General Public License
20 along with RTCW MP Source Code.  If not, see <http://www.gnu.org/licenses/>.
21 
22 In addition, the RTCW MP Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the RTCW MP Source Code.  If not, please request a copy in writing from id Software at the address below.
23 
24 If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
25 
26 ===========================================================================
27 */
28 
29 /*
30  * name:	cg_local.h
31  *
32  * desc:	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  *
38 */
39 
40 #include "../qcommon/q_shared.h"
41 #include "../renderer/tr_types.h"
42 #include "../game/bg_public.h"
43 #include "cg_public.h"
44 
45 
46 #define POWERUP_BLINKS      5
47 
48 #define POWERUP_BLINK_TIME  1000
49 #define FADE_TIME           200
50 #define PULSE_TIME          200
51 #define DAMAGE_DEFLECT_TIME 100
52 #define DAMAGE_RETURN_TIME  400
53 #define DAMAGE_TIME         500
54 #define LAND_DEFLECT_TIME   150
55 #define LAND_RETURN_TIME    300
56 #define STEP_TIME           200
57 #define DUCK_TIME           100
58 #define PAIN_TWITCH_TIME    200
59 #define WEAPON_SELECT_TIME  1400
60 #define HOLDABLE_SELECT_TIME 1400   //----(SA)	for drawing holdable icons
61 #define ITEM_SCALEUP_TIME   1000
62 #define ZOOM_TIME           150
63 #define ITEM_BLOB_TIME      200
64 #define MUZZLE_FLASH_TIME   30      //----(SA)
65 #define SINK_TIME           1000        // time for fragments to sink into ground before going away
66 #define ATTACKER_HEAD_TIME  10000
67 #define REWARD_TIME         3000
68 
69 #define PULSE_SCALE         1.5         // amount to scale up the icons when activating
70 
71 #define MAX_STEP_CHANGE     32
72 
73 #define MAX_VERTS_ON_POLY   10
74 #define MAX_MARK_POLYS      256 // JPW NERVE was 1024
75 
76 #define STAT_MINUS          10  // num frame for '-' stats digit
77 
78 #define ICON_SIZE           48
79 #define CHAR_WIDTH          32
80 #define CHAR_HEIGHT         48
81 #define TEXT_ICON_SPACE     4
82 
83 #define TEAMCHAT_WIDTH      80
84 #define TEAMCHAT_HEIGHT     8
85 
86 #define NOTIFY_WIDTH        80
87 #define NOTIFY_HEIGHT       5
88 
89 // very large characters
90 #define GIANT_WIDTH         32
91 #define GIANT_HEIGHT        48
92 
93 #define NUM_CROSSHAIRS      10
94 
95 // Ridah, trails
96 #define STYPE_STRETCH   0
97 #define STYPE_REPEAT    1
98 
99 #define TJFL_FADEIN     ( 1 << 0 )
100 #define TJFL_CROSSOVER  ( 1 << 1 )
101 #define TJFL_NOCULL     ( 1 << 2 )
102 #define TJFL_FIXDISTORT ( 1 << 3 )
103 #define TJFL_SPARKHEADFLARE ( 1 << 4 )
104 #define TJFL_NOPOLYMERGE    ( 1 << 5 )
105 // done.
106 
107 // NERVE - SMF - limbo mode 3d view position
108 #define LIMBO_3D_X  10
109 #define LIMBO_3D_Y  158
110 #define LIMBO_3D_W  420
111 #define LIMBO_3D_H  312
112 // -NERVE - SMF
113 
114 //=================================================
115 
116 // player entities need to track more information
117 // than any other type of entity.
118 
119 // note that not every player entity is a client entity,
120 // because corpses after respawn are outside the normal
121 // client numbering range
122 
123 // when changing animation, set animationTime to frameTime + lerping time
124 // The current lerp will finish out, then it will lerp to the new animation
125 typedef struct {
126 	int oldFrame;
127 	int oldFrameTime;               // time when ->oldFrame was exactly on
128 
129 	int frame;
130 	int frameTime;                  // time when ->frame will be exactly on
131 
132 	float backlerp;
133 
134 	float yawAngle;
135 	qboolean yawing;
136 	float pitchAngle;
137 	qboolean pitching;
138 
139 	int animationNumber;            // may include ANIM_TOGGLEBIT
140 	int oldAnimationNumber;         // may include ANIM_TOGGLEBIT
141 	animation_t *animation;
142 	int animationTime;              // time when the first frame of the animation will be exact
143 
144 	// Ridah, variable speed anims
145 	vec3_t oldFramePos;
146 	float animSpeedScale;
147 	int oldFrameSnapshotTime;
148 	headAnimation_t *headAnim;
149 	// done.
150 
151 } lerpFrame_t;
152 
153 // Ridah, effect defines
154 #define MAX_ZOMBIE_SPIRITS          1 // JPW NERVE was 4
155 #define MAX_ZOMBIE_DEATH_TRAILS     1 // JPW NERVE was 16
156 
157 #define MAX_LOPER_LIGHTNING_POINTS  1 // JPW NERVE was 24
158 
159 #define MAX_TESLA_BOLTS             1 // JPW NERVE was 4
160 
161 #define MAX_EFFECT_ENTS             20
162 
163 typedef struct {
164 	lerpFrame_t legs, torso;
165 
166 	// Ridah, talking animations
167 	lerpFrame_t head;
168 	// done.
169 
170 	lerpFrame_t weap;       //----(SA)	autonomous weapon animations
171 
172 	int painTime;
173 	int painDuration;
174 	int painDirection;              // flip from 0 to 1
175 	int painAnimTorso;
176 	int painAnimLegs;
177 	int lightningFiring;
178 
179 	int	railFireTime;
180 
181 	// machinegun spinning
182 	float barrelAngle;
183 	int barrelTime;
184 	qboolean barrelSpinning;
185 
186 	//----(SA) machinegun bolt sliding
187 	float boltPosition;
188 	int boltTime;
189 	int boltSliding;
190 	//----(SA) end
191 
192 	//----(SA) 'spinner' spinning (body part)
193 	float spinnerAngle;
194 	int spinnerTime;
195 	qboolean spinnerSpinning;
196 	//----(SA)	end
197 
198 	// Ridah, so we can do fast tag grabbing
199 	refEntity_t legsRefEnt, torsoRefEnt, headRefEnt, gunRefEnt;
200 	int gunRefEntFrame;
201 
202 	float animSpeed;            // for manual adjustment
203 
204 	// Zombie spirit effect
205 	// !!FIXME: these effects will be restarted by a *_restart command, can we save this data somehow?
206 	qboolean cueZombieSpirit;               // if this is qfalse, and the zombie effect flag is set, then we need to start a new attack
207 	int zombieSpiritStartTime;              // time the effect was started, so we can fade things in
208 	int zombieSpiritTrailHead[MAX_ZOMBIE_SPIRITS];
209 	int zombieSpiritRotationTimes[MAX_ZOMBIE_SPIRITS];
210 	int zombieSpiritRadiusCycleTimes[MAX_ZOMBIE_SPIRITS];
211 	int lastZombieSpirit;
212 	int nextZombieSpiritSound;
213 	int zombieSpiritEndTime;                // time the effect was disabled
214 	vec3_t zombieSpiritPos[MAX_ZOMBIE_SPIRITS];
215 	vec3_t zombieSpiritDir[MAX_ZOMBIE_SPIRITS];
216 	float zombieSpiritSpeed[MAX_ZOMBIE_SPIRITS];
217 	int zombieSpiritStartTimes[MAX_ZOMBIE_SPIRITS];
218 
219 	// Zombie death effect
220 	// !!FIXME: these effects will be restarted by a *_restart command, can we save this data somehow?
221 	qboolean cueZombieDeath;            // if this is qfalse, and the zombie effect flag is set, then we need to start a new attack
222 	int zombieDeathStartTime;               // time the effect was started, so we can fade things in
223 	int zombieDeathEndTime;             // time the effect was disabled
224 	int lastZombieDeath;
225 	int zombieDeathFadeStart;
226 	int zombieDeathFadeEnd;
227 	int zombieDeathTrailHead[MAX_ZOMBIE_DEATH_TRAILS];
228 	int zombieDeathRotationTimes[MAX_ZOMBIE_DEATH_TRAILS];
229 	int zombieDeathRadiusCycleTimes[MAX_ZOMBIE_DEATH_TRAILS];
230 
231 	// loper effects
232 	int loperLastGroundChargeTime;
233 	byte loperGroundChargeToggle;
234 	int loperGroundValidTime;
235 
236 	vec3_t headLookIdeal;
237 	vec3_t headLookOffset;
238 	float headLookSpeed;
239 	int headLookStopTime;
240 	float headLookSpeedMax;
241 
242 	// tesla coil effects
243 	vec3_t teslaEndPoints[MAX_TESLA_BOLTS];
244 	int teslaEndPointTimes[MAX_TESLA_BOLTS];            // time the bolt stays valid
245 	vec3_t teslaOffsetDirs[MAX_TESLA_BOLTS];            // bending direction from center or direct beam
246 	float teslaOffsets[MAX_TESLA_BOLTS];                // amount to offset from center
247 	int teslaOffsetTimes[MAX_TESLA_BOLTS];              // time the offset stays valid
248 	int teslaEnemy[MAX_TESLA_BOLTS];
249 	int teslaDamageApplyTime;
250 
251 	int teslaDamagedTime;                   // time we were last hit by a tesla bolt
252 
253 	// misc effects
254 	int effectEnts[MAX_EFFECT_ENTS];
255 	int numEffectEnts;
256 	int effect1EndTime;
257 	vec3_t lightningPoints[MAX_LOPER_LIGHTNING_POINTS];
258 	int lightningTimes[MAX_LOPER_LIGHTNING_POINTS];
259 	int lightningSoundTime;
260 
261 	qboolean forceLOD;
262 
263 } playerEntity_t;
264 
265 //----(SA)
266 typedef struct {
267 	char type[MAX_QPATH];           // md3_lower, md3_lbelt, md3_rbelt, etc.
268 	char model[MAX_QPATH];          // lower.md3, belt1.md3, etc.
269 } skinModel_t;
270 //----(SA) end
271 
272 
273 //=================================================
274 
275 
276 
277 // centity_t have a direct corespondence with gentity_t in the game, but
278 // only the entityState_t is directly communicated to the cgame
279 typedef struct centity_s {
280 	entityState_t currentState;     // from cg.frame
281 	entityState_t nextState;        // from cg.nextFrame, if available
282 	qboolean interpolate;           // true if next is valid to interpolate to
283 	qboolean currentValid;          // true if cg.frame holds this entity
284 
285 	int muzzleFlashTime;                // move to playerEntity?
286 	int overheatTime;
287 	int previousEvent;
288 	int previousEventSequence;              // Ridah
289 	int teleportFlag;
290 
291 	int trailTime;                  // so missile trails can handle dropped initial packets
292 	int miscTime;
293 
294 	playerEntity_t pe;
295 
296 	int errorTime;                  // decay the error from this time
297 	vec3_t errorOrigin;
298 	vec3_t errorAngles;
299 
300 	qboolean extrapolated;          // false if origin / angles is an interpolation
301 	vec3_t rawOrigin;
302 	vec3_t rawAngles;
303 
304 	vec3_t beamEnd;
305 
306 	// exact interpolated position of entity on this frame
307 	vec3_t lerpOrigin;
308 	vec3_t lerpAngles;
309 
310 	vec3_t lastLerpAngles;          // (SA) for remembering the last position when a state changes
311 
312 	// Ridah, trail effects
313 	int headJuncIndex, headJuncIndex2;
314 	int lastTrailTime;
315 	// done.
316 
317 	// Ridah
318 	float loopSoundVolume;
319 	vec3_t fireRiseDir;             // if standing still this will be up, otherwise it'll point away from movement dir
320 	int lastWeaponClientFrame;
321 	int lastFuseSparkTime;
322 	vec3_t lastFuseSparkOrg;
323 
324 	// client side dlights
325 	int dl_frame;
326 	int dl_oldframe;
327 	float dl_backlerp;
328 	int dl_time;
329 	char dl_stylestring[64];
330 	int dl_sound;
331 	int dl_atten;
332 
333 	lerpFrame_t lerpFrame;      //----(SA)	added
334 	vec3_t highlightOrigin;             // center of the geometry.  for things like corona placement on treasure
335 	qboolean usehighlightOrigin;
336 
337 	refEntity_t refEnt;
338 	int processedFrame;                 // frame we were last added to the scene
339 
340 	int voiceChatSprite;                    // DHM - Nerve
341 	int voiceChatSpriteTime;                // DHM - Nerve
342 
343 	// client-side lightning
344 	int boltTimes[MAX_TESLA_BOLTS];
345 	vec3_t boltLocs[MAX_TESLA_BOLTS];
346 	vec3_t boltCrawlDirs[MAX_TESLA_BOLTS];
347 
348 	// item highlighting
349 
350 	int highlightTime;
351 	qboolean highlighted;
352 } centity_t;
353 
354 
355 //======================================================================
356 
357 // local entities are created as a result of events or predicted actions,
358 // and live independantly from all server transmitted entities
359 
360 typedef struct markPoly_s {
361 	struct markPoly_s   *prevMark, *nextMark;
362 	int time;
363 	qhandle_t markShader;
364 	qboolean alphaFade;         // fade alpha instead of rgb
365 	float color[4];
366 	poly_t poly;
367 	polyVert_t verts[MAX_VERTS_ON_POLY];
368 
369 	int duration;           // Ridah
370 } markPoly_t;
371 
372 //----(SA)	moved in from cg_view.c
373 typedef enum {
374 	ZOOM_NONE,
375 	ZOOM_BINOC,
376 	ZOOM_SNIPER,
377 	ZOOM_SNOOPER,
378 	ZOOM_FG42SCOPE,
379 	ZOOM_MG42,
380 	ZOOM_MAX_ZOOMS
381 } EZoom_t;
382 
383 typedef enum {
384 	ZOOM_OUT,   // widest angle
385 	ZOOM_IN // tightest angle (approaching 0)
386 } EZoomInOut_t;
387 
388 extern float zoomTable[ZOOM_MAX_ZOOMS][2];
389 
390 //----(SA)	end
391 
392 typedef enum {
393 	LE_MARK,
394 	LE_EXPLOSION,
395 	LE_SPRITE_EXPLOSION,
396 	LE_FRAGMENT,
397 	LE_MOVE_SCALE_FADE,
398 	LE_FALL_SCALE_FADE,
399 	LE_FADE_RGB,
400 	LE_SCALE_FADE,
401 	LE_SPARK,
402 	LE_DEBRIS,
403 	LE_BLOOD,
404 	LE_FUSE_SPARK,
405 	LE_ZOMBIE_SPIRIT,
406 	LE_ZOMBIE_BAT,
407 	LE_MOVING_TRACER,
408 	LE_EMITTER
409 } leType_t;
410 
411 typedef enum {
412 	LEF_PUFF_DONT_SCALE  = 0x0001           // do not scale size over time
413 	,LEF_TUMBLE          = 0x0002           // tumble over time, used for ejecting shells
414 	,LEF_NOFADEALPHA     = 0x0004           // Ridah, sparks
415 	,LEF_SMOKING         = 0x0008           // (SA) smoking
416 } leFlag_t;
417 
418 typedef enum {
419 	LEMT_NONE,
420 	LEMT_BLOOD
421 } leMarkType_t;         // fragment local entities can leave marks on walls
422 
423 typedef enum {
424 	LEBS_NONE,
425 	LEBS_BLOOD,
426 	LEBS_ROCK,
427 	LEBS_WOOD,
428 	LEBS_BRASS,
429 	LEBS_BONE
430 } leBounceSoundType_t;  // fragment local entities can make sounds on impacts
431 
432 typedef struct localEntity_s {
433 	struct localEntity_s    *prev, *next;
434 	leType_t leType;
435 	int leFlags;
436 
437 	int startTime;
438 	int endTime;
439 	int fadeInTime;
440 
441 	float lifeRate;                     // 1.0 / (endTime - startTime)
442 
443 	trajectory_t pos;
444 	trajectory_t angles;
445 
446 	float bounceFactor;                 // 0.0 = no bounce, 1.0 = perfect
447 
448 	float color[4];
449 
450 	float radius;
451 
452 	float light;
453 	vec3_t lightColor;
454 
455 	leMarkType_t leMarkType;            // mark to leave on fragment impact
456 	leBounceSoundType_t leBounceSoundType;
457 
458 	refEntity_t refEntity;
459 
460 	// Ridah
461 	int lightOverdraw;
462 	int lastTrailTime;
463 	int headJuncIndex, headJuncIndex2;
464 	float effectWidth;
465 	int effectFlags;
466 	struct localEntity_s    *chain;     // used for grouping entities (like for flamethrower junctions)
467 	int onFireStart, onFireEnd;
468 	int ownerNum;
469 	int lastSpiritDmgTime;
470 
471 	int loopingSound;
472 
473 	int breakCount;                     // break-up this many times before we can break no more
474 	float sizeScale;
475 	// done.
476 
477 } localEntity_t;
478 
479 //======================================================================
480 
481 
482 typedef struct {
483 	int client;
484 	int score;
485 	int ping;
486 	int time;
487 	int scoreFlags;
488 	int powerUps;
489 	int accuracy;
490 	int impressiveCount;
491 	int excellentCount;
492 	int guantletCount;
493 	int defendCount;
494 	int assistCount;
495 	int captures;
496 	qboolean perfect;
497 	int team;
498 	int playerClass;                    // NERVE - SMF
499 	int respawnsLeft;                   // NERVE - SMF
500 } score_t;
501 
502 
503 typedef enum {
504 	ACC_BELT_LEFT,  // belt left (lower)
505 	ACC_BELT_RIGHT, // belt right (lower)
506 	ACC_BELT,       // belt (upper)
507 	ACC_BACK,       // back (upper)
508 	ACC_WEAPON,     // weapon (upper)
509 	ACC_WEAPON2,    // weapon2 (upper)
510 	ACC_HAT,        // hat (head)
511 	ACC_MOUTH2,     //
512 	ACC_MOUTH3,     //
513 	//
514 	ACC_MAX     // this is bound by network limits, must change network stream to increase this
515 				// (SA) No, really?  that's not true is it?  isn't this client-side only?
516 } accType_t;
517 
518 #define ACC_NUM_MOUTH 3 // matches the above count (hat/mouth2/mouth3)
519 
520 
521 
522 
523 // each client has an associated clientInfo_t
524 // that contains media references necessary to present the
525 // client model and other color coded effects
526 // this is regenerated each time a client's configstring changes,
527 // usually as a result of a userinfo (name, model, etc) change
528 #define MAX_CUSTOM_SOUNDS   32
529 #define MAX_GIB_MODELS      16
530 typedef struct {
531 	qboolean infoValid;
532 
533 	int clientNum;
534 
535 	char name[MAX_QPATH];
536 	team_t team;
537 
538 	int botSkill;                   // 0 = not bot, 1-5 = bot
539 
540 	vec3_t color;
541 
542 	byte c1RGBA[4];
543 
544 	int score;                      // updated by score servercmds
545 	int location;                   // location index for team mode
546 	int health;                     // you only get this info about your teammates
547 	int armor;
548 	int curWeapon;
549 
550 	int handicap;
551 	int wins, losses;               // in tourney mode
552 
553 	int powerups;                   // so can display quad/flag status
554 
555 	int breathPuffTime;
556 
557 	// when clientinfo is changed, the loading of models/skins/sounds
558 	// can be deferred until you are dead, to prevent hitches in
559 	// gameplay
560 	char modelName[MAX_QPATH];
561 	char skinName[MAX_QPATH];
562 	char hSkinName[MAX_QPATH];
563 	qboolean deferred;
564 
565 	qhandle_t legsModel;
566 	qhandle_t legsSkin;
567 
568 	qhandle_t torsoModel;
569 	qhandle_t torsoSkin;
570 
571 	qboolean isSkeletal;
572 
573 	//----(SA) added accessory models/skins for belts/backpacks/etc.
574 	qhandle_t accModels[ACC_MAX];       // see def of ACC_MAX for index descriptions
575 	qhandle_t accSkins[ACC_MAX];        // FIXME: put the #define for number of accessory models somewhere. (SA)
576 
577 	//----(SA)	additional parts for specialized characters (the loper's spinning trunk for example)
578 	qhandle_t partModels[1];        // expand to [2], [3], etc as necessary
579 	//----(SA)	end
580 
581 	qhandle_t headModel;
582 	qhandle_t headSkin;
583 
584 	qhandle_t modelIcon;
585 
586 	// RF, may be shared by multiple clients/characters
587 	animModelInfo_t *modelInfo;
588 
589 	sfxHandle_t sounds[MAX_CUSTOM_SOUNDS];
590 
591 	qhandle_t gibModels[MAX_GIB_MODELS];
592 
593 	vec3_t playermodelScale;            //----(SA)	set in the skin.  client-side only
594 
595 	int blinkTime;              //----(SA)
596 
597 	// NERVE - SMF
598 	char headModelName[MAX_QPATH];
599 	gender_t gender;                // from model
600 	// -NERVE - SMF
601 } clientInfo_t;
602 
603 
604 
605 typedef enum {
606 	W_PART_1,
607 	W_PART_2,
608 	W_PART_3,
609 	W_PART_4,
610 	W_PART_5,
611 	W_PART_6,
612 	W_PART_7,
613 	W_MAX_PARTS
614 } barrelType_t;
615 
616 typedef enum {
617 	W_TP_MODEL,         //	third person model
618 	W_FP_MODEL,         //	first person model
619 	W_PU_MODEL,         //	pickup model
620 	W_FP_MODEL_SWAP,    //	swap out model
621 	W_SKTP_MODEL,       //	SKELETAL version third person model
622 	W_NUM_TYPES
623 } modelViewType_t;
624 
625 // each WP_* weapon enum has an associated weaponInfo_t
626 // that contains media references necessary to present the
627 // weapon and its effects
628 typedef struct weaponInfo_s {
629 	qboolean registered;
630 	gitem_t         *item;
631 
632 //----(SA)	weapon animation sequences loaded from the weapon.cfg
633 	animation_t weapAnimations[MAX_WP_ANIMATIONS];
634 //----(SA)	end
635 
636 	qhandle_t handsModel;               // the hands don't actually draw, they just position the weapon
637 
638 	qhandle_t standModel;               // not drawn.  tags used for positioning weapons for pickup
639 
640 //----(SA) mod for 1st/3rd person weap views
641 	qhandle_t weaponModel[W_NUM_TYPES];
642 	qhandle_t partModels[W_NUM_TYPES][W_MAX_PARTS];
643 	qhandle_t flashModel[W_NUM_TYPES];
644 	qhandle_t modModel[W_NUM_TYPES];        // like the scope for the rifles
645 //----(SA) end
646 
647 	pose_t position;                    // wolf locations (high, low, knife, pistol, shoulder, throw)  defines are WPOS_HIGH, WPOS_LOW, WPOS_KNIFE, WPOS_PISTOL, WPOS_SHOULDER, WPOS_THROW
648 
649 	vec3_t weaponMidpoint;              // so it will rotate centered instead of by tag
650 
651 	float flashDlight;
652 	vec3_t flashDlightColor;
653 	sfxHandle_t flashSound[4];          // fast firing weapons randomly choose
654 	sfxHandle_t flashEchoSound[4];      //----(SA)	added - distant gun firing sound
655 	sfxHandle_t lastShotSound[4];       // sound of the last shot can be different (mauser doesn't have bolt action on last shot for example)
656 
657 	qhandle_t weaponIcon[2];            //----(SA)	[0] is weap icon, [1] is highlight icon
658 	qhandle_t ammoIcon;
659 
660 	qhandle_t ammoModel;
661 
662 	qhandle_t missileModel;
663 	sfxHandle_t missileSound;
664 	void ( *missileTrailFunc )( centity_t *, const struct weaponInfo_s *wi );
665 	float missileDlight;
666 	vec3_t missileDlightColor;
667 	int missileRenderfx;
668 
669 	void ( *ejectBrassFunc )( centity_t * );
670 
671 	float trailRadius;
672 	float wiTrailTime;
673 
674 	sfxHandle_t readySound;             // an amibient sound the weapon makes when it's /not/ firing
675 	sfxHandle_t firingSound;
676 	sfxHandle_t overheatSound;
677 	sfxHandle_t reloadSound;
678 
679 	sfxHandle_t spinupSound;        //----(SA)	added // sound started when fire button goes down, and stepped on when the first fire event happens
680 	sfxHandle_t spindownSound;      //----(SA)	added // sound called if the above is running but player doesn't follow through and fire
681 } weaponInfo_t;
682 
683 
684 // each IT_* item has an associated itemInfo_t
685 // that constains media references necessary to present the
686 // item and its effects
687 typedef struct {
688 	qboolean registered;
689 	qhandle_t models[MAX_ITEM_MODELS];
690 	qhandle_t icons[MAX_ITEM_ICONS];
691 } itemInfo_t;
692 
693 
694 typedef struct {
695 	int itemNum;
696 } powerupInfo_t;
697 
698 #define MAX_VIEWDAMAGE  8
699 typedef struct {
700 	int damageTime, damageDuration;
701 	float damageX, damageY, damageValue;
702 } viewDamage_t;
703 
704 //======================================================================
705 
706 // all cg.stepTime, cg.duckTime, cg.landTime, etc are set to cg.time when the action
707 // occurs, and they will have visible effects for #define STEP_TIME or whatever msec after
708 
709 #define MAX_PREDICTED_EVENTS    16
710 
711 #define MAX_SPAWN_VARS          64
712 #define MAX_SPAWN_VARS_CHARS    2048
713 
714 typedef struct {
715 	int clientFrame;                // incremented each frame
716 
717 	int clientNum;
718 
719 	qboolean demoPlayback;
720 	qboolean levelShot;             // taking a level menu screenshot
721 	int deferredPlayerLoading;
722 	qboolean loading;               // don't defer players at initial startup
723 	qboolean intermissionStarted;       // don't play voice rewards, because game will end shortly
724 
725 	// there are only one or two snapshot_t that are relevent at a time
726 	int latestSnapshotNum;          // the number of snapshots the client system has received
727 	int latestSnapshotTime;         // the time from latestSnapshotNum, so we don't need to read the snapshot yet
728 
729 	snapshot_t  *snap;              // cg.snap->serverTime <= cg.time
730 	snapshot_t  *nextSnap;          // cg.nextSnap->serverTime > cg.time, or NULL
731 	snapshot_t activeSnapshots[2];
732 
733 	float frameInterpolation;       // (float)( cg.time - cg.frame->serverTime ) / (cg.nextFrame->serverTime - cg.frame->serverTime)
734 
735 	qboolean thisFrameTeleport;
736 	qboolean nextFrameTeleport;
737 
738 	int frametime;              // cg.time - cg.oldTime
739 
740 	int time;                   // this is the time value that the client
741 								// is rendering at.
742 	int oldTime;                // time at last frame, used for missile trails and prediction checking
743 
744 	int physicsTime;            // either cg.snap->time or cg.nextSnap->time
745 
746 	int timelimitWarnings;          // 5 min, 1 min, overtime
747 	int fraglimitWarnings;
748 
749 	qboolean mapRestart;            // set on a map restart to set back the weapon
750 
751 	qboolean renderingThirdPerson;          // during deaths, chasecams, etc
752 
753 	// prediction state
754 	qboolean hyperspace;                // true if prediction has hit a trigger_teleport
755 	playerState_t predictedPlayerState;
756 	centity_t predictedPlayerEntity;
757 	qboolean validPPS;                  // clear until the first call to CG_PredictPlayerState
758 	int predictedErrorTime;
759 	vec3_t predictedError;
760 
761 	int eventSequence;
762 	int predictableEvents[MAX_PREDICTED_EVENTS];
763 
764 	float stepChange;                   // for stair up smoothing
765 	int stepTime;
766 
767 	float duckChange;                   // for duck viewheight smoothing
768 	int duckTime;
769 
770 	float landChange;                   // for landing hard
771 	int landTime;
772 
773 	// input state sent to server
774 	int weaponSelect;
775 	int holdableSelect;                 // (SA) which holdable item is currently held ("selected").  When the client is ready to use it, send "use item <holdableSelect>"
776 
777 	// auto rotating items
778 	vec3_t autoAnglesSlow;
779 	vec3_t autoAxisSlow[3];
780 	vec3_t autoAngles;
781 	vec3_t autoAxis[3];
782 	vec3_t autoAnglesFast;
783 	vec3_t autoAxisFast[3];
784 
785 	// view rendering
786 	refdef_t refdef;
787 	vec3_t refdefViewAngles;	// will be converted to refdef.viewaxis
788 	float fov;			// either range checked cg_fov or forced value
789 
790 	// zoom key
791 	qboolean zoomed;
792 	qboolean zoomedBinoc;
793 	int zoomedScope;            //----(SA)	changed to int
794 	int zoomTime;
795 	float zoomSensitivity;
796 	float zoomval;
797 
798 
799 	// information screen text during loading
800 	char infoScreenText[MAX_STRING_CHARS];
801 
802 	// scoreboard
803 	int scoresRequestTime;
804 	int numScores;
805 	int selectedScore;
806 	int teamScores[2];
807 	int teamPlayers[TEAM_NUM_TEAMS];         // JPW NERVE for scoreboard
808 	score_t scores[MAX_CLIENTS];
809 	qboolean showScores;
810 	qboolean scoreBoardShowing;
811 	int scoreFadeTime;
812 	char killerName[MAX_NAME_LENGTH];
813 	char spectatorList[MAX_STRING_CHARS];                   // list of names
814 	int spectatorLen;                                                           // length of list
815 	float spectatorWidth;                                                   // width in device units
816 	int spectatorTime;                                                      // next time to offset
817 	int spectatorPaintX;                                                    // current paint x
818 	int spectatorPaintX2;                                                   // current paint x
819 	int spectatorOffset;                                                    // current offset from start
820 	int spectatorPaintLen;                                              // current offset from start
821 
822 	qboolean showItems;
823 	int itemFadeTime;
824 
825 	qboolean lightstylesInited;
826 
827 	// centerprinting
828 	int centerPrintTime;
829 	int centerPrintCharWidth;
830 	int centerPrintY;
831 	char centerPrint[1024];
832 	int centerPrintLines;
833 	int centerPrintPriority;                    // NERVE - SMF
834 
835 	// fade in/out
836 	int fadeTime;
837 	float fadeRate;
838 	vec4_t fadeColor1;
839 	vec4_t fadeColor2;
840 
841 	// low ammo warning state
842 	int lowAmmoWarning;             // 1 = low, 2 = empty
843 
844 	// crosshair client ID
845 	int crosshairClientNum;
846 	int crosshairClientTime;
847 
848 	int crosshairPowerupNum;
849 	int crosshairPowerupTime;
850 
851 	int identifyClientNum;                  // NERVE - SMF
852 	int identifyClientHealth;               // NERVE - SMF
853 	int identifyNextTime;                   // NERVE - SMF
854 	int identifyClientRequest;              // NERVE - SMF
855 
856 //----(SA)	added
857 	// cursorhints
858 	int cursorHintIcon;
859 	int cursorHintTime;
860 	int cursorHintFade;
861 	int cursorHintValue;
862 //----(SA)	end
863 
864 	// powerup active flashing
865 	int powerupActive;
866 	int powerupTime;
867 
868 	// attacking player
869 	int attackerTime;
870 	int voiceTime;
871 
872 	// reward medals
873 	int rewardTime;
874 	int rewardCount;
875 	qhandle_t rewardShader;
876 
877 	// warmup countdown
878 	int warmup;
879 	int warmupCount;
880 
881 	//==========================
882 
883 	int itemPickup;
884 	int itemPickupTime;
885 	int itemPickupBlendTime;            // the pulse around the crosshair is timed seperately
886 
887 	int holdableSelectTime;             //----(SA)	for holdable item icon drawing
888 
889 	int weaponSelectTime;
890 	int weaponAnimation;
891 	int weaponAnimationTime;
892 
893 	// blend blobs
894 	viewDamage_t viewDamage[MAX_VIEWDAMAGE];
895 	float damageTime;           // last time any kind of damage was recieved
896 	int damageIndex;            // slot that was filled in
897 	float damageX, damageY, damageValue;
898 
899 	int grenLastTime;
900 
901 	int switchbackWeapon;
902 	int lastFiredWeapon;
903 	int lastWeapSelInBank[MAX_WEAP_BANKS];          // remember which weapon was last selected in a bank for 'weaponbank' commands //----(SA)	added
904 // JPW FIXME NOTE: max_weap_banks > max_weap_banks_mp so this should be OK, but if that changes, change this too
905 
906 	// status bar head
907 	float headYaw;
908 	float headEndPitch;
909 	float headEndYaw;
910 	int headEndTime;
911 	float headStartPitch;
912 	float headStartYaw;
913 	int headStartTime;
914 
915 	// view movement
916 	float v_dmg_time;
917 	float v_dmg_pitch;
918 	float v_dmg_roll;
919 
920 	// RF, view flames when getting burnt
921 	int v_fireTime, v_noFireTime;
922 	vec3_t v_fireRiseDir;
923 
924 	// temp working variables for player view
925 	float bobfracsin;
926 	int bobcycle;
927 	float xyspeed;
928 	int nextOrbitTime;
929 
930 	// development tool
931 	refEntity_t testModelEntity;
932 	char testModelName[MAX_QPATH];
933 	qboolean testGun;
934 
935 	// RF, new kick angles
936 	vec3_t kickAVel;            // for damage feedback, weapon recoil, etc
937 								// This is the angular velocity, to give a smooth
938 								// rotational feedback, rather than sudden jerks
939 	vec3_t kickAngles;          // for damage feedback, weapon recoil, etc
940 								// NOTE: this is not transmitted through MSG.C stream
941 								// since weapon kicks are client-side, and damage feedback
942 								// is rare enough that we can transmit that as an event
943 	float recoilPitch, recoilPitchAngle;
944 
945 	// Duffy
946 	qboolean cameraMode;        // if rendering from a camera
947 	// Duffy end
948 
949 	qboolean limboMenu;
950 
951 	int oidTeam;
952 	int oidPrintTime;
953 	int oidPrintCharWidth;
954 	int oidPrintY;
955 	char oidPrint[1024];
956 	int oidPrintLines;
957 
958 	// for voice chat buffer
959 	int voiceChatTime;
960 	int voiceChatBufferIn;
961 	int voiceChatBufferOut;
962 
963 	int newCrosshairIndex;
964 	qhandle_t crosshairShaderAlt[NUM_CROSSHAIRS];
965 
966 	int cameraShakeTime;
967 	float cameraShakePhase;
968 	float cameraShakeScale;
969 	float cameraShakeLength;
970 
971 	qboolean latchVictorySound;
972 	// -NERVE - SMF
973 
974 	// spawn variables
975 	qboolean spawning;                  // the CG_Spawn*() functions are valid
976 	int numSpawnVars;
977 	char        *spawnVars[MAX_SPAWN_VARS][2];  // key / value pairs
978 	int numSpawnVarChars;
979 	char spawnVarChars[MAX_SPAWN_VARS_CHARS];
980 
981 	// Arnout: allow overriding of countdown sounds
982 	char twoMinuteSound_g[MAX_QPATH];
983 	char twoMinuteSound_a[MAX_QPATH];
984 	char thirtySecondSound_g[MAX_QPATH];
985 	char thirtySecondSound_a[MAX_QPATH];
986 
987 	pmoveExt_t pmext;
988 
989 } cg_t;
990 
991 #define NUM_FUNNEL_SPRITES  21
992 #define MAX_LOCKER_DEBRIS   5
993 
994 // all of the model, shader, and sound references that are
995 // loaded at gamestate time are stored in cgMedia_t
996 // Other media that can be tied to clients, weapons, or items are
997 // stored in the clientInfo_t, itemInfo_t, weaponInfo_t, and powerupInfo_t
998 typedef struct {
999 	qhandle_t charsetShader;
1000 	// JOSEPH 4-17-00
1001 	qhandle_t menucharsetShader;
1002 	// END JOSEPH
1003 	qhandle_t charsetProp;
1004 	qhandle_t charsetPropGlow;
1005 	qhandle_t charsetPropB;
1006 	qhandle_t whiteShader;
1007 
1008 	qhandle_t redFlagModel;
1009 	qhandle_t blueFlagModel;
1010 
1011 	qhandle_t armorModel;
1012 
1013 // JPW NERVE
1014 	qhandle_t hudSprintBar;
1015 	qhandle_t hudPowerBar;
1016 	qhandle_t hudAxisHelmet;
1017 	qhandle_t hudAlliedHelmet;
1018 	qhandle_t redColorBar;
1019 	qhandle_t blueColorBar;
1020 // jpw
1021 	qhandle_t teamStatusBar;
1022 
1023 	qhandle_t deferShader;
1024 
1025 	// gib explosions
1026 	qhandle_t gibAbdomen;
1027 	qhandle_t gibArm;
1028 	qhandle_t gibChest;
1029 	qhandle_t gibFist;
1030 	qhandle_t gibFoot;
1031 	qhandle_t gibForearm;
1032 	qhandle_t gibIntestine;
1033 	qhandle_t gibLeg;
1034 	qhandle_t gibSkull;
1035 	qhandle_t gibBrain;
1036 
1037 	// debris
1038 	qhandle_t debBlock[6];
1039 	qhandle_t debRock[3];
1040 	qhandle_t debFabric[3];
1041 	qhandle_t debWood[6];
1042 
1043 	qhandle_t targetEffectExplosionShader;
1044 
1045 	qhandle_t machinegunBrassModel;
1046 	qhandle_t panzerfaustBrassModel;    //----(SA)	added
1047 
1048 	// Rafael
1049 	qhandle_t smallgunBrassModel;
1050 
1051 	qhandle_t shotgunBrassModel;
1052 
1053 	qhandle_t railRingsShader;
1054 	qhandle_t railCoreShader;
1055 
1056 	qhandle_t lightningShader;
1057 
1058 	qhandle_t friendShader;
1059 
1060 	qhandle_t spawnInvincibleShader;
1061 	qhandle_t scoreEliminatedShader;
1062 
1063 	qhandle_t voiceChatShader;
1064 	qhandle_t medicReviveShader;
1065 	qhandle_t balloonShader;
1066 	qhandle_t connectionShader;
1067 
1068 	qhandle_t aiStateShaders[MAX_AISTATES];
1069 
1070 	qhandle_t selectShader;
1071 	qhandle_t viewBloodShader;
1072 	qhandle_t tracerShader;
1073 	qhandle_t crosshairShader[NUM_CROSSHAIRS];
1074 	qhandle_t lagometerShader;
1075 	qhandle_t backTileShader;
1076 	qhandle_t noammoShader;
1077 
1078 	qhandle_t reticleShader;
1079 	qhandle_t reticleShaderSimple;
1080 	qhandle_t snooperShader;
1081 	qhandle_t snooperShaderSimple;
1082 	qhandle_t binocShader;
1083 	qhandle_t binocShaderSimple;
1084 // JPW NERVE
1085 	qhandle_t fleshSmokePuffShader;   // JPW NERVE for bullet hit flesh smoke puffs
1086 	qhandle_t nerveTestShader;
1087 	qhandle_t idTestShader;
1088 	qhandle_t hud1Shader;
1089 	qhandle_t hud2Shader;
1090 	qhandle_t hud3Shader;
1091 	qhandle_t hud4Shader;
1092 	qhandle_t hud5Shader;
1093 // jpw
1094 	qhandle_t smokePuffShader;
1095 	qhandle_t smokePuffRageProShader;
1096 	qhandle_t shotgunSmokePuffShader;
1097 	qhandle_t waterBubbleShader;
1098 	qhandle_t bloodTrailShader;
1099 
1100 	qhandle_t nailPuffShader;
1101 
1102 	//----(SA)	cursor hints
1103 	// would be nice to specify these in the menu scripts instead of permanent handles...
1104 	qhandle_t usableHintShader;
1105 	qhandle_t notUsableHintShader;
1106 	qhandle_t doorHintShader;
1107 	qhandle_t doorRotateHintShader;
1108 	qhandle_t doorLockHintShader;
1109 	qhandle_t doorRotateLockHintShader;
1110 	qhandle_t mg42HintShader;
1111 	qhandle_t breakableHintShader;
1112 	qhandle_t chairHintShader;
1113 	qhandle_t alarmHintShader;
1114 	qhandle_t healthHintShader;
1115 	qhandle_t treasureHintShader;
1116 	qhandle_t knifeHintShader;
1117 	qhandle_t ladderHintShader;
1118 	qhandle_t buttonHintShader;
1119 	qhandle_t waterHintShader;
1120 	qhandle_t cautionHintShader;
1121 	qhandle_t dangerHintShader;
1122 	qhandle_t secretHintShader;
1123 	qhandle_t qeustionHintShader;
1124 	qhandle_t exclamationHintShader;
1125 	qhandle_t clipboardHintShader;
1126 	qhandle_t weaponHintShader;
1127 	qhandle_t ammoHintShader;
1128 	qhandle_t armorHintShader;
1129 	qhandle_t powerupHintShader;
1130 	qhandle_t holdableHintShader;
1131 	qhandle_t inventoryHintShader;
1132 	qhandle_t exitHintShader;
1133 
1134 	qhandle_t hintPlrFriendShader;
1135 	qhandle_t hintPlrNeutralShader;
1136 	qhandle_t hintPlrEnemyShader;
1137 	qhandle_t hintPlrUnknownShader;
1138 
1139 	// DHM - Nerve :: Multiplayer hints
1140 	qhandle_t buildHintShader;
1141 	qhandle_t disarmHintShader;
1142 	qhandle_t reviveHintShader;
1143 	qhandle_t dynamiteHintShader;
1144 	// dhm - end
1145 //----(SA)	end
1146 
1147 	// Rafael
1148 	qhandle_t snowShader;
1149 	qhandle_t oilParticle;
1150 	qhandle_t oilSlick;
1151 	// done.
1152 
1153 	// Rafael - cannon
1154 	qhandle_t smokePuffShaderdirty;
1155 	qhandle_t smokePuffShaderb1;
1156 	qhandle_t smokePuffShaderb2;
1157 	qhandle_t smokePuffShaderb3;
1158 	qhandle_t smokePuffShaderb4;
1159 	qhandle_t smokePuffShaderb5;
1160 	// done
1161 
1162 	// Rafael - blood pool
1163 	qhandle_t bloodPool;
1164 
1165 	// Ridah, viewscreen blood animation
1166 	qhandle_t viewBloodAni[5];
1167 	qhandle_t viewFlashBlood;
1168 	qhandle_t viewFlashFire[16];
1169 	// done
1170 
1171 	// Rafael bats
1172 	qhandle_t bats[10];
1173 	// done
1174 
1175 	// Rafael shards
1176 	qhandle_t shardGlass1;
1177 	qhandle_t shardGlass2;
1178 	qhandle_t shardWood1;
1179 	qhandle_t shardWood2;
1180 	qhandle_t shardMetal1;
1181 	qhandle_t shardMetal2;
1182 	qhandle_t shardCeramic1;
1183 	qhandle_t shardCeramic2;
1184 	// done
1185 
1186 	qhandle_t shardRubble1;
1187 	qhandle_t shardRubble2;
1188 	qhandle_t shardRubble3;
1189 
1190 
1191 	qhandle_t shardJunk[MAX_LOCKER_DEBRIS];
1192 
1193 	qhandle_t numberShaders[11];
1194 
1195 	qhandle_t shadowMarkShader;
1196 	qhandle_t shadowFootShader;
1197 	qhandle_t shadowTorsoShader;
1198 
1199 	qhandle_t botSkillShaders[5];
1200 
1201 	// wall mark shaders
1202 	qhandle_t wakeMarkShader;
1203 	qhandle_t wakeMarkShaderAnim;
1204 	qhandle_t bloodMarkShaders[5];
1205 	qhandle_t bloodDotShaders[5];
1206 	qhandle_t bulletMarkShader;
1207 	qhandle_t bulletMarkShaderMetal;
1208 	qhandle_t bulletMarkShaderWood;
1209 	qhandle_t bulletMarkShaderCeramic;
1210 	qhandle_t bulletMarkShaderGlass;
1211 	qhandle_t burnMarkShader;
1212 	qhandle_t holeMarkShader;
1213 	qhandle_t energyMarkShader;
1214 
1215 	// powerup shaders
1216 	qhandle_t quadShader;
1217 	qhandle_t redQuadShader;
1218 	qhandle_t quadWeaponShader;
1219 	qhandle_t invisShader;
1220 	qhandle_t regenShader;
1221 	qhandle_t battleSuitShader;
1222 	qhandle_t battleWeaponShader;
1223 	qhandle_t hastePuffShader;
1224 
1225 	// weapon effect models
1226 	qhandle_t spearModel;   //----(SA)
1227 
1228 	qhandle_t bulletFlashModel;
1229 	qhandle_t ringFlashModel;
1230 	qhandle_t dishFlashModel;
1231 	qhandle_t lightningExplosionModel;
1232 
1233 	qhandle_t zombieLoogie;
1234 	qhandle_t flamebarrel;
1235 	qhandle_t mg42muzzleflash;
1236 	//qhandle_t	mg42muzzleflashgg;
1237 	qhandle_t planemuzzleflash;
1238 
1239 	// Rafael
1240 	qhandle_t crowbar;
1241 
1242 	qhandle_t waterSplashModel;
1243 	qhandle_t waterSplashShader;
1244 
1245 	qhandle_t thirdPersonBinocModel;    //----(SA)	added
1246 
1247 	qhandle_t batModel;
1248 	qhandle_t spiritSkullModel;
1249 
1250 	// weapon effect shaders
1251 	qhandle_t railExplosionShader;
1252 	qhandle_t bulletExplosionShader;
1253 	qhandle_t rocketExplosionShader;
1254 	qhandle_t grenadeExplosionShader;
1255 	qhandle_t bfgExplosionShader;
1256 	qhandle_t bloodExplosionShader;
1257 
1258 	qhandle_t flameThrowerhitShader;
1259 
1260 	// special effects models
1261 	qhandle_t teleportEffectModel;
1262 	qhandle_t teleportEffectShader;
1263 
1264 	// scoreboard headers
1265 	qhandle_t scoreboardName;
1266 	qhandle_t scoreboardPing;
1267 	qhandle_t scoreboardScore;
1268 	qhandle_t scoreboardTime;
1269 	// Ridah
1270 	qhandle_t bloodCloudShader;
1271 	qhandle_t sparkParticleShader;
1272 	qhandle_t smokeTrailShader;
1273 	qhandle_t fireTrailShader;
1274 	qhandle_t lightningBoltShader;
1275 	qhandle_t lightningBoss1Shader;
1276 	qhandle_t flamethrowerFireStream;
1277 	qhandle_t flamethrowerBlueStream;
1278 	qhandle_t flamethrowerFuelStream;
1279 	qhandle_t flamethrowerFuelShader;
1280 	qhandle_t onFireShader, onFireShader2;
1281 	//qhandle_t	dripWetShader, dripWetShader2;
1282 	qhandle_t viewFadeBlack;
1283 	qhandle_t sparkFlareShader;
1284 	qhandle_t funnelFireShader[NUM_FUNNEL_SPRITES];
1285 	qhandle_t spotLightShader;
1286 	qhandle_t spotLightBeamShader;
1287 	qhandle_t lightningHitWallShader;
1288 	qhandle_t lightningWaveShader;
1289 	qhandle_t bulletParticleTrailShader;
1290 	qhandle_t smokeParticleShader;
1291 
1292 	// DHM - Nerve :: bullet hitting dirt
1293 	qhandle_t dirtParticle1Shader;
1294 	qhandle_t dirtParticle2Shader;
1295 	qhandle_t dirtParticle3Shader;
1296 
1297 	qhandle_t zombieSpiritWallShader;
1298 	qhandle_t zombieSpiritTrailShader;
1299 	qhandle_t zombieSpiritSkullShader;
1300 	qhandle_t zombieDeathDustShader;
1301 	qhandle_t zombieBodyFadeShader;
1302 	qhandle_t zombieHeadFadeShader;
1303 
1304 	qhandle_t skeletonSkinShader;
1305 	qhandle_t skeletonLegsModel;
1306 	qhandle_t skeletonTorsoModel;
1307 	qhandle_t skeletonHeadModel;
1308 	qhandle_t skeletonLegsSkin;
1309 	qhandle_t skeletonTorsoSkin;
1310 	qhandle_t skeletonHeadSkin;
1311 
1312 	qhandle_t loperGroundChargeShader;
1313 
1314 	qhandle_t teslaDamageEffectShader;
1315 	qhandle_t teslaAltDamageEffectShader;
1316 	qhandle_t viewTeslaDamageEffectShader;
1317 	qhandle_t viewTeslaAltDamageEffectShader;
1318 	// done.
1319 
1320 //----(SA)
1321 	// proto/super/heini armor parts
1322 	qhandle_t protoArmor[9 * 3];        // 9 parts, 3 sections each	(nodam, dam1, dam2)
1323 	qhandle_t superArmor[16 * 3];       // 14 parts, 3 sections each
1324 	qhandle_t heinrichArmor[22 * 3];    // 20 parts, 3 sections each
1325 //----(SA)	end
1326 
1327 	// medals shown during gameplay
1328 	qhandle_t medalImpressive;
1329 	qhandle_t medalExcellent;
1330 	qhandle_t medalGauntlet;
1331 
1332 	// sounds
1333 	sfxHandle_t n_health;
1334 	sfxHandle_t noFireUnderwater;
1335 	sfxHandle_t snipersound;
1336 	sfxHandle_t quadSound;
1337 	sfxHandle_t tracerSound;
1338 	sfxHandle_t selectSound;
1339 	sfxHandle_t useNothingSound;
1340 	sfxHandle_t wearOffSound;
1341 	sfxHandle_t footsteps[FOOTSTEP_TOTAL][4];
1342 	sfxHandle_t sfx_lghit1;
1343 	sfxHandle_t sfx_lghit2;
1344 	sfxHandle_t sfx_lghit3;
1345 	sfxHandle_t sfx_ric1;
1346 	sfxHandle_t sfx_ric2;
1347 	sfxHandle_t sfx_ric3;
1348 	//sfxHandle_t sfx_railg;
1349 	sfxHandle_t sfx_rockexp;
1350 	sfxHandle_t sfx_rockexpDist; // JPW NERVE
1351 	sfxHandle_t sfx_dynamiteexp;
1352 	sfxHandle_t sfx_dynamiteexpDist;    //----(SA)	added
1353 	sfxHandle_t sfx_spearhit;
1354 	sfxHandle_t sfx_knifehit[5];
1355 	sfxHandle_t sfx_bullet_metalhit[3];
1356 	sfxHandle_t sfx_bullet_woodhit[3];
1357 	sfxHandle_t sfx_bullet_roofhit[3];
1358 	sfxHandle_t sfx_bullet_ceramichit[3];
1359 	sfxHandle_t sfx_bullet_glasshit[3];
1360 	sfxHandle_t gibSound;
1361 	sfxHandle_t gibBounce1Sound;
1362 	sfxHandle_t gibBounce2Sound;
1363 	sfxHandle_t gibBounce3Sound;
1364 	sfxHandle_t teleInSound;
1365 	sfxHandle_t teleOutSound;
1366 	sfxHandle_t noAmmoSound;
1367 	sfxHandle_t respawnSound;
1368 	sfxHandle_t talkSound;
1369 	sfxHandle_t landSound;
1370 	sfxHandle_t fallSound;
1371 	sfxHandle_t jumpPadSound;
1372 
1373 //	sfxHandle_t oneMinuteSound;
1374 //	sfxHandle_t fiveMinuteSound;
1375 //	sfxHandle_t suddenDeathSound;
1376 
1377 	sfxHandle_t twoMinuteSound_g, twoMinuteSound_a;
1378 	sfxHandle_t thirtySecondSound_g, thirtySecondSound_a;
1379 
1380 	sfxHandle_t threeFragSound;
1381 	sfxHandle_t twoFragSound;
1382 	sfxHandle_t oneFragSound;
1383 
1384 	sfxHandle_t hitSound;
1385 	sfxHandle_t hitTeamSound;
1386 	sfxHandle_t impressiveSound;
1387 	sfxHandle_t excellentSound;
1388 	sfxHandle_t deniedSound;
1389 	sfxHandle_t humiliationSound;
1390 
1391 	sfxHandle_t takenLeadSound;
1392 	sfxHandle_t tiedLeadSound;
1393 	sfxHandle_t lostLeadSound;
1394 
1395 	sfxHandle_t watrInSound;
1396 	sfxHandle_t watrOutSound;
1397 	sfxHandle_t watrUnSound;
1398 
1399 //	sfxHandle_t flightSound;
1400 	sfxHandle_t underWaterSound;
1401 	sfxHandle_t medkitSound;
1402 	sfxHandle_t wineSound;
1403 	sfxHandle_t elecSound;
1404 	sfxHandle_t fireSound;
1405 	sfxHandle_t waterSound;
1406 
1407 	// teamplay sounds
1408 	sfxHandle_t redLeadsSound;
1409 	sfxHandle_t blueLeadsSound;
1410 	sfxHandle_t teamsTiedSound;
1411 
1412 	// tournament sounds
1413 	sfxHandle_t count3Sound;
1414 	sfxHandle_t count2Sound;
1415 	sfxHandle_t count1Sound;
1416 	sfxHandle_t countFightSound;
1417 	sfxHandle_t countPrepareSound;
1418 
1419 	//----(SA) added
1420 	sfxHandle_t debBounce1Sound;
1421 	sfxHandle_t debBounce2Sound;
1422 	sfxHandle_t debBounce3Sound;
1423 	//----(SA) end
1424 
1425 	//----(SA)	added
1426 	sfxHandle_t grenadePulseSound4;
1427 	sfxHandle_t grenadePulseSound3;
1428 	sfxHandle_t grenadePulseSound2;
1429 	sfxHandle_t grenadePulseSound1;
1430 	//----(SA)
1431 
1432 //----(SA)	added
1433 	sfxHandle_t sparkSounds[2];
1434 //----(SA)
1435 
1436 	// Ridah
1437 	sfxHandle_t flameSound;
1438 	sfxHandle_t flameBlowSound;
1439 	sfxHandle_t flameStartSound;
1440 	sfxHandle_t flameStreamSound;
1441 	sfxHandle_t lightningSounds[3];
1442 	sfxHandle_t lightningZap;
1443 	sfxHandle_t flameCrackSound;
1444 	sfxHandle_t boneBounceSound;
1445 
1446 	sfxHandle_t zombieSpiritSound;
1447 	sfxHandle_t zombieSpiritLoopSound;
1448 	sfxHandle_t zombieDeathSound;
1449 
1450 	sfxHandle_t loperLightningSounds[3];
1451 	sfxHandle_t loperLightningZap;
1452 
1453 	sfxHandle_t lightningClap[5];
1454 
1455 	sfxHandle_t batsFlyingLoopSound;
1456 
1457 	sfxHandle_t grenadebounce1;
1458 	sfxHandle_t grenadebounce2;
1459 
1460 	sfxHandle_t dynamitebounce1;    //----(SA)	added
1461 
1462 	sfxHandle_t fbarrelexp1;
1463 	sfxHandle_t fbarrelexp2;
1464 
1465 	sfxHandle_t fkickwall;
1466 	sfxHandle_t fkickflesh;
1467 	sfxHandle_t fkickmiss;
1468 
1469 	int bulletHitFleshScript;
1470 
1471 	int teslaZapScript;
1472 	sfxHandle_t teslaLoopSound;
1473 	// done.
1474 
1475 	qhandle_t cursor;
1476 	qhandle_t selectCursor;
1477 	qhandle_t sizeCursor;
1478 
1479 } cgMedia_t;
1480 
1481 
1482 // The client game static (cgs) structure hold everything
1483 // loaded or calculated from the gamestate.  It will NOT
1484 // be cleared when a tournement restart is done, allowing
1485 // all clients to begin playing instantly
1486 typedef struct {
1487 	gameState_t gameState;              // gamestate from server
1488 	glconfig_t glconfig;                // rendering configuration
1489 	float screenXScale;                 // derived from glconfig
1490 	float screenYScale;
1491 	float screenXBias;
1492 	float screenYBias;
1493 	float screenXScaleStretch;
1494 	float screenYScaleStretch;
1495 
1496 	int serverCommandSequence;              // reliable command stream counter
1497 	int processedSnapshotNum;            // the number of snapshots cgame has requested
1498 
1499 	qboolean localServer;               // detected on startup by checking sv_running
1500 
1501 	// parsed from serverinfo
1502 	gametype_t gametype;
1503 	int antilag;
1504 
1505 	// Rafael gameskill
1506 	gameskill_t gameskill;
1507 	// done
1508 
1509 	int dmflags;
1510 	int teamflags;
1511 	int fraglimit;
1512 	int capturelimit;
1513 	float timelimit;                        // NERVE - SMF - made this a float
1514 	int maxclients;
1515 	char mapname[MAX_QPATH];
1516 	char redTeam[MAX_QPATH];                // A team
1517 	char blueTeam[MAX_QPATH];               // B team
1518 
1519 	int voteTime;
1520 	int voteYes;
1521 	int voteNo;
1522 	qboolean voteModified;                  // beep whenever changed
1523 	char voteString[MAX_STRING_TOKENS];
1524 
1525 	int teamVoteTime[2];
1526 	int teamVoteYes[2];
1527 	int teamVoteNo[2];
1528 	qboolean teamVoteModified[2];           // beep whenever changed
1529 	char teamVoteString[2][MAX_STRING_TOKENS];
1530 
1531 	int levelStartTime;
1532 
1533 	int scores1, scores2;                   // from configstrings
1534 
1535 	//
1536 	// locally derived information from gamestate
1537 	//
1538 	qhandle_t gameModels[MAX_MODELS];
1539 	sfxHandle_t gameSounds[MAX_SOUNDS];
1540 
1541 	int numInlineModels;
1542 	qhandle_t inlineDrawModel[MAX_MODELS];
1543 	vec3_t inlineModelMidpoints[MAX_MODELS];
1544 
1545 	clientInfo_t clientinfo[MAX_CLIENTS];
1546 
1547 	// teamchat width is *3 because of embedded color codes
1548 	char teamChatMsgs[TEAMCHAT_HEIGHT][TEAMCHAT_WIDTH * 3 + 1];
1549 	int teamChatMsgTimes[TEAMCHAT_HEIGHT];
1550 	int teamChatPos;
1551 	int teamLastChatPos;
1552 
1553 	// New notify mechanism for obits
1554 	char notifyMsgs[NOTIFY_HEIGHT][NOTIFY_WIDTH * 3 + 1];
1555 	int notifyMsgTimes[NOTIFY_HEIGHT];
1556 	int notifyPos;
1557 	int notifyLastPos;
1558 
1559 	int cursorX;
1560 	int cursorY;
1561 	qboolean eventHandling;
1562 	qboolean mouseCaptured;
1563 	qboolean sizingHud;
1564 	void *capturedItem;
1565 	qhandle_t activeCursor;
1566 
1567 	// screen fading
1568 	float fadeAlpha, fadeAlphaCurrent;
1569 	int fadeStartTime;
1570 	int fadeDuration;
1571 
1572 	// media
1573 	cgMedia_t media;
1574 
1575 	// player/AI model scripting (client repository)
1576 	animScriptData_t animScriptData;
1577 
1578 	// NERVE - SMF
1579 	int currentVoiceClient;
1580 	int currentRound;
1581 	float nextTimeLimit;
1582 	int minclients;
1583 	gamestate_t gamestate;
1584 	// -NERVE - SMF
1585 
1586 	int complaintClient;        // DHM - Nerve
1587 	int complaintEndTime;       // DHM - Nerve
1588 	float smokeWindDir; // JPW NERVE for smoke puffs & wind (arty, airstrikes, bullet impacts)
1589 } cgs_t;
1590 
1591 //==============================================================================
1592 
1593 extern cgs_t cgs;
1594 extern cg_t cg;
1595 extern centity_t cg_entities[MAX_GENTITIES];
1596 extern weaponInfo_t cg_weapons[MAX_WEAPONS];
1597 extern itemInfo_t cg_items[MAX_ITEMS];
1598 extern markPoly_t cg_markPolys[MAX_MARK_POLYS];
1599 
1600 extern vmCvar_t cg_centertime;
1601 extern vmCvar_t cg_runpitch;
1602 extern vmCvar_t cg_runroll;
1603 extern vmCvar_t cg_bobup;
1604 extern vmCvar_t cg_bobpitch;
1605 extern vmCvar_t cg_bobroll;
1606 extern vmCvar_t cg_swingSpeed;
1607 extern vmCvar_t cg_shadows;
1608 extern vmCvar_t cg_gibs;
1609 extern vmCvar_t cg_drawTimer;
1610 extern vmCvar_t cg_drawFPS;
1611 extern vmCvar_t cg_drawSnapshot;
1612 extern vmCvar_t cg_draw3dIcons;
1613 extern vmCvar_t cg_drawIcons;
1614 extern vmCvar_t cg_drawAmmoWarning;
1615 extern vmCvar_t cg_drawCrosshair;
1616 extern vmCvar_t cg_drawCrosshairNames;
1617 extern vmCvar_t cg_drawCrosshairPickups;
1618 extern vmCvar_t cg_hudAlpha;
1619 extern vmCvar_t cg_useWeapsForZoom;
1620 extern vmCvar_t cg_weaponCycleDelay;            //----(SA)	added
1621 extern vmCvar_t cg_cycleAllWeaps;
1622 extern vmCvar_t cg_drawAllWeaps;
1623 extern vmCvar_t cg_drawRewards;
1624 extern vmCvar_t cg_drawTeamOverlay;
1625 extern vmCvar_t cg_uselessNostalgia;         // JPW NERVE
1626 extern vmCvar_t cg_crosshairX;
1627 extern vmCvar_t cg_crosshairY;
1628 extern vmCvar_t cg_crosshairSize;
1629 extern vmCvar_t cg_crosshairHealth;
1630 extern vmCvar_t cg_drawStatus;
1631 extern vmCvar_t cg_draw2D;
1632 extern vmCvar_t cg_drawFrags;
1633 extern vmCvar_t cg_animSpeed;
1634 extern vmCvar_t cg_debugAnim;
1635 extern vmCvar_t cg_debugPosition;
1636 extern vmCvar_t cg_debugEvents;
1637 extern vmCvar_t cg_drawSpreadScale;
1638 extern vmCvar_t cg_railTrailTime;
1639 extern vmCvar_t cg_errorDecay;
1640 extern vmCvar_t cg_nopredict;
1641 extern vmCvar_t cg_noPlayerAnims;
1642 extern vmCvar_t cg_showmiss;
1643 extern vmCvar_t cg_footsteps;
1644 extern vmCvar_t cg_markTime;
1645 extern vmCvar_t cg_brassTime;
1646 extern vmCvar_t cg_gun_frame;
1647 extern vmCvar_t cg_gun_x;
1648 extern vmCvar_t cg_gun_y;
1649 extern vmCvar_t cg_gun_z;
1650 extern vmCvar_t cg_drawGun;
1651 extern vmCvar_t cg_drawFPGun;
1652 extern vmCvar_t cg_drawGamemodels;
1653 extern vmCvar_t cg_cursorHints;
1654 extern vmCvar_t cg_viewsize;
1655 extern vmCvar_t cg_letterbox;           //----(SA)	added
1656 extern vmCvar_t cg_tracerChance;
1657 extern vmCvar_t cg_tracerWidth;
1658 extern vmCvar_t cg_tracerLength;
1659 extern vmCvar_t cg_tracerSpeed;
1660 extern vmCvar_t cg_autoswitch;
1661 extern vmCvar_t cg_ignore;
1662 extern vmCvar_t cg_simpleItems;
1663 extern vmCvar_t cg_fov;
1664 extern vmCvar_t cg_fixedAspect;
1665 extern vmCvar_t cg_fixedAspectFOV;
1666 extern vmCvar_t cg_zoomFov;
1667 extern vmCvar_t cg_zoomDefaultBinoc;
1668 extern vmCvar_t cg_zoomDefaultSniper;
1669 extern vmCvar_t cg_zoomDefaultFG;
1670 extern vmCvar_t cg_zoomDefaultSnooper;
1671 extern vmCvar_t cg_zoomStepBinoc;
1672 extern vmCvar_t cg_zoomStepSniper;
1673 extern vmCvar_t cg_zoomStepSnooper;
1674 extern vmCvar_t cg_zoomStepFG;
1675 extern vmCvar_t cg_reticles;
1676 extern vmCvar_t cg_reticleType;
1677 extern vmCvar_t cg_reticleBrightness;
1678 extern vmCvar_t cg_thirdPersonRange;
1679 extern vmCvar_t cg_thirdPersonAngle;
1680 extern vmCvar_t cg_thirdPerson;
1681 extern vmCvar_t cg_lagometer;
1682 extern vmCvar_t cg_drawAttacker;
1683 extern vmCvar_t cg_synchronousClients;
1684 extern vmCvar_t cg_teamChatTime;
1685 extern vmCvar_t cg_teamChatHeight;
1686 extern vmCvar_t cg_stats;
1687 extern vmCvar_t cg_forceModel;
1688 extern vmCvar_t cg_coronafardist;
1689 extern vmCvar_t cg_coronas;
1690 extern vmCvar_t cg_buildScript;
1691 extern vmCvar_t cg_paused;
1692 extern vmCvar_t cg_blood;
1693 extern vmCvar_t cg_predictItems;
1694 extern vmCvar_t cg_deferPlayers;
1695 extern vmCvar_t cg_teamChatsOnly;
1696 extern vmCvar_t cg_noVoiceChats;                    // NERVE - SMF
1697 extern vmCvar_t cg_noVoiceText;                     // NERVE - SMF
1698 extern vmCvar_t cg_enableBreath;
1699 extern vmCvar_t cg_autoactivate;
1700 extern vmCvar_t cg_emptyswitch;
1701 extern vmCvar_t cg_smoothClients;
1702 extern vmCvar_t pmove_fixed;
1703 extern vmCvar_t pmove_msec;
1704 
1705 extern vmCvar_t cg_cameraOrbit;
1706 extern vmCvar_t cg_cameraOrbitDelay;
1707 extern vmCvar_t cg_timescaleFadeEnd;
1708 extern vmCvar_t cg_timescaleFadeSpeed;
1709 extern vmCvar_t cg_timescale;
1710 extern vmCvar_t cg_cameraMode;
1711 extern vmCvar_t cg_smallFont;
1712 extern vmCvar_t cg_bigFont;
1713 extern vmCvar_t cg_noTaunt;             // NERVE - SMF
1714 extern vmCvar_t cg_voiceSpriteTime;             // DHM - Nerve
1715 
1716 extern vmCvar_t cg_blinktime;           //----(SA)	added
1717 
1718 extern vmCvar_t cg_currentSelectedPlayer;
1719 extern vmCvar_t cg_currentSelectedPlayerName;
1720 
1721 // Rafael - particle switch
1722 extern vmCvar_t cg_wolfparticles;
1723 // done
1724 
1725 // Ridah
1726 extern vmCvar_t cg_gameType;
1727 extern vmCvar_t cg_bloodTime;
1728 extern vmCvar_t cg_norender;
1729 extern vmCvar_t cg_skybox;
1730 
1731 // Rafael gameskill
1732 extern vmCvar_t cg_gameSkill;
1733 // done
1734 
1735 // JPW NERVE
1736 extern vmCvar_t cg_medicChargeTime;
1737 extern vmCvar_t cg_engineerChargeTime;
1738 extern vmCvar_t cg_LTChargeTime;
1739 extern vmCvar_t cg_soldierChargeTime;
1740 extern vmCvar_t cg_redlimbotime;
1741 extern vmCvar_t cg_bluelimbotime;
1742 // jpw
1743 
1744 extern vmCvar_t cg_hunkUsed;
1745 extern vmCvar_t cg_soundAdjust;
1746 extern vmCvar_t cg_expectedhunkusage;
1747 
1748 extern vmCvar_t cg_showAIState;
1749 
1750 extern vmCvar_t cg_notebook;
1751 extern vmCvar_t cg_notebookpages;           // bitflags for the currently accessable pages.  if they wanna cheat, let 'em.  Most won't, or will wait 'til they actually play it.
1752 
1753 extern vmCvar_t cg_animState;
1754 extern vmCvar_t cg_missionStats;
1755 extern vmCvar_t cg_waitForFire;
1756 
1757 // NERVE - SMF - Wolf multiplayer configuration cvars
1758 extern vmCvar_t mp_playerType;
1759 extern vmCvar_t mp_currentPlayerType;
1760 extern vmCvar_t mp_team;
1761 extern vmCvar_t mp_currentTeam;
1762 extern vmCvar_t mp_weapon;
1763 extern vmCvar_t mp_item1;
1764 
1765 extern vmCvar_t cg_drawCompass;
1766 extern vmCvar_t cg_drawNotifyText;
1767 extern vmCvar_t cg_quickMessageAlt;
1768 extern vmCvar_t cg_popupLimboMenu;
1769 extern vmCvar_t cg_descriptiveText;
1770 // -NERVE - SMF
1771 
1772 // TTimo
1773 extern vmCvar_t cg_autoReload;
1774 extern vmCvar_t cg_antilag;
1775 
1776 //
1777 // cg_main.c
1778 //
1779 const char *CG_ConfigString( int index );
1780 const char *CG_Argv( int arg );
1781 
1782 float CG_Cvar_Get( const char *cvar );
1783 
1784 void QDECL CG_Printf( const char *msg, ... ) __attribute__ ((format (printf, 1, 2)));
1785 void QDECL CG_Error( const char *msg, ... ) __attribute__ ((noreturn, format (printf, 1, 2)));
1786 
1787 void CG_StartMusic( void );
1788 
1789 void CG_UpdateCvars( void );
1790 
1791 int CG_CrosshairPlayer( void );
1792 int CG_LastAttacker( void );
1793 void CG_LoadMenus( const char *menuFile );
1794 void CG_KeyEvent( int key, qboolean down );
1795 void CG_MouseEvent( int x, int y );
1796 void CG_EventHandling( int type );
1797 
1798 qboolean CG_GetTag( int clientNum, char *tagname, orientation_t * or );
1799 qboolean CG_GetWeaponTag( int clientNum, char *tagname, orientation_t * or );
1800 
1801 qboolean CG_CheckCenterView( void );
1802 
1803 //
1804 // cg_view.c
1805 //
1806 void CG_TestModel_f( void );
1807 void CG_TestGun_f( void );
1808 void CG_TestModelNextFrame_f( void );
1809 void CG_TestModelPrevFrame_f( void );
1810 void CG_TestModelNextSkin_f( void );
1811 void CG_TestModelPrevSkin_f( void );
1812 void CG_ZoomDown_f( void );
1813 void CG_ZoomIn_f( void );
1814 void CG_ZoomOut_f( void );
1815 void CG_ZoomUp_f( void );
1816 
1817 void CG_DrawActiveFrame( int serverTime, stereoFrame_t stereoView, qboolean demoPlayback );
1818 
1819 void CG_Concussive( centity_t *cent );
1820 
1821 //
1822 // cg_drawtools.c
1823 //
1824 void CG_SetScreenPlacement(screenPlacement_e hpos, screenPlacement_e vpos);
1825 
1826 void CG_AdjustFrom640( float *x, float *y, float *w, float *h );
1827 void CG_FillRect( float x, float y, float width, float height, const float *color );
1828 void CG_HorizontalPercentBar( float x, float y, float width, float height, float percent );
1829 void CG_DrawMotd( void );
1830 void CG_DrawPic( float x, float y, float width, float height, qhandle_t hShader );
1831 void CG_DrawRotatedPic( float x, float y, float width, float height, qhandle_t hShader, float angle );      // NERVE - SMF
1832 void CG_FilledBar( float x, float y, float w, float h, float *startColor, float *endColor, const float *bgColor, float frac, int flags );
1833 // JOSEPH 10-26-99
1834 void CG_DrawStretchPic( float x, float y, float width, float height, qhandle_t hShader );
1835 // END JOSEPH
1836 void CG_DrawString( float x, float y, const char *string,
1837 					float charWidth, float charHeight, const float *modulate );
1838 
1839 
1840 void CG_DrawStringExt( int x, int y, const char *string, const float *setColor,
1841 					   qboolean forceColor, qboolean shadow, int charWidth, int charHeight, int maxChars );
1842 // JOSEPH 4-17-00
1843 void CG_DrawStringExt2( int x, int y, const char *string, const float *setColor,
1844 						qboolean forceColor, qboolean shadow, int charWidth, int charHeight, int maxChars );
1845 // END JOSEPH
1846 void CG_DrawBigString( int x, int y, const char *s, float alpha );
1847 void CG_DrawBigStringColor( int x, int y, const char *s, vec4_t color );
1848 void CG_DrawSmallString( int x, int y, const char *s, float alpha );
1849 void CG_DrawSmallStringColor( int x, int y, const char *s, vec4_t color );
1850 // JOSEPH 4-25-00
1851 void CG_DrawBigString2( int x, int y, const char *s, float alpha );
1852 void CG_DrawBigStringColor2( int x, int y, const char *s, vec4_t color );
1853 // END JOSEPH
1854 int CG_DrawStrlen( const char *str );
1855 
1856 float   *CG_FadeColor( int startMsec, int totalMsec );
1857 float *CG_TeamColor( int team );
1858 void CG_TileClear( void );
1859 void CG_ColorForHealth( vec4_t hcolor );
1860 void CG_GetColorForHealth( int health, int armor, vec4_t hcolor );
1861 
1862 float UI_ProportionalSizeScale( int style );
1863 int UI_ProportionalStringWidth( const char* str );
1864 void UI_DrawProportionalString( int x, int y, const char* str, int style, vec4_t color );
1865 
1866 // new hud stuff
1867 void CG_DrawRect( float x, float y, float width, float height, float size, const float *color );
1868 void CG_DrawSides( float x, float y, float w, float h, float size );
1869 void CG_DrawTopBottom( float x, float y, float w, float h, float size );
1870 
1871 // NERVE - SMF - localization functions
1872 void CG_InitTranslation( void );
1873 char* CG_TranslateString( const char *string );
1874 void CG_SaveTransTable( void );
1875 void CG_ReloadTranslation( void );
1876 // -NERVE - SMF
1877 
1878 //
1879 // cg_draw.c, cg_newDraw.c
1880 //
1881 extern int sortedTeamPlayers[TEAM_MAXOVERLAY];
1882 extern int numSortedTeamPlayers;
1883 extern int drawTeamOverlayModificationCount;
1884 extern char systemChat[256];
1885 extern char teamChat1[256];
1886 extern char teamChat2[256];
1887 extern char cg_fxflags;  // JPW NERVE
1888 
1889 void CG_AddLagometerFrameInfo( void );
1890 void CG_AddLagometerSnapshotInfo( snapshot_t *snap );
1891 void CG_CenterPrint( const char *str, int y, int charWidth );
1892 void CG_PriorityCenterPrint( const char *str, int y, int charWidth, int priority );     // NERVE - SMF
1893 void CG_ObjectivePrint( const char *str, int charWidth );                       // NERVE - SMF
1894 void CG_DrawHead( float x, float y, float w, float h, int clientNum, vec3_t headAngles );
1895 void CG_DrawActive( stereoFrame_t stereoView );
1896 void CG_DrawFlagModel( float x, float y, float w, float h, int team );
1897 
1898 void CG_DrawTeamBackground( int x, int y, int w, int h, float alpha, int team );
1899 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 );
1900 void CG_Text_Paint( float x, float y, float scale, vec4_t color, const char *text, float adjust, int limit, int style );
1901 int CG_Text_Width( const char *text, float scale, int limit );
1902 int CG_Text_Height( const char *text, float scale, int limit );
1903 void CG_SelectPrevPlayer( void );
1904 void CG_SelectNextPlayer( void );
1905 float CG_GetValue( int ownerDraw, int type ); // 'type' is relative or absolute (fractional-'0.5' or absolute- '50' health)
1906 qboolean CG_OwnerDrawVisible( int flags );
1907 void CG_RunMenuScript( char **args );
1908 void CG_ShowResponseHead( void );
1909 void CG_SetPrintString( int type, const char *p );
1910 void CG_InitTeamChat( void );
1911 void CG_GetTeamColor( vec4_t *color );
1912 const char *CG_GetGameStatusText( void );
1913 const char *CG_GetKillerText( void );
1914 void CG_Draw3DModel( float x, float y, float w, float h, qhandle_t model, qhandle_t skin, vec3_t origin, vec3_t angles );
1915 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 );
1916 void CG_CheckOrderPending( void );
1917 const char *CG_GameTypeString( void );
1918 qboolean CG_YourTeamHasFlag( void );
1919 qboolean CG_OtherTeamHasFlag( void );
1920 qhandle_t CG_StatusHandle( int task );
1921 void CG_Fade( int r, int g, int b, int a, float time );
1922 
1923 
1924 
1925 
1926 //
1927 // cg_player.c
1928 //
1929 qboolean CG_EntOnFire( centity_t *cent );    // Ridah
1930 void CG_Player( centity_t *cent );
1931 void CG_ResetPlayerEntity( centity_t *cent );
1932 void CG_AddRefEntityWithPowerups( refEntity_t *ent, int powerups, int team, entityState_t *es, const vec3_t fireRiseDir );
1933 void CG_NewClientInfo( int clientNum );
1934 sfxHandle_t CG_CustomSound( int clientNum, const char *soundName );
1935 
1936 // Rafael particles
1937 extern qboolean initparticles;
1938 int CG_NewParticleArea( int num );
1939 
1940 //
1941 // cg_predict.c
1942 //
1943 void CG_BuildSolidList( void );
1944 int CG_PointContents( const vec3_t point, int passEntityNum );
1945 void CG_Trace( trace_t *result, const vec3_t start, const vec3_t mins, const vec3_t maxs, const vec3_t end,
1946 			   int skipNumber, int mask );
1947 void CG_PredictPlayerState( void );
1948 void CG_LoadDeferredPlayers( void );
1949 
1950 
1951 //
1952 // cg_events.c
1953 //
1954 void CG_CheckEvents( centity_t *cent );
1955 const char  *CG_PlaceString( int rank );
1956 void CG_EntityEvent( centity_t *cent, vec3_t position );
1957 void CG_PainEvent( centity_t *cent, int health, qboolean crouching );
1958 
1959 
1960 //
1961 // cg_ents.c
1962 //
1963 void CG_SetEntitySoundPosition( centity_t *cent );
1964 void CG_AddPacketEntities( void );
1965 void CG_Beam( centity_t *cent );
1966 void CG_AdjustPositionForMover(const vec3_t in, int moverNum, int fromTime, int toTime, vec3_t out, vec3_t angles_in, vec3_t angles_out);
1967 
1968 void CG_PositionEntityOnTag( refEntity_t *entity, const refEntity_t *parent,
1969 							 char *tagName, int startIndex, vec3_t *offset );
1970 void CG_PositionRotatedEntityOnTag( refEntity_t *entity, const refEntity_t *parent, char *tagName );
1971 
1972 
1973 //----(SA)
1974 void CG_AttachedPartChange( centity_t *cent );
1975 void CG_NextItem_f( void );
1976 void CG_PrevItem_f( void );
1977 void CG_Item_f( void );
1978 //----(SA)	end
1979 
1980 
1981 //
1982 // cg_weapons.c
1983 //
1984 void CG_LastWeaponUsed_f( void );     //----(SA)	added
1985 void CG_NextWeaponInBank_f( void );   //----(SA)	added
1986 void CG_PrevWeaponInBank_f( void );   //----(SA)	added
1987 void CG_AltWeapon_f( void );
1988 void CG_NextWeapon_f( void );
1989 void CG_PrevWeapon_f( void );
1990 void CG_Weapon_f( void );
1991 void CG_WeaponBank_f( void );
1992 
1993 void CG_FinishWeaponChange( int lastweap, int newweap );
1994 
1995 void CG_RegisterWeapon( int weaponNum );
1996 void CG_RegisterItemVisuals( int itemNum );
1997 
1998 void CG_FireWeapon( centity_t *cent );   //----(SA)	modified.
1999 //void CG_EndFireWeapon( centity_t *cent, int firemode );	//----(SA)	added
2000 void CG_MissileHitWall( int weapon, int clientNum, vec3_t origin, vec3_t dir, int surfaceFlags );   //	(SA) modified to send missilehitwall surface parameters
2001 
2002 void CG_MissileHitWallSmall( int weapon, int clientNum, vec3_t origin, vec3_t dir );
2003 void CG_DrawTracer( vec3_t start, vec3_t finish );
2004 
2005 // Rafael
2006 void CG_MG42EFX( centity_t *cent );
2007 
2008 void CG_FLAKEFX( centity_t *cent, int whichgun );
2009 
2010 void CG_MortarEFX( centity_t *cent );
2011 
2012 // Ridah
2013 qboolean CG_MonsterUsingWeapon( centity_t *cent, int aiChar, int weaponNum );
2014 
2015 // Rafael
2016 void CG_MissileHitWall2( int weapon, int clientNum, vec3_t origin, vec3_t dir );
2017 // done
2018 
2019 void CG_MissileHitPlayer( centity_t *cent, int weapon, vec3_t origin, vec3_t dir, int entityNum );
2020 //----(SA)
2021 void CG_VenomFire( entityState_t *es, qboolean fullmode );
2022 //----(SA)
2023 void CG_Bullet( vec3_t origin, int sourceEntityNum, vec3_t normal, qboolean flesh, int fleshEntityNum, qboolean wolfkick, int otherEntNum2, int seed );
2024 
2025 void CG_RailTrail( clientInfo_t *ci, vec3_t start, vec3_t end, int type );   //----(SA)	added 'type'
2026 void CG_GrappleTrail( centity_t *ent, const weaponInfo_t *wi );
2027 void CG_AddViewWeapon( playerState_t *ps );
2028 void CG_AddPlayerWeapon( refEntity_t *parent, playerState_t *ps, centity_t *cent );
2029 void CG_DrawWeaponSelect( void );
2030 void CG_DrawHoldableSelect( void );
2031 
2032 void CG_OutOfAmmoChange( void );
2033 void CG_HoldableUsedupChange( void ); //----(SA)	added
2034 
2035 //----(SA) added to header to access from outside cg_weapons.c
2036 void CG_AddDebris( vec3_t origin, vec3_t dir, int speed, int duration, int count );
2037 //----(SA) done
2038 
2039 void CG_ClientDamage( int entnum, int enemynum, int id );
2040 
2041 //
2042 // cg_marks.c
2043 //
2044 void    CG_InitMarkPolys( void );
2045 void    CG_AddMarks( void );
2046 void    CG_ImpactMark( qhandle_t markShader,
2047 					   const vec3_t origin, const vec3_t dir,
2048 					   float orientation,
2049 					   float r, float g, float b, float a,
2050 					   qboolean alphaFade,
2051 					   float radius, qboolean temporary, int duration );
2052 
2053 // Rafael particles
2054 //
2055 // cg_particles.c
2056 //
2057 void    CG_ClearParticles( void );
2058 void    CG_AddParticles( void );
2059 void    CG_ParticleSnow( qhandle_t pshader, vec3_t origin, vec3_t origin2, int turb, float range, int snum );
2060 void    CG_ParticleSmoke( qhandle_t pshader, centity_t *cent );
2061 void    CG_AddParticleShrapnel( localEntity_t *le );
2062 void    CG_ParticleSnowFlurry( qhandle_t pshader, centity_t *cent );
2063 void    CG_ParticleBulletDebris( vec3_t org, vec3_t vel, int duration );
2064 void    CG_ParticleDirtBulletDebris( vec3_t org, vec3_t vel, int duration );     // DHM - Nerve
2065 void    CG_ParticleDirtBulletDebris_Core( vec3_t org, vec3_t vel, int duration, float width, float height, float alpha, char *shadername );  // NERVE - SMF // JPW addtnl params
2066 void    CG_ParticleSparks( vec3_t org, vec3_t vel, int duration, float x, float y, float speed );
2067 void    CG_ParticleDust( centity_t *cent, vec3_t origin, vec3_t dir );
2068 void    CG_ParticleMisc( qhandle_t pshader, vec3_t origin, int size, int duration, float alpha );
2069 
2070 // Ridah
2071 void CG_ParticleExplosion( char *animStr, vec3_t origin, vec3_t vel, int duration, int sizeStart, int sizeEnd );
2072 
2073 // Rafael snow pvs check
2074 void    CG_SnowLink( centity_t *cent, qboolean particleOn );
2075 // done.
2076 
2077 // Rafael bats
2078 void CG_ParticleBat( centity_t *cent );
2079 void    CG_ParticleBats( qhandle_t pshader, centity_t *cent );
2080 void    CG_BatsUpdatePosition( centity_t *cent );
2081 void CG_ParticleImpactSmokePuff( qhandle_t pshader, vec3_t origin );
2082 void CG_ParticleImpactSmokePuffExtended( qhandle_t pshader, vec3_t origin, int lifetime, int vel, int acc, int maxroll, float alpha );       // (SA) so I can add more parameters without screwing up the one that's there
2083 void CG_Particle_Bleed( qhandle_t pshader, vec3_t start, vec3_t dir, int fleshEntityNum, int duration );
2084 void CG_GetBleedOrigin( vec3_t head_origin, vec3_t torso_origin, vec3_t legs_origin, int fleshEntityNum );
2085 void CG_Particle_OilParticle( qhandle_t pshader, vec3_t origin, vec3_t origin2, int ptime, int snum );
2086 void CG_Particle_OilSlick( qhandle_t pshader, centity_t *cent );
2087 void CG_OilSlickRemove( centity_t *cent );
2088 void CG_BloodPool( localEntity_t *le, qhandle_t pshader, trace_t *tr );
2089 void CG_ParticleBloodCloudZombie( centity_t *cent, vec3_t origin, vec3_t dir );
2090 void CG_ParticleBloodCloud( centity_t *cent, vec3_t origin, vec3_t dir );
2091 // done
2092 
2093 // Ridah, trails
2094 //
2095 // cg_trails.c
2096 //
2097 int CG_AddTrailJunc( int headJuncIndex, qhandle_t shader, int spawnTime, int sType, vec3_t pos, int trailLife, float alphaStart, float alphaEnd, float startWidth, float endWidth, int flags, vec3_t colorStart, vec3_t colorEnd, float sRatio, float animSpeed );
2098 int CG_AddSparkJunc( int headJuncIndex, qhandle_t shader, vec3_t pos, int trailLife, float alphaStart, float alphaEnd, float startWidth, float endWidth );
2099 int CG_AddSmokeJunc( int headJuncIndex, qhandle_t shader, vec3_t pos, int trailLife, float alpha, float startWidth, float endWidth );
2100 int CG_AddFireJunc( int headJuncIndex, qhandle_t shader, vec3_t pos, int trailLife, float alpha, float startWidth, float endWidth );
2101 void CG_AddTrails( void );
2102 void CG_ClearTrails( void );
2103 // done.
2104 
2105 // Ridah, sound scripting
2106 int CG_SoundScriptPrecache( const char *name );
2107 qboolean CG_SoundPlaySoundScript( const char *name, vec3_t org, int entnum );
2108 void CG_SoundPlayIndexedScript( int index, vec3_t org, int entnum );
2109 void CG_SoundInit( void );
2110 // done.
2111 
2112 // Ridah, flamethrower
2113 void CG_FireFlameChunks( centity_t *cent, vec3_t origin, vec3_t angles, float speedScale, qboolean firing );
2114 void CG_InitFlameChunks( void );
2115 void CG_AddFlameChunks( void );
2116 void CG_UpdateFlamethrowerSounds( void );
2117 void CG_FlameDamage( int owner, vec3_t org, float radius );
2118 // done.
2119 
2120 //
2121 // cg_localents.c
2122 //
2123 void    CG_InitLocalEntities( void );
2124 localEntity_t   *CG_AllocLocalEntity( void );
2125 void    CG_AddLocalEntities( void );
2126 
2127 //
2128 // cg_effects.c
2129 //
2130 int CG_GetOriginForTag( centity_t * cent, refEntity_t * parent, char *tagName, int startIndex, vec3_t org, vec3_t axis[3] );
2131 localEntity_t *CG_SmokePuff( const vec3_t p,
2132 							 const vec3_t vel,
2133 							 float radius,
2134 							 float r, float g, float b, float a,
2135 							 float duration,
2136 							 int startTime,
2137 							 int fadeInTime,
2138 							 int leFlags,
2139 							 qhandle_t hShader );
2140 
2141 void CG_BubbleTrail( vec3_t start, vec3_t end, float size, float spacing );
2142 void CG_SpawnEffect( vec3_t org );
2143 void CG_GibPlayer( centity_t *cent, vec3_t playerOrigin, vec3_t gdir );
2144 void CG_LoseHat( centity_t *cent, vec3_t dir );         //----(SA)	added
2145 void CG_GibHead( vec3_t headOrigin );
2146 
2147 void CG_Bleed( vec3_t origin, int entityNum );
2148 
2149 localEntity_t *CG_MakeExplosion( vec3_t origin, vec3_t dir,
2150 								 qhandle_t hModel, qhandle_t shader, int msec,
2151 								 qboolean isSprite );
2152 // Ridah
2153 void CG_DynamicLightningBolt( qhandle_t shader, vec3_t start, vec3_t pend, int numBolts, float maxWidth, qboolean fade, float startAlpha, int recursion, int randseed );
2154 void CG_SparklerSparks( vec3_t origin, int count );
2155 void CG_ClearFlameChunks( void );
2156 void CG_ProjectedSpotLight( vec3_t start, vec3_t dir );
2157 // done.
2158 
2159 //----(SA)
2160 void CG_Spotlight( centity_t *cent, float *color, vec3_t start, vec3_t dir, int segs, float range, int startWidth, float coneAngle, int flags );
2161 #define SL_NOTRACE          0x001   // don't do a trace check for shortening the beam, always draw at full 'range' length
2162 #define SL_NODLIGHT         0x002   // don't put a dlight at the end
2163 #define SL_NOSTARTCAP       0x004   // dont' cap the start circle
2164 #define SL_LOCKTRACETORANGE 0x010   // only trace out as far as the specified range (rather than to max spot range)
2165 #define SL_NOFLARE          0x020   // don't draw a flare when the light is pointing at the camera
2166 #define SL_NOIMPACT         0x040   // don't draw the impact mark
2167 #define SL_LOCKUV           0x080   // lock the texture coordinates at the 'true' length of the requested beam.
2168 #define SL_NOCORE           0x100   // don't draw the center 'core' beam
2169 #define SL_TRACEWORLDONLY   0x200
2170 //----(SA)	done
2171 
2172 void CG_RumbleEfx( float pitch, float yaw );
2173 
2174 //
2175 // cg_snapshot.c
2176 //
2177 void CG_ProcessSnapshots( void );
2178 
2179 //
2180 // cg_spawn.c
2181 //
2182 qboolean    CG_SpawnString( const char *key, const char *defaultString, char **out );
2183 qboolean    CG_SpawnFloat( const char *key, const char *defaultString, float *out );
2184 qboolean    CG_SpawnInt( const char *key, const char *defaultString, int *out );
2185 qboolean    CG_SpawnVector( const char *key, const char *defaultString, float *out );
2186 void        CG_ParseEntitiesFromString( void );
2187 
2188 //
2189 // cg_info.c
2190 //
2191 void CG_LoadingString( const char *s );
2192 void CG_LoadingItem( int itemNum );
2193 void CG_LoadingClient( int clientNum );
2194 void CG_DrawInformation( void );
2195 
2196 //
2197 // cg_scoreboard.c
2198 //
2199 qboolean CG_DrawScoreboard( void );
2200 void CG_DrawTourneyScoreboard( void );
2201 
2202 //
2203 // cg_consolecmds.c
2204 //
2205 qboolean CG_ConsoleCommand( void );
2206 void CG_InitConsoleCommands( void );
2207 
2208 //
2209 // cg_servercmds.c
2210 //
2211 void CG_ExecuteNewServerCommands( int latestSequence );
2212 void CG_ParseServerinfo( void );
2213 void CG_ParseWolfinfo( void );          // NERVE - SMF
2214 void CG_SetConfigValues( void );
2215 void CG_ShaderStateChanged( void );
2216 void CG_SendMoveSpeed( animation_t *animList, int numAnims, char *modelName );
2217 void CG_LoadVoiceChats( void );               // NERVE - SMF
2218 void CG_PlayBufferedVoiceChats( void );       // NERVE - SMF
2219 void CG_AddToNotify( const char *str );
2220 
2221 //
2222 // cg_playerstate.c
2223 //
2224 void CG_Respawn( void );
2225 void CG_TransitionPlayerState( playerState_t *ps, playerState_t *ops );
2226 
2227 
2228 //===============================================
2229 
2230 //
2231 // system traps
2232 // These functions are how the cgame communicates with the main game system
2233 //
2234 
2235 // print message on the local console
2236 void	trap_Print( const char *fmt );
2237 
2238 // abort the game
2239 void	trap_Error(const char *fmt) __attribute__((noreturn));
2240 
2241 // milliseconds should only be used for performance tuning, never
2242 // for anything game related.  Get time from the CG_DrawActiveFrame parameter
2243 int         trap_Milliseconds( void );
2244 
2245 // console variable interaction
2246 void        trap_Cvar_Register( vmCvar_t *vmCvar, const char *varName, const char *defaultValue, int flags );
2247 void        trap_Cvar_Update( vmCvar_t *vmCvar );
2248 void        trap_Cvar_Set( const char *var_name, const char *value );
2249 void        trap_Cvar_VariableStringBuffer( const char *var_name, char *buffer, int bufsize );
2250 
2251 // ServerCommand and ConsoleCommand parameter access
2252 int         trap_Argc( void );
2253 void        trap_Argv( int n, char *buffer, int bufferLength );
2254 void        trap_Args( char *buffer, int bufferLength );
2255 
2256 // filesystem access
2257 // returns length of file
2258 int         trap_FS_FOpenFile( const char *qpath, fileHandle_t *f, fsMode_t mode );
2259 void        trap_FS_Read( void *buffer, int len, fileHandle_t f );
2260 void        trap_FS_Write( const void *buffer, int len, fileHandle_t f );
2261 void        trap_FS_FCloseFile( fileHandle_t f );
2262 
2263 // add commands to the local console as if they were typed in
2264 // for map changing, etc.  The command is not executed immediately,
2265 // but will be executed in order the next time console commands
2266 // are processed
2267 void        trap_SendConsoleCommand( const char *text );
2268 
2269 // register a command name so the console can perform command completion.
2270 // FIXME: replace this with a normal console command "defineCommand"?
2271 void	trap_AddCommand( const char *cmdName );
2272 void	trap_RemoveCommand( const char *cmdName );
2273 
2274 // send a string to the server over the network
2275 void        trap_SendClientCommand( const char *s );
2276 
2277 // force a screen update, only used during gamestate load
2278 void        trap_UpdateScreen( void );
2279 
2280 // model collision
2281 void        trap_CM_LoadMap( const char *mapname );
2282 int         trap_CM_NumInlineModels( void );
2283 clipHandle_t trap_CM_InlineModel( int index );      // 0 = world, 1+ = bmodels
2284 clipHandle_t trap_CM_TempBoxModel( const vec3_t mins, const vec3_t maxs );
2285 clipHandle_t trap_CM_TempCapsuleModel( const vec3_t mins, const vec3_t maxs );
2286 int         trap_CM_PointContents( const vec3_t p, clipHandle_t model );
2287 int         trap_CM_TransformedPointContents( const vec3_t p, clipHandle_t model, const vec3_t origin, const vec3_t angles );
2288 void        trap_CM_BoxTrace( trace_t *results, const vec3_t start, const vec3_t end,
2289 							  const vec3_t mins, const vec3_t maxs,
2290 							  clipHandle_t model, int brushmask );
2291 void        trap_CM_TransformedBoxTrace( trace_t *results, const vec3_t start, const vec3_t end,
2292 										 const vec3_t mins, const vec3_t maxs,
2293 										 clipHandle_t model, int brushmask,
2294 										 const vec3_t origin, const vec3_t angles );
2295 
2296 void        trap_CM_CapsuleTrace( trace_t *results, const vec3_t start, const vec3_t end,
2297 								  const vec3_t mins, const vec3_t maxs,
2298 								  clipHandle_t model, int brushmask );
2299 void        trap_CM_TransformedCapsuleTrace( trace_t *results, const vec3_t start, const vec3_t end,
2300 											 const vec3_t mins, const vec3_t maxs,
2301 											 clipHandle_t model, int brushmask,
2302 											 const vec3_t origin, const vec3_t angles );
2303 
2304 // Returns the projection of a polygon onto the solid brushes in the world
2305 int         trap_CM_MarkFragments( int numPoints, const vec3_t *points,
2306 								   const vec3_t projection,
2307 								   int maxPoints, vec3_t pointBuffer,
2308 								   int maxFragments, markFragment_t *fragmentBuffer );
2309 
2310 // normal sounds will have their volume dynamically changed as their entity
2311 // moves and the listener moves
2312 void        trap_S_StartSound( vec3_t origin, int entityNum, int entchannel, sfxHandle_t sfx );
2313 void        trap_S_StartSoundEx( vec3_t origin, int entityNum, int entchannel, sfxHandle_t sfx, int flags );
2314 void        trap_S_StopLoopingSound( int entnum );
2315 
2316 // a local sound is always played full volume
2317 void        trap_S_StartLocalSound( sfxHandle_t sfx, int channelNum );
2318 void        trap_S_ClearLoopingSounds( qboolean killall );
2319 void        trap_S_AddLoopingSound( int entityNum, const vec3_t origin, const vec3_t velocity, int range, sfxHandle_t sfx, int volume );
2320 void        trap_S_AddRealLoopingSound( int entityNum, const vec3_t origin, const vec3_t velocity, int range, sfxHandle_t sfx, int volume );
2321 void        trap_S_UpdateEntityPosition( int entityNum, const vec3_t origin );
2322 
2323 // Ridah, talking animations
2324 int         trap_S_GetVoiceAmplitude( int entityNum );
2325 // done.
2326 
2327 // repatialize recalculates the volumes of sound as they should be heard by the
2328 // given entityNum and position
2329 void trap_S_Respatialize( int entityNum, const vec3_t origin, vec3_t axis[3], int inwater );
2330 sfxHandle_t trap_S_RegisterSound( const char *sample );     // returns buzz if not found
2331 void        trap_S_StartBackgroundTrack( const char *intro, const char *loop ); // empty name stops music
2332 void        trap_S_StopBackgroundTrack( void );
2333 void        trap_S_StartStreamingSound( const char *intro, const char *loop, int entnum, int channel, int attenuation );
2334 
2335 void        trap_R_LoadWorldMap( const char *mapname );
2336 
2337 // all media should be registered during level startup to prevent
2338 // hitches during gameplay
2339 qhandle_t   trap_R_RegisterModel( const char *name );           // returns rgb axis if not found
2340 qhandle_t   trap_R_RegisterSkin( const char *name );            // returns all white if not found
2341 qhandle_t   trap_R_RegisterShader( const char *name );          // returns all white if not found
2342 qhandle_t   trap_R_RegisterShaderNoMip( const char *name );         // returns all white if not found
2343 
2344 qboolean    trap_R_GetSkinModel( qhandle_t skinid, const char *type, char *name );   //----(SA) added
2345 qhandle_t   trap_R_GetShaderFromModel( qhandle_t modelid, int surfnum, int withlightmap );   //----(SA)	added
2346 
2347 // a scene is built up by calls to R_ClearScene and the various R_Add functions.
2348 // Nothing is drawn until R_RenderScene is called.
2349 void        trap_R_ClearScene( void );
2350 void        trap_R_AddRefEntityToScene( const refEntity_t *re );
2351 
2352 // polys are intended for simple wall marks, not really for doing
2353 // significant construction
2354 void        trap_R_AddPolyToScene( qhandle_t hShader, int numVerts, const polyVert_t *verts );
2355 // Ridah
2356 void        trap_R_AddPolysToScene( qhandle_t hShader, int numVerts, const polyVert_t *verts, int numPolys );
2357 // done.
2358 void        trap_R_AddLightToScene( const vec3_t org, float intensity, float r, float g, float b, int overdraw );
2359 void	    trap_R_AddAdditiveLightToScene( const vec3_t org, float intensity, float r, float g, float b );
2360 void        trap_R_AddCoronaToScene( const vec3_t org, float r, float g, float b, float scale, int id, qboolean visible );
2361 void        trap_R_RenderScene( const refdef_t *fd );
2362 void        trap_R_SetColor( const float *rgba );   // NULL = 1,1,1,1
2363 void        trap_R_DrawStretchPic( float x, float y, float w, float h,
2364 								   float s1, float t1, float s2, float t2, qhandle_t hShader );
2365 void        trap_R_DrawRotatedPic( float x, float y, float w, float h,
2366 								   float s1, float t1, float s2, float t2, qhandle_t hShader, float angle );    // NERVE - SMF
2367 void        trap_R_DrawStretchPicGradient( float x, float y, float w, float h,
2368 										   float s1, float t1, float s2, float t2, qhandle_t hShader, const float *gradientColor, int gradientType );
2369 
2370 void        trap_R_ModelBounds( clipHandle_t model, vec3_t mins, vec3_t maxs );
2371 int         trap_R_LerpTag( orientation_t *tag, const refEntity_t *refent, const char *tagName, int startIndex );
2372 void        trap_R_RemapShader( const char *oldShader, const char *newShader, const char *timeOffset );
2373 qboolean    trap_R_inPVS( const vec3_t p1, const vec3_t p2 );
2374 
2375 //----(SA)
2376 void    trap_R_SetFog( int fogvar, int var1, int var2, float r, float g, float b, float density );
2377 
2378 //----(SA)
2379 
2380 // The glconfig_t will not change during the life of a cgame.
2381 // If it needs to change, the entire cgame will be restarted, because
2382 // all the qhandle_t are then invalid.
2383 void        trap_GetGlconfig( glconfig_t *glconfig );
2384 
2385 // the gamestate should be grabbed at startup, and whenever a
2386 // configstring changes
2387 void        trap_GetGameState( gameState_t *gamestate );
2388 
2389 // cgame will poll each frame to see if a newer snapshot has arrived
2390 // that it is interested in.  The time is returned seperately so that
2391 // snapshot latency can be calculated.
2392 void        trap_GetCurrentSnapshotNumber( int *snapshotNumber, int *serverTime );
2393 
2394 // a snapshot get can fail if the snapshot (or the entties it holds) is so
2395 // old that it has fallen out of the client system queue
2396 qboolean    trap_GetSnapshot( int snapshotNumber, snapshot_t *snapshot );
2397 
2398 // retrieve a text command from the server stream
2399 // the current snapshot will hold the number of the most recent command
2400 // qfalse can be returned if the client system handled the command
2401 // argc() / argv() can be used to examine the parameters of the command
2402 qboolean    trap_GetServerCommand( int serverCommandNumber );
2403 
2404 // returns the most recent command number that can be passed to GetUserCmd
2405 // this will always be at least one higher than the number in the current
2406 // snapshot, and it may be quite a few higher if it is a fast computer on
2407 // a lagged connection
2408 int         trap_GetCurrentCmdNumber( void );
2409 
2410 qboolean    trap_GetUserCmd( int cmdNumber, usercmd_t *ucmd );
2411 
2412 // used for the weapon/holdable select and zoom
2413 void        trap_SetUserCmdValue( int stateValue, int holdValue, float sensitivityScale, int mpSetup, int mpIdentClient );
2414 void        trap_SetClientLerpOrigin( float x, float y, float z );      // DHM - Nerve
2415 
2416 // aids for VM testing
2417 void        testPrintInt( char *string, int i );
2418 void        testPrintFloat( char *string, float f );
2419 
2420 int         trap_MemoryRemaining( void );
2421 void        trap_R_RegisterFont( const char *fontName, int pointSize, fontInfo_t *font );
2422 qboolean    trap_Key_IsDown( int keynum );
2423 int         trap_Key_GetCatcher( void );
2424 void        trap_Key_SetCatcher( int catcher );
2425 int         trap_Key_GetKey( const char *binding );
2426 
2427 void CG_S_AddLoopingSound( int entityNum, const vec3_t origin, const vec3_t velocity, sfxHandle_t sfx, int volume );
2428 void CG_S_AddRangedLoopingSound( int entityNum, const vec3_t origin, const vec3_t velocity, sfxHandle_t sfx, int range );
2429 void CG_S_AddRealLoopingSound( int entityNum, const vec3_t origin, const vec3_t velocity, sfxHandle_t sfx );
2430 
2431 // RF
2432 void trap_SendMoveSpeedsToGame( int entnum, char *movespeeds );
2433 
2434 typedef enum {
2435 	SYSTEM_PRINT,
2436 	CHAT_PRINT,
2437 	TEAMCHAT_PRINT
2438 } q3print_t;
2439 
2440 void trap_UI_Popup( const char *arg0 );   //----(SA)	added
2441 
2442 // NERVE - SMF
2443 qhandle_t getTestShader( void ); // JPW NERVE shhh
2444 void trap_UI_ClosePopup( const char *arg0 );
2445 void trap_UI_LimboChat( const char *arg0 );
2446 void trap_Key_GetBindingBuf( int keynum, char *buf, int buflen );
2447 void trap_Key_SetBinding( int keynum, const char *binding );
2448 void trap_Key_KeynumToStringBuf( int keynum, char *buf, int buflen );
2449 // -NERVE - SMF
2450 
2451 void trap_TranslateString( const char *string, char *buf );       // NERVE - SMF - localization
2452 
2453 int trap_CIN_PlayCinematic( const char *arg0, int xpos, int ypos, int width, int height, int bits );
2454 e_status trap_CIN_StopCinematic( int handle );
2455 e_status trap_CIN_RunCinematic( int handle );
2456 void trap_CIN_DrawCinematic( int handle );
2457 void trap_CIN_SetExtents( int handle, int x, int y, int w, int h );
2458 
2459 int	trap_RealTime(qtime_t *qtime);
2460 void trap_SnapVector( float *v );
2461 
2462 qboolean    trap_GetEntityToken( char *buffer, int bufferSize );
2463 
2464 // Duffy, camera stuff
2465 #define CAM_PRIMARY 0   // the main camera for cutscenes, etc.
2466 qboolean    trap_loadCamera( int camNum, const char *name );
2467 void        trap_startCamera( int camNum, int time );
2468 qboolean    trap_getCameraInfo( int camNum, int time, vec3_t *origin, vec3_t *angles, float *fov );
2469 void        CG_StartCamera( const char *name, qboolean startBlack );
2470 
2471 //----(SA)	added
2472 int         CG_LoadCamera( const char *name );
2473 void        CG_FreeCamera( int camNum );
2474 //----(SA)	end
2475