codemp/game/g_local.h

Go to the documentation of this file.
00001 // Copyright (C) 1999-2000 Id Software, Inc.
00002 //
00003 // g_local.h -- local definitions for game module
00004 
00005 #include "q_shared.h"
00006 #include "bg_public.h"
00007 #include "bg_vehicles.h"
00008 #include "g_public.h"
00009 
00010 #ifndef __LCC__
00011 #define GAME_INLINE ID_INLINE
00012 #else
00013 #define GAME_INLINE //none
00014 #endif
00015 
00016 typedef struct gentity_s gentity_t;
00017 typedef struct gclient_s gclient_t;
00018 
00019 //npc stuff
00020 #include "b_public.h"
00021 
00022 extern int gPainMOD;
00023 extern int gPainHitLoc;
00024 extern vec3_t gPainPoint;
00025 
00026 //==================================================================
00027 
00028 // the "gameversion" client command will print this plus compile date
00029 #define GAMEVERSION     "basejka_mod"
00030 
00031 #define BODY_QUEUE_SIZE         8
00032 
00033 #ifndef INFINITE
00034 #define INFINITE                        1000000
00035 #endif
00036 
00037 #define FRAMETIME                       100                                     // msec
00038 #define CARNAGE_REWARD_TIME     3000
00039 #define REWARD_SPRITE_TIME      2000
00040 
00041 #define INTERMISSION_DELAY_TIME 1000
00042 #define SP_INTERMISSION_DELAY_TIME      5000
00043 
00044 //primarily used by NPCs
00045 #define START_TIME_LINK_ENTS            FRAMETIME*1 // time-delay after map start at which all ents have been spawned, so can link them
00046 #define START_TIME_FIND_LINKS           FRAMETIME*2 // time-delay after map start at which you can find linked entities
00047 #define START_TIME_MOVERS_SPAWNED       FRAMETIME*2 // time-delay after map start at which all movers should be spawned
00048 #define START_TIME_REMOVE_ENTS          FRAMETIME*3 // time-delay after map start to remove temporary ents
00049 #define START_TIME_NAV_CALC                     FRAMETIME*4 // time-delay after map start to connect waypoints and calc routes
00050 #define START_TIME_FIND_WAYPOINT        FRAMETIME*5 // time-delay after map start after which it's okay to try to find your best waypoint
00051 
00052 // gentity->flags
00053 #define FL_GODMODE                              0x00000010
00054 #define FL_NOTARGET                             0x00000020
00055 #define FL_TEAMSLAVE                    0x00000400      // not the first on the team
00056 #define FL_NO_KNOCKBACK                 0x00000800
00057 #define FL_DROPPED_ITEM                 0x00001000
00058 #define FL_NO_BOTS                              0x00002000      // spawn point not for bot use
00059 #define FL_NO_HUMANS                    0x00004000      // spawn point just for bots
00060 #define FL_FORCE_GESTURE                0x00008000      // force gesture on client
00061 #define FL_INACTIVE                             0x00010000      // inactive
00062 #define FL_NAVGOAL                              0x00020000      // for npc nav stuff
00063 #define FL_DONT_SHOOT                   0x00040000
00064 #define FL_SHIELDED                             0x00080000
00065 #define FL_UNDYING                              0x00100000      // takes damage down to 1, but never dies
00066 
00067 //ex-eFlags -rww
00068 #define FL_BOUNCE                               0x00100000              // for missiles
00069 #define FL_BOUNCE_HALF                  0x00200000              // for missiles
00070 #define FL_BOUNCE_SHRAPNEL              0x00400000              // special shrapnel flag
00071 
00072 //vehicle game-local stuff -rww
00073 #define FL_VEH_BOARDING                 0x00800000              // special shrapnel flag
00074 
00075 //breakable flags -rww
00076 #define FL_DMG_BY_SABER_ONLY            0x01000000 //only take dmg from saber
00077 #define FL_DMG_BY_HEAVY_WEAP_ONLY       0x02000000 //only take dmg from explosives
00078 
00079 #define FL_BBRUSH                                       0x04000000 //I am a breakable brush
00080 
00081 #ifndef FINAL_BUILD
00082 #define DEBUG_SABER_BOX
00083 #endif
00084 
00085 #define MAX_G_SHARED_BUFFER_SIZE                8192
00086 extern char gSharedBuffer[MAX_G_SHARED_BUFFER_SIZE];
00087 
00088 // movers are things like doors, plats, buttons, etc
00089 typedef enum {
00090         MOVER_POS1,
00091         MOVER_POS2,
00092         MOVER_1TO2,
00093         MOVER_2TO1
00094 } moverState_t;
00095 
00096 #define SP_PODIUM_MODEL         "models/mapobjects/podium/podium4.md3"
00097 
00098 typedef enum 
00099 {
00100         HL_NONE = 0,
00101         HL_FOOT_RT,
00102         HL_FOOT_LT,
00103         HL_LEG_RT,
00104         HL_LEG_LT,
00105         HL_WAIST,
00106         HL_BACK_RT,
00107         HL_BACK_LT,
00108         HL_BACK,
00109         HL_CHEST_RT,
00110         HL_CHEST_LT,
00111         HL_CHEST,
00112         HL_ARM_RT,
00113         HL_ARM_LT,
00114         HL_HAND_RT,
00115         HL_HAND_LT,
00116         HL_HEAD,
00117         HL_GENERIC1,
00118         HL_GENERIC2,
00119         HL_GENERIC3,
00120         HL_GENERIC4,
00121         HL_GENERIC5,
00122         HL_GENERIC6,
00123         HL_MAX
00124 };
00125 
00126 //============================================================================
00127 extern void *precachedKyle;
00128 extern void *g2SaberInstance;
00129 
00130 extern qboolean gEscaping;
00131 extern int gEscapeTime;
00132 
00133 struct gentity_s {
00134         //rww - entstate must be first, to correspond with the bg shared entity structure
00135         entityState_t   s;                              // communicated by server to clients
00136         playerState_t   *playerState;   //ptr to playerstate if applicable (for bg ents)
00137         Vehicle_t               *m_pVehicle; //vehicle data
00138         void                    *ghoul2; //g2 instance
00139         int                             localAnimIndex; //index locally (game/cgame) to anim data for this skel
00140         vec3_t                  modelScale; //needed for g2 collision
00141 
00142         //From here up must be the same as centity_t/bgEntity_t
00143 
00144         entityShared_t  r;                              // shared by both the server system and game
00145 
00146         //rww - these are shared icarus things. They must be in this order as well in relation to the entityshared structure.
00147         int                             taskID[NUM_TIDS];
00148         parms_t                 *parms;
00149         char                    *behaviorSet[NUM_BSETS];
00150         char                    *script_targetname;
00151         int                             delayScriptTime;
00152         char                    *fullName;
00153 
00154         //rww - targetname and classname are now shared as well. ICARUS needs access to them.
00155         char                    *targetname;
00156         char                    *classname;                     // set in QuakeEd
00157 
00158         //rww - and yet more things to share. This is because the nav code is in the exe because it's all C++.
00159         int                             waypoint;                       //Set once per frame, if you've moved, and if someone asks
00160         int                             lastWaypoint;           //To make sure you don't double-back
00161         int                             lastValidWaypoint;      //ALWAYS valid -used for tracking someone you lost
00162         int                             noWaypointTime;         //Debouncer - so don't keep checking every waypoint in existance every frame that you can't find one
00163         int                             combatPoint;
00164         int                             failedWaypoints[MAX_FAILED_NODES];
00165         int                             failedWaypointCheckTime;
00166 
00167         int                             next_roff_time; //rww - npc's need to know when they're getting roff'd
00168 
00169         // DO NOT MODIFY ANYTHING ABOVE THIS, THE SERVER
00170         // EXPECTS THE FIELDS IN THAT ORDER!
00171         //================================
00172 
00173         struct gclient_s        *client;                        // NULL if not a client
00174 
00175         gNPC_t          *NPC;//Only allocated if the entity becomes an NPC
00176         int                     cantHitEnemyCounter;//HACK - Makes them look for another enemy on the same team if the one they're after can't be hit
00177 
00178         qboolean        noLumbar; //see note in cg_local.h
00179 
00180         qboolean        inuse;
00181 
00182         int                     lockCount; //used by NPCs
00183 
00184         int                     spawnflags;                     // set in QuakeEd
00185 
00186         int                     teamnodmg;                      // damage will be ignored if it comes from this team
00187 
00188         char            *roffname;                      // set in QuakeEd
00189         char            *rofftarget;            // set in QuakeEd
00190 
00191         char            *healingclass; //set in quakeed
00192         char            *healingsound; //set in quakeed
00193         int                     healingrate; //set in quakeed
00194         int                     healingDebounce; //debounce for generic object healing shiz
00195 
00196         char            *ownername;
00197 
00198         int                     objective;
00199         int                     side;
00200 
00201         int                     passThroughNum;         // set to index to pass through (+1) for missiles
00202 
00203         int                     aimDebounceTime;
00204         int                     painDebounceTime;
00205         int                     attackDebounceTime;
00206         int                     alliedTeam;                     // only useable by this team, never target this team
00207 
00208         int                     roffid;                         // if roffname != NULL then set on spawn
00209 
00210         qboolean        neverFree;                      // if true, FreeEntity will only unlink
00211                                                                         // bodyque uses this
00212 
00213         int                     flags;                          // FL_* variables
00214 
00215         char            *model;
00216         char            *model2;
00217         int                     freetime;                       // level.time when the object was freed
00218         
00219         int                     eventTime;                      // events will be cleared EVENT_VALID_MSEC after set
00220         qboolean        freeAfterEvent;
00221         qboolean        unlinkAfterEvent;
00222 
00223         qboolean        physicsObject;          // if true, it can be pushed by movers and fall off edges
00224                                                                         // all game items are physicsObjects, 
00225         float           physicsBounce;          // 1.0 = continuous bounce, 0.0 = no bounce
00226         int                     clipmask;                       // brushes with this content value will be collided against
00227                                                                         // when moving.  items and corpses do not collide against
00228                                                                         // players, for instance
00229 
00230 //Only used by NPC_spawners
00231         char            *NPC_type;
00232         char            *NPC_targetname;
00233         char            *NPC_target;
00234 
00235         // movers
00236         moverState_t moverState;
00237         int                     soundPos1;
00238         int                     sound1to2;
00239         int                     sound2to1;
00240         int                     soundPos2;
00241         int                     soundLoop;
00242         gentity_t       *parent;
00243         gentity_t       *nextTrain;
00244         gentity_t       *prevTrain;
00245         vec3_t          pos1, pos2;
00246 
00247         //for npc's
00248         vec3_t          pos3;
00249 
00250         char            *message;
00251 
00252         int                     timestamp;              // body queue sinking, etc
00253 
00254         float           angle;                  // set in editor, -1 = up, -2 = down
00255         char            *target;
00256         char            *target2;
00257         char            *target3;               //For multiple targets, not used for firing/triggering/using, though, only for path branches
00258         char            *target4;               //For multiple targets, not used for firing/triggering/using, though, only for path branches
00259         char            *target5;               //mainly added for siege items
00260         char            *target6;               //mainly added for siege items
00261 
00262         char            *team;
00263         char            *targetShaderName;
00264         char            *targetShaderNewName;
00265         gentity_t       *target_ent;
00266 
00267         char            *closetarget;
00268         char            *opentarget;
00269         char            *paintarget;
00270 
00271         char            *goaltarget;
00272         char            *idealclass;
00273 
00274         float           radius;
00275 
00276         int                     maxHealth; //used as a base for crosshair health display
00277 
00278         float           speed;
00279         vec3_t          movedir;
00280         float           mass;
00281         int                     setTime;
00282 
00283 //Think Functions
00284         int                     nextthink;
00285         void            (*think)(gentity_t *self);
00286         void            (*reached)(gentity_t *self);    // movers call this when hitting endpoint
00287         void            (*blocked)(gentity_t *self, gentity_t *other);
00288         void            (*touch)(gentity_t *self, gentity_t *other, trace_t *trace);
00289         void            (*use)(gentity_t *self, gentity_t *other, gentity_t *activator);
00290         void            (*pain)(gentity_t *self, gentity_t *attacker, int damage);
00291         void            (*die)(gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int damage, int mod);
00292 
00293         int                     pain_debounce_time;
00294         int                     fly_sound_debounce_time;        // wind tunnel
00295         int                     last_move_time;
00296 
00297 //Health and damage fields
00298         int                     health;
00299         qboolean        takedamage;
00300         material_t      material;
00301 
00302         int                     damage;
00303         int                     dflags;
00304         int                     splashDamage;   // quad will increase this without increasing radius
00305         int                     splashRadius;
00306         int                     methodOfDeath;
00307         int                     splashMethodOfDeath;
00308 
00309         int                     locationDamage[HL_MAX];         // Damage accumulated on different body locations
00310 
00311         int                     count;
00312         int                     bounceCount;
00313         qboolean        alt_fire;
00314 
00315         gentity_t       *chain;
00316         gentity_t       *enemy;
00317         gentity_t       *lastEnemy;
00318         gentity_t       *activator;
00319         gentity_t       *teamchain;             // next entity in team
00320         gentity_t       *teammaster;    // master of the team
00321 
00322         int                     watertype;
00323         int                     waterlevel;
00324 
00325         int                     noise_index;
00326 
00327         // timing variables
00328         float           wait;
00329         float           random;
00330         int                     delay;
00331 
00332         //generic values used by various entities for different purposes.
00333         int                     genericValue1;
00334         int                     genericValue2;
00335         int                     genericValue3;
00336         int                     genericValue4;
00337         int                     genericValue5;
00338         int                     genericValue6;
00339         int                     genericValue7;
00340         int                     genericValue8;
00341         int                     genericValue9;
00342         int                     genericValue10;
00343         int                     genericValue11;
00344         int                     genericValue12;
00345         int                     genericValue13;
00346         int                     genericValue14;
00347         int                     genericValue15;
00348 
00349         char            *soundSet;
00350 
00351         qboolean        isSaberEntity;
00352 
00353         int                     damageRedirect; //if entity takes damage, redirect to..
00354         int                     damageRedirectTo; //this entity number
00355 
00356         vec3_t          epVelocity;
00357         float           epGravFactor;
00358 
00359         gitem_t         *item;                  // for bonus items
00360 };
00361 
00362 #define DAMAGEREDIRECT_HEAD             1
00363 #define DAMAGEREDIRECT_RLEG             2
00364 #define DAMAGEREDIRECT_LLEG             3
00365 
00366 typedef enum {
00367         CON_DISCONNECTED,
00368         CON_CONNECTING,
00369         CON_CONNECTED
00370 };
00371 typedef int clientConnected_t;
00372 
00373 typedef enum {
00374         SPECTATOR_NOT,
00375         SPECTATOR_FREE,
00376         SPECTATOR_FOLLOW,
00377         SPECTATOR_SCOREBOARD
00378 } spectatorState_t;
00379 
00380 typedef enum {
00381         TEAM_BEGIN,             // Beginning a team game, spawn at base
00382         TEAM_ACTIVE             // Now actively playing
00383 } playerTeamStateState_t;
00384 
00385 typedef struct {
00386         playerTeamStateState_t  state;
00387 
00388         int                     location;
00389 
00390         int                     captures;
00391         int                     basedefense;
00392         int                     carrierdefense;
00393         int                     flagrecovery;
00394         int                     fragcarrier;
00395         int                     assists;
00396 
00397         float           lasthurtcarrier;
00398         float           lastreturnedflag;
00399         float           flagsince;
00400         float           lastfraggedcarrier;
00401 } playerTeamState_t;
00402 
00403 // the auto following clients don't follow a specific client
00404 // number, but instead follow the first two active players
00405 #define FOLLOW_ACTIVE1  -1
00406 #define FOLLOW_ACTIVE2  -2
00407 
00408 // client data that stays across multiple levels or tournament restarts
00409 // this is achieved by writing all the data to cvar strings at game shutdown
00410 // time and reading them back at connection time.  Anything added here
00411 // MUST be dealt with in G_InitSessionData() / G_ReadSessionData() / G_WriteSessionData()
00412 typedef struct {
00413         team_t          sessionTeam;
00414         int                     spectatorTime;          // for determining next-in-line to play
00415         spectatorState_t        spectatorState;
00416         int                     spectatorClient;        // for chasecam and follow mode
00417         int                     wins, losses;           // tournament stats
00418         int                     selectedFP;                     // check against this, if doesn't match value in playerstate then update userinfo
00419         int                     saberLevel;                     // similar to above method, but for current saber attack level
00420         qboolean        setForce;                       // set to true once player is given the chance to set force powers
00421         int                     updateUITime;           // only update userinfo for FP/SL if < level.time
00422         qboolean        teamLeader;                     // true when this client is a team leader
00423         char            siegeClass[64];
00424         char            saberType[64];
00425         char            saber2Type[64];
00426         int                     duelTeam;
00427         int                     siegeDesiredTeam;
00428 } clientSession_t;
00429 
00430 // playerstate mGameFlags
00431 #define PSG_VOTED                               (1<<0)          // already cast a vote
00432 #define PSG_TEAMVOTED                   (1<<1)          // already cast a team vote
00433 
00434 //
00435 #define MAX_NETNAME                     36
00436 #define MAX_VOTE_COUNT          3
00437 
00438 // client data that stays across multiple respawns, but is cleared
00439 // on each level change or team change at ClientBegin()
00440 typedef struct {
00441         clientConnected_t       connected;      
00442         usercmd_t       cmd;                            // we would lose angles if not persistant
00443         qboolean        localClient;            // true if "ip" info key is "localhost"
00444         qboolean        initialSpawn;           // the first spawn should be at a cool location
00445         qboolean        predictItemPickup;      // based on cg_predictItems userinfo
00446         qboolean        pmoveFixed;                     //
00447         char            netname[MAX_NETNAME];
00448         int                     netnameTime;                            // Last time the name was changed
00449         int                     maxHealth;                      // for handicapping
00450         int                     enterTime;                      // level.time the client entered the game
00451         playerTeamState_t teamState;    // status in teamplay games
00452         int                     voteCount;                      // to prevent people from constantly calling votes
00453         int                     teamVoteCount;          // to prevent people from constantly calling votes
00454         qboolean        teamInfo;                       // send team overlay updates?
00455 } clientPersistant_t;
00456 
00457 typedef struct renderInfo_s
00458 {
00459         //In whole degrees, How far to let the different model parts yaw and pitch
00460         int             headYawRangeLeft;
00461         int             headYawRangeRight;
00462         int             headPitchRangeUp;
00463         int             headPitchRangeDown;
00464 
00465         int             torsoYawRangeLeft;
00466         int             torsoYawRangeRight;
00467         int             torsoPitchRangeUp;
00468         int             torsoPitchRangeDown;
00469 
00470         int             legsFrame;
00471         int             torsoFrame;
00472 
00473         float   legsFpsMod;
00474         float   torsoFpsMod;
00475 
00476         //Fields to apply to entire model set, individual model's equivalents will modify this value
00477         vec3_t  customRGB;//Red Green Blue, 0 = don't apply
00478         int             customAlpha;//Alpha to apply, 0 = none?
00479 
00480         //RF?
00481         int                     renderFlags;
00482 
00483         //
00484         vec3_t          muzzlePoint;
00485         vec3_t          muzzleDir;
00486         vec3_t          muzzlePointOld;
00487         vec3_t          muzzleDirOld;
00488         //vec3_t                muzzlePointNext;        // Muzzle point one server frame in the future!
00489         //vec3_t                muzzleDirNext;
00490         int                     mPCalcTime;//Last time muzzle point was calced
00491 
00492         //
00493         float           lockYaw;//
00494 
00495         //
00496         vec3_t          headPoint;//Where your tag_head is
00497         vec3_t          headAngles;//where the tag_head in the torso is pointing
00498         vec3_t          handRPoint;//where your right hand is
00499         vec3_t          handLPoint;//where your left hand is
00500         vec3_t          crotchPoint;//Where your crotch is
00501         vec3_t          footRPoint;//where your right hand is
00502         vec3_t          footLPoint;//where your left hand is
00503         vec3_t          torsoPoint;//Where your chest is
00504         vec3_t          torsoAngles;//Where the chest is pointing
00505         vec3_t          eyePoint;//Where your eyes are
00506         vec3_t          eyeAngles;//Where your eyes face
00507         int                     lookTarget;//Which ent to look at with lookAngles
00508         lookMode_t      lookMode;
00509         int                     lookTargetClearTime;//Time to clear the lookTarget
00510         int                     lastVoiceVolume;//Last frame's voice volume
00511         vec3_t          lastHeadAngles;//Last headAngles, NOT actual facing of head model
00512         vec3_t          headBobAngles;//headAngle offsets
00513         vec3_t          targetHeadBobAngles;//head bob angles will try to get to targetHeadBobAngles
00514         int                     lookingDebounceTime;//When we can stop using head looking angle behavior
00515         float           legsYaw;//yaw angle your legs are actually rendering at
00516 
00517         //for tracking legitimate bolt indecies
00518         void            *lastG2; //if it doesn't match ent->ghoul2, the bolts are considered invalid.
00519         int                     headBolt;
00520         int                     handRBolt;
00521         int                     handLBolt;
00522         int                     torsoBolt;
00523         int                     crotchBolt;
00524         int                     footRBolt;
00525         int                     footLBolt;
00526         int                     motionBolt;
00527 
00528         int                     boltValidityTime;
00529 } renderInfo_t;
00530 
00531 // this structure is cleared on each ClientSpawn(),
00532 // except for 'client->pers' and 'client->sess'
00533 struct gclient_s {
00534         // ps MUST be the first element, because the server expects it
00535         playerState_t   ps;                             // communicated by server to clients
00536 
00537         // the rest of the structure is private to game
00538         clientPersistant_t      pers;
00539         clientSession_t         sess;
00540 
00541         saberInfo_t     saber[MAX_SABERS];
00542         void            *weaponGhoul2[MAX_SABERS];
00543 
00544         int                     tossableItemDebounce;
00545 
00546         int                     bodyGrabTime;
00547         int                     bodyGrabIndex;
00548 
00549         int                     pushEffectTime;
00550 
00551         int                     invulnerableTimer;
00552 
00553         int                     saberCycleQueue;
00554 
00555         int                     legsAnimExecute;
00556         int                     torsoAnimExecute;
00557         qboolean        legsLastFlip;
00558         qboolean        torsoLastFlip;
00559 
00560         qboolean        readyToExit;            // wishes to leave the intermission
00561 
00562         qboolean        noclip;
00563 
00564         int                     lastCmdTime;            // level.time of last usercmd_t, for EF_CONNECTION
00565                                                                         // we can't just use pers.lastCommand.time, because
00566                                                                         // of the g_sycronousclients case
00567         int                     buttons;
00568         int                     oldbuttons;
00569         int                     latched_buttons;
00570 
00571         vec3_t          oldOrigin;
00572 
00573         // sum up damage over an entire frame, so
00574         // shotgun blasts give a single big kick
00575         int                     damage_armor;           // damage absorbed by armor
00576         int                     damage_blood;           // damage taken out of health
00577         int                     damage_knockback;       // impact damage
00578         vec3_t          damage_from;            // origin for vector calculation
00579         qboolean        damage_fromWorld;       // if true, don't use the damage_from vector
00580 
00581         int                     damageBoxHandle_Head; //entity number of head damage box
00582         int                     damageBoxHandle_RLeg; //entity number of right leg damage box
00583         int                     damageBoxHandle_LLeg; //entity number of left leg damage box
00584 
00585         int                     accurateCount;          // for "impressive" reward sound
00586 
00587         int                     accuracy_shots;         // total number of shots
00588         int                     accuracy_hits;          // total number of hits
00589 
00590         //
00591         int                     lastkilled_client;      // last client that this client killed
00592         int                     lasthurt_client;        // last client that damaged this client
00593         int                     lasthurt_mod;           // type of damage the client did
00594 
00595         // timers
00596         int                     respawnTime;            // can respawn when time > this, force after g_forcerespwan
00597         int                     inactivityTime;         // kick players when time > this
00598         qboolean        inactivityWarning;      // qtrue if the five seoond warning has been given
00599         int                     rewardTime;                     // clear the EF_AWARD_IMPRESSIVE, etc when time > this
00600 
00601         int                     airOutTime;
00602 
00603         int                     lastKillTime;           // for multiple kill rewards
00604 
00605         qboolean        fireHeld;                       // used for hook
00606         gentity_t       *hook;                          // grapple hook if out
00607 
00608         int                     switchTeamTime;         // time the player switched teams
00609 
00610         int                     switchDuelTeamTime;             // time the player switched duel teams
00611 
00612         int                     switchClassTime;        // class changed debounce timer
00613 
00614         // timeResidual is used to handle events that happen every second
00615         // like health / armor countdowns and regeneration
00616         int                     timeResidual;
00617 
00618         char            *areabits;
00619 
00620         int                     g2LastSurfaceHit; //index of surface hit during the most recent ghoul2 collision performed on this client.
00621         int                     g2LastSurfaceTime; //time when the surface index was set (to make sure it's up to date)
00622 
00623         int                     corrTime;
00624 
00625         vec3_t          lastHeadAngles;
00626         int                     lookTime;
00627 
00628         int                     brokenLimbs;
00629 
00630         qboolean        noCorpse; //don't leave a corpse on respawn this time.
00631 
00632         int                     jetPackTime;
00633 
00634         qboolean        jetPackOn;
00635         int                     jetPackToggleTime;
00636         int                     jetPackDebRecharge;
00637         int                     jetPackDebReduce;
00638 
00639         int                     cloakToggleTime;
00640         int                     cloakDebRecharge;
00641         int                     cloakDebReduce;
00642 
00643         int                     saberStoredIndex; //stores saberEntityNum from playerstate for when it's set to 0 (indicating saber was knocked out of the air)
00644 
00645         int                     saberKnockedTime; //if saber gets knocked away, can't pull it back until this value is < level.time
00646 
00647         vec3_t          olderSaberBase; //Set before lastSaberBase_Always, to whatever lastSaberBase_Always was previously
00648         qboolean        olderIsValid;   //is it valid?
00649 
00650         vec3_t          lastSaberDir_Always; //every getboltmatrix, set to saber dir
00651         vec3_t          lastSaberBase_Always; //every getboltmatrix, set to saber base
00652         int                     lastSaberStorageTime; //server time that the above two values were updated (for making sure they aren't out of date)
00653 
00654         qboolean        hasCurrentPosition;     //are lastSaberTip and lastSaberBase valid?
00655 
00656         int                     dangerTime;             // level.time when last attack occured
00657 
00658         int                     idleTime;               //keep track of when to play an idle anim on the client.
00659 
00660         int                     idleHealth;             //stop idling if health decreases
00661         vec3_t          idleViewAngles; //stop idling if viewangles change
00662 
00663         int                     forcePowerSoundDebounce; //if > level.time, don't do certain sound events again (drain sound, absorb sound, etc)
00664 
00665         char            modelname[MAX_QPATH];
00666 
00667         qboolean        fjDidJump;
00668 
00669         qboolean        ikStatus;
00670 
00671         int                     throwingIndex;
00672         int                     beingThrown;
00673         int                     doingThrow;
00674 
00675         float           hiddenDist;//How close ents have to be to pick you up as an enemy
00676         vec3_t          hiddenDir;//Normalized direction in which NPCs can't see you (you are hidden)
00677 
00678         renderInfo_t    renderInfo;
00679 
00680         //mostly NPC stuff:
00681         npcteam_t       playerTeam;
00682         npcteam_t       enemyTeam;
00683         char            *squadname;
00684         gentity_t       *team_leader;
00685         gentity_t       *leader;
00686         gentity_t       *follower;
00687         int                     numFollowers;
00688         gentity_t       *formationGoal;
00689         int                     nextFormGoal;
00690         class_t         NPC_class;
00691 
00692         vec3_t          pushVec;
00693         int                     pushVecTime;
00694 
00695         int                     siegeClass;
00696         int                     holdingObjectiveItem;
00697 
00698         //time values for when being healed/supplied by supplier class
00699         int                     isMedHealed;
00700         int                     isMedSupplied;
00701 
00702         //seperate debounce time for refilling someone's ammo as a supplier
00703         int                     medSupplyDebounce;
00704 
00705         //used in conjunction with ps.hackingTime
00706         int                     isHacking;
00707         vec3_t          hackingAngles;
00708 
00709         //debounce time for sending extended siege data to certain classes
00710         int                     siegeEDataSend;
00711 
00712         int                     ewebIndex; //index of e-web gun if spawned
00713         int                     ewebTime; //e-web use debounce
00714         int                     ewebHealth; //health of e-web (to keep track between deployments)
00715 
00716         int                     inSpaceIndex; //ent index of space trigger if inside one
00717         int                     inSpaceSuffocation; //suffocation timer
00718 
00719         int                     tempSpectate; //time to force spectator mode
00720 
00721         //keep track of last person kicked and the time so we don't hit multiple times per kick
00722         int                     jediKickIndex;
00723         int                     jediKickTime;
00724 
00725         //special moves (designed for kyle boss npc, but useable by players in mp)
00726         int                     grappleIndex;
00727         int                     grappleState;
00728 
00729         int                     solidHack;
00730 
00731         int                     noLightningTime;
00732 
00733         unsigned        mGameFlags;
00734 
00735         //fallen duelist
00736         qboolean        iAmALoser;
00737 
00738         int                     lastGenCmd;
00739         int                     lastGenCmdTime;
00740 };
00741 
00742 //Interest points
00743 
00744 #define MAX_INTEREST_POINTS             64
00745 
00746 typedef struct 
00747 {
00748         vec3_t          origin;
00749         char            *target;
00750 } interestPoint_t;
00751 
00752 //Combat points
00753 
00754 #define MAX_COMBAT_POINTS               512
00755 
00756 typedef struct 
00757 {
00758         vec3_t          origin;
00759         int                     flags;
00760 //      char            *NPC_targetname;
00761 //      team_t          team;
00762         qboolean        occupied;
00763         int                     waypoint;
00764         int                     dangerTime;
00765 } combatPoint_t;
00766 
00767 // Alert events
00768 
00769 #define MAX_ALERT_EVENTS        32
00770 
00771 typedef enum
00772 {
00773         AET_SIGHT,
00774         AET_SOUND,
00775 } alertEventType_e;
00776 
00777 typedef enum
00778 {
00779         AEL_MINOR,                      //Enemy responds to the sound, but only by looking
00780         AEL_SUSPICIOUS,         //Enemy looks at the sound, and will also investigate it
00781         AEL_DISCOVERED,         //Enemy knows the player is around, and will actively hunt
00782         AEL_DANGER,                     //Enemy should try to find cover
00783         AEL_DANGER_GREAT,       //Enemy should run like hell!
00784 } alertEventLevel_e;
00785 
00786 typedef struct alertEvent_s
00787 {
00788         vec3_t                          position;       //Where the event is located
00789         float                           radius;         //Consideration radius
00790         alertEventLevel_e       level;          //Priority level of the event
00791         alertEventType_e        type;           //Event type (sound,sight)
00792         gentity_t                       *owner;         //Who made the sound
00793         float                           light;          //ambient light level at point
00794         float                           addLight;       //additional light- makes it more noticable, even in darkness
00795         int                                     ID;                     //unique... if get a ridiculous number, this will repeat, but should not be a problem as it's just comparing it to your lastAlertID
00796         int                                     timestamp;      //when it was created
00797 } alertEvent_t;
00798 
00799 //
00800 // this structure is cleared as each map is entered
00801 //
00802 typedef struct
00803 {
00804         char    targetname[MAX_QPATH];
00805         char    target[MAX_QPATH];
00806         char    target2[MAX_QPATH];
00807         char    target3[MAX_QPATH];
00808         char    target4[MAX_QPATH];
00809         int             nodeID;
00810 } waypointData_t;
00811 
00812 typedef struct {
00813         struct gclient_s        *clients;               // [maxclients]
00814 
00815         struct gentity_s        *gentities;
00816         int                     gentitySize;
00817         int                     num_entities;           // current number, <= MAX_GENTITIES
00818 
00819         int                     warmupTime;                     // restart match at this time
00820 
00821         fileHandle_t    logFile;
00822 
00823         // store latched cvars here that we want to get at often
00824         int                     maxclients;
00825 
00826         int                     framenum;
00827         int                     time;                                   // in msec
00828         int                     previousTime;                   // so movers can back up when blocked
00829 
00830         int                     startTime;                              // level.time the map was started
00831 
00832         int                     teamScores[TEAM_NUM_TEAMS];
00833         int                     lastTeamLocationTime;           // last time of client team location update
00834 
00835         qboolean        newSession;                             // don't use any old session data, because
00836                                                                                 // we changed gametype
00837 
00838         qboolean        restarted;                              // waiting for a map_restart to fire
00839 
00840         int                     numConnectedClients;
00841         int                     numNonSpectatorClients; // includes connecting clients
00842         int                     numPlayingClients;              // connected, non-spectators
00843         int                     sortedClients[MAX_CLIENTS];             // sorted by score
00844         int                     follow1, follow2;               // clientNums for auto-follow spectators
00845 
00846         int                     snd_fry;                                // sound index for standing in lava
00847 
00848         int                     snd_hack;                               //hacking loop sound
00849     int                 snd_medHealed;                  //being healed by supply class