codemp/cgame/cg_local.h

Go to the documentation of this file.
00001 // Copyright (C) 1999-2000 Id Software, Inc.
00002 //
00003 #include "../game/q_shared.h"
00004 #include "tr_types.h"
00005 #include "../game/bg_public.h"
00006 #include "cg_public.h"
00007 
00008 // The entire cgame module is unloaded and reloaded on each level change,
00009 // so there is NO persistant data between levels on the client side.
00010 // If you absolutely need something stored, it can either be kept
00011 // by the server in the server stored userinfos, or stashed in a cvar.
00012 
00013 #ifndef __LCC__
00014 #define CGAME_INLINE ID_INLINE
00015 #else
00016 #define CGAME_INLINE //none
00017 #endif
00018 
00019 #define NULL_HANDLE                     ((qhandle_t) 0)
00020 #define NULL_SOUND                      ((sfxHandle_t) 0)
00021 #define NULL_FX                         ((fxHandle_t) 0)
00022 
00023 #define POWERUP_BLINKS          5
00024 
00025 #define POWERUP_BLINK_TIME      1000
00026 #define FADE_TIME                       200
00027 #define PULSE_TIME                      200
00028 #define DAMAGE_DEFLECT_TIME     100
00029 #define DAMAGE_RETURN_TIME      400
00030 #define DAMAGE_TIME                     500
00031 #define LAND_DEFLECT_TIME       150
00032 #define LAND_RETURN_TIME        300
00033 #define STEP_TIME                       200
00034 #define DUCK_TIME                       100
00035 #define PAIN_TWITCH_TIME        200
00036 #define WEAPON_SELECT_TIME      1400
00037 #define ITEM_SCALEUP_TIME       1000
00038 
00039 // Zoom vars
00040 #define ZOOM_TIME                       150             // not currently used?
00041 #define MAX_ZOOM_FOV            3.0f
00042 #define ZOOM_IN_TIME            1500.0f 
00043 #define ZOOM_OUT_TIME           100.0f
00044 #define ZOOM_START_PERCENT      0.3f    
00045 
00046 #define ITEM_BLOB_TIME          200
00047 #define MUZZLE_FLASH_TIME       20
00048 #define SINK_TIME                       1000            // time for fragments to sink into ground before going away
00049 #define ATTACKER_HEAD_TIME      10000
00050 #define REWARD_TIME                     3000
00051 
00052 #define PULSE_SCALE                     1.5                     // amount to scale up the icons when activating
00053 
00054 #define MAX_STEP_CHANGE         32
00055 
00056 #define MAX_VERTS_ON_POLY       10
00057 #define MAX_MARK_POLYS          256
00058 
00059 #define STAT_MINUS                      10      // num frame for '-' stats digit
00060 
00061 #define ICON_SIZE                       48
00062 #define CHAR_WIDTH                      32
00063 #define CHAR_HEIGHT                     48
00064 #define TEXT_ICON_SPACE         4
00065 
00066 // very large characters
00067 #define GIANT_WIDTH                     32
00068 #define GIANT_HEIGHT            48
00069 
00070 #define NUM_FONT_BIG    1
00071 #define NUM_FONT_SMALL  2
00072 #define NUM_FONT_CHUNKY 3
00073 
00074 #define NUM_CROSSHAIRS          9
00075 
00076 #define TEAM_OVERLAY_MAXNAME_WIDTH      32
00077 #define TEAM_OVERLAY_MAXLOCATION_WIDTH  64
00078 
00079 #define WAVE_AMPLITUDE  1
00080 #define WAVE_FREQUENCY  0.4
00081 
00082 #define DEFAULT_MODEL                   "kyle"
00083 
00084 #define DEFAULT_FORCEPOWERS             "5-1-000000000000000000"
00085 //"rank-side-heal.lev.speed.push.pull.tele.grip.lightning.rage.protect.absorb.teamheal.teamforce.drain.see"
00086 
00087 #define DEFAULT_REDTEAM_NAME            "Empire"
00088 #define DEFAULT_BLUETEAM_NAME           "Rebellion"
00089 
00090 typedef enum {
00091         FOOTSTEP_STONEWALK,
00092         FOOTSTEP_STONERUN,
00093         FOOTSTEP_METALWALK,
00094         FOOTSTEP_METALRUN,
00095         FOOTSTEP_PIPEWALK,
00096         FOOTSTEP_PIPERUN,
00097         FOOTSTEP_SPLASH,
00098         FOOTSTEP_WADE,
00099         FOOTSTEP_SWIM,
00100         FOOTSTEP_SNOWWALK,
00101         FOOTSTEP_SNOWRUN,
00102         FOOTSTEP_SANDWALK,
00103         FOOTSTEP_SANDRUN,
00104         FOOTSTEP_GRASSWALK,
00105         FOOTSTEP_GRASSRUN,
00106         FOOTSTEP_DIRTWALK,
00107         FOOTSTEP_DIRTRUN,
00108         FOOTSTEP_MUDWALK,
00109         FOOTSTEP_MUDRUN,
00110         FOOTSTEP_GRAVELWALK,
00111         FOOTSTEP_GRAVELRUN,
00112         FOOTSTEP_RUGWALK,
00113         FOOTSTEP_RUGRUN,
00114         FOOTSTEP_WOODWALK,
00115         FOOTSTEP_WOODRUN,
00116 
00117         FOOTSTEP_TOTAL
00118 } footstep_t;
00119 
00120 typedef enum {
00121         IMPACTSOUND_DEFAULT,
00122         IMPACTSOUND_METAL,
00123         IMPACTSOUND_FLESH
00124 } impactSound_t;
00125 
00126 //=================================================
00127 
00128 // player entities need to track more information
00129 // than any other type of entity.
00130 
00131 // note that not every player entity is a client entity,
00132 // because corpses after respawn are outside the normal
00133 // client numbering range
00134 
00135 // when changing animation, set animationTime to frameTime + lerping time
00136 // The current lerp will finish out, then it will lerp to the new animation
00137 typedef struct {
00138         int                     oldFrame;
00139         int                     oldFrameTime;           // time when ->oldFrame was exactly on
00140 
00141         int                     frame;
00142         int                     frameTime;                      // time when ->frame will be exactly on
00143 
00144         float           backlerp;
00145 
00146         qboolean        lastFlip; //if does not match torsoFlip/legsFlip, restart the anim.
00147 
00148         int                     lastForcedFrame;
00149 
00150         float           yawAngle;
00151         qboolean        yawing;
00152         float           pitchAngle;
00153         qboolean        pitching;
00154 
00155         float           yawSwingDif;
00156 
00157         int                     animationNumber;
00158         animation_t     *animation;
00159         int                     animationTime;          // time when the first frame of the animation will be exact
00160 
00161         float           animationSpeed;         // scale the animation speed
00162         float           animationTorsoSpeed;
00163 
00164         qboolean        torsoYawing;
00165 } lerpFrame_t;
00166 
00167 
00168 typedef struct {
00169         lerpFrame_t             legs, torso, flag;
00170         int                             painTime;
00171         int                             painDirection;  // flip from 0 to 1
00172         int                             lightningFiring;
00173 
00174         // machinegun spinning
00175         float                   barrelAngle;
00176         int                             barrelTime;
00177         qboolean                barrelSpinning;
00178 } playerEntity_t;
00179 
00180 //=================================================
00181 
00182 // each client has an associated clientInfo_t
00183 // that contains media references necessary to present the
00184 // client model and other color coded effects
00185 // this is regenerated each time a client's configstring changes,
00186 // usually as a result of a userinfo (name, model, etc) change
00187 #define MAX_CUSTOM_COMBAT_SOUNDS        40
00188 #define MAX_CUSTOM_EXTRA_SOUNDS 40
00189 #define MAX_CUSTOM_JEDI_SOUNDS  40
00190 //#define MAX_CUSTOM_SIEGE_SOUNDS..defined in bg_public.h
00191 #define MAX_CUSTOM_DUEL_SOUNDS  40
00192 
00193 #define MAX_CUSTOM_SOUNDS       40 //rww - Note that for now these must all be the same, because of the way I am
00194                                                            //cycling through them and comparing for custom sounds.
00195 
00196 typedef struct {
00197         qboolean                infoValid;
00198 
00199         float                   colorOverride[3];
00200 
00201         saberInfo_t             saber[MAX_SABERS];
00202         void                    *ghoul2Weapons[MAX_SABERS];
00203 
00204         char                    saberName[64];
00205         char                    saber2Name[64];
00206 
00207         char                    name[MAX_QPATH];
00208         team_t                  team;
00209 
00210         int                             duelTeam;
00211 
00212         int                             botSkill;               // 0 = not bot, 1-5 = bot
00213 
00214         int                             frame;
00215 
00216         vec3_t                  color1;
00217         vec3_t                  color2;
00218 
00219         int                             icolor1;
00220         int                             icolor2;
00221 
00222         int                             score;                  // updated by score servercmds
00223         int                             location;               // location index for team mode
00224         int                             health;                 // you only get this info about your teammates
00225         int                             armor;
00226         int                             curWeapon;
00227 
00228         int                             handicap;
00229         int                             wins, losses;   // in tourney mode
00230 
00231         int                             teamTask;               // task in teamplay (offence/defence)
00232         qboolean                teamLeader;             // true when this is a team leader
00233 
00234         int                             powerups;               // so can display quad/flag status
00235 
00236         int                             medkitUsageTime;
00237 
00238         int                             breathPuffTime;
00239 
00240         // when clientinfo is changed, the loading of models/skins/sounds
00241         // can be deferred until you are dead, to prevent hitches in
00242         // gameplay
00243         char                    modelName[MAX_QPATH];
00244         char                    skinName[MAX_QPATH];
00245 //      char                    headModelName[MAX_QPATH];
00246 //      char                    headSkinName[MAX_QPATH];
00247         char                    forcePowers[MAX_QPATH];
00248 //      char                    redTeam[MAX_TEAMNAME];
00249 //      char                    blueTeam[MAX_TEAMNAME];
00250 
00251         char                    teamName[MAX_TEAMNAME];
00252 
00253         int                             corrTime;
00254 
00255         vec3_t                  lastHeadAngles;
00256         int                             lookTime;
00257 
00258         int                             brokenLimbs;
00259 
00260         qboolean                deferred;
00261 
00262         qboolean                newAnims;               // true if using the new mission pack animations
00263         qboolean                fixedlegs;              // true if legs yaw is always the same as torso yaw
00264         qboolean                fixedtorso;             // true if torso never changes yaw
00265 
00266         vec3_t                  headOffset;             // move head in icon views
00267         //footstep_t            footsteps;
00268         gender_t                gender;                 // from model
00269 
00270         qhandle_t               legsModel;
00271         qhandle_t               legsSkin;
00272 
00273         qhandle_t               torsoModel;
00274         qhandle_t               torsoSkin;
00275 
00276         //qhandle_t             headModel;
00277         //qhandle_t             headSkin;
00278 
00279         void                    *ghoul2Model;
00280         
00281         qhandle_t               modelIcon;
00282 
00283         qhandle_t               bolt_rhand;
00284         qhandle_t               bolt_lhand;
00285 
00286         qhandle_t               bolt_head;
00287 
00288         qhandle_t               bolt_motion;
00289 
00290         qhandle_t               bolt_llumbar;
00291 
00292         int                             siegeIndex;
00293         int                             siegeDesiredTeam;
00294 
00295         sfxHandle_t             sounds[MAX_CUSTOM_SOUNDS];
00296         sfxHandle_t             combatSounds[MAX_CUSTOM_COMBAT_SOUNDS];
00297         sfxHandle_t             extraSounds[MAX_CUSTOM_EXTRA_SOUNDS];
00298         sfxHandle_t             jediSounds[MAX_CUSTOM_JEDI_SOUNDS];
00299         sfxHandle_t             siegeSounds[MAX_CUSTOM_SIEGE_SOUNDS];
00300         sfxHandle_t             duelSounds[MAX_CUSTOM_DUEL_SOUNDS];
00301 
00302         int                             legsAnim;
00303         int                             torsoAnim;
00304 
00305         float           facial_blink;           // time before next blink. If a minus value, we are in blink mode
00306         float           facial_frown;           // time before next frown. If a minus value, we are in frown mode
00307         float           facial_aux;                     // time before next aux. If a minus value, we are in aux mode
00308 
00309         int                     superSmoothTime; //do crazy amount of smoothing
00310 
00311 #ifdef _XBOX
00312         int                     friendshipStatus;
00313 #endif
00314         
00315 } clientInfo_t;
00316 
00317 //rww - cheap looping sound struct
00318 #ifdef _XBOX
00319 #define MAX_CG_LOOPSOUNDS 2
00320 #else
00321 #define MAX_CG_LOOPSOUNDS 8
00322 #endif
00323 
00324 typedef struct cgLoopSound_s {
00325         int entityNum;
00326         vec3_t origin;
00327         vec3_t velocity;
00328         sfxHandle_t sfx;
00329 } cgLoopSound_t;
00330 
00331 // centity_t have a direct corespondence with gentity_t in the game, but
00332 // only the entityState_t is directly communicated to the cgame
00333 typedef struct centity_s {
00334         // This comment below is correct, but now m_pVehicle is the first thing in bg shared entity, so it goes first. - AReis
00335         //rww - entstate must be first, to correspond with the bg shared entity structure
00336         entityState_t   currentState;   // from cg.frame
00337         playerState_t   *playerState;   //ptr to playerstate if applicable (for bg ents)
00338         Vehicle_t               *m_pVehicle; //vehicle data
00339         void                    *ghoul2; //g2 instance
00340         int                             localAnimIndex; //index locally (game/cgame) to anim data for this skel
00341         vec3_t                  modelScale; //needed for g2 collision
00342 
00343         //from here up must be unified with bgEntity_t -rww
00344 
00345         entityState_t   nextState;              // from cg.nextFrame, if available
00346         qboolean                interpolate;    // true if next is valid to interpolate to
00347         qboolean                currentValid;   // true if cg.frame holds this entity
00348 
00349         int                             muzzleFlashTime;        // move to playerEntity?
00350         int                             previousEvent;
00351 //      int                             teleportFlag;
00352 
00353         int                             trailTime;              // so missile trails can handle dropped initial packets
00354         int                             dustTrailTime;
00355         int                             miscTime;
00356 
00357         vec3_t                  damageAngles;
00358         int                             damageTime;
00359 
00360         int                             snapShotTime;   // last time this entity was found in a snapshot
00361 
00362         playerEntity_t  pe;
00363 
00364 //      int                             errorTime;              // decay the error from this time
00365 //      vec3_t                  errorOrigin;
00366 //      vec3_t                  errorAngles;
00367         
00368 //      qboolean                extrapolated;   // false if origin / angles is an interpolation
00369 //      vec3_t                  rawOrigin;
00370         vec3_t                  rawAngles;
00371 
00372         vec3_t                  beamEnd;
00373 
00374         // exact interpolated position of entity on this frame
00375         vec3_t                  lerpOrigin;
00376         vec3_t                  lerpAngles;
00377 
00378 #if 0
00379         //add up bone offsets until next client frame before adding them in
00380         qboolean                hasRagOffset;
00381         vec3_t                  ragOffsets;
00382         int                             ragOffsetTime;
00383 #endif
00384 
00385         vec3_t                  ragLastOrigin;
00386         int                             ragLastOriginTime;
00387 
00388         qboolean                noLumbar; //if true only do anims and things on model_root instead of lower_lumbar, this will be the case for some NPCs.
00389         qboolean                noFace;
00390 
00391         //For keeping track of the current surface status in relation to the entitystate surface fields.
00392         int                             npcLocalSurfOn;
00393         int                             npcLocalSurfOff;
00394 
00395         int                             eventAnimIndex;
00396 
00397         clientInfo_t    *npcClient; //dynamically allocated - always free it, and never stomp over it.
00398 
00399         int                             weapon;
00400 
00401         void                    *ghoul2weapon; //rww - pointer to ghoul2 instance of the current 3rd person weapon
00402 
00403         float                   radius;
00404         int                             boltInfo;
00405 
00406         //sometimes used as a bolt index, but these values are also used as generic values for clientside entities
00407         //at times
00408         int                             bolt1;
00409         int                             bolt2;
00410         int                             bolt3;
00411         int                             bolt4;
00412 
00413         float                   bodyHeight;
00414 
00415         int                             torsoBolt;
00416         
00417         vec3_t                  turAngles;
00418 
00419         vec3_t                  frame_minus1;
00420         vec3_t                  frame_minus2;
00421 
00422         int                             frame_minus1_refreshed;
00423         int                             frame_minus2_refreshed;
00424 
00425         void                    *frame_hold; //pointer to a ghoul2 instance
00426 
00427         int                             frame_hold_time;
00428         int                             frame_hold_refreshed;
00429 
00430         void                    *grip_arm; //pointer to a ghoul2 instance
00431 
00432         int                             trickAlpha;
00433         int                             trickAlphaTime;
00434 
00435         int                             teamPowerEffectTime;
00436         qboolean                teamPowerType; //0 regen, 1 heal, 2 drain, 3 absorb
00437 
00438         qboolean                isRagging;
00439         qboolean                ownerRagging;
00440         int                             overridingBones;
00441 
00442         int                             bodyFadeTime;
00443         vec3_t                  pushEffectOrigin;
00444 
00445         cgLoopSound_t   loopingSound[MAX_CG_LOOPSOUNDS];
00446         int                             numLoopingSounds;
00447 
00448         int                             serverSaberHitIndex;
00449         int                             serverSaberHitTime;
00450         qboolean                serverSaberFleshImpact; //true if flesh, false if anything else.
00451 
00452         qboolean                ikStatus;
00453 
00454         qboolean                saberWasInFlight;
00455 
00456         float                   smoothYaw;
00457 
00458         int                             uncloaking;
00459         qboolean                cloaked;
00460 
00461         int                             vChatTime;
00462 } centity_t;
00463 
00464 
00465 //======================================================================
00466 
00467 // local entities are created as a result of events or predicted actions,
00468 // and live independently from all server transmitted entities
00469 
00470 typedef struct markPoly_s {
00471         struct markPoly_s       *prevMark, *nextMark;
00472         int                     time;
00473         qhandle_t       markShader;
00474         qboolean        alphaFade;              // fade alpha instead of rgb
00475         float           color[4];
00476         poly_t          poly;
00477         polyVert_t      verts[MAX_VERTS_ON_POLY];
00478 } markPoly_t;
00479 
00480 
00481 typedef enum {
00482         LE_MARK,
00483         LE_EXPLOSION,
00484         LE_SPRITE_EXPLOSION,
00485         LE_FADE_SCALE_MODEL, // currently only for Demp2 shock sphere
00486         LE_FRAGMENT,
00487         LE_PUFF,
00488         LE_MOVE_SCALE_FADE,
00489         LE_FALL_SCALE_FADE,
00490         LE_FADE_RGB,
00491         LE_SCALE_FADE,
00492         LE_SCOREPLUM,
00493         LE_OLINE,
00494         LE_SHOWREFENTITY,
00495         LE_LINE
00496 } leType_t;
00497 
00498 typedef enum {
00499         LEF_PUFF_DONT_SCALE = 0x0001,                   // do not scale size over time
00500         LEF_TUMBLE                      = 0x0002,                       // tumble over time, used for ejecting shells
00501         LEF_FADE_RGB            = 0x0004,                       // explicitly fade
00502         LEF_NO_RANDOM_ROTATE= 0x0008                    // MakeExplosion adds random rotate which could be bad in some cases
00503 } leFlag_t;
00504 
00505 typedef enum {
00506         LEMT_NONE,
00507         LEMT_BURN,
00508         LEMT_BLOOD
00509 } leMarkType_t;                 // fragment local entities can leave marks on walls
00510 
00511 typedef enum {
00512         LEBS_NONE,
00513         LEBS_BLOOD,
00514         LEBS_BRASS,
00515         LEBS_METAL,
00516         LEBS_ROCK
00517 } leBounceSoundType_t;  // fragment local entities can make sounds on impacts
00518 
00519 typedef struct localEntity_s {
00520         struct localEntity_s    *prev, *next;
00521         leType_t                leType;
00522         int                             leFlags;
00523 
00524         int                             startTime;
00525         int                             endTime;
00526         int                             fadeInTime;
00527 
00528         float                   lifeRate;                       // 1.0 / (endTime - startTime)
00529 
00530         trajectory_t    pos;
00531         trajectory_t    angles;
00532 
00533         float                   bounceFactor;           // 0.0 = no bounce, 1.0 = perfect
00534         int                             bounceSound;            // optional sound index to play upon bounce
00535 
00536         float                   alpha;
00537         float                   dalpha;
00538 
00539         int                             forceAlpha;
00540 
00541         float                   color[4];
00542 
00543         float                   radius;
00544 
00545         float                   light;
00546         vec3_t                  lightColor;
00547 
00548         leMarkType_t            leMarkType;             // mark to leave on fragment impact
00549         leBounceSoundType_t     leBounceSoundType;
00550 
00551         union {
00552                 struct {
00553                         float radius;
00554                         float dradius;
00555                         vec3_t startRGB;
00556                         vec3_t dRGB;
00557                 } sprite;
00558                 struct {
00559                         float width;
00560                         float dwidth;
00561                         float length;
00562                         float dlength;
00563                         vec3_t startRGB;
00564                         vec3_t dRGB;
00565                 } trail;
00566                 struct {
00567                         float width;
00568                         float dwidth;
00569                         // Below are bezier specific.
00570                         vec3_t                  control1;                               // initial position of control points
00571                         vec3_t                  control2;
00572                         vec3_t                  control1_velocity;              // initial velocity of control points
00573                         vec3_t                  control2_velocity;
00574                         vec3_t                  control1_acceleration;  // constant acceleration of control points
00575                         vec3_t                  control2_acceleration;
00576                 } line;
00577                 struct {
00578                         float width;
00579                         float dwidth;
00580                         float width2;
00581                         float dwidth2;
00582                         vec3_t startRGB;
00583                         vec3_t dRGB;
00584                 } line2;
00585                 struct {
00586                         float width;
00587                         float dwidth;
00588                         float width2;
00589                         float dwidth2;
00590                         float height;
00591                         float dheight;
00592                 } cylinder;
00593                 struct {
00594                         float width;
00595                         float dwidth;
00596                 } electricity;
00597                 struct
00598                 {
00599                         // fight the power! open and close brackets in the same column!
00600                         float radius;
00601                         float dradius;
00602                         qboolean (*thinkFn)(struct localEntity_s *le);
00603                         vec3_t  dir;    // magnitude is 1, but this is oldpos - newpos right before the
00604                                                         //particle is sent to the renderer
00605                         // may want to add something like particle::localEntity_s *le (for the particle's think fn)
00606                 } particle;
00607                 struct
00608                 {
00609                         qboolean        dontDie;
00610                         vec3_t          dir;
00611                         float           variance;
00612                         int                     delay;
00613                         int                     nextthink;
00614                         qboolean        (*thinkFn)(struct localEntity_s *le);
00615                         int                     data1;
00616                         int                     data2;
00617                 } spawner;
00618                 struct
00619                 {
00620                         float radius;
00621                 } fragment;
00622         } data;
00623 
00624         refEntity_t             refEntity;              
00625 } localEntity_t;
00626 
00627 //======================================================================
00628 
00629 
00630 typedef struct {
00631         int                             client;
00632         int                             score;
00633         int                             ping;
00634         int                             time;
00635         int                             scoreFlags;
00636         int                             powerUps;
00637         int                             accuracy;
00638         int                             impressiveCount;
00639         int                             excellentCount;
00640         int                             guantletCount;
00641         int                             defendCount;
00642         int                             assistCount;
00643         int                             captures;
00644         qboolean        perfect;
00645         int                             team;
00646 } score_t;
00647 
00648 
00649 // each WP_* weapon enum has an associated weaponInfo_t
00650 // that contains media references necessary to present the
00651 // weapon and its effects
00652 typedef struct weaponInfo_s {
00653         qboolean                registered;
00654         gitem_t                 *item;
00655 
00656         qhandle_t               handsModel;                     // the hands don't actually draw, they just position the weapon
00657         qhandle_t               weaponModel;            // this is the pickup model
00658         qhandle_t               viewModel;                      // this is the in-view model used by the player
00659         qhandle_t               barrelModel;
00660         qhandle_t               flashModel;
00661 
00662         vec3_t                  weaponMidpoint;         // so it will rotate centered instead of by tag
00663 
00664         float                   flashDlight;
00665         vec3_t                  flashDlightColor;
00666 
00667         qhandle_t               weaponIcon;
00668         qhandle_t               ammoIcon;
00669 
00670         qhandle_t               ammoModel;
00671 
00672         sfxHandle_t             flashSound[4];          // fast firing weapons randomly choose
00673         sfxHandle_t             firingSound;
00674         sfxHandle_t             chargeSound;
00675         fxHandle_t              muzzleEffect;
00676         qhandle_t               missileModel;
00677         sfxHandle_t             missileSound;
00678         void                    (*missileTrailFunc)( centity_t *, const struct weaponInfo_s *wi );
00679         float                   missileDlight;
00680         vec3_t                  missileDlightColor;
00681         int                             missileRenderfx;
00682         sfxHandle_t             missileHitSound;
00683 
00684         sfxHandle_t             altFlashSound[4];
00685         sfxHandle_t             altFiringSound;
00686         sfxHandle_t             altChargeSound;
00687         fxHandle_t              altMuzzleEffect;
00688         qhandle_t               altMissileModel;
00689         sfxHandle_t             altMissileSound;
00690         void                    (*altMissileTrailFunc)( centity_t *, const struct weaponInfo_s *wi );
00691         float                   altMissileDlight;
00692         vec3_t                  altMissileDlightColor;
00693         int                             altMissileRenderfx;
00694         sfxHandle_t             altMissileHitSound;
00695 
00696         sfxHandle_t             selectSound;
00697 
00698         sfxHandle_t             readySound;
00699         float                   trailRadius;
00700         float                   wiTrailTime;
00701 
00702 } weaponInfo_t;
00703 
00704 
00705 // each IT_* item has an associated itemInfo_t
00706 // that constains media references necessary to present the
00707 // item and its effects
00708 typedef struct {
00709         qboolean                registered;
00710         qhandle_t               models[MAX_ITEM_MODELS];
00711         qhandle_t               icon;
00712 /*
00713 Ghoul2 Insert Start
00714 */
00715         void                    *g2Models[MAX_ITEM_MODELS];
00716         float                   radius[MAX_ITEM_MODELS];
00717 /*
00718 Ghoul2 Insert End
00719 */
00720 } itemInfo_t;
00721 
00722 
00723 typedef struct {
00724         int                             itemNum;
00725 } powerupInfo_t;
00726 
00727 
00728 #define MAX_SKULLTRAIL          10
00729 
00730 typedef struct {
00731         vec3_t positions[MAX_SKULLTRAIL];
00732         int numpositions;
00733 } skulltrail_t;
00734 
00735 
00736 #define MAX_REWARDSTACK         10
00737 #define MAX_SOUNDBUFFER         20
00738 
00739 //======================================================================
00740 
00741 // all cg.stepTime, cg.duckTime, cg.landTime, etc are set to cg.time when the action
00742 // occurs, and they will have visible effects for #define STEP_TIME or whatever msec after
00743 
00744 #define MAX_PREDICTED_EVENTS    16
00745 
00746 
00747 #define MAX_CHATBOX_ITEMS               5
00748 typedef struct chatBoxItem_s
00749 {
00750         char    string[MAX_SAY_TEXT];
00751         int             time;
00752         int             lines;
00753 } chatBoxItem_t;
00754 
00755 typedef struct {
00756         int                     clientFrame;            // incremented each frame
00757 
00758         int                     clientNum;
00759         
00760         qboolean        demoPlayback;
00761         qboolean        levelShot;                      // taking a level menu screenshot
00762         int                     deferredPlayerLoading;
00763         qboolean        loading;                        // don't defer players at initial startup
00764         qboolean        intermissionStarted;    // don't play voice rewards, because game will end shortly
00765 
00766         // there are only one or two snapshot_t that are relevent at a time
00767         int                     latestSnapshotNum;      // the number of snapshots the client system has received
00768         int                     latestSnapshotTime;     // the time from latestSnapshotNum, so we don't need to read the snapshot yet
00769 
00770         snapshot_t      *snap;                          // cg.snap->serverTime <= cg.time
00771         snapshot_t      *nextSnap;                      // cg.nextSnap->serverTime > cg.time, or NULL
00772 //      snapshot_t      activeSnapshots[2];
00773 
00774         float           frameInterpolation;     // (float)( cg.time - cg.frame->serverTime ) / (cg.nextFrame->serverTime - cg.frame->serverTime)
00775 
00776         qboolean        mMapChange;
00777 
00778         qboolean        thisFrameTeleport;
00779         qboolean        nextFrameTeleport;
00780 
00781         int                     frametime;              // cg.time - cg.oldTime
00782 
00783         int                     time;                   // this is the time value that the client
00784                                                                 // is rendering at.
00785         int                     oldTime;                // time at last frame, used for missile trails and prediction checking
00786 
00787         int                     physicsTime;    // either cg.snap->time or cg.nextSnap->time
00788 
00789         int                     timelimitWarnings;      // 5 min, 1 min, overtime
00790         int                     fraglimitWarnings;
00791 
00792         qboolean        mapRestart;                     // set on a map restart to set back the weapon
00793 
00794         qboolean        mInRMG; //rwwRMG - added
00795         qboolean        mRMGWeather; //rwwRMG - added
00796 
00797         qboolean        renderingThirdPerson;           // during deaths, chasecams, etc
00798 
00799         // prediction state
00800         qboolean        hyperspace;                             // true if prediction has hit a trigger_teleport
00801         playerState_t   predictedPlayerState;
00802         playerState_t   predictedVehicleState;
00803         
00804         //centity_t             predictedPlayerEntity;
00805         //rww - I removed this and made it use cg_entities[clnum] directly.
00806 
00807         qboolean        validPPS;                               // clear until the first call to CG_PredictPlayerState
00808         int                     predictedErrorTime;
00809         vec3_t          predictedError;
00810 
00811         int                     eventSequence;
00812         int                     predictableEvents[MAX_PREDICTED_EVENTS];
00813 
00814         float           stepChange;                             // for stair up smoothing
00815         int                     stepTime;
00816 
00817         float           duckChange;                             // for duck viewheight smoothing
00818         int                     duckTime;
00819 
00820         float           landChange;                             // for landing hard
00821         int                     landTime;
00822 
00823         // input state sent to server
00824         int                     weaponSelect;
00825 
00826         int                     forceSelect;
00827         int                     itemSelect;
00828 
00829         // auto rotating items
00830         vec3_t          autoAngles;
00831         vec3_t          autoAxis[3];
00832         vec3_t          autoAnglesFast;
00833         vec3_t          autoAxisFast[3];
00834 
00835         // view rendering
00836         refdef_t        refdef;
00837 
00838 #ifdef _XBOX
00839         qboolean widescreen;
00840 #endif
00841 
00842         // zoom key
00843         qboolean        zoomed;
00844         int                     zoomTime;
00845         float           zoomSensitivity;
00846 
00847         // information screen text during loading
00848         char            infoScreenText[MAX_STRING_CHARS];
00849 
00850         // scoreboard
00851         int                     scoresRequestTime;
00852         int                     numScores;
00853         int                     selectedScore;
00854         int                     teamScores[2];
00855         score_t         scores[MAX_CLIENTS];
00856         qboolean        showScores;
00857         qboolean        scoreBoardShowing;
00858         int                     scoreFadeTime;
00859         char            killerName[MAX_NAME_LENGTH];
00860         char                    spectatorList[MAX_STRING_CHARS];                // list of names
00861         int                             spectatorLen;                                                                                           // length of list
00862         float                   spectatorWidth;                                                                                 // width in device units
00863         int                             spectatorTime;                                                                                  // next time to offset
00864         int                             spectatorPaintX;                                                                                // current paint x
00865         int                             spectatorPaintX2;                                                                               // current paint x
00866         int                             spectatorOffset;                                                                                // current offset from start
00867         int                             spectatorPaintLen;                                                                      // current offset from start
00868 
00869         // skull trails
00870         skulltrail_t    skulltrails[MAX_CLIENTS];
00871 
00872         // centerprinting
00873         int                     centerPrintTime;
00874         int                     centerPrintCharWidth;
00875         int                     centerPrintY;
00876         char            centerPrint[1024];
00877         int                     centerPrintLines;
00878 
00879         // low ammo warning state
00880         int                     lowAmmoWarning;         // 1 = low, 2 = empty
00881 
00882         // kill timers for carnage reward
00883         int                     lastKillTime;
00884 
00885         // crosshair client ID
00886         int                     crosshairClientNum;
00887         int                     crosshairClientTime;
00888 
00889         int                     crosshairVehNum;
00890         int                     crosshairVehTime;
00891 
00892         // powerup active flashing
00893         int                     powerupActive;
00894         int                     powerupTime;
00895 
00896         // attacking player
00897         int                     attackerTime;
00898         int                     voiceTime;
00899 
00900         // reward medals
00901         int                     rewardStack;
00902         int                     rewardTime;
00903         int                     rewardCount[MAX_REWARDSTACK];
00904         qhandle_t       rewardShader[MAX_REWARDSTACK];
00905         qhandle_t       rewardSound[MAX_REWARDSTACK];
00906 
00907         // sound buffer mainly for announcer sounds
00908         int                     soundBufferIn;
00909         int                     soundBufferOut;
00910         int                     soundTime;
00911         qhandle_t       soundBuffer[MAX_SOUNDBUFFER];
00912 
00913         // for voice chat buffer
00914         int                     voiceChatTime;
00915         int                     voiceChatBufferIn;
00916         int                     voiceChatBufferOut;
00917 
00918         // warmup countdown
00919         int                     warmup;
00920         int                     warmupCount;
00921 
00922         //==========================
00923 
00924         int                     itemPickup;
00925         int                     itemPickupTime;
00926         int                     itemPickupBlendTime;    // the pulse around the crosshair is timed seperately
00927 
00928         int                     weaponSelectTime;
00929         int                     weaponAnimation;
00930         int                     weaponAnimationTime;
00931 
00932         // blend blobs
00933         float           damageTime;
00934         float           damageX, damageY, damageValue;
00935 
00936         // status bar head
00937         float           headYaw;
00938         float           headEndPitch;
00939         float           headEndYaw;
00940         int                     headEndTime;
00941         float           headStartPitch;
00942         float           headStartYaw;
00943         int                     headStartTime;
00944 
00945         // view movement
00946         float           v_dmg_time;
00947         float           v_dmg_pitch;
00948         float           v_dmg_roll;
00949 
00950         vec3_t          kick_angles;    // weapon kicks
00951         int                     kick_time;
00952         vec3_t          kick_origin;
00953 
00954         // temp working variables for player view
00955         float           bobfracsin;
00956         int                     bobcycle;
00957         float           xyspeed;
00958         int     nextOrbitTime;
00959 
00960         //qboolean cameraMode;          // if rendering from a loaded camera
00961         int                     loadLCARSStage;
00962 
00963         int                     forceHUDTotalFlashTime;
00964         int                     forceHUDNextFlashTime;
00965         qboolean        forceHUDActive;                         // Flag to show force hud is off/on
00966 
00967         // development tool
00968         refEntity_t             testModelEntity;
00969         char                    testModelName[MAX_QPATH];
00970         qboolean                testGun;
00971 
00972         int                     VHUDFlashTime;
00973         qboolean        VHUDTurboFlag;
00974 
00975         // HUD stuff
00976         float                   HUDTickFlashTime;
00977         qboolean                HUDArmorFlag;
00978         qboolean                HUDHealthFlag;
00979         qboolean                iconHUDActive;
00980         float                   iconHUDPercent;
00981         float                   iconSelectTime;
00982         float                   invenSelectTime;
00983         float                   forceSelectTime;
00984 
00985         vec3_t                  lastFPFlashPoint;
00986 
00987 /*
00988 Ghoul2 Insert Start
00989 */
00990         int                             testModel;
00991         // 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
00992         snapshot_t      activeSnapshots[2];
00993 /*
00994 Ghoul2 Insert End
00995 */
00996 
00997         char                            sharedBuffer[MAX_CG_SHARED_BUFFER_SIZE];
00998 
00999         short                           radarEntityCount;
01000         short                           radarEntities[MAX_CLIENTS+16];
01001 
01002         short                           bracketedEntityCount;
01003         short                           bracketedEntities[MAX_CLIENTS+16];
01004 
01005         float                           distanceCull;
01006 
01007         chatBoxItem_t           chatItems[MAX_CHATBOX_ITEMS];
01008         int                                     chatItemActive;
01009         
01010 #if 0
01011         int                                     snapshotTimeoutTime;
01012 #endif
01013         
01014 } cg_t;
01015 
01016 #define MAX_TICS        14
01017 
01018 typedef struct forceTicPos_s
01019 {
01020         int                             x;
01021         int                             y;
01022         int                             width;
01023         int                             height;
01024         char                    *file;
01025         qhandle_t               tic;
01026 } forceTicPos_t;
01027 extern forceTicPos_t forceTicPos[];
01028 extern forceTicPos_t ammoTicPos[];
01029 
01030 typedef struct cgscreffects_s
01031 {
01032         float           FOV;
01033         float           FOV2;
01034 
01035         float           shake_intensity;
01036         int                     shake_duration;
01037         int                     shake_start;
01038 
01039         float           music_volume_multiplier;
01040         int                     music_volume_time;
01041         qboolean        music_volume_set;
01042 } cgscreffects_t;
01043 
01044 extern cgscreffects_t cgScreenEffects;
01045 
01046 void CGCam_Shake( float intensity, int duration );
01047 void CGCam_SetMusicMult( float multiplier, int duration );
01048 
01049 typedef enum 
01050 {
01051         CHUNK_METAL1 = 0,
01052         CHUNK_METAL2,
01053         CHUNK_ROCK1,
01054         CHUNK_ROCK2,
01055         CHUNK_ROCK3,
01056         CHUNK_CRATE1,
01057         CHUNK_CRATE2,
01058         CHUNK_WHITE_METAL,
01059         NUM_CHUNK_TYPES
01060 };
01061 #define NUM_CHUNK_MODELS        4
01062 
01063 // all of the model, shader, and sound references that are
01064 // loaded at gamestate time are stored in cgMedia_t
01065 // Other media that can be tied to clients, weapons, or items are
01066 // stored in the clientInfo_t, itemInfo_t, weaponInfo_t, and powerupInfo_t
01067 typedef struct {
01068         qhandle_t       charsetShader;
01069         qhandle_t       whiteShader;
01070 
01071         qhandle_t       loadBarLED;
01072         qhandle_t       loadBarLEDCap;
01073         qhandle_t       loadBarLEDSurround;
01074 
01075         qhandle_t       bryarFrontFlash;
01076         qhandle_t       greenFrontFlash;
01077         qhandle_t       lightningFlash;
01078 
01079         qhandle_t       itemHoloModel;
01080         qhandle_t       redFlagModel;
01081         qhandle_t       blueFlagModel;
01082 
01083         qhandle_t       flagPoleModel;
01084         qhandle_t       flagFlapModel;
01085 
01086         qhandle_t       redFlagBaseModel;
01087         qhandle_t       blueFlagBaseModel;
01088         qhandle_t       neutralFlagBaseModel;
01089 
01090         qhandle_t       teamStatusBar;
01091 
01092         qhandle_t       deferShader;
01093 
01094         qhandle_t       radarShader;
01095         qhandle_t       siegeItemShader;
01096         qhandle_t       mAutomapPlayerIcon;
01097         qhandle_t       mAutomapRocketIcon;
01098 
01099         qhandle_t       wireframeAutomapFrame_left;
01100         qhandle_t       wireframeAutomapFrame_right;
01101         qhandle_t       wireframeAutomapFrame_top;
01102         qhandle_t       wireframeAutomapFrame_bottom;
01103 
01104 //Chunks
01105         qhandle_t       chunkModels[NUM_CHUNK_TYPES][4];
01106         sfxHandle_t     chunkSound;
01107         sfxHandle_t     grateSound;
01108         sfxHandle_t     rockBreakSound;
01109         sfxHandle_t     rockBounceSound[2];
01110         sfxHandle_t     metalBounceSound[2];
01111         sfxHandle_t     glassChunkSound;
01112         sfxHandle_t     crateBreakSound[2];
01113 
01114         qhandle_t       hackerIconShader;
01115 
01116         // Saber shaders
01117         //-----------------------------
01118         qhandle_t       forceCoronaShader;
01119 
01120         qhandle_t       redSaberGlowShader;
01121         qhandle_t       redSaberCoreShader;
01122         qhandle_t       orangeSaberGlowShader;
01123         qhandle_t       orangeSaberCoreShader;
01124         qhandle_t       yellowSaberGlowShader;
01125         qhandle_t       yellowSaberCoreShader;
01126         qhandle_t       greenSaberGlowShader;
01127         qhandle_t       greenSaberCoreShader;
01128         qhandle_t       blueSaberGlowShader;
01129         qhandle_t       blueSaberCoreShader;
01130         qhandle_t       purpleSaberGlowShader;
01131         qhandle_t       purpleSaberCoreShader;
01132         qhandle_t       saberBlurShader;
01133         qhandle_t       swordTrailShader;
01134 
01135         qhandle_t       yellowDroppedSaberShader;
01136 
01137         qhandle_t       rivetMarkShader;
01138 
01139         qhandle_t       teamRedShader;
01140         qhandle_t       teamBlueShader;
01141 
01142         qhandle_t       powerDuelAllyShader;
01143 
01144         qhandle_t       balloonShader;
01145         qhandle_t       vchatShader;
01146         qhandle_t       connectionShader;
01147 
01148         qhandle_t       crosshairShader[NUM_CROSSHAIRS];
01149         qhandle_t       lagometerShader;
01150         qhandle_t       backTileShader;
01151 
01152         qhandle_t       numberShaders[11];
01153         qhandle_t       smallnumberShaders[11];
01154         qhandle_t       chunkyNumberShaders[11];
01155 
01156         qhandle_t       electricBodyShader;
01157         qhandle_t       electricBody2Shader;
01158 
01159         qhandle_t       fsrMarkShader;
01160         qhandle_t       fslMarkShader;
01161         qhandle_t       fshrMarkShader;
01162         qhandle_t       fshlMarkShader;
01163 
01164         qhandle_t       refractionShader;
01165 
01166         qhandle_t       cloakedShader;
01167 
01168         qhandle_t       boltShader;
01169 
01170         qhandle_t       shadowMarkShader;
01171 
01172         //glass shard shader
01173         qhandle_t       glassShardShader;
01174 
01175         // wall mark shaders
01176         qhandle_t       wakeMarkShader;
01177 
01178         // Pain view shader
01179         qhandle_t       viewPainShader;
01180         qhandle_t       viewPainShader_Shields;
01181         qhandle_t       viewPainShader_ShieldsAndHealth;
01182 
01183         qhandle_t       itemRespawningPlaceholder;
01184         qhandle_t       itemRespawningRezOut;
01185 
01186         qhandle_t       playerShieldDamage;
01187         qhandle_t       protectShader;
01188         qhandle_t       forceSightBubble;
01189         qhandle_t       forceShell;
01190         qhandle_t       sightShell;
01191 
01192         // Disruptor zoom graphics
01193         qhandle_t       disruptorMask;
01194         qhandle_t       disruptorInsert;
01195         qhandle_t       disruptorLight;
01196         qhandle_t       disruptorInsertTick;
01197         qhandle_t       disruptorChargeShader;
01198 
01199         // Binocular graphics
01200         qhandle_t       binocularCircle;
01201         qhandle_t       binocularMask;
01202         qhandle_t       binocularArrow;
01203         qhandle_t       binocularTri;
01204         qhandle_t       binocularStatic;
01205         qhandle_t       binocularOverlay;
01206 
01207         // weapon effect models
01208         qhandle_t       lightningExplosionModel;
01209 
01210         // explosion assets
01211         qhandle_t       explosionModel;
01212         qhandle_t       surfaceExplosionShader;
01213 
01214         qhandle_t       disruptorShader;
01215 
01216         qhandle_t       solidWhite;
01217 
01218         qhandle_t       heartShader;
01219 
01220         // All the player shells
01221         qhandle_t       ysaliredShader;
01222         qhandle_t       ysaliblueShader;
01223         qhandle_t       ysalimariShader;
01224         qhandle_t       boonShader;
01225         qhandle_t       endarkenmentShader;
01226         qhandle_t       enlightenmentShader;
01227         qhandle_t       invulnerabilityShader;
01228 
01229 #ifdef JK2AWARDS
01230         // medals shown during gameplay
01231         qhandle_t       medalImpressive;
01232         qhandle_t       medalExcellent;
01233         qhandle_t       medalGauntlet;
01234         qhandle_t       medalDefend;
01235         qhandle_t       medalAssist;
01236         qhandle_t       medalCapture;
01237 #endif
01238 
01239         // sounds
01240         sfxHandle_t     selectSound;
01241         sfxHandle_t     footsteps[FOOTSTEP_TOTAL][4];
01242 
01243         sfxHandle_t     winnerSound;
01244         sfxHandle_t     loserSound;
01245 
01246         sfxHandle_t crackleSound;
01247 
01248         sfxHandle_t     grenadeBounce1;
01249         sfxHandle_t     grenadeBounce2;
01250 
01251         sfxHandle_t teamHealSound;
01252         sfxHandle_t teamRegenSound;
01253 
01254         sfxHandle_t     teleInSound;
01255         sfxHandle_t     teleOutSound;
01256         sfxHandle_t     respawnSound;
01257         sfxHandle_t talkSound;
01258         sfxHandle_t landSound;
01259         sfxHandle_t fallSound;
01260 
01261         sfxHandle_t oneMinuteSound;
01262         sfxHandle_t fiveMinuteSound;
01263 
01264         sfxHandle_t threeFragSound;
01265         sfxHandle_t twoFragSound;
01266         sfxHandle_t oneFragSound;
01267 
01268 #ifdef JK2AWARDS
01269         sfxHandle_t impressiveSound;
01270         sfxHandle_t excellentSound;
01271         sfxHandle_t deniedSound;
01272         sfxHandle_t humiliationSound;
01273         sfxHandle_t defendSound;
01274 #endif
01275 
01276         /*
01277         sfxHandle_t takenLeadSound;
01278         sfxHandle_t tiedLeadSound;
01279         sfxHandle_t lostLeadSound;
01280         */
01281 
01282         sfxHandle_t rollSound;
01283 
01284         sfxHandle_t watrInSound;
01285         sfxHandle_t watrOutSound;
01286         sfxHandle_t watrUnSound;
01287 
01288         sfxHandle_t noforceSound;
01289 
01290         sfxHandle_t deploySeeker;
01291         sfxHandle_t medkitSound;
01292 
01293         // teamplay sounds
01294 #ifdef JK2AWARDS
01295         sfxHandle_t captureAwardSound;
01296 #endif
01297         sfxHandle_t redScoredSound;
01298         sfxHandle_t blueScoredSound;
01299         sfxHandle_t redLeadsSound;
01300         sfxHandle_t blueLeadsSound;
01301         sfxHandle_t teamsTiedSound;
01302 
01303         sfxHandle_t redFlagReturnedSound;
01304         sfxHandle_t blueFlagReturnedSound;
01305         sfxHandle_t     redTookFlagSound;
01306         sfxHandle_t blueTookFlagSound;
01307 
01308         sfxHandle_t redYsalReturnedSound;
01309         sfxHandle_t blueYsalReturnedSound;
01310         sfxHandle_t     redTookYsalSound;
01311         sfxHandle_t blueTookYsalSound;
01312 
01313         sfxHandle_t     drainSound;
01314 
01315         //music blips
01316         sfxHandle_t     happyMusic;
01317         sfxHandle_t dramaticFailure;
01318 
01319         // tournament sounds
01320         sfxHandle_t     count3Sound;
01321         sfxHandle_t     count2Sound;
01322         sfxHandle_t     count1Sound;
01323         sfxHandle_t     countFightSound;
01324 
01325         // new stuff
01326         qhandle_t patrolShader;
01327         qhandle_t assaultShader;
01328         qhandle_t campShader;
01329         qhandle_t followShader;
01330         qhandle_t defendShader;
01331         qhandle_t teamLeaderShader;
01332         qhandle_t retrieveShader;
01333         qhandle_t escortShader;
01334         qhandle_t flagShaders[3];
01335 
01336         qhandle_t halfShieldModel;
01337         qhandle_t halfShieldShader;
01338 
01339         qhandle_t demp2Shell;
01340         qhandle_t demp2ShellShader;
01341 
01342         qhandle_t cursor;
01343         qhandle_t selectCursor;
01344         qhandle_t sizeCursor;
01345 
01346         //weapon icons
01347         qhandle_t weaponIcons[WP_NUM_WEAPONS];
01348         qhandle_t weaponIcons_NA[WP_NUM_WEAPONS];
01349 
01350         //holdable inventory item icons
01351         qhandle_t invenIcons[HI_NUM_HOLDABLE];
01352 
01353         //force power icons
01354         qhandle_t forcePowerIcons[NUM_FORCE_POWERS];
01355 
01356         qhandle_t rageRecShader;
01357 
01358         //other HUD parts
01359         int                     currentBackground;
01360         qhandle_t       weaponIconBackground;
01361         qhandle_t       forceIconBackground;
01362         qhandle_t       inventoryIconBackground;
01363 
01364         sfxHandle_t     holocronPickup;
01365 
01366         // Zoom
01367         sfxHandle_t     zoomStart;
01368         sfxHandle_t     zoomLoop;
01369         sfxHandle_t     zoomEnd;
01370         sfxHandle_t     disruptorZoomLoop;
01371 
01372         qhandle_t       bdecal_bodyburn1;
01373         qhandle_t       bdecal_saberglow;
01374         qhandle_t       bdecal_burn1;
01375         qhandle_t       mSaberDamageGlow;
01376 
01377         // For vehicles only now
01378         sfxHandle_t     noAmmoSound;
01379 
01380 } cgMedia_t;
01381 
01382 
01383 // Stored FX handles
01384 //--------------------
01385 typedef struct
01386 {
01387         //concussion
01388         fxHandle_t      concussionShotEffect;
01389         fxHandle_t      concussionImpactEffect;
01390 
01391         // BRYAR PISTOL
01392         fxHandle_t      bryarShotEffect;
01393         fxHandle_t      bryarPowerupShotEffect;
01394         fxHandle_t      bryarWallImpactEffect;
01395         fxHandle_t      bryarWallImpactEffect2;
01396         fxHandle_t      bryarWallImpactEffect3;
01397         fxHandle_t      bryarFleshImpactEffect;
01398         fxHandle_t      bryarDroidImpactEffect;
01399 
01400         // BLASTER
01401         fxHandle_t  blasterShotEffect;
01402         fxHandle_t  blasterWallImpactEffect;
01403         fxHandle_t  blasterFleshImpactEffect;
01404         fxHandle_t  blasterDroidImpactEffect;
01405 
01406         // DISRUPTOR
01407         fxHandle_t  disruptorRingsEffect;
01408         fxHandle_t  disruptorProjectileEffect;
01409         fxHandle_t  disruptorWallImpactEffect;  
01410         fxHandle_t  disruptorFleshImpactEffect; 
01411         fxHandle_t  disruptorAltMissEffect;     
01412         fxHandle_t  disruptorAltHitEffect;      
01413 
01414         // BOWCASTER
01415         fxHandle_t      bowcasterShotEffect;
01416         fxHandle_t      bowcasterImpactEffect;
01417 
01418         // REPEATER
01419         fxHandle_t  repeaterProjectileEffect;
01420         fxHandle_t  repeaterAltProjectileEffect;
01421         fxHandle_t  repeaterWallImpactEffect;   
01422         fxHandle_t  repeaterFleshImpactEffect;
01423         fxHandle_t  repeaterAltWallImpactEffect;
01424 
01425         // DEMP2
01426         fxHandle_t  demp2ProjectileEffect;
01427         fxHandle_t  demp2WallImpactEffect;
01428         fxHandle_t  demp2FleshImpactEffect;
01429 
01430         // FLECHETTE
01431         fxHandle_t      flechetteShotEffect;
01432         fxHandle_t      flechetteAltShotEffect;
01433         fxHandle_t      flechetteWallImpactEffect;
01434         fxHandle_t      flechetteFleshImpactEffect;
01435 
01436         // ROCKET
01437         fxHandle_t  rocketShotEffect;
01438         fxHandle_t  rocketExplosionEffect;
01439 
01440         // THERMAL
01441         fxHandle_t      thermalExplosionEffect;
01442         fxHandle_t      thermalShockwaveEffect;
01443 
01444         // TRIPMINE
01445         fxHandle_t      tripmineLaserFX;
01446         fxHandle_t      tripmineGlowFX;
01447 
01448         //FORCE
01449         fxHandle_t forceLightning;
01450         fxHandle_t forceLightningWide;
01451 
01452         fxHandle_t forceDrain;
01453         fxHandle_t forceDrainWide;
01454         fxHandle_t forceDrained;
01455 
01456         //TURRET
01457         fxHandle_t turretShotEffect;
01458 
01459         //Whatever
01460         fxHandle_t itemCone;
01461 
01462         fxHandle_t      mSparks;
01463         fxHandle_t      mSaberCut;
01464         fxHandle_t      mTurretMuzzleFlash;
01465         fxHandle_t      mSaberBlock;
01466         fxHandle_t      mSaberBloodSparks;
01467         fxHandle_t      mSaberBloodSparksSmall;
01468         fxHandle_t      mSaberBloodSparksMid;
01469         fxHandle_t      mSpawn;
01470         fxHandle_t      mJediSpawn;
01471         fxHandle_t      mBlasterDeflect;
01472         fxHandle_t      mBlasterSmoke;
01473         fxHandle_t      mForceConfustionOld;
01474         fxHandle_t      mDisruptorDeathSmoke;
01475         fxHandle_t      mSparkExplosion;
01476         fxHandle_t      mTurretExplode;
01477         fxHandle_t      mEmplacedExplode;
01478         fxHandle_t      mEmplacedDeadSmoke;
01479         fxHandle_t      mTripmineExplosion;
01480         fxHandle_t      mDetpackExplosion;
01481         fxHandle_t      mFlechetteAltBlow;
01482         fxHandle_t      mStunBatonFleshImpact;
01483         fxHandle_t      mAltDetonate;
01484         fxHandle_t      mSparksExplodeNoSound;
01485         fxHandle_t      mTripMineLaster;
01486         fxHandle_t      mEmplacedMuzzleFlash;
01487         fxHandle_t      mConcussionAltRing;
01488         fxHandle_t      mHyperspaceStars;
01489         fxHandle_t      mBlackSmoke;
01490         fxHandle_t      mShipDestDestroyed;
01491         fxHandle_t      mShipDestBurning;
01492         fxHandle_t      mBobaJet;
01493 
01494         //footstep effects
01495         fxHandle_t footstepMud;
01496         fxHandle_t footstepSand;
01497         fxHandle_t footstepSnow;
01498         fxHandle_t footstepGravel;
01499         //landing effects
01500         fxHandle_t landingMud;
01501         fxHandle_t landingSand;
01502         fxHandle_t landingDirt;
01503         fxHandle_t landingSnow;
01504         fxHandle_t landingGravel;
01505         //splashes
01506         fxHandle_t waterSplash;
01507         fxHandle_t lavaSplash;
01508         fxHandle_t acidSplash;
01509 } cgEffects_t;
01510 
01511 
01512 // The client game static (cgs) structure hold everything
01513 // loaded or calculated from the gamestate.  It will NOT
01514 // be cleared when a tournement restart is done, allowing
01515 // all clients to begin playing instantly
01516 typedef struct {
01517         gameState_t             gameState;                      // gamestate from server
01518         glconfig_t              glconfig;                       // rendering configuration
01519         float                   screenXScale;           // derived from glconfig
01520         float                   screenYScale;
01521         float                   screenXBias;
01522 
01523         int                             serverCommandSequence;  // reliable command stream counter
01524         int                             processedSnapshotNum;// the number of snapshots cgame has requested
01525 
01526         qboolean                localServer;            // detected on startup by checking sv_running
01527 
01528         // parsed from serverinfo
01529         int                             siegeTeamSwitch;
01530         int                             showDuelHealths;
01531         gametype_t              gametype;
01532         int                             debugMelee;
01533         int                             stepSlideFix;
01534         int                             noSpecMove;
01535         int                             dmflags;
01536         int                             teamflags;
01537         int                             fraglimit;
01538         int                             duel_fraglimit;
01539         int                             capturelimit;
01540         int                             timelimit;
01541         int                             maxclients;
01542         qboolean                needpass;
01543         qboolean                jediVmerc;
01544         int                             wDisable;
01545         int                             fDisable;
01546 
01547         char                    mapname[MAX_QPATH];
01548 //      char                    redTeam[MAX_QPATH];
01549 //      char                    blueTeam[MAX_QPATH];
01550 
01551         int                             voteTime;
01552         int                             voteYes;
01553         int                             voteNo;
01554         qboolean                voteModified;                   // beep whenever changed
01555         char                    voteString[MAX_STRING_TOKENS];
01556 
01557         int                             teamVoteTime[2];
01558         int                             teamVoteYes[2];
01559         int                             teamVoteNo[2];
01560         qboolean                teamVoteModified[2];    // beep whenever changed
01561         char                    teamVoteString[2][MAX_STRING_TOKENS];
01562 
01563         int                             levelStartTime;
01564 
01565         int                             scores1, scores2;               // from configstrings
01566         int                             jediMaster;
01567         int                             duelWinner;
01568         int                             duelist1;
01569         int                             duelist2;
01570         int                             duelist3;
01571 // nmckenzie: DUEL_HEALTH.  hmm.
01572         int                             duelist1health;
01573         int                             duelist2health;
01574         int                             duelist3health;
01575 
01576         int                             redflag, blueflag;              // flag status from configstrings
01577         int                             flagStatus;
01578 
01579         qboolean  newHud;
01580 
01581         //
01582         // locally derived information from gamestate
01583         //
01584         qhandle_t               gameModels[MAX_MODELS];
01585         sfxHandle_t             gameSounds[MAX_SOUNDS];
01586         fxHandle_t              gameEffects[MAX_FX];
01587         qhandle_t               gameIcons[MAX_ICONS];
01588 
01589         int                             numInlineModels;
01590         qhandle_t               inlineDrawModel[MAX_MODELS];
01591         vec3_t                  inlineModelMidpoints[MAX_MODELS];
01592 
01593         clientInfo_t    clientinfo[MAX_CLIENTS];
01594 
01595         int cursorX;
01596         int cursorY;
01597         qboolean eventHandling;
01598         qboolean mouseCaptured;
01599         qboolean sizingHud;
01600         void *capturedItem;
01601         qhandle_t activeCursor;
01602 
01603         // media
01604         cgMedia_t               media;
01605 
01606         // effects
01607         cgEffects_t             effects;
01608 
01609 } cgs_t;
01610 
01611 typedef struct siegeExtended_s
01612 {
01613         int                     health;
01614         int                     maxhealth;
01615         int                     ammo;
01616         int                     weapon;
01617         int                     lastUpdated;
01618 } siegeExtended_t;
01619 
01620 //keep an entry available for each client
01621 extern siegeExtended_t cg_siegeExtendedData[MAX_CLIENTS];
01622 
01623 //==============================================================================
01624 
01625 extern  cgs_t                   cgs;
01626 extern  cg_t                    cg;
01627 extern  centity_t               cg_entities[MAX_GENTITIES];
01628 
01629 extern  centity_t               *cg_permanents[MAX_GENTITIES];
01630 extern  int                             cg_numpermanents;
01631 
01632 extern  weaponInfo_t    cg_weapons[MAX_WEAPONS];
01633 extern  itemInfo_t              cg_items[MAX_ITEMS];
01634 extern  markPoly_t              cg_markPolys[MAX_MARK_POLYS];
01635 
01636 extern  vmCvar_t                cg_centertime;
01637 extern  vmCvar_t                cg_runpitch;
01638 extern  vmCvar_t                cg_runroll;
01639 extern  vmCvar_t                cg_bobup;
01640 extern  vmCvar_t                cg_bobpitch;
01641 extern  vmCvar_t                cg_bobroll;
01642 //extern        vmCvar_t                cg_swingSpeed;
01643 extern  vmCvar_t                cg_shadows;
01644 extern  vmCvar_t                cg_renderToTextureFX;
01645 extern  vmCvar_t                cg_drawTimer;
01646 extern  vmCvar_t                cg_drawFPS;
01647 extern  vmCvar_t                cg_drawSnapshot;
01648 extern  vmCvar_t                cg_draw3dIcons;
01649 extern  vmCvar_t                cg_drawIcons;
01650 extern  vmCvar_t                cg_drawAmmoWarning;
01651 extern  vmCvar_t                cg_drawCrosshair;
01652 extern  vmCvar_t                cg_drawCrosshairNames;
01653 extern  vmCvar_t                cg_drawRadar;
01654 extern  vmCvar_t                cg_drawVehLeadIndicator;
01655 extern  vmCvar_t                cg_drawAutomap;
01656 extern  vmCvar_t                cg_drawScores;
01657 extern  vmCvar_t                cg_dynamicCrosshair;
01658 extern  vmCvar_t                cg_dynamicCrosshairPrecision;
01659 extern  vmCvar_t                cg_drawRewards;
01660 extern  vmCvar_t                cg_drawTeamOverlay;
01661 extern  vmCvar_t                cg_teamOverlayUserinfo;
01662 extern  vmCvar_t                cg_crosshairX;
01663 extern  vmCvar_t                cg_crosshairY;
01664 extern  vmCvar_t                cg_crosshairSize;
01665 extern  vmCvar_t                cg_crosshairHealth;
01666 extern  vmCvar_t                cg_drawStatus;
01667 extern  vmCvar_t                cg_draw2D;
01668 extern  vmCvar_t                cg_animSpeed;
01669 extern  vmCvar_t                cg_debugAnim;
01670 extern  vmCvar_t                cg_debugPosition;
01671 extern  vmCvar_t                cg_debugEvents;
01672 extern  vmCvar_t                cg_errorDecay;
01673 extern  vmCvar_t                cg_nopredict;
01674 extern  vmCvar_t                cg_noPlayerAnims;
01675 extern  vmCvar_t                cg_showmiss;
01676 extern  vmCvar_t                cg_showVehMiss;
01677 extern  vmCvar_t                cg_footsteps;
01678 extern  vmCvar_t                cg_addMarks;
01679 extern  vmCvar_t                cg_gun_frame;
01680 extern  vmCvar_t                cg_gun_x;
01681 extern  vmCvar_t                cg_gun_y;
01682 extern  vmCvar_t                cg_gun_z;
01683 extern  vmCvar_t                cg_drawGun;
01684 extern  vmCvar_t                cg_viewsize;
01685 extern  vmCvar_t                cg_autoswitch;
01686 extern  vmCvar_t                cg_ignore;
01687 extern  vmCvar_t                cg_simpleItems;
01688 extern  vmCvar_t                cg_fov;
01689 extern  vmCvar_t                cg_zoomFov;
01690 
01691 extern  vmCvar_t                cg_swingAngles;
01692 
01693 extern  vmCvar_t                cg_oldPainSounds;
01694 
01695 extern  vmCvar_t                cg_ragDoll;
01696 
01697 extern  vmCvar_t                cg_jumpSounds;
01698 
01699 extern  vmCvar_t                cg_autoMap;
01700 extern  vmCvar_t                cg_autoMapX;
01701 extern  vmCvar_t                cg_autoMapY;
01702 extern  vmCvar_t                cg_autoMapW;
01703 extern  vmCvar_t                cg_autoMapH;
01704 
01705 extern  vmCvar_t                bg_fighterAltControl;
01706 
01707 extern  vmCvar_t                cg_chatBox;
01708 extern  vmCvar_t                cg_chatBoxHeight;
01709 
01710 extern  vmCvar_t                cg_saberModelTraceEffect;
01711 
01712 extern  vmCvar_t                cg_saberClientVisualCompensation;
01713 
01714 extern  vmCvar_t                cg_g2TraceLod;
01715 
01716 extern  vmCvar_t                cg_fpls;
01717 
01718 extern  vmCvar_t                cg_ghoul2Marks;
01719 
01720 extern  vmCvar_t                cg_optvehtrace;
01721 
01722 extern  vmCvar_t                cg_saberDynamicMarks;
01723 extern  vmCvar_t                cg_saberDynamicMarkTime;
01724 
01725 extern  vmCvar_t                cg_saberContact;
01726 extern  vmCvar_t                cg_saberTrail;
01727 
01728 extern  vmCvar_t                cg_duelHeadAngles;
01729 
01730 extern  vmCvar_t                cg_speedTrail;
01731 extern  vmCvar_t                cg_auraShell;
01732 
01733 extern  vmCvar_t                cg_repeaterOrb;
01734 
01735 extern  vmCvar_t                cg_animBlend;
01736 
01737 extern  vmCvar_t                cg_dismember;
01738 
01739 extern  vmCvar_t                cg_thirdPersonSpecialCam;
01740 
01741 extern  vmCvar_t                cg_thirdPerson;
01742 extern  vmCvar_t                cg_thirdPersonRange;
01743 extern  vmCvar_t                cg_thirdPersonAngle;
01744 extern  vmCvar_t                cg_thirdPersonPitchOffset;
01745 extern  vmCvar_t                cg_thirdPersonVertOffset;
01746 extern  vmCvar_t                cg_thirdPersonCameraDamp;
01747 extern  vmCvar_t                cg_thirdPersonTargetDamp;
01748 
01749 extern  vmCvar_t                cg_thirdPersonAlpha;
01750 extern  vmCvar_t                cg_thirdPersonHorzOffset;
01751 
01752 extern  vmCvar_t                cg_stereoSeparation;
01753 extern  vmCvar_t                cg_lagometer;
01754 extern  vmCvar_t                cg_drawEnemyInfo;
01755 extern  vmCvar_t                cg_synchronousClients;
01756 extern  vmCvar_t                cg_stats;
01757 extern  vmCvar_t                cg_forceModel;
01758 extern  vmCvar_t                cg_buildScript;
01759 extern  vmCvar_t                cg_paused;
01760 extern  vmCvar_t                cg_blood;
01761 extern  vmCvar_t                cg_predictItems;
01762 extern  vmCvar_t                cg_deferPlayers;
01763 extern  vmCvar_t                cg_drawFriend;
01764 extern  vmCvar_t                cg_teamChatsOnly;
01765 extern  vmCvar_t                cg_noVoiceChats;
01766 extern  vmCvar_t                cg_noVoiceText;
01767 extern  vmCvar_t                cg_scorePlum;
01768 extern  vmCvar_t                cg_hudFiles;
01769 extern  vmCvar_t                cg_smoothClients;
01770 
01771 #include "../namespace_begin.h"
01772 extern  vmCvar_t                pmove_fixed;
01773 extern  vmCvar_t                pmove_msec;
01774 #include "../namespace_end.h"
01775 
01776 //extern        vmCvar_t                cg_pmove_fixed;
01777 extern  vmCvar_t                cg_cameraOrbit;
01778 extern  vmCvar_t                cg_cameraOrbitDelay;
01779 extern  vmCvar_t                cg_timescaleFadeEnd;
01780 extern  vmCvar_t                cg_timescaleFadeSpeed;
01781 extern  vmCvar_t                cg_timescale;
01782 extern  vmCvar_t                cg_cameraMode;
01783 extern  vmCvar_t                cg_smallFont;
01784 extern  vmCvar_t                cg_bigFont;
01785 extern  vmCvar_t                cg_noTaunt;
01786 extern  vmCvar_t                cg_noProjectileTrail;
01787 //extern        vmCvar_t                cg_trueLightning;
01788 
01789 //extern        vmCvar_t                cg_redTeamName;
01790 //extern        vmCvar_t                cg_blueTeamName;
01791 extern  vmCvar_t                cg_currentSelectedPlayer;
01792 extern  vmCvar_t                cg_currentSelectedPlayerName;
01793 //extern        vmCvar_t                cg_singlePlayerActive;
01794 extern  vmCvar_t                cg_recordSPDemo;
01795 extern  vmCvar_t                cg_recordSPDemoName;
01796 
01797 extern  vmCvar_t                ui_myteam;
01798 extern  vmCvar_t                cg_snapshotTimeout;
01799 /*
01800 Ghoul2 Insert Start
01801 */
01802 
01803 extern  vmCvar_t                cg_debugBB;
01804 
01805 /*
01806 Ghoul2 Insert End
01807 */
01808 
01809 //
01810 // cg_main.c
01811 //
01812 void CG_DrawMiscEnts(void);
01813 
01814 const char *CG_ConfigString( int index );
01815 const char *CG_Argv( int arg );
01816 
01817 void QDECL CG_Printf( const char *msg, ... );
01818 void QDECL CG_Error( const char *msg, ... );
01819 
01820 void CG_StartMusic( qboolean bForceStart );
01821 
01822 void CG_UpdateCvars( void );
01823 
01824 int CG_CrosshairPlayer( void );
01825 int CG_LastAttacker( void );
01826 void CG_LoadMenus(const char *menuFile);
01827 void CG_KeyEvent(int key, qboolean down);
01828 void CG_MouseEvent(int x, int y);
01829 void CG_EventHandling(int type);
01830 void CG_RankRunFrame( void );
01831 void CG_SetScoreSelection(void *menu);
01832 void CG_BuildSpectatorString(void);
01833 void CG_NextInventory_f(void);
01834 void CG_PrevInventory_f(void);
01835 void CG_NextForcePower_f(void);
01836 void CG_PrevForcePower_f(void);
01837 
01838 //
01839 // cg_view.c
01840 //
01841 void CG_TestModel_f (void);
01842 void CG_TestGun_f (void);
01843 void CG_TestModelNextFrame_f (void);
01844 void CG_TestModelPrevFrame_f (void);
01845 void CG_TestModelNextSkin_f (void);
01846 void CG_TestModelPrevSkin_f (void);
01847 void CG_ZoomDown_f( void );
01848 void CG_ZoomUp_f( void );
01849 void CG_AddBufferedSound( sfxHandle_t sfx);
01850 
01851 void CG_DrawActiveFrame( int serverTime, stereoFrame_t stereoView, qboolean demoPlayback );
01852 /*
01853 Ghoul2 Insert Start
01854 */
01855 
01856 void CG_TestG2Model_f (void);
01857 void CG_TestModelSurfaceOnOff_f(void);
01858 void CG_ListModelSurfaces_f (void);
01859 void CG_ListModelBones_f (void);
01860 void CG_TestModelSetAnglespre_f(void);
01861 void CG_TestModelSetAnglespost_f(void);
01862 void CG_TestModelAnimate_f(void);
01863 /*
01864 Ghoul2 Insert End
01865 */
01866 
01867 //
01868 // cg_drawtools.c
01869 //
01870 void CG_FillRect( float x, float y, float width, float height, const float *color );
01871 void CG_DrawPic( float x, float y, float width, float height, qhandle_t hShader );
01872 void CG_DrawRotatePic( float x, float y, float width, float height,float angle, qhandle_t hShader );
01873 void CG_DrawRotatePic2( float x, float y, float width, float height,float angle, qhandle_t hShader );
01874 void CG_DrawString( float x, float y, const char *string, 
01875                                    float charWidth, float charHeight, const float *modulate );
01876 
01877 void CG_DrawNumField (int x, int y, int width, int value,int charWidth,int charHeight,int style,qboolean zeroFill);
01878 
01879 void CG_DrawStringExt( int x, int y, const char *string, const float *setColor, 
01880                 qboolean forceColor, qboolean shadow, int charWidth, int charHeight, int maxChars );
01881 void CG_DrawBigString( int x, int y, const char *s, float alpha );
01882 void CG_DrawBigStringColor( int x, int y, const char *s, vec4_t color );
01883 void CG_DrawSmallString( int x, int y, const char *s, float alpha );
01884 void CG_DrawSmallStringColor( int x, int y, const char *s, vec4_t color );
01885 
01886 int CG_DrawStrlen( const char *str );
01887 
01888 float   *CG_FadeColor( int startMsec, int totalMsec );
01889 float *CG_TeamColor( int team );
01890 void CG_TileClear( void );
01891 void CG_ColorForHealth( vec4_t hcolor );
01892 void CG_GetColorForHealth( int health, int armor, vec4_t hcolor );
01893 
01894 void UI_DrawProportionalString( int x, int y, const char* str, int style, vec4_t color );
01895 void UI_DrawScaledProportionalString( int x, int y, const char* str, int style, vec4_t color, float scale);
01896 void CG_DrawRect( float x, float y, float width, float height, float size, const float *color );
01897 void CG_DrawSides(float x, float y, float w, float h, float size);
01898 void CG_DrawTopBottom(float x, float y, float w, float h, float size);
01899 
01900 //
01901 // cg_draw.c, cg_newDraw.c
01902 //
01903 extern  int sortedTeamPlayers[TEAM_MAXOVERLAY];
01904 extern  int     numSortedTeamPlayers;
01905 extern  char systemChat[256];
01906 
01907 void CG_AddLagometerFrameInfo( void );
01908 void CG_AddLagometerSnapshotInfo( snapshot_t *snap );
01909 void CG_CenterPrint( const char *str, int y, int charWidth );
01910 void CG_DrawHead( float x, float y, float w, float h, int clientNum, vec3_t headAngles );
01911 void CG_DrawActive( stereoFrame_t stereoView );
01912 void CG_DrawFlagModel( float x, float y, float w, float h, int team, qboolean force2D );
01913 void CG_DrawTeamBackground( int x, int y, int w, int h, float alpha, int team );
01914 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);
01915 void CG_Text_Paint(float x, float y, float scale, vec4_t color, const char *text, float adjust, int limit, int style, int iMenuFont);
01916 int CG_Text_Width(const char *text, float scale, int iMenuFont);
01917 int CG_Text_Height(const char *text, float scale, int iMenuFont);
01918 float CG_GetValue(int ownerDraw);
01919 qboolean CG_OwnerDrawVisible(int flags);
01920 void CG_RunMenuScript(char **args);
01921 qboolean CG_DeferMenuScript(char **args);
01922 void CG_ShowResponseHead(void);
01923 void CG_GetTeamColor(vec4_t *color);
01924 const char *CG_GetGameStatusText(void);
01925 const char *CG_GetKillerText(void);
01926 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 );
01927 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);
01928 const char *CG_GameTypeString(void);
01929 qboolean CG_YourTeamHasFlag(void);
01930 qboolean CG_OtherTeamHasFlag(void);
01931 qhandle_t CG_StatusHandle(int task);
01932 
01933 
01934 
01935 //
01936 // cg_player.c
01937 //
01938 qboolean CG_RagDoll(centity_t *cent, vec3_t forcedAngles);
01939 qboolean CG_G2TraceCollide(trace_t *tr, const vec3_t mins, const vec3_t maxs, const vec3_t lastValidStart, const vec3_t lastValidEnd);
01940 void CG_AddGhoul2Mark(int shader, float size, vec3_t start, vec3_t end, int entnum,
01941                                           vec3_t entposition, float entangle, void *ghoul2, vec3_t scale, int lifeTime);
01942 
01943 void CG_CreateNPCClient(clientInfo_t **ci);
01944 void CG_DestroyNPCClient(clientInfo_t **ci);
01945 
01946 void CG_Player( centity_t *cent );
01947 void CG_ResetPlayerEntity( centity_t *cent );
01948 void CG_AddRefEntityWithPowerups( refEntity_t *ent, entityState_t *state, int team );
01949 void CG_NewClientInfo( int clientNum, qboolean entitiesInitialized );
01950 sfxHandle_t     CG_CustomSound( int clientNum, const char *soundName );
01951 void CG_PlayerShieldHit(int entitynum, vec3_t angles, int amount);
01952 
01953 
01954 //
01955 // cg_predict.c
01956 //
01957 void CG_BuildSolidList( void );
01958 int     CG_PointContents( const vec3_t point, int passEntityNum );
01959 void CG_Trace( trace_t *result, const vec3_t start, const vec3_t mins, const vec3_t maxs, const vec3_t end, 
01960                                          int skipNumber, int mask );
01961 void CG_G2Trace( trace_t *result, const vec3_t start, const vec3_t mins, const vec3_t maxs, const vec3_t end, 
01962                                          int skipNumber, int mask );
01963 void CG_PredictPlayerState( void );
01964 void CG_LoadDeferredPlayers( void );
01965 
01966 
01967 //
01968 // cg_events.c
01969 //
01970 void CG_CheckEvents( centity_t *cent );
01971 const char      *CG_PlaceString( int rank );
01972 void CG_EntityEvent( centity_t *cent, vec3_t position );
01973 void CG_PainEvent( centity_t *cent, int health );
01974 void CG_ReattachLimb(centity_t *source);
01975 
01976 
01977 //
01978 // cg_ents.c
01979 //
01980 
01981 void CG_S_AddLoopingSound(int entityNum, const vec3_t origin, const vec3_t velocity, sfxHandle_t sfx);
01982 void CG_S_AddRealLoopingSound(int entityNum, const vec3_t origin, const vec3_t velocity, sfxHandle_t sfx);
01983 void CG_S_StopLoopingSound(int entityNum, sfxHandle_t sfx);
01984 void CG_S_UpdateLoopingSounds(int entityNum);
01985 
01986 void CG_SetEntitySoundPosition( centity_t *cent );
01987 void CG_AddPacketEntities( qboolean isPortal );
01988 void CG_ManualEntityRender(centity_t *cent);
01989 void CG_Beam( centity_t *cent );
01990 void CG_AdjustPositionForMover( const vec3_t in, int moverNum, int fromTime, int toTime, vec3_t out );
01991 
01992 void CG_PositionEntityOnTag( refEntity_t *entity, const refEntity_t *parent, 
01993                                                         qhandle_t parentModel, char *tagName );
01994 void CG_PositionRotatedEntityOnTag( refEntity_t *entity, const refEntity_t *parent, 
01995                                                         qhandle_t parentModel, char *tagName );
01996 
01997 /*
01998 Ghoul2 Insert Start
01999 */
02000 void ScaleModelAxis(refEntity_t *ent);
02001 /*
02002 Ghoul2 Insert End
02003 */
02004 
02005 //
02006 // cg_turret.c
02007 //
02008 void TurretClientRun(centity_t *ent);
02009 
02010 //
02011 // cg_weapons.c
02012 //
02013 void CG_GetClientWeaponMuzzleBoltPoint(int clIndex, vec3_t to);
02014 
02015 void CG_NextWeapon_f( void );
02016 void CG_PrevWeapon_f( void );
02017 void CG_Weapon_f( void );
02018 void CG_WeaponClean_f( void );
02019 
02020 void CG_RegisterWeapon( int weaponNum);
02021 void CG_RegisterItemVisuals( int itemNum );
02022 
02023 void CG_FireWeapon( centity_t *cent, qboolean alt_fire );
02024 void CG_MissileHitWall(int weapon, int clientNum, vec3_t origin, vec3_t dir, impactSound_t soundType, qboolean alt_fire, int charge);
02025 void CG_MissileHitPlayer( int weapon, vec3_t origin, vec3_t dir, int entityNum, qboolean alt_fire);
02026 
02027 void CG_AddViewWeapon (playerState_t *ps);
02028 void CG_AddPlayerWeapon( refEntity_t *parent, playerState_t *ps, centity_t *cent, int team, vec3_t newAngles, qboolean thirdPerson );
02029 void CG_DrawWeaponSelect( void );
02030 void CG_DrawIconBackground(void);
02031 
02032 void CG_OutOfAmmoChange( int oldWeapon );       // should this be in pmove?
02033 
02034 //
02035 // cg_marks.c
02036 //
02037 void    CG_InitMarkPolys( void );
02038 void    CG_AddMarks( void );
02039 void    CG_ImpactMark( qhandle_t markShader, 
02040                                     const vec3_t origin, const vec3_t dir, 
02041                                         float orientation, 
02042                                     float r, float g, float b, float a, 
02043                                         qboolean alphaFade, 
02044                                         float radius, qboolean temporary );
02045 
02046 //
02047 // cg_localents.c
02048 //
02049 void    CG_InitLocalEntities( void );
02050 localEntity_t   *CG_AllocLocalEntity( void );
02051 void    CG_AddLocalEntities( void );
02052 
02053 //
02054 // cg_effects.c
02055 //
02056 localEntity_t *CG_SmokePuff( const vec3_t p, 
02057                                    const vec3_t vel, 
02058                                    float radius,
02059                                    float r, float g, float b, float a,
02060                                    float duration,
02061                                    int startTime,
02062                                    int fadeInTime,
02063                                    int leFlags,
02064                                    qhandle_t hShader );
02065 void CG_BubbleTrail( vec3_t start, vec3_t end, float spacing );
02066 void CG_GlassShatter(int entnum, vec3_t dmgPt, vec3_t dmgDir, float dmgRadius, int maxShards);
02067 void CG_ScorePlum( int client, vec3_t org, int score );
02068 
02069 void CG_Chunks( int owner, vec3_t origin, const vec3_t normal, const vec3_t mins, const vec3_t maxs, 
02070                                                 float speed, int numChunks, material_t chunkType, int customChunk, float baseScale );
02071 void CG_MiscModelExplosion( vec3_t mins, vec3_t maxs, int size, material_t chunkType );
02072 
02073 void CG_Bleed( vec3_t origin, int entityNum );
02074 
02075 localEntity_t *CG_MakeExplosion( vec3_t origin, vec3_t dir, 
02076                                                                 qhandle_t hModel, int numframes, qhandle_t shader, int msec,
02077                                                                 qboolean isSprite, float scale, int flags );// Overloaded in single player
02078 
02079 void CG_SurfaceExplosion( vec3_t origin, vec3_t normal, float radius, float shake_speed, qboolean smoke );
02080 
02081 void CG_TestLine( vec3_t start, vec3_t end, int time, unsigned int color, int radius);
02082 
02083 void CG_InitGlass( void );
02084 
02085 //
02086 // cg_snapshot.c
02087 //
02088 void CG_ProcessSnapshots( void );
02089 
02090 //
02091 // cg_info.c
02092 //
02093 void CG_LoadingString( const char *s );
02094 void CG_LoadingItem( int itemNum );
02095 void CG_LoadingClient( int clientNum );
02096 void CG_DrawInformation( void );
02097 
02098 //
02099 // cg_scoreboard.c
02100 //
02101 qboolean CG_DrawOldScoreboard( void );
02102 void CG_DrawOldTourneyScoreboard( void );
02103 
02104 //
02105 // cg_consolecmds.c
02106 //
02107 qboolean CG_ConsoleCommand( void );
02108 void CG_InitConsoleCommands( void );
02109 
02110 //
02111 // cg_servercmds.c
02112 //
02113 void CG_ExecuteNewServerCommands( int latestSequence );
02114 void CG_ParseServerinfo( void );
02115 void CG_SetConfigValues( void );
02116 void CG_ShaderStateChanged(void);
02117 
02118 //
02119 // cg_playerstate.c
02120 //
02121 int CG_IsMindTricked(int trickIndex1, int trickIndex2, int trickIndex3, int trickIndex4, int client);
02122 void CG_Respawn( void );
02123 void CG_TransitionPlayerState( playerState_t *ps, playerState_t *ops );
02124 void CG_CheckChangedPredictableEvents( playerState_t *ps );
02125 
02126 
02127 //
02128 // cg_siege.c
02129 //
02130 void CG_InitSiegeMode(void);
02131 void CG_SiegeRoundOver(centity_t *ent, int won);
02132 void CG_SiegeObjectiveCompleted(centity_t *ent, int won, int objectivenum);
02133 
02134 
02135 
02136 //===============================================
02137 
02138 //
02139 // system traps
02140 // These functions are how the cgame communicates with the main game system
02141 //
02142 
02143 #include "../namespace_begin.h"
02144 
02145 // print message on the local console
02146 void            trap_Print( const char *fmt );
02147 
02148 // abort the game
02149 void            trap_Error( const char *fmt );
02150 
02151 // milliseconds should only be used for performance tuning, never
02152 // for anything game related.  Get time from the CG_DrawActiveFrame parameter
02153 int                     trap_Milliseconds( void );
02154 
02155 //rww - precision timer funcs... -ALWAYS- call end after start with supplied ptr, or you'll get a nasty memory leak.
02156 //not that you should be using these outside of debug anyway.. because you shouldn't be. So don't.
02157 void            trap_PrecisionTimer_Start(void **theNewTimer);
02158 int                     trap_PrecisionTimer_End(void *theTimer);
02159 
02160 // console variable interaction
02161 void            trap_Cvar_Register( vmCvar_t *vmCvar, const char *varName, const char *defaultValue, int flags );
02162 void            trap_Cvar_Update( vmCvar_t *vmCvar );
02163 void            trap_Cvar_Set( const char *var_name, const char *value );
02164 void            trap_Cvar_VariableStringBuffer( const char *var_name, char *buffer, int bufsize );
02165 int                     trap_Cvar_GetHiddenVarValue(const char *name);
02166 
02167 // ServerCommand and ConsoleCommand parameter access
02168 int                     trap_Argc( void );
02169 void            trap_Argv( int n, char *buffer, int bufferLength );
02170 void            trap_Args( char *buffer, int bufferLength );
02171 
02172 // filesystem access
02173 // returns length of file
02174 int                     trap_FS_FOpenFile( const char *qpath, fileHandle_t *f, fsMode_t mode );
02175 void            trap_FS_Read( void *buffer, int len, fileHandle_t f );
02176 void            trap_FS_Write( const void *buffer, int len, fileHandle_t f );
02177 void            trap_FS_FCloseFile( fileHandle_t f );
02178 int                     trap_FS_GetFileList(  const char *path, const char *extension, char *listbuf, int bufsize );
02179 
02180 // add commands to the local console as if they were typed in
02181 // for map changing, etc.  The command is not executed immediately,
02182 // but will be executed in order the next time console commands
02183 // are processed
02184 void            trap_SendConsoleCommand( const char *text );
02185 
02186 // register a command name so the console can perform command completion.
02187 // FIXME: replace this with a normal console command "defineCommand"?
02188 void            trap_AddCommand( const char *cmdName );
02189 
02190 // send a string to the server over the network
02191 void            trap_SendClientCommand( const char *s );
02192 
02193 // force a screen update, only used during gamestate load
02194 void            trap_UpdateScreen( void );
02195 
02196 // model collision
02197 void            trap_CM_LoadMap( const char *mapname, qboolean SubBSP );
02198 int                     trap_CM_NumInlineModels( void );
02199 clipHandle_t trap_CM_InlineModel( int index );          // 0 = world, 1+ = bmodels
02200 clipHandle_t trap_CM_TempBoxModel( const vec3_t mins, const vec3_t maxs );
02201 int                     trap_CM_PointContents( const vec3_t p, clipHandle_t model );
02202 int                     trap_CM_TransformedPointContents( const vec3_t p, clipHandle_t model, const vec3_t origin, const vec3_t angles );
02203 void            trap_CM_BoxTrace( trace_t *results, const vec3_t start, const vec3_t end,
02204                                           const vec3_t mins, const vec3_t maxs,
02205                                           clipHandle_t model, int brushmask );
02206 void            trap_CM_TransformedBoxTrace( trace_t *results, const vec3_t start, const vec3_t end,
02207                                           const vec3_t mins, const vec3_t maxs,
02208                                           clipHandle_t model, int brushmask,
02209                                           const vec3_t origin, const vec3_t angles );
02210 
02211 // Returns the projection of a polygon onto the solid brushes in the world
02212 int                     trap_CM_MarkFragments( int numPoints, const vec3_t *points, 
02213                         const vec3_t projection,
02214                         int maxPoints, vec3_t pointBuffer,
02215                         int maxFragments, markFragment_t *fragmentBuffer );
02216 
02217 // normal sounds will have their volume dynamically changed as their entity
02218 // moves and the listener moves
02219 int                     trap_S_GetVoiceVolume( int entityNum );
02220 void            trap_S_MuteSound( int entityNum, int entchannel );
02221 void            trap_S_StartSound( vec3_t origin, int entityNum, int entchannel, sfxHandle_t sfx );
02222 void            trap_S_StopLoopingSound(int entnum);
02223 
02224 // a local sound is always played full volume
02225 void            trap_S_StartLocalSound( sfxHandle_t sfx, int channelNum );
02226 void            trap_S_ClearLoopingSounds( void );
02227 void            trap_S_AddLoopingSound( int entityNum, const vec3_t origin, const vec3_t velocity, sfxHandle_t sfx );
02228 void            trap_S_AddRealLoopingSound( int entityNum, const vec3_t origin, const vec3_t velocity, sfxHandle_t sfx );
02229 void            trap_S_UpdateEntityPosition( int entityNum, const vec3_t origin );
02230 
02231 // repatialize recalculates the volumes of sound as they should be heard by the
02232 // given entityNum and position
02233 void            trap_S_Respatialize( int entityNum, const vec3_t origin, vec3_t axis[3], int inwater );
02234 void            trap_S_ShutUp(qboolean shutUpFactor);
02235 sfxHandle_t     trap_S_RegisterSound( const char *sample);              // returns buzz if not found
02236 void            trap_S_StartBackgroundTrack( const char *intro, const char *loop, qboolean bReturnWithoutStarting);     // empty name stops music
02237 void    trap_S_StopBackgroundTrack( void );
02238 
02239 void            trap_S_UpdateAmbientSet( const char *name, vec3_t origin );
02240 void            trap_AS_ParseSets( void );
02241 void            trap_AS_AddPrecacheEntry( const char *name );
02242 int                     trap_S_AddLocalSet( const char *name, vec3_t listener_origin, vec3_t origin, int entID, int time );
02243 sfxHandle_t     trap_AS_GetBModelSound( const char *name, int stage );
02244 
02245 void            trap_R_LoadWorldMap( const char *mapname );
02246 
02247 // all media should be registered during level startup to prevent
02248 // hitches during gameplay
02249 qhandle_t       trap_R_RegisterModel( const char *name );                       // returns rgb axis if not found
02250 qhandle_t       trap_R_RegisterSkin( const char *name );                        // returns all white if not found
02251 qhandle_t       trap_R_RegisterShader( const char *name );                      // returns all white if not found
02252 qhandle_t       trap_R_RegisterShaderNoMip( const char *name );                 // returns all white if not found
02253 qhandle_t       trap_R_RegisterFont( const char *name );
02254 int                     trap_R_Font_StrLenPixels(const char *text, const int iFontIndex, const float scale);
02255 int                     trap_R_Font_StrLenChars(const char *text);
02256 int                     trap_R_Font_HeightPixels(const int iFontIndex, const float scale);
02257 void            trap_R_Font_DrawString(int ox, int oy, const char *text, const float *rgba, const int setIndex, int iCharLimit, const float scale);
02258 qboolean        trap_Language_IsAsian(void);
02259 qboolean        trap_Language_UsesSpaces(void);
02260 unsigned        trap_AnyLanguage_ReadCharFromString( const char *psText, int *piAdvanceCount, qboolean *pbIsTrailingPunctuation/* = NULL*/ );
02261 
02262 
02263 // a scene is built up by calls to R_ClearScene and the various R_Add functions.
02264 // Nothing is drawn until R_RenderScene is called.
02265 void            trap_R_ClearScene( void );
02266 void            trap_R_ClearDecals ( void );
02267 void            trap_R_AddRefEntityToScene( const refEntity_t *re );
02268 
02269 // polys are intended for simple wall marks, not really for doing
02270 // significant construction
02271 void            trap_R_AddPolyToScene( qhandle_t hShader , int numVerts, const polyVert_t *verts );
02272 void            trap_R_AddPolysToScene( qhandle_t hShader , int numVerts, const polyVert_t *verts, int numPolys );
02273 void            trap_R_AddDecalToScene ( qhandle_t shader, const vec3_t origin, const vec3_t dir, float orientation, float r, float g, float b, float a, qboolean alphaFade, float radius, qboolean temporary );
02274 void            trap_R_AddLightToScene( const vec3_t org, float intensity, float r, float g, float b );
02275 int                     trap_R_LightForPoint( vec3_t point, vec3_t ambientLight, vec3_t directedLight, vec3_t lightDir );
02276 void            trap_R_RenderScene( const refdef_t *fd );
02277 void            trap_R_SetColor( const float *rgba );   // NULL = 1,1,1,1
02278 void            trap_R_DrawStretchPic( float x, float y, float w, float h, 
02279                         float s1, float t1, float s2, float t2, qhandle_t hShader );
02280 void            trap_R_ModelBounds( clipHandle_t model, vec3_t mins, vec3_t maxs );
02281 int                     trap_R_LerpTag( orientation_t *tag, clipHandle_t mod, int startFrame, int endFrame, 
02282                                            float frac, const char *tagName );
02283 // Does weird, barely controllable rotation behaviour
02284 void    trap_R_DrawRotatePic( float x, float y, float w, float h, 
02285                         float s1, float t1, float s2, float t2,float a, qhandle_t hShader );
02286 // rotates image around exact center point of passed in coords
02287 void    trap_R_DrawRotatePic2( float x, float y, float w, float h, 
02288                         float s1, float t1, float s2, float t2,float a, qhandle_t hShader );
02289 
02290 void            trap_R_SetRangeFog(float range);
02291 
02292 void            trap_R_SetRefractProp(float alpha, float stretch, qboolean prepost, qboolean negate);
02293 
02294 void            trap_R_RemapShader( const char *oldShader, const char *newShader, const char *timeOffset );
02295 
02296 void            trap_R_GetLightStyle(int style, color4ub_t color);
02297 void            trap_R_SetLightStyle(int style, int color);
02298 
02299 void            trap_R_GetBModelVerts(int bmodelIndex, vec3_t *verts, vec3_t normal );
02300 
02301 void            trap_R_GetDistanceCull(float *f);
02302 
02303 void            trap_R_GetRealRes(int *w, int *h); //get screen resolution -rww
02304 void            trap_R_AutomapElevAdj(float newHeight); //automap elevation setting -rww
02305 qboolean        trap_R_InitWireframeAutomap(void); //initialize automap -rww
02306 
02307 
02308 void    trap_FX_AddLine( const vec3_t start, const vec3_t end, float size1, float size2, float sizeParm,
02309                                                                         float alpha1, float alpha2, float alphaParm,
02310                                                                         const vec3_t sRGB, const vec3_t eRGB, float rgbParm,
02311                                                                         int killTime, qhandle_t shader, int flags);
02312 
02313 // The glconfig_t will not change during the life of a cgame.
02314 // If it needs to change, the entire cgame will be restarted, because
02315 // all the qhandle_t are then invalid.
02316 void            trap_GetGlconfig( glconfig_t *glconfig );
02317 
02318 // the gamestate should be grabbed at startup, and whenever a
02319 // configstring changes
02320 void            trap_GetGameState( gameState_t *gamestate );
02321 
02322 // cgame will poll each frame to see if a newer snapshot has arrived
02323 // that it is interested in.  The time is returned seperately so that
02324 // snapshot latency can be calculated.
02325 void            trap_GetCurrentSnapshotNumber( int *snapshotNumber, int *serverTime );
02326 
02327 // a snapshot get can fail if the snapshot (or the entties it holds) is so
02328 // old that it has fallen out of the client system queue
02329 qboolean        trap_GetSnapshot( int snapshotNumber, snapshot_t *snapshot );
02330 
02331 
02332 qboolean        trap_GetDefaultState(int entityIndex, entityState_t *state );
02333 
02334 // retrieve a text command from the server stream
02335 // the current snapshot will hold the number of the most recent command
02336 // qfalse can be returned if the client system handled the command
02337 // argc() / argv() can be used to examine the parameters of the command
02338 qboolean        trap_GetServerCommand( int serverCommandNumber );
02339 
02340 // returns the most recent command number that can be passed to GetUserCmd
02341 // this will always be at least one higher than the number in the current
02342 // snapshot, and it may be quite a few higher if it is a fast computer on
02343 // a lagged connection
02344 int                     trap_GetCurrentCmdNumber( void );       
02345 
02346 qboolean        trap_GetUserCmd( int cmdNumber, usercmd_t *ucmd );
02347 
02348 // used for the weapon select and zoom
02349 void            trap_SetUserCmdValue( int stateValue, float sensitivityScale, float mPitchOverride, float mYawOverride, float mSensitivityOverride, int fpSel, int invenSel, qboolean fighterControls );
02350 
02351 void            trap_SetClientForceAngle(int time, vec3_t angle);
02352 void            trap_SetClientTurnExtent(float turnAdd, float turnSub, int turnTime);
02353 
02354 void trap_OpenUIMenu(int menuID);
02355 
02356 // aids for VM testing
02357 void            testPrintInt( char *string, int i );
02358 void            testPrintFloat( char *string, float f );
02359 
02360 int                     trap_MemoryRemaining( void );
02361 qboolean        trap_Key_IsDown( int keynum );
02362 int                     trap_Key_GetCatcher( void );
02363 void            trap_Key_SetCatcher( int catcher );
02364 int                     trap_Key_GetKey( const char *binding );
02365 
02366 void            BG_CycleInven(playerState_t *ps, int direction);
02367 int                     BG_ProperForceIndex(int power);
02368 void            BG_CycleForce(playerState_t *ps, int direction);
02369 
02370 #include "../namespace_end.h"
02371 
02372 
02373 typedef enum {
02374   SYSTEM_PRINT,
02375   CHAT_PRINT,
02376   TEAMCHAT_PRINT
02377 } q3print_t; // bk001201 - warning: useless keyword or type name in empty declaration
02378 
02379 #include "../namespace_begin.h"
02380 
02381 int trap_CIN_PlayCinematic( const char *arg0, int xpos, int ypos, int width, int height, int bits);
02382 e_status trap_CIN_StopCinematic(int handle);
02383 e_status trap_CIN_RunCinematic (int handle);
02384 void trap_CIN_DrawCinematic (int handle);
02385 void trap_CIN_SetExtents (int handle, int x, int y, int w, int h);
02386 
02387 void trap_SnapVector( float *v );
02388 
02389 qboolean        trap_loadCamera(const char *name);
02390 void            trap_startCamera(int time);
02391 qboolean        trap_getCameraInfo(int time, vec3_t *origin, vec3_t *angles);
02392 
02393 qboolean        trap_GetEntityToken( char *buffer, int bufferSize );
02394 qboolean        trap_R_inPVS( const vec3_t p1, const vec3_t p2, byte *mask );
02395 
02396 int                     trap_FX_InitSystem                      ( refdef_t* );
02397 void            trap_FX_SetRefDef                       ( refdef_t* refdef );
02398 int                     trap_FX_RegisterEffect          ( const char *file);
02399 void            trap_FX_PlayEffect                      ( const char *file, vec3_t org, vec3_t fwd, int vol, int rad );         // builds arbitrary perp. right vector, does a cross product to define up
02400 void            trap_FX_PlayEntityEffect        ( const char *file, vec3_t org, vec3_t axis[3], const int boltInfo, const int entNum, int vol, int rad );
02401 void            trap_FX_PlayEffectID            ( int id, vec3_t org, vec3_t fwd, int vol, int rad );           // builds arbitrary perp. right vector, does a cross product to define up
02402 void            trap_FX_PlayPortalEffectID      ( int id, vec3_t org, vec3_t fwd, int vol, int rad );           // builds arbitrary perp. right vector, does a cross product to define up
02403 void            trap_FX_PlayEntityEffectID      ( int id, vec3_t org, vec3_t axis[3], const int boltInfo, const int pGhoul2, int vol, int rad );
02404 void            trap_FX_PlayBoltedEffectID      ( int id, vec3_t org, void *pGhoul2, const int boltNum, const int entNum, const int modelNum, int iLooptime, qboolean isRelative );
02405 void            trap_FX_AddScheduledEffects     ( qboolean skyPortal );
02406 void            trap_FX_Draw2DEffects           ( float screenXScale, float screenYScale );
02407 qboolean        trap_FX_FreeSystem                      ( void );
02408 void            trap_FX_AdjustTime                      ( int time );
02409 void            trap_FX_Reset                           ( void );
02410 
02411 //rww - additional funcs for adding custom incode stuff
02412 void trap_FX_AddPoly( addpolyArgStruct_t *p );
02413 void trap_FX_AddBezier( addbezierArgStruct_t *p );
02414 void trap_FX_AddPrimitive( effectTrailArgStruct_t *p );
02415 void trap_FX_AddSprite( addspriteArgStruct_t *p );
02416 void trap_FX_AddElectricity( addElectricityArgStruct_t *p );
02417 
02418 //void trap_SP_Print(const unsigned ID, byte *Data);
02419 int trap_SP_GetStringTextString(const char *text, char *buffer, int bufferLength);
02420 
02421 void            trap_CG_RegisterSharedMemory(char *memory);
02422 
02423 int                     trap_CM_RegisterTerrain(const char *config);
02424 void            trap_RMG_Init(int terrainID, const char *terrainInfo);
02425 void            trap_RE_InitRendererTerrain( const char *info );
02426 void            trap_R_WeatherContentsOverride( int contents );
02427 void            trap_R_WorldEffectCommand(const char *cmd);
02428 void            trap_WE_AddWeatherZone( const vec3_t mins, const vec3_t maxs );
02429 
02430 qboolean        trap_ROFF_Clean( void );
02431 void            trap_ROFF_UpdateEntities( void );
02432         int                     trap_ROFF_Cache( char *file );
02433 qboolean        trap_ROFF_Play( int entID, int roffID, qboolean doTranslation );
02434 qboolean        trap_ROFF_Purge_Ent( int entID );
02435 
02436 //rww - dynamic vm memory allocation!
02437 void    trap_TrueMalloc(void **ptr, int size);
02438 void    trap_TrueFree(void **ptr);
02439 
02440 #include "../namespace_end.h"
02441 
02442 void    CG_ClearParticles (void);
02443 void    CG_AddParticles (void);
02444 void    CG_ParticleSnow (qhandle_t pshader, vec3_t origin, vec3_t origin2, int turb, float range, int snum);
02445 void    CG_ParticleSmoke (qhandle_t pshader, centity_t *cent);
02446 void    CG_AddParticleShrapnel (localEntity_t *le);
02447 void    CG_ParticleSnowFlurry (qhandle_t pshader, centity_t *cent);
02448 void    CG_ParticleBulletDebris (vec3_t org, vec3_t vel, int duration);
02449 void    CG_ParticleSparks (vec3_t org, vec3_t vel, int duration, float x, float y, float speed);
02450 void    CG_ParticleDust (centity_t *cent, vec3_t origin, vec3_t dir);
02451 void    CG_ParticleMisc (qhandle_t pshader, vec3_t origin, int size, int duration, float alpha);
02452 void    CG_ParticleExplosion (char *animStr, vec3_t origin, vec3_t vel, int duration, int sizeStart, int sizeEnd);
02453 const char *CG_GetStringEdString(char *refSection, char *refName);
02454 extern qboolean         initparticles;
02455 int CG_NewParticleArea ( int num );
02456 
02457 void FX_TurretProjectileThink(  centity_t *cent, const struct weaponInfo_s *weapon );
02458 void FX_TurretHitWall( vec3_t origin, vec3_t normal );
02459 void FX_TurretHitPlayer( vec3_t origin, vec3_t normal, qboolean humanoid );
02460 
02461 void FX_ConcussionHitWall( vec3_t origin, vec3_t normal );
02462 void FX_ConcussionHitPlayer( vec3_t origin, vec3_t normal, qboolean humanoid );
02463 void FX_ConcussionProjectileThink(  centity_t *cent, const struct weaponInfo_s *weapon );
02464 void FX_ConcAltShot( vec3_t start, vec3_t end );
02465 
02466 //-----------------------------
02467 // Effects related prototypes
02468 //-----------------------------
02469 
02470 // Environmental effects 
02471 void CG_Spark( vec3_t origin, vec3_t dir );
02472 
02473 // Weapon prototypes
02474 void FX_BryarHitWall( vec3_t origin, vec3_t normal );
02475 void FX_BryarAltHitWall( vec3_t origin, vec3_t normal, int power );
02476 void FX_BryarHitPlayer( vec3_t origin, vec3_t normal, qboolean humanoid );
02477 void FX_BryarAltHitPlayer( vec3_t origin, vec3_t normal, qboolean humanoid );
02478 
02479 void FX_BlasterProjectileThink( centity_t *cent, const struct weaponInfo_s *weapon );
02480 void FX_BlasterAltFireThink( centity_t *cent, const struct weaponInfo_s *weapon );
02481 void FX_BlasterWeaponHitWall( vec3_t origin, vec3_t normal );
02482 void FX_BlasterWeaponHitPlayer( vec3_t origin, vec3_t normal, qboolean humanoid );
02483 
02484 
02485 void FX_ForceDrained(vec3_t origin, vec3_t dir);
02486 
02487 
02488 //-----------------------------
02489 // Effects related prototypes
02490 //-----------------------------
02491 
02492 // Environmental effects 
02493 void CG_Spark( vec3_t origin, vec3_t dir );
02494 
02495 // Weapon prototypes
02496 void FX_BryarHitWall( vec3_t origin, vec3_t normal );
02497 void FX_BryarAltHitWall( vec3_t origin, vec3_t normal, int power );
02498 void FX_BryarHitPlayer( vec3_t origin, vec3_t normal, qboolean humanoid );
02499 void FX_BryarAltHitPlayer( vec3_t origin, vec3_t normal, qboolean humanoid );
02500 
02501 void FX_BlasterProjectileThink( centity_t *cent, const struct weaponInfo_s *weapon );
02502 void FX_BlasterAltFireThink( centity_t *cent, const struct weaponInfo_s *weapon );
02503 void FX_BlasterWeaponHitWall( vec3_t origin, vec3_t normal );
02504 void FX_BlasterWeaponHitPlayer( vec3_t origin, vec3_t normal, qboolean humanoid );
02505 
02506 #include "../namespace_begin.h"
02507 
02508 void            trap_G2API_CollisionDetect              ( CollisionRecord_t *collRecMap, void* ghoul2, const vec3_t angles, const vec3_t position,int frameNumber, int entNum, const vec3_t rayStart, const vec3_t rayEnd, const vec3_t scale, int traceFlags, int useLod, float fRadius );
02509 void            trap_G2API_CollisionDetectCache         ( CollisionRecord_t *collRecMap, void* ghoul2, const vec3_t angles, const vec3_t position,int frameNumber, int entNum, const vec3_t rayStart, const vec3_t rayEnd, const vec3_t scale, int traceFlags, int useLod, float fRadius );
02510 
02511 /*
02512 Ghoul2 Insert Start
02513 */
02514 // CG specific API access
02515 void            trap_G2_ListModelSurfaces(void *ghlInfo);
02516 void            trap_G2_ListModelBones(void *ghlInfo, int frame);
02517 void            trap_G2_SetGhoul2ModelIndexes(void *ghoul2, qhandle_t *modelList, qhandle_t *skinList);
02518 qboolean        trap_G2_HaveWeGhoul2Models(void *ghoul2);
02519 qboolean        trap_G2API_GetBoltMatrix(void *ghoul2, const int modelIndex, const int boltIndex, mdxaBone_t *matrix,
02520                                                                 const vec3_t angles, const vec3_t position, const int frameNum, qhandle_t *modelList, vec3_t scale);
02521 qboolean        trap_G2API_GetBoltMatrix_NoReconstruct(void *ghoul2, const int modelIndex, const int boltIndex, mdxaBone_t *matrix,
02522                                                                 const vec3_t angles, const vec3_t position, const int frameNum, qhandle_t *modelList, vec3_t scale);
02523 qboolean        trap_G2API_GetBoltMatrix_NoRecNoRot(void *ghoul2, const int modelIndex, const int boltIndex, mdxaBone_t *matrix,
02524                                                                 const vec3_t angles, const vec3_t position, const int frameNum, qhandle_t *modelList, vec3_t scale);
02525 int                     trap_G2API_InitGhoul2Model(void **ghoul2Ptr, const char *fileName, int modelIndex, qhandle_t customSkin,
02526                                                   qhandle_t customShader, int modelFlags, int lodBias);
02527 qboolean        trap_G2API_SetSkin(void *ghoul2, int modelIndex, qhandle_t customSkin, qhandle_t renderSkin);
02528 
02529 int                     trap_G2API_CopyGhoul2Instance(void *g2From, void *g2To, int modelIndex);
02530 void            trap_G2API_CopySpecificGhoul2Model(void *g2From, int modelFrom, void *g2To, int modelTo);
02531 void            trap_G2API_DuplicateGhoul2Instance(void *g2From, void **g2To);
02532 qboolean        trap_G2API_HasGhoul2ModelOnIndex(void *ghlInfo, int modelIndex);
02533 qboolean        trap_G2API_RemoveGhoul2Model(void *ghlInfo, int modelIndex);
02534 
02535 qboolean        trap_G2API_SkinlessModel(void *ghlInfo, int modelIndex);
02536 
02537 //rww - for adding gore (or whatever) shaders to the g2 model
02538 int                     trap_G2API_GetNumGoreMarks(void *ghlInfo, int modelIndex);
02539 void            trap_G2API_AddSkinGore(void *ghlInfo,SSkinGoreData *gore);
02540 void            trap_G2API_ClearSkinGore ( void* ghlInfo );
02541 
02542 int                     trap_G2API_Ghoul2Size ( void* ghlInfo );
02543 
02544 int                     trap_G2API_AddBolt(void *ghoul2, int modelIndex, const char *boneName);
02545 void            trap_G2API_SetBoltInfo(void *ghoul2, int modelIndex, int boltInfo);
02546 qboolean        trap_G2API_AttachEnt(int *boltInfo, void *ghlInfoTo, int toBoltIndex, int entNum, int toModelNum);
02547 
02548 void            trap_G2API_CleanGhoul2Models(void **ghoul2Ptr);
02549 qboolean        trap_G2API_SetBoneAngles(void *ghoul2, int modelIndex, const char *boneName, const vec3_t angles, const int flags,
02550                                                                 const int up, const int right, const int forward, qhandle_t *modelList,
02551                                                                 int blendTime , int currentTime );
02552 void            trap_G2API_GetGLAName(void *ghoul2, int modelIndex, char *fillBuf);
02553 qboolean        trap_G2API_SetBoneAnim(void *ghoul2, const int modelIndex, const char *boneName, const int startFrame, const int endFrame,
02554                                                           const int flags, const float animSpeed, const int currentTime, const float setFrame , const int blendTime );
02555 qboolean        trap_G2API_GetBoneAnim(void *ghoul2, const char *boneName, const int currentTime, float *currentFrame, int *startFrame,
02556                                                                 int *endFrame, int *flags, float *animSpeed, int *modelList, const int modelIndex);
02557 qboolean        trap_G2API_GetBoneFrame(void *ghoul2, const char *boneName, const int currentTime, float *currentFrame, int *modelList, const int modelIndex);
02558 
02559 qboolean        trap_G2API_SetRootSurface(void *ghoul2, const int modelIndex, const char *surfaceName);
02560 qboolean        trap_G2API_SetSurfaceOnOff(void *ghoul2, const char *surfaceName, const int flags);
02561 qboolean        trap_G2API_SetNewOrigin(void *ghoul2, const int boltIndex);
02562 qboolean        trap_G2API_DoesBoneExist(void *ghoul2, int modelIndex, const char *boneName);
02563 int                     trap_G2API_GetSurfaceRenderStatus(void *ghoul2, const int modelIndex, const char *surfaceName);
02564 
02565 int                     trap_G2API_GetTime(void);
02566 void            trap_G2API_SetTime(int time, int clock);
02567 
02568 void            trap_G2API_AbsurdSmoothing(void *ghoul2, qboolean status);
02569 
02570 void            trap_G2API_SetRagDoll(void *ghoul2, sharedRagDollParams_t *params);
02571 void            trap_G2API_AnimateG2Models(void *ghoul2, int time, sharedRagDollUpdateParams_t *params);
02572 
02573 //additional ragdoll options -rww
02574 qboolean        trap_G2API_RagPCJConstraint(void *ghoul2, const char *boneName, vec3_t min, vec3_t max); //override default pcj bonee constraints
02575 qboolean        trap_G2API_RagPCJGradientSpeed(void *ghoul2, const char *boneName, const float speed); //override the default gradient movespeed for a pcj bone
02576 qboolean        trap_G2API_RagEffectorGoal(void *ghoul2, const char *boneName, vec3_t pos); //override an effector bone's goal position (world coordinates)
02577 qboolean        trap_G2API_GetRagBonePos(void *ghoul2, const char *boneName, vec3_t pos, vec3_t entAngles, vec3_t entPos, vec3_t entScale); //current position of said bone is put into pos (world coordinates)
02578 qboolean        trap_G2API_RagEffectorKick(void *ghoul2, const char *boneName, vec3_t velocity); //add velocity to a rag bone
02579 qboolean        trap_G2API_RagForceSolve(void *ghoul2, qboolean force); //make sure we are actively performing solve/settle routines, if desired
02580 
02581 qboolean        trap_G2API_SetBoneIKState(void *ghoul2, int time, const char *boneName, int ikState, sharedSetBoneIKStateParams_t *params);
02582 qboolean        trap_G2API_IKMove(void *ghoul2, int time, sharedIKMoveParams_t *params);
02583 
02584 //for removing bones so they no longer have their own seperate animation hierarchy. Or whatever reason you may have. -rww
02585 qboolean        trap_G2API_RemoveBone(void *ghoul2, const char *boneName, int modelIndex);
02586 
02587 void            trap_G2API_AttachInstanceToEntNum(void *ghoul2, int entityNum, qboolean server);
02588 void            trap_G2API_ClearAttachedInstance(int entityNum);
02589 void            trap_G2API_CleanEntAttachments(void);
02590 qboolean        trap_G2API_OverrideServer(void *serverInstance);
02591 
02592 void            trap_G2API_GetSurfaceName(void *ghoul2, int surfNumber, int modelIndex, char *fillBuf);
02593 
02594 #include "../namespace_end.h"
02595 
02596 void            CG_Init_CG(void);
02597 void            CG_Init_CGents(void);
02598 
02599 
02600 void CG_SetGhoul2Info( refEntity_t *ent, centity_t *cent);
02601 void CG_CreateBBRefEnts(entityState_t *s1, vec3_t origin );
02602 
02603 void CG_InitG2Weapons(void);
02604 void CG_ShutDownG2Weapons(void);
02605 void CG_CopyG2WeaponInstance(centity_t *cent, int weaponNum, void *toGhoul2);
02606 void *CG_G2WeaponInstance(centity_t *cent, int weapon);
02607 void CG_CheckPlayerG2Weapons(playerState_t *ps, centity_t *cent);
02608 
02609 void CG_SetSiegeTimerCvar( int msec );
02610 
02611 /*
02612 Ghoul2 Insert End
02613 */