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