Main Page | Class Hierarchy | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

cg_local.h

Go to the documentation of this file.
00001 /*
00002 ===========================================================================
00003 Copyright (C) 1999-2005 Id Software, Inc.
00004 
00005 This file is part of Quake III Arena source code.
00006 
00007 Quake III Arena source code is free software; you can redistribute it
00008 and/or modify it under the terms of the GNU General Public License as
00009 published by the Free Software Foundation; either version 2 of the License,
00010 or (at your option) any later version.
00011 
00012 Quake III Arena source code is distributed in the hope that it will be
00013 useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015 GNU General Public License for more details.
00016 
00017 You should have received a copy of the GNU General Public License
00018 along with Foobar; if not, write to the Free Software
00019 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00020 ===========================================================================
00021 */
00022 //
00023 #include "../game/q_shared.h"
00024 #include "tr_types.h"
00025 #include "../game/bg_public.h"
00026 #include "cg_public.h"
00027 
00028 
00029 // The entire cgame module is unloaded and reloaded on each level change,
00030 // so there is NO persistant data between levels on the client side.
00031 // If you absolutely need something stored, it can either be kept
00032 // by the server in the server stored userinfos, or stashed in a cvar.
00033 
00034 #ifdef MISSIONPACK
00035 #define CG_FONT_THRESHOLD 0.1
00036 #endif
00037 
00038 #define POWERUP_BLINKS      5
00039 
00040 #define POWERUP_BLINK_TIME  1000
00041 #define FADE_TIME           200
00042 #define PULSE_TIME          200
00043 #define DAMAGE_DEFLECT_TIME 100
00044 #define DAMAGE_RETURN_TIME  400
00045 #define DAMAGE_TIME         500
00046 #define LAND_DEFLECT_TIME   150
00047 #define LAND_RETURN_TIME    300
00048 #define STEP_TIME           200
00049 #define DUCK_TIME           100
00050 #define PAIN_TWITCH_TIME    200
00051 #define WEAPON_SELECT_TIME  1400
00052 #define ITEM_SCALEUP_TIME   1000
00053 #define ZOOM_TIME           150
00054 #define ITEM_BLOB_TIME      200
00055 #define MUZZLE_FLASH_TIME   20
00056 #define SINK_TIME           1000        // time for fragments to sink into ground before going away
00057 #define ATTACKER_HEAD_TIME  10000
00058 #define REWARD_TIME         3000
00059 
00060 #define PULSE_SCALE         1.5         // amount to scale up the icons when activating
00061 
00062 #define MAX_STEP_CHANGE     32
00063 
00064 #define MAX_VERTS_ON_POLY   10
00065 #define MAX_MARK_POLYS      256
00066 
00067 #define STAT_MINUS          10  // num frame for '-' stats digit
00068 
00069 #define ICON_SIZE           48
00070 #define CHAR_WIDTH          32
00071 #define CHAR_HEIGHT         48
00072 #define TEXT_ICON_SPACE     4
00073 
00074 #define TEAMCHAT_WIDTH      80
00075 #define TEAMCHAT_HEIGHT     8
00076 
00077 // very large characters
00078 #define GIANT_WIDTH         32
00079 #define GIANT_HEIGHT        48
00080 
00081 #define NUM_CROSSHAIRS      10
00082 
00083 #define TEAM_OVERLAY_MAXNAME_WIDTH  12
00084 #define TEAM_OVERLAY_MAXLOCATION_WIDTH  16
00085 
00086 #define DEFAULT_MODEL           "sarge"
00087 #ifdef MISSIONPACK
00088 #define DEFAULT_TEAM_MODEL      "james"
00089 #define DEFAULT_TEAM_HEAD       "*james"
00090 #else
00091 #define DEFAULT_TEAM_MODEL      "sarge"
00092 #define DEFAULT_TEAM_HEAD       "sarge"
00093 #endif
00094 
00095 #define DEFAULT_REDTEAM_NAME        "Stroggs"
00096 #define DEFAULT_BLUETEAM_NAME       "Pagans"
00097 
00098 typedef enum {
00099     FOOTSTEP_NORMAL,
00100     FOOTSTEP_BOOT,
00101     FOOTSTEP_FLESH,
00102     FOOTSTEP_MECH,
00103     FOOTSTEP_ENERGY,
00104     FOOTSTEP_METAL,
00105     FOOTSTEP_SPLASH,
00106 
00107     FOOTSTEP_TOTAL
00108 } footstep_t;
00109 
00110 typedef enum {
00111     IMPACTSOUND_DEFAULT,
00112     IMPACTSOUND_METAL,
00113     IMPACTSOUND_FLESH
00114 } impactSound_t;
00115 
00116 //=================================================
00117 
00118 // player entities need to track more information
00119 // than any other type of entity.
00120 
00121 // note that not every player entity is a client entity,
00122 // because corpses after respawn are outside the normal
00123 // client numbering range
00124 
00125 // when changing animation, set animationTime to frameTime + lerping time
00126 // The current lerp will finish out, then it will lerp to the new animation
00127 typedef struct {
00128     int         oldFrame;
00129     int         oldFrameTime;       // time when ->oldFrame was exactly on
00130 
00131     int         frame;
00132     int         frameTime;          // time when ->frame will be exactly on
00133 
00134     float       backlerp;
00135 
00136     float       yawAngle;
00137     qboolean    yawing;
00138     float       pitchAngle;
00139     qboolean    pitching;
00140 
00141     int         animationNumber;    // may include ANIM_TOGGLEBIT
00142     animation_t *animation;
00143     int         animationTime;      // time when the first frame of the animation will be exact
00144 } lerpFrame_t;
00145 
00146 
00147 typedef struct {
00148     lerpFrame_t     legs, torso, flag;
00149     int             painTime;
00150     int             painDirection;  // flip from 0 to 1
00151     int             lightningFiring;
00152 
00153     // railgun trail spawning
00154     vec3_t          railgunImpact;
00155     qboolean        railgunFlash;
00156 
00157     // machinegun spinning
00158     float           barrelAngle;
00159     int             barrelTime;
00160     qboolean        barrelSpinning;
00161 } playerEntity_t;
00162 
00163 //=================================================
00164 
00165 
00166 
00167 // centity_t have a direct corespondence with gentity_t in the game, but
00168 // only the entityState_t is directly communicated to the cgame
00169 typedef struct centity_s {
00170     entityState_t   currentState;   // from cg.frame
00171     entityState_t   nextState;      // from cg.nextFrame, if available
00172     qboolean        interpolate;    // true if next is valid to interpolate to
00173     qboolean        currentValid;   // true if cg.frame holds this entity
00174 
00175     int             muzzleFlashTime;    // move to playerEntity?
00176     int             previousEvent;
00177     int             teleportFlag;
00178 
00179     int             trailTime;      // so missile trails can handle dropped initial packets
00180     int             dustTrailTime;
00181     int             miscTime;
00182 
00183     int             snapShotTime;   // last time this entity was found in a snapshot
00184 
00185     playerEntity_t  pe;
00186 
00187     int             errorTime;      // decay the error from this time
00188     vec3_t          errorOrigin;
00189     vec3_t          errorAngles;
00190     
00191     qboolean        extrapolated;   // false if origin / angles is an interpolation
00192     vec3_t          rawOrigin;
00193     vec3_t          rawAngles;
00194 
00195     vec3_t          beamEnd;
00196 
00197     // exact interpolated position of entity on this frame
00198     vec3_t          lerpOrigin;
00199     vec3_t          lerpAngles;
00200 } centity_t;
00201 
00202 
00203 //======================================================================
00204 
00205 // local entities are created as a result of events or predicted actions,
00206 // and live independantly from all server transmitted entities
00207 
00208 typedef struct markPoly_s {
00209     struct markPoly_s   *prevMark, *nextMark;
00210     int         time;
00211     qhandle_t   markShader;
00212     qboolean    alphaFade;      // fade alpha instead of rgb
00213     float       color[4];
00214     poly_t      poly;
00215     polyVert_t  verts[MAX_VERTS_ON_POLY];
00216 } markPoly_t;
00217 
00218 
00219 typedef enum {
00220     LE_MARK,
00221     LE_EXPLOSION,
00222     LE_SPRITE_EXPLOSION,
00223     LE_FRAGMENT,
00224     LE_MOVE_SCALE_FADE,
00225     LE_FALL_SCALE_FADE,
00226     LE_FADE_RGB,
00227     LE_SCALE_FADE,
00228     LE_SCOREPLUM,
00229 #ifdef MISSIONPACK
00230     LE_KAMIKAZE,
00231     LE_INVULIMPACT,
00232     LE_INVULJUICED,
00233     LE_SHOWREFENTITY
00234 #endif
00235 } leType_t;
00236 
00237 typedef enum {
00238     LEF_PUFF_DONT_SCALE  = 0x0001,          // do not scale size over time
00239     LEF_TUMBLE           = 0x0002,          // tumble over time, used for ejecting shells
00240     LEF_SOUND1           = 0x0004,          // sound 1 for kamikaze
00241     LEF_SOUND2           = 0x0008           // sound 2 for kamikaze
00242 } leFlag_t;
00243 
00244 typedef enum {
00245     LEMT_NONE,
00246     LEMT_BURN,
00247     LEMT_BLOOD
00248 } leMarkType_t;         // fragment local entities can leave marks on walls
00249 
00250 typedef enum {
00251     LEBS_NONE,
00252     LEBS_BLOOD,
00253     LEBS_BRASS
00254 } leBounceSoundType_t;  // fragment local entities can make sounds on impacts
00255 
00256 typedef struct localEntity_s {
00257     struct localEntity_s    *prev, *next;
00258     leType_t        leType;
00259     int             leFlags;
00260 
00261     int             startTime;
00262     int             endTime;
00263     int             fadeInTime;
00264 
00265     float           lifeRate;           // 1.0 / (endTime - startTime)
00266 
00267     trajectory_t    pos;
00268     trajectory_t    angles;
00269 
00270     float           bounceFactor;       // 0.0 = no bounce, 1.0 = perfect
00271 
00272     float           color[4];
00273 
00274     float           radius;
00275 
00276     float           light;
00277     vec3_t          lightColor;
00278 
00279     leMarkType_t        leMarkType;     // mark to leave on fragment impact
00280     leBounceSoundType_t leBounceSoundType;
00281 
00282     refEntity_t     refEntity;      
00283 } localEntity_t;
00284 
00285 //======================================================================
00286 
00287 
00288 typedef struct {
00289     int             client;
00290     int             score;
00291     int             ping;
00292     int             time;
00293     int             scoreFlags;
00294     int             powerUps;
00295     int             accuracy;
00296     int             impressiveCount;
00297     int             excellentCount;
00298     int             guantletCount;
00299     int             defendCount;
00300     int             assistCount;
00301     int             captures;
00302     qboolean    perfect;
00303     int             team;
00304 } score_t;
00305 
00306 // each client has an associated clientInfo_t
00307 // that contains media references necessary to present the
00308 // client model and other color coded effects
00309 // this is regenerated each time a client's configstring changes,
00310 // usually as a result of a userinfo (name, model, etc) change
00311 #define MAX_CUSTOM_SOUNDS   32
00312 
00313 typedef struct {
00314     qboolean        infoValid;
00315 
00316     char            name[MAX_QPATH];
00317     team_t          team;
00318 
00319     int             botSkill;       // 0 = not bot, 1-5 = bot
00320 
00321     vec3_t          color1;
00322     vec3_t          color2;
00323 
00324     int             score;          // updated by score servercmds
00325     int             location;       // location index for team mode
00326     int             health;         // you only get this info about your teammates
00327     int             armor;
00328     int             curWeapon;
00329 
00330     int             handicap;
00331     int             wins, losses;   // in tourney mode
00332 
00333     int             teamTask;       // task in teamplay (offence/defence)
00334     qboolean        teamLeader;     // true when this is a team leader
00335 
00336     int             powerups;       // so can display quad/flag status
00337 
00338     int             medkitUsageTime;
00339     int             invulnerabilityStartTime;
00340     int             invulnerabilityStopTime;
00341 
00342     int             breathPuffTime;
00343 
00344     // when clientinfo is changed, the loading of models/skins/sounds
00345     // can be deferred until you are dead, to prevent hitches in
00346     // gameplay
00347     char            modelName[MAX_QPATH];
00348     char            skinName[MAX_QPATH];
00349     char            headModelName[MAX_QPATH];
00350     char            headSkinName[MAX_QPATH];
00351     char            redTeam[MAX_TEAMNAME];
00352     char            blueTeam[MAX_TEAMNAME];
00353     qboolean        deferred;
00354 
00355     qboolean        newAnims;       // true if using the new mission pack animations
00356     qboolean        fixedlegs;      // true if legs yaw is always the same as torso yaw
00357     qboolean        fixedtorso;     // true if torso never changes yaw
00358 
00359     vec3_t          headOffset;     // move head in icon views
00360     footstep_t      footsteps;
00361     gender_t        gender;         // from model
00362 
00363     qhandle_t       legsModel;
00364     qhandle_t       legsSkin;
00365 
00366     qhandle_t       torsoModel;
00367     qhandle_t       torsoSkin;
00368 
00369     qhandle_t       headModel;
00370     qhandle_t       headSkin;
00371 
00372     qhandle_t       modelIcon;
00373 
00374     animation_t     animations[MAX_TOTALANIMATIONS];
00375 
00376     sfxHandle_t     sounds[MAX_CUSTOM_SOUNDS];
00377 } clientInfo_t;
00378 
00379 
00380 // each WP_* weapon enum has an associated weaponInfo_t
00381 // that contains media references necessary to present the
00382 // weapon and its effects
00383 typedef struct weaponInfo_s {
00384     qboolean        registered;
00385     gitem_t         *item;
00386 
00387     qhandle_t       handsModel;         // the hands don't actually draw, they just position the weapon
00388     qhandle_t       weaponModel;
00389     qhandle_t       barrelModel;
00390     qhandle_t       flashModel;
00391 
00392     vec3_t          weaponMidpoint;     // so it will rotate centered instead of by tag
00393 
00394     float           flashDlight;
00395     vec3_t          flashDlightColor;
00396     sfxHandle_t     flashSound[4];      // fast firing weapons randomly choose
00397 
00398     qhandle_t       weaponIcon;
00399     qhandle_t       ammoIcon;
00400 
00401     qhandle_t       ammoModel;
00402 
00403     qhandle_t       missileModel;
00404     sfxHandle_t     missileSound;
00405     void            (*missileTrailFunc)( centity_t *, const struct weaponInfo_s *wi );
00406     float           missileDlight;
00407     vec3_t          missileDlightColor;
00408     int             missileRenderfx;
00409 
00410     void            (*ejectBrassFunc)( centity_t * );
00411 
00412     float           trailRadius;
00413     float           wiTrailTime;
00414 
00415     sfxHandle_t     readySound;
00416     sfxHandle_t     firingSound;
00417     qboolean        loopFireSound;
00418 } weaponInfo_t;
00419 
00420 
00421 // each IT_* item has an associated itemInfo_t
00422 // that constains media references necessary to present the
00423 // item and its effects
00424 typedef struct {
00425     qboolean        registered;
00426     qhandle_t       models[MAX_ITEM_MODELS];
00427     qhandle_t       icon;
00428 } itemInfo_t;
00429 
00430 
00431 typedef struct {
00432     int             itemNum;
00433 } powerupInfo_t;
00434 
00435 
00436 #define MAX_SKULLTRAIL      10
00437 
00438 typedef struct {
00439     vec3_t positions[MAX_SKULLTRAIL];
00440     int numpositions;
00441 } skulltrail_t;
00442 
00443 
00444 #define MAX_REWARDSTACK     10
00445 #define MAX_SOUNDBUFFER     20
00446 
00447 //======================================================================
00448 
00449 // all cg.stepTime, cg.duckTime, cg.landTime, etc are set to cg.time when the action
00450 // occurs, and they will have visible effects for #define STEP_TIME or whatever msec after
00451 
00452 #define MAX_PREDICTED_EVENTS    16
00453  
00454 typedef struct {
00455     int         clientFrame;        // incremented each frame
00456 
00457     int         clientNum;
00458     
00459     qboolean    demoPlayback;
00460     qboolean    levelShot;          // taking a level menu screenshot
00461     int         deferredPlayerLoading;
00462     qboolean    loading;            // don't defer players at initial startup
00463     qboolean    intermissionStarted;    // don't play voice rewards, because game will end shortly
00464 
00465     // there are only one or two snapshot_t that are relevent at a time
00466     int         latestSnapshotNum;  // the number of snapshots the client system has received
00467     int         latestSnapshotTime; // the time from latestSnapshotNum, so we don't need to read the snapshot yet
00468 
00469     snapshot_t  *snap;              // cg.snap->serverTime <= cg.time
00470     snapshot_t  *nextSnap;          // cg.nextSnap->serverTime > cg.time, or NULL
00471     snapshot_t  activeSnapshots[2];
00472 
00473     float       frameInterpolation; // (float)( cg.time - cg.frame->serverTime ) / (cg.nextFrame->serverTime - cg.frame->serverTime)
00474 
00475     qboolean    thisFrameTeleport;
00476     qboolean    nextFrameTeleport;
00477 
00478     int         frametime;      // cg.time - cg.oldTime
00479 
00480     int         time;           // this is the time value that the client
00481                                 // is rendering at.
00482     int         oldTime;        // time at last frame, used for missile trails and prediction checking
00483 
00484     int         physicsTime;    // either cg.snap->time or cg.nextSnap->time
00485 
00486     int         timelimitWarnings;  // 5 min, 1 min, overtime
00487     int         fraglimitWarnings;
00488 
00489     qboolean    mapRestart;         // set on a map restart to set back the weapon
00490 
00491     qboolean    renderingThirdPerson;       // during deaths, chasecams, etc
00492 
00493     // prediction state
00494     qboolean    hyperspace;             // true if prediction has hit a trigger_teleport
00495     playerState_t   predictedPlayerState;
00496     centity_t       predictedPlayerEntity;
00497     qboolean    validPPS;               // clear until the first call to CG_PredictPlayerState
00498     int         predictedErrorTime;
00499     vec3_t      predictedError;
00500 
00501     int         eventSequence;
00502     int         predictableEvents[MAX_PREDICTED_EVENTS];
00503 
00504     float       stepChange;             // for stair up smoothing
00505     int         stepTime;
00506 
00507     float       duckChange;             // for duck viewheight smoothing
00508     int         duckTime;
00509 
00510     float       landChange;             // for landing hard
00511     int         landTime;
00512 
00513     // input state sent to server
00514     int         weaponSelect;
00515 
00516     // auto rotating items
00517     vec3_t      autoAngles;
00518     vec3_t      autoAxis[3];
00519     vec3_t      autoAnglesFast;
00520     vec3_t      autoAxisFast[3];
00521 
00522     // view rendering
00523     refdef_t    refdef;
00524     vec3_t      refdefViewAngles;       // will be converted to refdef.viewaxis
00525 
00526     // zoom key
00527     qboolean    zoomed;
00528     int         zoomTime;
00529     float       zoomSensitivity;
00530 
00531     // information screen text during loading
00532     char        infoScreenText[MAX_STRING_CHARS];
00533 
00534     // scoreboard
00535     int         scoresRequestTime;
00536     int         numScores;
00537     int         selectedScore;
00538     int         teamScores[2];
00539     score_t     scores[MAX_CLIENTS];
00540     qboolean    showScores;
00541     qboolean    scoreBoardShowing;
00542     int         scoreFadeTime;
00543     char        killerName[MAX_NAME_LENGTH];
00544     char            spectatorList[MAX_STRING_CHARS];        // list of names
00545     int             spectatorLen;                                               // length of list
00546     float           spectatorWidth;                                         // width in device units
00547     int             spectatorTime;                                          // next time to offset
00548     int             spectatorPaintX;                                        // current paint x
00549     int             spectatorPaintX2;                                       // current paint x
00550     int             spectatorOffset;                                        // current offset from start
00551     int             spectatorPaintLen;                                  // current offset from start
00552 
00553     // skull trails
00554     skulltrail_t    skulltrails[MAX_CLIENTS];
00555 
00556     // centerprinting
00557     int         centerPrintTime;
00558     int         centerPrintCharWidth;
00559     int         centerPrintY;
00560     char        centerPrint[1024];
00561     int         centerPrintLines;
00562 
00563     // low ammo warning state
00564     int         lowAmmoWarning;     // 1 = low, 2 = empty
00565 
00566     // kill timers for carnage reward
00567     int         lastKillTime;
00568 
00569     // crosshair client ID
00570     int         crosshairClientNum;
00571     int         crosshairClientTime;
00572 
00573     // powerup active flashing
00574     int         powerupActive;
00575     int         powerupTime;
00576 
00577     // attacking player
00578     int         attackerTime;
00579     int         voiceTime;
00580 
00581     // reward medals
00582     int         rewardStack;
00583     int         rewardTime;
00584     int         rewardCount[MAX_REWARDSTACK];
00585     qhandle_t   rewardShader[MAX_REWARDSTACK];
00586     qhandle_t   rewardSound[MAX_REWARDSTACK];
00587 
00588     // sound buffer mainly for announcer sounds
00589     int         soundBufferIn;
00590     int         soundBufferOut;
00591     int         soundTime;
00592     qhandle_t   soundBuffer[MAX_SOUNDBUFFER];
00593 
00594     // for voice chat buffer
00595     int         voiceChatTime;
00596     int         voiceChatBufferIn;
00597     int         voiceChatBufferOut;
00598 
00599     // warmup countdown
00600     int         warmup;
00601     int         warmupCount;
00602 
00603     //==========================
00604 
00605     int         itemPickup;
00606     int         itemPickupTime;
00607     int         itemPickupBlendTime;    // the pulse around the crosshair is timed seperately
00608 
00609     int         weaponSelectTime;
00610     int         weaponAnimation;
00611     int         weaponAnimationTime;
00612 
00613     // blend blobs
00614     float       damageTime;
00615     float       damageX, damageY, damageValue;
00616 
00617     // status bar head
00618     float       headYaw;
00619     float       headEndPitch;
00620     float       headEndYaw;
00621     int         headEndTime;
00622     float       headStartPitch;
00623     float       headStartYaw;
00624     int         headStartTime;
00625 
00626     // view movement
00627     float       v_dmg_time;
00628     float       v_dmg_pitch;
00629     float       v_dmg_roll;
00630 
00631     vec3_t      kick_angles;    // weapon kicks
00632     vec3_t      kick_origin;
00633 
00634     // temp working variables for player view
00635     float       bobfracsin;
00636     int         bobcycle;
00637     float       xyspeed;
00638     int     nextOrbitTime;
00639 
00640     //qboolean cameraMode;      // if rendering from a loaded camera
00641 
00642 
00643     // development tool
00644     refEntity_t     testModelEntity;
00645     char            testModelName[MAX_QPATH];
00646     qboolean        testGun;
00647 
00648 } cg_t;
00649 
00650 
00651 // all of the model, shader, and sound references that are
00652 // loaded at gamestate time are stored in cgMedia_t
00653 // Other media that can be tied to clients, weapons, or items are
00654 // stored in the clientInfo_t, itemInfo_t, weaponInfo_t, and powerupInfo_t
00655 typedef struct {
00656     qhandle_t   charsetShader;
00657     qhandle_t   charsetProp;
00658     qhandle_t   charsetPropGlow;
00659     qhandle_t   charsetPropB;
00660     qhandle_t   whiteShader;
00661 
00662     qhandle_t   redCubeModel;
00663     qhandle_t   blueCubeModel;
00664     qhandle_t   redCubeIcon;
00665     qhandle_t   blueCubeIcon;
00666     qhandle_t   redFlagModel;
00667     qhandle_t   blueFlagModel;
00668     qhandle_t   neutralFlagModel;
00669     qhandle_t   redFlagShader[3];
00670     qhandle_t   blueFlagShader[3];
00671     qhandle_t   flagShader[4];
00672 
00673     qhandle_t   flagPoleModel;
00674     qhandle_t   flagFlapModel;
00675 
00676     qhandle_t   redFlagFlapSkin;
00677     qhandle_t   blueFlagFlapSkin;
00678     qhandle_t   neutralFlagFlapSkin;
00679 
00680     qhandle_t   redFlagBaseModel;
00681     qhandle_t   blueFlagBaseModel;
00682     qhandle_t   neutralFlagBaseModel;
00683 
00684 #ifdef MISSIONPACK
00685     qhandle_t   overloadBaseModel;
00686     qhandle_t   overloadTargetModel;
00687     qhandle_t   overloadLightsModel;
00688     qhandle_t   overloadEnergyModel;
00689 
00690     qhandle_t   harvesterModel;
00691     qhandle_t   harvesterRedSkin;
00692     qhandle_t   harvesterBlueSkin;
00693     qhandle_t   harvesterNeutralModel;
00694 #endif
00695 
00696     qhandle_t   armorModel;
00697     qhandle_t   armorIcon;
00698 
00699     qhandle_t   teamStatusBar;
00700 
00701     qhandle_t   deferShader;
00702 
00703     // gib explosions
00704     qhandle_t   gibAbdomen;
00705     qhandle_t   gibArm;
00706     qhandle_t   gibChest;
00707     qhandle_t   gibFist;
00708     qhandle_t   gibFoot;
00709     qhandle_t   gibForearm;
00710     qhandle_t   gibIntestine;
00711     qhandle_t   gibLeg;
00712     qhandle_t   gibSkull;
00713     qhandle_t   gibBrain;
00714 
00715     qhandle_t   smoke2;
00716 
00717     qhandle_t   machinegunBrassModel;
00718     qhandle_t   shotgunBrassModel;
00719 
00720     qhandle_t   railRingsShader;
00721     qhandle_t   railCoreShader;
00722 
00723     qhandle_t   lightningShader;
00724 
00725     qhandle_t   friendShader;
00726 
00727     qhandle_t   balloonShader;
00728     qhandle_t   connectionShader;
00729 
00730     qhandle_t   selectShader;
00731     qhandle_t   viewBloodShader;
00732     qhandle_t   tracerShader;
00733     qhandle_t   crosshairShader[NUM_CROSSHAIRS];
00734     qhandle_t   lagometerShader;
00735     qhandle_t   backTileShader;
00736     qhandle_t   noammoShader;
00737 
00738     qhandle_t   smokePuffShader;
00739     qhandle_t   smokePuffRageProShader;
00740     qhandle_t   shotgunSmokePuffShader;
00741     qhandle_t   plasmaBallShader;
00742     qhandle_t   waterBubbleShader;
00743     qhandle_t   bloodTrailShader;
00744 #ifdef MISSIONPACK
00745     qhandle_t   nailPuffShader;
00746     qhandle_t   blueProxMine;
00747 #endif
00748 
00749     qhandle_t   numberShaders[11];
00750 
00751     qhandle_t   shadowMarkShader;
00752 
00753     qhandle_t   botSkillShaders[5];
00754 
00755     // wall mark shaders
00756     qhandle_t   wakeMarkShader;
00757     qhandle_t   bloodMarkShader;
00758     qhandle_t   bulletMarkShader;
00759     qhandle_t   burnMarkShader;
00760     qhandle_t   holeMarkShader;
00761     qhandle_t   energyMarkShader;
00762 
00763     // powerup shaders
00764     qhandle_t   quadShader;
00765     qhandle_t   redQuadShader;
00766     qhandle_t   quadWeaponShader;
00767     qhandle_t   invisShader;
00768     qhandle_t   regenShader;
00769     qhandle_t   battleSuitShader;
00770     qhandle_t   battleWeaponShader;
00771     qhandle_t   hastePuffShader;
00772     qhandle_t   redKamikazeShader;
00773     qhandle_t   blueKamikazeShader;
00774 
00775     // weapon effect models
00776     qhandle_t   bulletFlashModel;
00777     qhandle_t   ringFlashModel;
00778     qhandle_t   dishFlashModel;
00779     qhandle_t   lightningExplosionModel;
00780 
00781     // weapon effect shaders
00782     qhandle_t   railExplosionShader;
00783     qhandle_t   plasmaExplosionShader;
00784     qhandle_t   bulletExplosionShader;
00785     qhandle_t   rocketExplosionShader;
00786     qhandle_t   grenadeExplosionShader;
00787     qhandle_t   bfgExplosionShader;
00788     qhandle_t   bloodExplosionShader;
00789 
00790     // special effects models
00791     qhandle_t   teleportEffectModel;
00792     qhandle_t   teleportEffectShader;
00793 #ifdef MISSIONPACK
00794     qhandle_t   kamikazeEffectModel;
00795     qhandle_t   kamikazeShockWave;
00796     qhandle_t   kamikazeHeadModel;
00797     qhandle_t   kamikazeHeadTrail;
00798     qhandle_t   guardPowerupModel;
00799     qhandle_t   scoutPowerupModel;
00800     qhandle_t   doublerPowerupModel;
00801     qhandle_t   ammoRegenPowerupModel;
00802     qhandle_t   invulnerabilityImpactModel;
00803     qhandle_t   invulnerabilityJuicedModel;
00804     qhandle_t   medkitUsageModel;
00805     qhandle_t   dustPuffShader;
00806     qhandle_t   heartShader;
00807 #endif
00808     qhandle_t   invulnerabilityPowerupModel;
00809 
00810     // scoreboard headers
00811     qhandle_t   scoreboardName;
00812     qhandle_t   scoreboardPing;
00813     qhandle_t   scoreboardScore;
00814     qhandle_t   scoreboardTime;
00815 
00816     // medals shown during gameplay
00817     qhandle_t   medalImpressive;
00818     qhandle_t   medalExcellent;
00819     qhandle_t   medalGauntlet;
00820     qhandle_t   medalDefend;
00821     qhandle_t   medalAssist;
00822     qhandle_t   medalCapture;
00823 
00824     // sounds
00825     sfxHandle_t quadSound;
00826     sfxHandle_t tracerSound;
00827     sfxHandle_t selectSound;
00828     sfxHandle_t useNothingSound;
00829     sfxHandle_t wearOffSound;
00830     sfxHandle_t footsteps[FOOTSTEP_TOTAL][4];
00831     sfxHandle_t sfx_lghit1;
00832     sfxHandle_t sfx_lghit2;
00833     sfxHandle_t sfx_lghit3;
00834     sfxHandle_t sfx_ric1;
00835     sfxHandle_t sfx_ric2;
00836     sfxHandle_t sfx_ric3;
00837     sfxHandle_t sfx_railg;
00838     sfxHandle_t sfx_rockexp;
00839     sfxHandle_t sfx_plasmaexp;
00840 #ifdef MISSIONPACK
00841     sfxHandle_t sfx_proxexp;
00842     sfxHandle_t sfx_nghit;
00843     sfxHandle_t sfx_nghitflesh;
00844     sfxHandle_t sfx_nghitmetal;
00845     sfxHandle_t sfx_chghit;
00846     sfxHandle_t sfx_chghitflesh;
00847     sfxHandle_t sfx_chghitmetal;
00848     sfxHandle_t kamikazeExplodeSound;
00849     sfxHandle_t kamikazeImplodeSound;
00850     sfxHandle_t kamikazeFarSound;
00851     sfxHandle_t useInvulnerabilitySound;
00852     sfxHandle_t invulnerabilityImpactSound1;
00853     sfxHandle_t invulnerabilityImpactSound2;
00854     sfxHandle_t invulnerabilityImpactSound3;
00855     sfxHandle_t invulnerabilityJuicedSound;
00856     sfxHandle_t obeliskHitSound1;
00857     sfxHandle_t obeliskHitSound2;
00858     sfxHandle_t obeliskHitSound3;
00859     sfxHandle_t obeliskRespawnSound;
00860     sfxHandle_t winnerSound;
00861     sfxHandle_t loserSound;
00862     sfxHandle_t youSuckSound;
00863 #endif
00864     sfxHandle_t gibSound;
00865     sfxHandle_t gibBounce1Sound;
00866     sfxHandle_t gibBounce2Sound;
00867     sfxHandle_t gibBounce3Sound;
00868     sfxHandle_t teleInSound;
00869     sfxHandle_t teleOutSound;
00870     sfxHandle_t noAmmoSound;
00871     sfxHandle_t respawnSound;
00872     sfxHandle_t talkSound;
00873     sfxHandle_t landSound;
00874     sfxHandle_t fallSound;
00875     sfxHandle_t jumpPadSound;
00876 
00877     sfxHandle_t oneMinuteSound;
00878     sfxHandle_t fiveMinuteSound;
00879     sfxHandle_t suddenDeathSound;
00880 
00881     sfxHandle_t threeFragSound;
00882     sfxHandle_t twoFragSound;
00883     sfxHandle_t oneFragSound;
00884 
00885     sfxHandle_t hitSound;
00886     sfxHandle_t hitSoundHighArmor;
00887     sfxHandle_t hitSoundLowArmor;
00888     sfxHandle_t hitTeamSound;
00889     sfxHandle_t impressiveSound;
00890     sfxHandle_t excellentSound;
00891     sfxHandle_t deniedSound;
00892     sfxHandle_t humiliationSound;
00893     sfxHandle_t assistSound;
00894     sfxHandle_t defendSound;
00895     sfxHandle_t firstImpressiveSound;
00896     sfxHandle_t firstExcellentSound;
00897     sfxHandle_t firstHumiliationSound;
00898 
00899     sfxHandle_t takenLeadSound;
00900     sfxHandle_t tiedLeadSound;
00901     sfxHandle_t lostLeadSound;
00902 
00903     sfxHandle_t voteNow;
00904     sfxHandle_t votePassed;
00905     sfxHandle_t voteFailed;
00906 
00907     sfxHandle_t watrInSound;
00908     sfxHandle_t watrOutSound;
00909     sfxHandle_t watrUnSound;
00910 
00911     sfxHandle_t flightSound;
00912     sfxHandle_t medkitSound;
00913 
00914     sfxHandle_t weaponHoverSound;
00915 
00916     // teamplay sounds
00917     sfxHandle_t captureAwardSound;
00918     sfxHandle_t redScoredSound;
00919     sfxHandle_t blueScoredSound;
00920     sfxHandle_t redLeadsSound;
00921     sfxHandle_t blueLeadsSound;
00922     sfxHandle_t teamsTiedSound;
00923 
00924     sfxHandle_t captureYourTeamSound;
00925     sfxHandle_t captureOpponentSound;
00926     sfxHandle_t returnYourTeamSound;
00927     sfxHandle_t returnOpponentSound;
00928     sfxHandle_t takenYourTeamSound;
00929     sfxHandle_t takenOpponentSound;
00930 
00931     sfxHandle_t redFlagReturnedSound;
00932     sfxHandle_t blueFlagReturnedSound;
00933     sfxHandle_t neutralFlagReturnedSound;
00934     sfxHandle_t enemyTookYourFlagSound;
00935     sfxHandle_t enemyTookTheFlagSound;
00936     sfxHandle_t yourTeamTookEnemyFlagSound;
00937     sfxHandle_t yourTeamTookTheFlagSound;
00938     sfxHandle_t youHaveFlagSound;
00939     sfxHandle_t yourBaseIsUnderAttackSound;
00940     sfxHandle_t holyShitSound;
00941 
00942     // tournament sounds
00943     sfxHandle_t count3Sound;
00944     sfxHandle_t count2Sound;
00945     sfxHandle_t count1Sound;
00946     sfxHandle_t countFightSound;
00947     sfxHandle_t countPrepareSound;
00948 
00949 #ifdef MISSIONPACK
00950     // new stuff
00951     qhandle_t patrolShader;
00952     qhandle_t assaultShader;
00953     qhandle_t campShader;
00954     qhandle_t followShader;
00955     qhandle_t defendShader;
00956     qhandle_t teamLeaderShader;
00957     qhandle_t retrieveShader;
00958     qhandle_t escortShader;
00959     qhandle_t flagShaders[3];
00960     sfxHandle_t countPrepareTeamSound;
00961 
00962     sfxHandle_t ammoregenSound;
00963     sfxHandle_t doublerSound;
00964     sfxHandle_t guardSound;
00965     sfxHandle_t scoutSound;
00966 #endif
00967     qhandle_t cursor;
00968     qhandle_t selectCursor;
00969     qhandle_t sizeCursor;
00970 
00971     sfxHandle_t regenSound;
00972     sfxHandle_t protectSound;
00973     sfxHandle_t n_healthSound;
00974     sfxHandle_t hgrenb1aSound;
00975     sfxHandle_t hgrenb2aSound;
00976     sfxHandle_t wstbimplSound;
00977     sfxHandle_t wstbimpmSound;
00978     sfxHandle_t wstbimpdSound;
00979     sfxHandle_t wstbactvSound;
00980 
00981 } cgMedia_t;
00982 
00983 
00984 // The client game static (cgs) structure hold everything
00985 // loaded or calculated from the gamestate.  It will NOT
00986 // be cleared when a tournement restart is done, allowing
00987 // all clients to begin playing instantly
00988 typedef struct {
00989     gameState_t     gameState;          // gamestate from server
00990     glconfig_t      glconfig;           // rendering configuration
00991     float           screenXScale;       // derived from glconfig
00992     float           screenYScale;
00993     float           screenXBias;
00994 
00995     int             serverCommandSequence;  // reliable command stream counter
00996     int             processedSnapshotNum;// the number of snapshots cgame has requested
00997 
00998     qboolean        localServer;        // detected on startup by checking sv_running
00999 
01000     // parsed from serverinfo
01001     gametype_t      gametype;
01002     int             dmflags;
01003     int             teamflags;
01004     int             fraglimit;
01005     int             capturelimit;
01006     int             timelimit;
01007     int             maxclients;
01008     char            mapname[MAX_QPATH];
01009     char            redTeam[MAX_QPATH];
01010     char            blueTeam[MAX_QPATH];
01011 
01012     int             voteTime;
01013     int             voteYes;
01014     int             voteNo;
01015     qboolean        voteModified;           // beep whenever changed
01016     char            voteString[MAX_STRING_TOKENS];
01017 
01018     int             teamVoteTime[2];
01019     int             teamVoteYes[2];
01020     int             teamVoteNo[2];
01021     qboolean        teamVoteModified[2];    // beep whenever changed
01022     char            teamVoteString[2][MAX_STRING_TOKENS];
01023 
01024     int             levelStartTime;
01025 
01026     int             scores1, scores2;       // from configstrings
01027     int             redflag, blueflag;      // flag status from configstrings
01028     int             flagStatus;
01029 
01030     qboolean  newHud;
01031 
01032     //
01033     // locally derived information from gamestate
01034     //
01035     qhandle_t       gameModels[MAX_MODELS];
01036     sfxHandle_t     gameSounds[MAX_SOUNDS];
01037 
01038     int             numInlineModels;
01039     qhandle_t       inlineDrawModel[MAX_MODELS];
01040     vec3_t          inlineModelMidpoints[MAX_MODELS];
01041 
01042     clientInfo_t    clientinfo[MAX_CLIENTS];
01043 
01044     // teamchat width is *3 because of embedded color codes
01045     char            teamChatMsgs[TEAMCHAT_HEIGHT][TEAMCHAT_WIDTH*3+1];
01046     int             teamChatMsgTimes[TEAMCHAT_HEIGHT];
01047     int             teamChatPos;
01048     int             teamLastChatPos;
01049 
01050     int cursorX;
01051     int cursorY;
01052     qboolean eventHandling;
01053     qboolean mouseCaptured;
01054     qboolean sizingHud;
01055     void *capturedItem;
01056     qhandle_t activeCursor;
01057 
01058     // orders
01059     int currentOrder;
01060     qboolean orderPending;
01061     int orderTime;
01062     int currentVoiceClient;
01063     int acceptOrderTime;
01064     int acceptTask;
01065     int acceptLeader;
01066     char acceptVoice[MAX_NAME_LENGTH];
01067 
01068     // media
01069     cgMedia_t       media;
01070 
01071 } cgs_t;
01072 
01073 //==============================================================================
01074 
01075 extern  cgs_t           cgs;
01076 extern  cg_t            cg;
01077 extern  centity_t       cg_entities[MAX_GENTITIES];
01078 extern  weaponInfo_t    cg_weapons[MAX_WEAPONS];
01079 extern  itemInfo_t      cg_items[MAX_ITEMS];
01080 extern  markPoly_t      cg_markPolys[MAX_MARK_POLYS];
01081 
01082 extern  vmCvar_t        cg_centertime;
01083 extern  vmCvar_t        cg_runpitch;
01084 e