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
00850         int                     snd_medSupplied;                //being supplied by supply class
00851 
00852         int                     warmupModificationCount;        // for detecting if g_warmup is changed
00853 
00854         // voting state
00855         char            voteString[MAX_STRING_CHARS];
00856         char            voteDisplayString[MAX_STRING_CHARS];
00857         int                     voteTime;                               // level.time vote was called
00858         int                     voteExecuteTime;                // time the vote is executed
00859         int                     voteYes;
00860         int                     voteNo;
00861         int                     numVotingClients;               // set by CalculateRanks
00862 
00863         qboolean        votingGametype;
00864         int                     votingGametypeTo;
00865 
00866         // team voting state
00867         char            teamVoteString[2][MAX_STRING_CHARS];
00868         int                     teamVoteTime[2];                // level.time vote was called
00869         int                     teamVoteYes[2];
00870         int                     teamVoteNo[2];
00871         int                     numteamVotingClients[2];// set by CalculateRanks
00872 
00873         // spawn variables
00874         qboolean        spawning;                               // the G_Spawn*() functions are valid
00875         int                     numSpawnVars;
00876         char            *spawnVars[MAX_SPAWN_VARS][2];  // key / value pairs
00877         int                     numSpawnVarChars;
00878         char            spawnVarChars[MAX_SPAWN_VARS_CHARS];
00879 
00880         // intermission state
00881         int                     intermissionQueued;             // intermission was qualified, but
00882                                                                                 // wait INTERMISSION_DELAY_TIME before
00883                                                                                 // actually going there so the last
00884                                                                                 // frag can be watched.  Disable future
00885                                                                                 // kills during this delay
00886         int                     intermissiontime;               // time the intermission was started
00887         char            *changemap;
00888         qboolean        readyToExit;                    // at least one client wants to exit
00889         int                     exitTime;
00890         vec3_t          intermission_origin;    // also used for spectator spawns
00891         vec3_t          intermission_angle;
00892 
00893         qboolean        locationLinked;                 // target_locations get linked
00894         gentity_t       *locationHead;                  // head of the location list
00895         int                     bodyQueIndex;                   // dead bodies
00896         gentity_t       *bodyQue[BODY_QUEUE_SIZE];
00897         int                     portalSequence;
00898 
00899         alertEvent_t    alertEvents[ MAX_ALERT_EVENTS ];
00900         int                             numAlertEvents;
00901         int                             curAlertID;
00902 
00903         AIGroupInfo_t   groups[MAX_FRAME_GROUPS];
00904 
00905         //Interest points- squadmates automatically look at these if standing around and close to them
00906         interestPoint_t interestPoints[MAX_INTEREST_POINTS];
00907         int                     numInterestPoints;
00908 
00909         //Combat points- NPCs in bState BS_COMBAT_POINT will find their closest empty combat_point
00910         combatPoint_t   combatPoints[MAX_COMBAT_POINTS];
00911         int                     numCombatPoints;
00912 
00913         //rwwRMG - added:
00914         int                     mNumBSPInstances;
00915         int                     mBSPInstanceDepth;
00916         vec3_t          mOriginAdjust;
00917         float           mRotationAdjust;
00918         char            *mTargetAdjust;
00919 
00920         char            mTeamFilter[MAX_QPATH];
00921 
00922 } level_locals_t;
00923 
00924 
00925 //
00926 // g_spawn.c
00927 //
00928 qboolean        G_SpawnString( const char *key, const char *defaultString, char **out );
00929 // spawn string returns a temporary reference, you must CopyString() if you want to keep it
00930 qboolean        G_SpawnFloat( const char *key, const char *defaultString, float *out );
00931 qboolean        G_SpawnInt( const char *key, const char *defaultString, int *out );
00932 qboolean        G_SpawnVector( const char *key, const char *defaultString, float *out );
00933 void            G_SpawnEntitiesFromString( qboolean inSubBSP );
00934 char *G_NewString( const char *string );
00935 
00936 //
00937 // g_cmds.c
00938 //
00939 void Cmd_Score_f (gentity_t *ent);
00940 void StopFollowing( gentity_t *ent );
00941 void BroadcastTeamChange( gclient_t *client, int oldTeam );
00942 void SetTeam( gentity_t *ent, char *s );
00943 void Cmd_FollowCycle_f( gentity_t *ent, int dir );
00944 void Cmd_SaberAttackCycle_f(gentity_t *ent);
00945 int G_ItemUsable(playerState_t *ps, int forcedUse);
00946 void Cmd_ToggleSaber_f(gentity_t *ent);
00947 void Cmd_EngageDuel_f(gentity_t *ent);
00948 
00949 gentity_t *G_GetDuelWinner(gclient_t *client);
00950 
00951 //
00952 // g_items.c
00953 //
00954 void ItemUse_Binoculars(gentity_t *ent);
00955 void ItemUse_Shield(gentity_t *ent);
00956 void ItemUse_Sentry(gentity_t *ent);
00957 
00958 void Jetpack_Off(gentity_t *ent);
00959 void Jetpack_On(gentity_t *ent);
00960 void ItemUse_Jetpack(gentity_t *ent);
00961 void ItemUse_UseCloak( gentity_t *ent );
00962 void ItemUse_UseDisp(gentity_t *ent, int type);
00963 void ItemUse_UseEWeb(gentity_t *ent);
00964 void G_PrecacheDispensers(void);
00965 
00966 void ItemUse_Seeker(gentity_t *ent);
00967 void ItemUse_MedPack(gentity_t *ent);
00968 void ItemUse_MedPack_Big(gentity_t *ent);
00969 
00970 void G_CheckTeamItems( void );
00971 void G_RunItem( gentity_t *ent );
00972 void RespawnItem( gentity_t *ent );
00973 
00974 void UseHoldableItem( gentity_t *ent );
00975 void PrecacheItem (gitem_t *it);
00976 gentity_t *Drop_Item( gentity_t *ent, gitem_t *item, float angle );
00977 gentity_t *LaunchItem( gitem_t *item, vec3_t origin, vec3_t velocity );
00978 void SetRespawn (gentity_t *ent, float delay);
00979 void G_SpawnItem (gentity_t *ent, gitem_t *item);
00980 void FinishSpawningItem( gentity_t *ent );
00981 void Think_Weapon (gentity_t *ent);
00982 int ArmorIndex (gentity_t *ent);
00983 void    Add_Ammo (gentity_t *ent, int weapon, int count);
00984 void Touch_Item (gentity_t *ent, gentity_t *other, trace_t *trace);
00985 
00986 void ClearRegisteredItems( void );
00987 void RegisterItem( gitem_t *item );
00988 void SaveRegisteredItems( void );
00989 
00990 //
00991 // g_utils.c
00992 //
00993 int             G_ModelIndex( const char *name );
00994 int             G_SoundIndex( const char *name );
00995 int             G_SoundSetIndex(const char *name);
00996 int             G_EffectIndex( const char *name );
00997 int             G_BSPIndex( const char *name );
00998 int             G_IconIndex( const char* name );
00999 
01000 qboolean        G_PlayerHasCustomSkeleton(gentity_t *ent);
01001 
01002 void    G_TeamCommand( team_t team, char *cmd );
01003 void    G_ScaleNetHealth(gentity_t *self);
01004 void    G_KillBox (gentity_t *ent);
01005 gentity_t *G_Find (gentity_t *from, int fieldofs, const char *match);
01006 int             G_RadiusList ( vec3_t origin, float radius,     gentity_t *ignore, qboolean takeDamage, gentity_t *ent_list[MAX_GENTITIES]);
01007 
01008 void    G_Throw( gentity_t *targ, vec3_t newDir, float push );
01009 
01010 void    G_FreeFakeClient(gclient_t **cl);
01011 void    G_CreateFakeClient(int entNum, gclient_t **cl);
01012 void    G_CleanAllFakeClients(void);
01013 
01014 void    G_SetAnim(gentity_t *ent, usercmd_t *ucmd, int setAnimParts, int anim, int setAnimFlags, int blendTime);
01015 gentity_t *G_PickTarget (char *targetname);
01016 void    GlobalUse(gentity_t *self, gentity_t *other, gentity_t *activator);
01017 void    G_UseTargets2( gentity_t *ent, gentity_t *activator, const char *string );
01018 void    G_UseTargets (gentity_t *ent, gentity_t *activator);
01019 void    G_SetMovedir ( vec3_t angles, vec3_t movedir);
01020 void    G_SetAngles( gentity_t *ent, vec3_t angles );
01021 
01022 void    G_InitGentity( gentity_t *e );
01023 gentity_t       *G_Spawn (void);
01024 gentity_t *G_TempEntity( vec3_t origin, int event );
01025 gentity_t       *G_PlayEffect(int fxID, vec3_t org, vec3_t ang);
01026 gentity_t       *G_PlayEffectID(const int fxID, vec3_t org, vec3_t ang);
01027 gentity_t *G_ScreenShake(vec3_t org, gentity_t *target, float intensity, int duration, qboolean global);
01028 void    G_MuteSound( int entnum, int channel );
01029 void    G_Sound( gentity_t *ent, int channel, int soundIndex );
01030 void    G_SoundAtLoc( vec3_t loc, int channel, int soundIndex );
01031 void    G_EntitySound( gentity_t *ent, int channel, int soundIndex );
01032 void    TryUse( gentity_t *ent );
01033 void    G_SendG2KillQueue(void);
01034 void    G_KillG2Queue(int entNum);
01035 void    G_FreeEntity( gentity_t *e );
01036 qboolean        G_EntitiesFree( void );
01037 
01038 qboolean G_ActivateBehavior (gentity_t *self, int bset );
01039 
01040 void    G_TouchTriggers (gentity_t *ent);
01041 void    G_TouchSolids (gentity_t *ent);
01042 void    GetAnglesForDirection( const vec3_t p1, const vec3_t p2, vec3_t out );
01043 
01044 //
01045 // g_object.c
01046 //
01047 
01048 extern void G_RunObject                 ( gentity_t *ent );
01049 
01050 
01051 float   *tv (float x, float y, float z);
01052 char    *vtos( const vec3_t v );
01053 
01054 void G_AddPredictableEvent( gentity_t *ent, int event, int eventParm );
01055 void G_AddEvent( gentity_t *ent, int event, int eventParm );
01056 void G_SetOrigin( gentity_t *ent, vec3_t origin );
01057 qboolean G_CheckInSolid (gentity_t *self, qboolean fix);
01058 void AddRemap(const char *oldShader, const char *newShader, float timeOffset);
01059 const char *BuildShaderStateConfig(void);
01060 /*
01061 Ghoul2 Insert Start
01062 */
01063 int G_BoneIndex( const char *name );
01064 
01065 #include "../namespace_begin.h"
01066 
01067 qhandle_t       trap_R_RegisterSkin( const char *name );
01068 
01069 // CG specific API access
01070 void            trap_G2_ListModelSurfaces(void *ghlInfo);
01071 void            trap_G2_ListModelBones(void *ghlInfo, int frame);
01072 void            trap_G2_SetGhoul2ModelIndexes(void *ghoul2, qhandle_t *modelList, qhandle_t *skinList);
01073 qboolean        trap_G2_HaveWeGhoul2Models(void *ghoul2);
01074 qboolean        trap_G2API_GetBoltMatrix(void *ghoul2, const int modelIndex, const int boltIndex, mdxaBone_t *matrix,
01075                                                                 const vec3_t angles, const vec3_t position, const int frameNum, qhandle_t *modelList, vec3_t scale);
01076 qboolean        trap_G2API_GetBoltMatrix_NoReconstruct(void *ghoul2, const int modelIndex, const int boltIndex, mdxaBone_t *matrix,
01077                                                                 const vec3_t angles, const vec3_t position, const int frameNum, qhandle_t *modelList, vec3_t scale);
01078 qboolean        trap_G2API_GetBoltMatrix_NoRecNoRot(void *ghoul2, const int modelIndex, const int boltIndex, mdxaBone_t *matrix,
01079                                                                 const vec3_t angles, const vec3_t position, const int frameNum, qhandle_t *modelList, vec3_t scale);
01080 int                     trap_G2API_InitGhoul2Model(void **ghoul2Ptr, const char *fileName, int modelIndex, qhandle_t customSkin,
01081                                                   qhandle_t customShader, int modelFlags, int lodBias);
01082 qboolean        trap_G2API_SetSkin(void *ghoul2, int modelIndex, qhandle_t customSkin, qhandle_t renderSkin);
01083 
01084 int                     trap_G2API_Ghoul2Size ( void* ghlInfo );
01085 
01086 int                     trap_G2API_AddBolt(void *ghoul2, int modelIndex, const char *boneName);
01087 void            trap_G2API_SetBoltInfo(void *ghoul2, int modelIndex, int boltInfo);
01088 
01089 int                     trap_G2API_CopyGhoul2Instance(void *g2From, void *g2To, int modelIndex);
01090 void            trap_G2API_CopySpecificGhoul2Model(void *g2From, int modelFrom, void *g2To, int modelTo);
01091 void            trap_G2API_DuplicateGhoul2Instance(void *g2From, void **g2To);
01092 qboolean        trap_G2API_HasGhoul2ModelOnIndex(void *ghlInfo, int modelIndex);
01093 qboolean        trap_G2API_RemoveGhoul2Model(void *ghlInfo, int modelIndex);
01094 qboolean        trap_G2API_RemoveGhoul2Models(void *ghlInfo);
01095 void            trap_G2API_CleanGhoul2Models(void **ghoul2Ptr);
01096 void            trap_G2API_CollisionDetect ( CollisionRecord_t *collRecMap, void* ghoul2, const vec3_t angles, const vec3_t position,
01097                                                                 int frameNumber, int entNum, vec3_t rayStart, vec3_t rayEnd, vec3_t scale, int traceFlags, int useLod, float fRadius );
01098 void            trap_G2API_CollisionDetectCache ( CollisionRecord_t *collRecMap, void* ghoul2, const vec3_t angles, const vec3_t position,
01099                                                                 int frameNumber, int entNum, vec3_t rayStart, vec3_t rayEnd, vec3_t scale, int traceFlags, int useLod, float fRadius );
01100 
01101 qboolean        trap_G2API_SetBoneAngles(void *ghoul2, int modelIndex, const char *boneName, const vec3_t angles, const int flags,
01102                                                                 const int up, const int right, const int forward, qhandle_t *modelList,
01103                                                                 int blendTime , int currentTime );
01104 void            trap_G2API_GetGLAName(void *ghoul2, int modelIndex, char *fillBuf);
01105 qboolean        trap_G2API_SetBoneAnim(void *ghoul2, const int modelIndex, const char *boneName, const int startFrame, const int endFrame,
01106                                                           const int flags, const float animSpeed, const int currentTime, const float setFrame , const int blendTime );
01107 qboolean        trap_G2API_GetBoneAnim(void *ghoul2, const char *boneName, const int currentTime, float *currentFrame, int *startFrame,
01108                                                                 int *endFrame, int *flags, float *animSpeed, int *modelList, const int modelIndex);
01109 void            trap_G2API_GetSurfaceName(void *ghoul2, int surfNumber, int modelIndex, char *fillBuf);
01110 qboolean        trap_G2API_SetRootSurface(void *ghoul2, const int modelIndex, const char *surfaceName);
01111 qboolean        trap_G2API_SetSurfaceOnOff(void *ghoul2, const char *surfaceName, const int flags);
01112 qboolean        trap_G2API_SetNewOrigin(void *ghoul2, const int boltIndex);
01113 qboolean        trap_G2API_DoesBoneExist(void *ghoul2, int modelIndex, const char *boneName);
01114 int                     trap_G2API_GetSurfaceRenderStatus(void *ghoul2, const int modelIndex, const char *surfaceName);
01115 
01116 void            trap_G2API_AbsurdSmoothing(void *ghoul2, qboolean status);
01117 
01118 void            trap_G2API_SetRagDoll(void *ghoul2, sharedRagDollParams_t *params);
01119 void            trap_G2API_AnimateG2Models(void *ghoul2, int time, sharedRagDollUpdateParams_t *params);
01120 
01121 //additional ragdoll options -rww
01122 qboolean        trap_G2API_RagPCJConstraint(void *ghoul2, const char *boneName, vec3_t min, vec3_t max); //override default pcj bonee constraints
01123 qboolean        trap_G2API_RagPCJGradientSpeed(void *ghoul2, const char *boneName, const float speed); //override the default gradient movespeed for a pcj bone
01124 qboolean        trap_G2API_RagEffectorGoal(void *ghoul2, const char *boneName, vec3_t pos); //override an effector bone's goal position (world coordinates)
01125 qboolean        trap_G2API_GetRagBonePos(void *ghoul2, const char *boneName, vec3_t pos, vec3_t entAngles, vec3_t entPos, vec3_t entScale); //current position of said bone is put into pos (world coordinates)
01126 qboolean        trap_G2API_RagEffectorKick(void *ghoul2, const char *boneName, vec3_t velocity); //add velocity to a rag bone
01127 qboolean        trap_G2API_RagForceSolve(void *ghoul2, qboolean force); //make sure we are actively performing solve/settle routines, if desired
01128 
01129 qboolean        trap_G2API_SetBoneIKState(void *ghoul2, int time, const char *boneName, int ikState, sharedSetBoneIKStateParams_t *params);
01130 qboolean        trap_G2API_IKMove(void *ghoul2, int time, sharedIKMoveParams_t *params);
01131 
01132 //for removing bones so they no longer have their own seperate animation hierarchy. Or whatever reason you may have. -rww
01133 qboolean        trap_G2API_RemoveBone(void *ghoul2, const char *boneName, int modelIndex);
01134 
01135 void            trap_G2API_AttachInstanceToEntNum(void *ghoul2, int entityNum, qboolean server);
01136 void            trap_G2API_ClearAttachedInstance(int entityNum);
01137 void            trap_G2API_CleanEntAttachments(void);
01138 qboolean        trap_G2API_OverrideServer(void *serverInstance);
01139 
01140 #include "../namespace_end.h"
01141 
01142 /*
01143 Ghoul2 Insert End
01144 */
01145 
01146 //
01147 // g_combat.c
01148 //
01149 qboolean CanDamage (gentity_t *targ, vec3_t origin);
01150 void G_Damage (gentity_t *targ, gentity_t *inflictor, gentity_t *attacker, vec3_t dir, vec3_t point, int damage, int dflags, int mod);
01151 qboolean G_RadiusDamage (vec3_t origin, gentity_t *attacker, float damage, float radius, gentity_t *ignore, gentity_t *missile, int mod);
01152 void body_die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int damage, int meansOfDeath );
01153 void TossClientWeapon(gentity_t *self, vec3_t direction, float speed);
01154 void TossClientItems( gentity_t *self );
01155 void TossClientCubes( gentity_t *self );
01156 void ExplodeDeath( gentity_t *self );
01157 void G_CheckForDismemberment(gentity_t *ent, gentity_t *enemy, vec3_t point, int damage, int deathAnim, qboolean postDeath);
01158 extern int gGAvoidDismember;
01159 
01160 
01161 // damage flags
01162 #define DAMAGE_NORMAL                           0x00000000      // No flags set.
01163 #define DAMAGE_RADIUS                           0x00000001      // damage was indirect
01164 #define DAMAGE_NO_ARMOR                         0x00000002      // armour does not protect from this damage
01165 #define DAMAGE_NO_KNOCKBACK                     0x00000004      // do not affect velocity, just view angles
01166 #define DAMAGE_NO_PROTECTION            0x00000008  // armor, shields, invulnerability, and godmode have no effect
01167 #define DAMAGE_NO_TEAM_PROTECTION       0x00000010  // armor, shields, invulnerability, and godmode have no effect
01168 //JK2 flags
01169 #define DAMAGE_EXTRA_KNOCKBACK          0x00000040      // add extra knockback to this damage
01170 #define DAMAGE_DEATH_KNOCKBACK          0x00000080      // only does knockback on death of target
01171 #define DAMAGE_IGNORE_TEAM                      0x00000100      // damage is always done, regardless of teams
01172 #define DAMAGE_NO_DAMAGE                        0x00000200      // do no actual damage but react as if damage was taken
01173 #define DAMAGE_HALF_ABSORB                      0x00000400      // half shields, half health
01174 #define DAMAGE_HALF_ARMOR_REDUCTION     0x00000800      // This damage doesn't whittle down armor as efficiently.
01175 #define DAMAGE_HEAVY_WEAP_CLASS         0x00001000      // Heavy damage
01176 #define DAMAGE_NO_HIT_LOC                       0x00002000      // No hit location
01177 #define DAMAGE_NO_SELF_PROTECTION       0x00004000      // Dont apply half damage to self attacks
01178 #define DAMAGE_NO_DISMEMBER                     0x00008000      // Dont do dismemberment
01179 #define DAMAGE_SABER_KNOCKBACK1         0x00010000      // Check the attacker's first saber for a knockbackScale
01180 #define DAMAGE_SABER_KNOCKBACK2         0x00020000      // Check the attacker's second saber for a knockbackScale
01181 #define DAMAGE_SABER_KNOCKBACK1_B2      0x00040000      // Check the attacker's first saber for a knockbackScale2
01182 #define DAMAGE_SABER_KNOCKBACK2_B2      0x00080000      // Check the attacker's second saber for a knockbackScale2
01183 //
01184 // g_exphysics.c
01185 //
01186 void G_RunExPhys(gentity_t *ent, float gravity, float mass, float bounce, qboolean autoKill, int *g2Bolts, int numG2Bolts);
01187 
01188 //
01189 // g_missile.c
01190 //
01191 void G_ReflectMissile( gentity_t *ent, gentity_t *missile, vec3_t forward );
01192 
01193 void G_RunMissile( gentity_t *ent );
01194 
01195 gentity_t *CreateMissile( vec3_t org, vec3_t dir, float vel, int life, 
01196                                                         gentity_t *owner, qboolean altFire);
01197 void G_BounceProjectile( vec3_t start, vec3_t impact, vec3_t dir, vec3_t endout );
01198 void G_ExplodeMissile( gentity_t *ent );
01199 
01200 void WP_FireBlasterMissile( gentity_t *ent, vec3_t start, vec3_t dir, qboolean altFire );
01201 
01202 
01203 //
01204 // g_mover.c
01205 //
01206 extern int      BMS_START;
01207 extern int      BMS_MID;
01208 extern int      BMS_END;
01209 
01210 #define SPF_BUTTON_USABLE               1
01211 #define SPF_BUTTON_FPUSHABLE    2
01212 void G_PlayDoorLoopSound( gentity_t *ent );
01213 void G_PlayDoorSound( gentity_t *ent, int type );
01214 void G_RunMover( gentity_t *ent );
01215 void Touch_DoorTrigger( gentity_t *ent, gentity_t *other, trace_t *trace );
01216 
01217 //
01218 // g_trigger.c
01219 //
01220 void trigger_teleporter_touch (gentity_t *self, gentity_t *other, trace_t *trace );
01221 
01222 
01223 //
01224 // g_misc.c
01225 //
01226 #define MAX_REFNAME     32
01227 #define START_TIME_LINK_ENTS            FRAMETIME*1
01228 
01229 #define RTF_NONE        0
01230 #define RTF_NAVGOAL     0x00000001
01231 
01232 typedef struct reference_tag_s
01233 {
01234         char            name[MAX_REFNAME];
01235         vec3_t          origin;
01236         vec3_t          angles;
01237         int                     flags;  //Just in case
01238         int                     radius; //For nav goals
01239         qboolean        inuse;
01240 } reference_tag_t;
01241 
01242 void TAG_Init( void );
01243 reference_tag_t *TAG_Find( const char *owner, const char *name );
01244 reference_tag_t *TAG_Add( const char *name, const char *owner, vec3_t origin, vec3_t angles, int radius, int flags );
01245 int     TAG_GetOrigin( const char *owner, const char *name, vec3_t origin );
01246 int     TAG_GetOrigin2( const char *owner, const char *name, vec3_t origin );
01247 int     TAG_GetAngles( const char *owner, const char *name, vec3_t angles );
01248 int TAG_GetRadius( const char *owner, const char *name );
01249 int TAG_GetFlags( const char *owner, const char *name );
01250 
01251 void TeleportPlayer( gentity_t *player, vec3_t origin, vec3_t angles );
01252 
01253 //
01254 // g_weapon.c
01255 //
01256 void WP_FireTurretMissile( gentity_t *ent, vec3_t start, vec3_t dir, qboolean altFire, int damage, int velocity, int mod, gentity_t *ignore );
01257 void WP_FireGenericBlasterMissile( gentity_t *ent, vec3_t start, vec3_t dir, qboolean altFire, int damage, int velocity, int mod );
01258 qboolean LogAccuracyHit( gentity_t *target, gentity_t *attacker );
01259 void CalcMuzzlePoint ( gentity_t *ent, vec3_t forward, vec3_t right, vec3_t up, vec3_t muzzlePoint );
01260 void SnapVectorTowards( vec3_t v, vec3_t to );
01261 qboolean CheckGauntletAttack( gentity_t *ent );
01262 
01263 
01264 //
01265 // g_client.c
01266 //
01267 team_t TeamCount( int ignoreClientNum, int team );
01268 int TeamLeader( int team );
01269 team_t PickTeam( int ignoreClientNum );
01270 void SetClientViewAngle( gentity_t *ent, vec3_t angle );
01271 gentity_t *SelectSpawnPoint ( vec3_t avoidPoint, vec3_t origin, vec3_t angles, team_t team );
01272 void MaintainBodyQueue(gentity_t *ent);
01273 void respawn (gentity_t *ent);
01274 void BeginIntermission (void);
01275 void InitBodyQue (void);
01276 void ClientSpawn( gentity_t *ent );
01277 void player_die (gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int damage, int mod);
01278 void AddScore( gentity_t *ent, vec3_t origin, int score );
01279 void CalculateRanks( void );
01280 qboolean SpotWouldTelefrag( gentity_t *spot );
01281 
01282 extern gentity_t *gJMSaberEnt;
01283 
01284 //
01285 // g_svcmds.c
01286 //
01287 qboolean        ConsoleCommand( void );
01288 void G_ProcessIPBans(void);
01289 qboolean G_FilterPacket (char *from);
01290 
01291 //
01292 // g_weapon.c
01293 //
01294 void FireWeapon( gentity_t *ent, qboolean altFire );
01295 void BlowDetpacks(gentity_t *ent);
01296 
01297 //
01298 // p_hud.c
01299 //
01300 void MoveClientToIntermission (gentity_t *client);
01301 void G_SetStats (gentity_t *ent);
01302 void DeathmatchScoreboardMessage (gentity_t *client);
01303 
01304 //
01305 // g_cmds.c
01306 //
01307 
01308 //
01309 // g_pweapon.c
01310 //
01311 
01312 
01313 //
01314 // g_main.c
01315 //
01316 extern vmCvar_t g_ff_objectives;
01317 extern qboolean gDoSlowMoDuel;
01318 extern int gSlowMoDuelTime;
01319 
01320 void G_PowerDuelCount(int *loners, int *doubles, qboolean countSpec);
01321 
01322 void FindIntermissionPoint( void );
01323 void SetLeader(int team, int client);
01324 void CheckTeamLeader( int team );
01325 void G_RunThink (gentity_t *ent);
01326 void QDECL G_LogPrintf( const char *fmt, ... );
01327 void SendScoreboardMessageToAllClients( void );
01328 void QDECL G_Printf( const char *fmt, ... );
01329 void QDECL G_Error( const char *fmt, ... );
01330 const char *G_GetStringEdString(char *refSection, char *refName);
01331 
01332 //
01333 // g_client.c
01334 //
01335 char *ClientConnect( int clientNum, qboolean firstTime, qboolean isBot );
01336 void ClientUserinfoChanged( int clientNum );
01337 void ClientDisconnect( int clientNum );
01338 void ClientBegin( int clientNum, qboolean allowTeamReset );
01339 void G_BreakArm(gentity_t *ent, int arm);
01340 void G_UpdateClientAnims(gentity_t *self, float animSpeedScale);
01341 void ClientCommand( int clientNum );
01342 
01343 //
01344 // g_active.c
01345 //
01346 void G_CheckClientTimeouts      ( gentity_t *ent );
01347 void ClientThink                        ( int clientNum, usercmd_t *ucmd );
01348 void ClientEndFrame                     ( gentity_t *ent );
01349 void G_RunClient                        ( gentity_t *ent );
01350 
01351 //
01352 // g_team.c
01353 //
01354 qboolean OnSameTeam( gentity_t *ent1, gentity_t *ent2 );
01355 void Team_CheckDroppedItem( gentity_t *dropped );
01356 
01357 //
01358 // g_mem.c
01359 //
01360 void *G_Alloc( int size );
01361 void G_InitMemory( void );
01362 void Svcmd_GameMem_f( void );
01363 
01364 //
01365 // g_session.c
01366 //
01367 void G_ReadSessionData( gclient_t *client );
01368 void G_InitSessionData( gclient_t *client, char *userinfo, qboolean isBot );
01369 
01370 void G_InitWorldSession( void );
01371 void G_WriteSessionData( void );
01372 
01373 //
01374 // NPC_senses.cpp
01375 //
01376 extern void AddSightEvent( gentity_t *owner, vec3_t position, float radius, alertEventLevel_e alertLevel, float addLight ); //addLight = 0.0f
01377 extern void AddSoundEvent( gentity_t *owner, vec3_t position, float radius, alertEventLevel_e alertLevel, qboolean needLOS ); //needLOS = qfalse
01378 extern qboolean G_CheckForDanger( gentity_t *self, int alertEvent );
01379 extern int G_CheckAlertEvents( gentity_t *self, qboolean checkSight, qboolean checkSound, float maxSeeDist, float maxHearDist, int ignoreAlert, qboolean mustHaveOwner, int minAlertLevel ); //ignoreAlert = -1, mustHaveOwner = qfalse, minAlertLevel = AEL_MINOR
01380 extern qboolean G_CheckForDanger( gentity_t *self, int alertEvent );
01381 extern qboolean G_ClearLOS( gentity_t *self, const vec3_t start, const vec3_t end );
01382 extern qboolean G_ClearLOS2( gentity_t *self, gentity_t *ent, const vec3_t end );
01383 extern qboolean G_ClearLOS3( gentity_t *self, const vec3_t start, gentity_t *ent );
01384 extern qboolean G_ClearLOS4( gentity_t *self, gentity_t *ent );
01385 extern qboolean G_ClearLOS5( gentity_t *self, const vec3_t end );
01386 
01387 //
01388 // g_arenas.c
01389 //
01390 void UpdateTournamentInfo( void );
01391 //void SpawnModelsOnVictoryPads( void );
01392 //void Svcmd_AbortPodium_f( void );
01393 
01394 //
01395 // g_bot.c
01396 //
01397 void G_InitBots( qboolean restart );
01398 char *G_GetBotInfoByNumber( int num );
01399 char *G_GetBotInfoByName( const char *name );
01400 void G_CheckBotSpawn( void );
01401 void G_RemoveQueuedBotBegin( int clientNum );
01402 qboolean G_BotConnect( int clientNum, qboolean restart );
01403 void Svcmd_AddBot_f( void );
01404 void Svcmd_BotList_f( void );
01405 void BotInterbreedEndMatch( void );
01406 qboolean G_DoesMapSupportGametype(const char *mapname, int gametype);
01407 const char *G_RefreshNextMap(int gametype, qboolean forced);
01408 
01409 // w_force.c / w_saber.c
01410 gentity_t *G_PreDefSound(vec3_t org, int pdSound);
01411 qboolean HasSetSaberOnly(void);
01412 void WP_ForcePowerStop( gentity_t *self, forcePowers_t forcePower );
01413 void WP_SaberPositionUpdate( gentity_t *self, usercmd_t *ucmd );
01414 int WP_SaberCanBlock(gentity_t *self, vec3_t point, int dflags, int mod, qboolean projectile, int attackStr);
01415 void WP_SaberInitBladeData( gentity_t *ent );
01416 void WP_InitForcePowers( gentity_t *ent );
01417 void WP_SpawnInitForcePowers( gentity_t *ent );
01418 void WP_ForcePowersUpdate( gentity_t *self, usercmd_t *ucmd );
01419 int ForcePowerUsableOn(gentity_t *attacker, gentity_t *other, forcePowers_t forcePower);
01420 void ForceHeal( gentity_t *self );
01421 void ForceSpeed( gentity_t *self, int forceDuration );
01422 void ForceRage( gentity_t *self );
01423 void ForceGrip( gentity_t *self );
01424 void ForceProtect( gentity_t *self );
01425 void ForceAbsorb( gentity_t *self );
01426 void ForceTeamHeal( gentity_t *self );
01427 void ForceTeamForceReplenish( gentity_t *self );
01428 void ForceSeeing( gentity_t *self );
01429 void ForceThrow( gentity_t *self, qboolean pull );
01430 void ForceTelepathy(gentity_t *self);
01431 qboolean Jedi_DodgeEvasion( gentity_t *self, gentity_t *shooter, trace_t *tr, int hitLoc );
01432 
01433 // g_log.c
01434 void QDECL G_LogPrintf( const char *fmt, ... );
01435 void QDECL G_LogWeaponPickup(int client, int weaponid);
01436 void QDECL G_LogWeaponFire(int client, int weaponid);
01437 void QDECL G_LogWeaponDamage(int client, int mod, int amount);
01438 void QDECL G_LogWeaponKill(int client, int mod);
01439 void QDECL G_LogWeaponDeath(int client, int weaponid);
01440 void QDECL G_LogWeaponFrag(int attacker, int deadguy);
01441 void QDECL G_LogWeaponPowerup(int client, int powerupid);
01442 void QDECL G_LogWeaponItem(int client, int itemid);
01443 void QDECL G_LogWeaponInit(void);
01444 void QDECL G_LogWeaponOutput(void);
01445 void QDECL G_LogExit( const char *string );
01446 void QDECL G_ClearClientLog(int client);
01447 
01448 // g_siege.c
01449 void InitSiegeMode(void);
01450 void G_SiegeClientExData(gentity_t *msgTarg);
01451 
01452 // g_timer
01453 //Timing information
01454 void            TIMER_Clear( void );
01455 void            TIMER_Clear2( gentity_t *ent );
01456 void            TIMER_Set( gentity_t *ent, const char *identifier, int duration );
01457 int                     TIMER_Get( gentity_t *ent, const char *identifier );
01458 qboolean        TIMER_Done( gentity_t *ent, const char *identifier );
01459 qboolean        TIMER_Start( gentity_t *self, const char *identifier, int duration );
01460 qboolean        TIMER_Done2( gentity_t *ent, const char *identifier, qboolean remove );
01461 qboolean        TIMER_Exists( gentity_t *ent, const char *identifier );
01462 void            TIMER_Remove( gentity_t *ent, const char *identifier );
01463 
01464 float NPC_GetHFOVPercentage( vec3_t spot, vec3_t from, vec3_t facing, float hFOV );
01465 float NPC_GetVFOVPercentage( vec3_t spot, vec3_t from, vec3_t facing, float vFOV );
01466 
01467 
01468 extern void G_SetEnemy (gentity_t *self, gentity_t *enemy);
01469 qboolean InFront( vec3_t spot, vec3_t from, vec3_t fromAngles, float threshHold );
01470 
01471 // ai_main.c
01472 #define MAX_FILEPATH                    144
01473 
01474 int             OrgVisible              ( vec3_t org1, vec3_t org2, int ignore);
01475 void    BotOrder                ( gentity_t *ent, int clientnum, int ordernum);
01476 int             InFieldOfVision ( vec3_t viewangles, float fov, vec3_t angles);
01477 
01478 // ai_util.c
01479 void B_InitAlloc(void);
01480 void B_CleanupAlloc(void);
01481 
01482 //bot settings
01483 typedef struct bot_settings_s
01484 {
01485         char personalityfile[MAX_FILEPATH];
01486         float skill;
01487         char team[MAX_FILEPATH];
01488 } bot_settings_t;
01489 
01490 int BotAISetup( int restart );
01491 int BotAIShutdown( int restart );
01492 int BotAILoadMap( int restart );
01493 int BotAISetupClient(int client, struct bot_settings_s *settings, qboolean restart);
01494 int BotAIShutdownClient( int client, qboolean restart );
01495 int BotAIStartFrame( int time );
01496 
01497 #include "g_team.h" // teamplay specific stuff
01498 
01499 
01500 extern  level_locals_t  level;
01501 extern  gentity_t               g_entities[MAX_GENTITIES];
01502 
01503 #define FOFS(x) ((int)&(((gentity_t *)0)->x))
01504 
01505 extern  vmCvar_t        g_gametype;
01506 extern  vmCvar_t        g_dedicated;
01507 extern  vmCvar_t        g_developer;
01508 extern  vmCvar_t        g_cheats;
01509 extern  vmCvar_t        g_maxclients;                   // allow this many total, including spectators
01510 extern  vmCvar_t        g_maxGameClients;               // allow this many active
01511 extern  vmCvar_t        g_restarted;
01512 
01513 extern  vmCvar_t        g_trueJedi;
01514 
01515 extern  vmCvar_t        g_autoMapCycle;
01516 extern  vmCvar_t        g_dmflags;
01517 extern  vmCvar_t        g_maxForceRank;
01518 extern  vmCvar_t        g_forceBasedTeams;
01519 extern  vmCvar_t        g_privateDuel;
01520 
01521 extern  vmCvar_t        g_allowNPC;
01522 
01523 extern  vmCvar_t        g_armBreakage;
01524 
01525 extern  vmCvar_t        g_saberLocking;
01526 extern  vmCvar_t        g_saberLockFactor;
01527 extern  vmCvar_t        g_saberTraceSaberFirst;
01528 
01529 extern  vmCvar_t        d_saberKickTweak;
01530 
01531 extern  vmCvar_t        d_powerDuelPrint;
01532 
01533 extern  vmCvar_t        d_saberGhoul2Collision;
01534 extern  vmCvar_t        g_saberBladeFaces;
01535 extern  vmCvar_t        d_saberAlwaysBoxTrace;
01536 extern  vmCvar_t        d_saberBoxTraceSize;
01537 
01538 extern  vmCvar_t        d_siegeSeekerNPC;
01539 
01540 extern  vmCvar_t        g_debugMelee;
01541 extern  vmCvar_t        g_stepSlideFix;
01542 
01543 extern  vmCvar_t        g_noSpecMove;
01544 
01545 #ifdef _DEBUG
01546 extern  vmCvar_t        g_disableServerG2;
01547 #endif
01548 
01549 extern  vmCvar_t        d_perPlayerGhoul2;
01550 
01551 extern  vmCvar_t        d_projectileGhoul2Collision;
01552 
01553 extern  vmCvar_t        g_g2TraceLod;
01554 
01555 extern  vmCvar_t        g_optvehtrace;
01556 
01557 extern  vmCvar_t        g_locationBasedDamage;
01558 
01559 extern  vmCvar_t        g_allowHighPingDuelist;
01560 
01561 extern  vmCvar_t        g_logClientInfo;
01562 
01563 extern  vmCvar_t        g_slowmoDuelEnd;
01564 
01565 extern  vmCvar_t        g_saberDamageScale;
01566 
01567 extern  vmCvar_t        g_useWhileThrowing;
01568 
01569 extern  vmCvar_t        g_RMG;
01570 
01571 extern  vmCvar_t        g_svfps;
01572 
01573 extern  vmCvar_t        g_forceRegenTime;
01574 extern  vmCvar_t        g_spawnInvulnerability;
01575 extern  vmCvar_t        g_forcePowerDisable;
01576 extern  vmCvar_t        g_weaponDisable;
01577 
01578 extern  vmCvar_t        g_allowDuelSuicide;
01579 extern  vmCvar_t        g_fraglimitVoteCorrection;
01580 
01581 extern  vmCvar_t        g_duelWeaponDisable;
01582 extern  vmCvar_t        g_fraglimit;
01583 extern  vmCvar_t        g_duel_fraglimit;
01584 extern  vmCvar_t        g_timelimit;
01585 extern  vmCvar_t        g_capturelimit;
01586 extern  vmCvar_t        d_saberInterpolate;
01587 extern  vmCvar_t        g_friendlyFire;
01588 extern  vmCvar_t        g_friendlySaber;
01589 extern  vmCvar_t        g_password;
01590 extern  vmCvar_t        g_needpass;
01591 extern  vmCvar_t        g_gravity;
01592 extern  vmCvar_t        g_speed;
01593 extern  vmCvar_t        g_knockback;
01594 extern  vmCvar_t        g_quadfactor;
01595 extern  vmCvar_t        g_forcerespawn;
01596 extern  vmCvar_t        g_siegeRespawn;
01597 extern  vmCvar_t        g_inactivity;
01598 extern  vmCvar_t        g_debugMove;
01599 extern  vmCvar_t        g_debugAlloc;
01600 #ifndef FINAL_BUILD
01601 extern  vmCvar_t        g_debugDamage;
01602 #endif
01603 extern  vmCvar_t        g_debugServerSkel;
01604 extern  vmCvar_t        g_weaponRespawn;
01605 extern  vmCvar_t        g_weaponTeamRespawn;
01606 extern  vmCvar_t        g_adaptRespawn;
01607 extern  vmCvar_t        g_synchronousClients;
01608 extern  vmCvar_t        g_motd;
01609 extern  vmCvar_t        g_warmup;
01610 extern  vmCvar_t        g_doWarmup;
01611 extern  vmCvar_t        g_blood;
01612 extern  vmCvar_t        g_allowVote;
01613 extern  vmCvar_t        g_teamAutoJoin;
01614 extern  vmCvar_t        g_teamForceBalance;
01615 extern  vmCvar_t        g_banIPs;
01616 extern  vmCvar_t        g_filterBan;
01617 extern  vmCvar_t        g_debugForward;
01618 extern  vmCvar_t        g_debugRight;
01619 extern  vmCvar_t        g_debugUp;
01620 //extern        vmCvar_t        g_redteam;
01621 //extern        vmCvar_t        g_blueteam;
01622 extern  vmCvar_t        g_smoothClients;
01623 
01624 #include "../namespace_begin.h"
01625 extern  vmCvar_t        pmove_fixed;
01626 extern  vmCvar_t        pmove_msec;
01627 #include "../namespace_end.h"
01628 
01629 extern  vmCvar_t        g_enableBreath;
01630 extern  vmCvar_t        g_singlePlayer;
01631 extern  vmCvar_t        g_dismember;
01632 extern  vmCvar_t        g_forceDodge;
01633 extern  vmCvar_t        g_timeouttospec;
01634 
01635 extern  vmCvar_t        g_saberDmgVelocityScale;
01636 extern  vmCvar_t        g_saberDmgDelay_Idle;
01637 extern  vmCvar_t        g_saberDmgDelay_Wound;
01638 
01639 #ifndef FINAL_BUILD
01640 extern  vmCvar_t        g_saberDebugPrint;
01641 #endif
01642 
01643 extern  vmCvar_t        g_siegeTeamSwitch;
01644 
01645 extern  vmCvar_t        bg_fighterAltControl;
01646 
01647 #ifdef DEBUG_SABER_BOX
01648 extern  vmCvar_t        g_saberDebugBox;
01649 #endif
01650 
01651 //NPC nav debug
01652 extern vmCvar_t         d_altRoutes;
01653 extern vmCvar_t         d_patched;
01654 extern  vmCvar_t        d_noIntermissionWait;
01655 
01656 extern  vmCvar_t        g_siegeTeam1;
01657 extern  vmCvar_t        g_siegeTeam2;
01658 
01659 extern  vmCvar_t        g_austrian;
01660 
01661 extern  vmCvar_t        g_powerDuelStartHealth;
01662 extern  vmCvar_t        g_powerDuelEndHealth;
01663 
01664 extern vmCvar_t         g_showDuelHealths;
01665 
01666 #include "../namespace_begin.h"
01667 
01668 void    trap_Printf( const char *fmt );
01669 void    trap_Error( const char *fmt );
01670 int             trap_Milliseconds( void );
01671 void    trap_PrecisionTimer_Start(void **theNewTimer);
01672 int             trap_PrecisionTimer_End(void *theTimer);
01673 int             trap_Argc( void );
01674 void    trap_Argv( int n, char *buffer, int bufferLength );
01675 void    trap_Args( char *buffer, int bufferLength );
01676 int             trap_FS_FOpenFile( const char *qpath, fileHandle_t *f, fsMode_t mode );
01677 void    trap_FS_Read( void *buffer, int len, fileHandle_t f );
01678 void    trap_FS_Write( const void *buffer, int len, fileHandle_t f );
01679 void    trap_FS_FCloseFile( fileHandle_t f );
01680 int             trap_FS_GetFileList( const char *path, const char *extension, char *listbuf, int bufsize );
01681 void    trap_SendConsoleCommand( int exec_when, const char *text );
01682 void    trap_Cvar_Register( vmCvar_t *cvar, const char *var_name, const char *value, int flags );
01683 void    trap_Cvar_Update( vmCvar_t *cvar );
01684 void    trap_Cvar_Set( const char *var_name, const char *value );
01685 int             trap_Cvar_VariableIntegerValue( const char *var_name );
01686 float   trap_Cvar_VariableValue( const char *var_name );
01687 void    trap_Cvar_VariableStringBuffer( const char *var_name, char *buffer, int bufsize );
01688 void    trap_LocateGameData( gentity_t *gEnts, int numGEntities, int sizeofGEntity_t, playerState_t *gameClients, int sizeofGameClient );
01689 void    trap_DropClient( int clientNum, const char *reason );
01690 void    trap_SendServerCommand( int clientNum, const char *text );
01691 void    trap_SetConfigstring( int num, const char *string );
01692 void    trap_GetConfigstring( int num, char *buffer, int bufferSize );
01693 void    trap_GetUserinfo( int num, char *buffer, int bufferSize );
01694 void    trap_SetUserinfo( int num, const char *buffer );
01695 void    trap_GetServerinfo( char *buffer, int bufferSize );
01696 void    trap_SetServerCull(float cullDistance);
01697 void    trap_SetBrushModel( gentity_t *ent, const char *name );
01698 void    trap_Trace( trace_t *results, const vec3_t start, const vec3_t mins, const vec3_t maxs, const vec3_t end, int passEntityNum, int contentmask );
01699 void    trap_G2Trace( trace_t *results, const vec3_t start, const vec3_t mins, const vec3_t maxs, const vec3_t end, int passEntityNum, int contentmask, int g2TraceType, int traceLod );
01700 int             trap_PointContents( const vec3_t point, int passEntityNum );
01701 qboolean trap_InPVS( const vec3_t p1, const vec3_t p2 );
01702 qboolean trap_InPVSIgnorePortals( const vec3_t p1, const vec3_t p2 );
01703 void    trap_AdjustAreaPortalState( gentity_t *ent, qboolean open );
01704 qboolean trap_AreasConnected( int area1, int area2 );
01705 void    trap_LinkEntity( gentity_t *ent );
01706 void    trap_UnlinkEntity( gentity_t *ent );
01707 int             trap_EntitiesInBox( const vec3_t mins, const vec3_t maxs, int *entityList, int maxcount );
01708 qboolean trap_EntityContact( const vec3_t mins, const vec3_t maxs, const gentity_t *ent );
01709 int             trap_BotAllocateClient( void );
01710 void    trap_BotFreeClient( int clientNum );
01711 void    trap_GetUsercmd( int clientNum, usercmd_t *cmd );
01712 qboolean        trap_GetEntityToken( char *buffer, int bufferSize );
01713 
01714 //adding giant gamebreaking features post-alpha is fun!
01715 void    trap_SiegePersSet(siegePers_t *pers);
01716 void    trap_SiegePersGet(siegePers_t *pers);
01717 
01718 #ifdef BOT_ZMALLOC
01719 void    *trap_BotGetMemoryGame(int size);
01720 void    trap_BotFreeMemoryGame(void *ptr);
01721 #endif
01722 
01723 int             trap_DebugPolygonCreate(int color, int numPoints, vec3_t *points);
01724 void    trap_DebugPolygonDelete(int id);
01725 
01726 int             trap_BotLibSetup( void );
01727 int             trap_BotLibShutdown( void );
01728 int             trap_BotLibVarSet(char *var_name, char *value);
01729 int             trap_BotLibVarGet(char *var_name, char *value, int size);
01730 int             trap_BotLibDefine(char *string);
01731 int             trap_BotLibStartFrame(float time);
01732 int             trap_BotLibLoadMap(const char *mapname);
01733 int             trap_BotLibUpdateEntity(int ent, void /* struct bot_updateentity_s */ *bue);
01734 int             trap_BotLibTest(int parm0, char *parm1, vec3_t parm2, vec3_t parm3);
01735 
01736 int             trap_BotGetSnapshotEntity( int clientNum, int sequence );
01737 int             trap_BotGetServerCommand(int clientNum, char *message, int size);
01738 void    trap_BotUserCommand(int client, usercmd_t *ucmd);
01739 
01740 int             trap_AAS_BBoxAreas(vec3_t absmins, vec3_t absmaxs, int *areas, int maxareas);
01741 int             trap_AAS_AreaInfo( int areanum, void /* struct aas_areainfo_s */ *info );
01742 void    trap_AAS_EntityInfo(int entnum, void /* struct aas_entityinfo_s */ *info);
01743 
01744 int             trap_AAS_Initialized(void);
01745 void    trap_AAS_PresenceTypeBoundingBox(int presencetype, vec3_t mins, vec3_t maxs);
01746 float   trap_AAS_Time(void);
01747 
01748 int             trap_AAS_PointAreaNum(vec3_t point);
01749 int             trap_AAS_PointReachabilityAreaIndex(vec3_t point);
01750 int             trap_AAS_TraceAreas(vec3_t start, vec3_t end, int *areas, vec3_t *points, int maxareas);
01751 
01752 int             trap_AAS_PointContents(vec3_t point);
01753 int             trap_AAS_NextBSPEntity(int ent);
01754 int             trap_AAS_ValueForBSPEpairKey(int ent, char *key, char *value, int size);
01755 int             trap_AAS_VectorForBSPEpairKey(int ent, char *key, vec3_t v);
01756 int             trap_AAS_FloatForBSPEpairKey(int ent, char *key, float *value);
01757 int             trap_AAS_IntForBSPEpairKey(int ent, char *key, int *value);
01758 
01759 int             trap_AAS_AreaReachability(int areanum);
01760 
01761 int             trap_AAS_AreaTravelTimeToGoalArea(int areanum, vec3_t origin, int goalareanum, int travelflags);
01762 int             trap_AAS_EnableRoutingArea( int areanum, int enable );
01763 int             trap_AAS_PredictRoute(void /*struct aas_predictroute_s*/ *route, int areanum, vec3_t origin,
01764                                                         int goalareanum, int travelflags, int maxareas, int maxtime,
01765                                                         int stopevent, int stopcontents, int stoptfl, int stopareanum);
01766 
01767 int             trap_AAS_AlternativeRouteGoals(vec3_t start, int startareanum, vec3_t goal, int goalareanum, int travelflags,
01768                                                                                 void /*struct aas_altroutegoal_s*/ *altroutegoals, int maxaltroutegoals,
01769                                                                                 int type);
01770 int             trap_AAS_Swimming(vec3_t origin);
01771 int             trap_AAS_PredictClientMovement(void /* aas_clientmove_s */ *move, int entnum, vec3_t origin, int presencetype, int onground, vec3_t velocity, vec3_t cmdmove, int cmdframes, int maxframes, float frametime, int stopevent, int stopareanum, int visualize);
01772 
01773 
01774 void    trap_EA_Say(int client, char *str);
01775 void    trap_EA_SayTeam(int client, char *str);
01776 void    trap_EA_Command(int client, char *command);
01777 
01778 void    trap_EA_Action(int client, int action);
01779 void    trap_EA_Gesture(int client);
01780 void    trap_EA_Talk(int client);
01781 void    trap_EA_Attack(int client);
01782 void    trap_EA_Use(int client);
01783 void    trap_EA_Respawn(int client);
01784 void    trap_EA_Crouch(int client);
01785 void    trap_EA_MoveUp(int client);
01786 void    trap_EA_MoveDown(int client);
01787 void    trap_EA_MoveForward(int client);
01788 void    trap_EA_MoveBack(int client);
01789 void    trap_EA_MoveLeft(int client);
01790 void    trap_EA_MoveRight(int client);
01791 void    trap_EA_SelectWeapon(int client, int weapon);
01792 void    trap_EA_Jump(int client);
01793 void    trap_EA_DelayedJump(int client);
01794 void    trap_EA_Move(int client, vec3_t dir, float speed);
01795 void    trap_EA_View(int client, vec3_t viewangles);
01796 void    trap_EA_Alt_Attack(int client);
01797 void    trap_EA_ForcePower(int client);
01798 
01799 void    trap_EA_EndRegular(int client, float thinktime);
01800 void    trap_EA_GetInput(int client, float thinktime, void /* struct bot_input_s */ *input);
01801 void    trap_EA_ResetInput(int client);
01802 
01803 
01804 int             trap_BotLoadCharacter(char *charfile, float skill);
01805 void    trap_BotFreeCharacter(int character);
01806 float   trap_Characteristic_Float(int character, int index);
01807 float   trap_Characteristic_BFloat(int character, int index, float min, float max);
01808 int             trap_Characteristic_Integer(int character, int index);
01809 int             trap_Characteristic_BInteger(int character, int index, int min, int max);
01810 void    trap_Characteristic_String(int character, int index, char *buf, int size);
01811 
01812 int             trap_BotAllocChatState(void);
01813 void    trap_BotFreeChatState(int handle);
01814 void    trap_BotQueueConsoleMessage(int chatstate, int type, char *message);
01815 void    trap_BotRemoveConsoleMessage(int chatstate, int handle);
01816 int             trap_BotNextConsoleMessage(int chatstate, void /* struct bot_consolemessage_s */ *cm);
01817 int             trap_BotNumConsoleMessages(int chatstate);
01818 void    trap_BotInitialChat(int chatstate, char *type, int mcontext, char *var0, char *var1, char *var2, char *var3, char *var4, char *var5, char *var6, char *var7 );
01819 int             trap_BotNumInitialChats(int chatstate, char *type);
01820 int             trap_BotReplyChat(int chatstate, char *message, int mcontext, int vcontext, char *var0, char *var1, char *var2, char *var3, char *var4, char *var5, char *var6, char *var7 );
01821 int             trap_BotChatLength(int chatstate);
01822 void    trap_BotEnterChat(int chatstate, int client, int sendto);
01823 void    trap_BotGetChatMessage(int chatstate, char *buf, int size);
01824 int             trap_StringContains(char *str1, char *str2, int casesensitive);
01825 int             trap_BotFindMatch(char *str, void /* struct bot_match_s */ *match, unsigned long int context);
01826 void    trap_BotMatchVariable(void /* struct bot_match_s */ *match, int variable, char *buf, int size);
01827 void    trap_UnifyWhiteSpaces(char *string);
01828 void    trap_BotReplaceSynonyms(char *string, unsigned long int context);
01829 int             trap_BotLoadChatFile(int chatstate, char *chatfile, char *chatname);
01830 void    trap_BotSetChatGender(int chatstate, int gender);
01831 void    trap_BotSetChatName(int chatstate, char *name, int client);
01832 void    trap_BotResetGoalState(int goalstate);
01833 void    trap_BotRemoveFromAvoidGoals(int goalstate, int number);
01834 void    trap_BotResetAvoidGoals(int goalstate);
01835 void    trap_BotPushGoal(int goalstate, void /* struct bot_goal_s */ *goal);
01836 void    trap_BotPopGoal(int goalstate);
01837 void    trap_BotEmptyGoalStack(int goalstate);
01838 void    trap_BotDumpAvoidGoals(int goalstate);
01839 void    trap_BotDumpGoalStack(int goalstate);
01840 void    trap_BotGoalName(int number, char *name, int size);
01841 int             trap_BotGetTopGoal(int goalstate, void /* struct bot_goal_s */ *goal);
01842 int             trap_BotGetSecondGoal(int goalstate, void /* struct bot_goal_s */ *goal);
01843 int             trap_BotChooseLTGItem(int goalstate, vec3_t origin, int *inventory, int travelflags);
01844 int             trap_BotChooseNBGItem(int goalstate, vec3_t origin, int *inventory, int travelflags, void /* struct bot_goal_s */ *ltg, float maxtime);
01845 int             trap_BotTouchingGoal(vec3_t origin, void /* struct bot_goal_s */ *goal);
01846 int             trap_BotItemGoalInVisButNotVisible(int viewer, vec3_t eye, vec3_t viewangles, void /* struct bot_goal_s */ *goal);
01847 int             trap_BotGetNextCampSpotGoal(int num, void /* struct bot_goal_s */ *goal);
01848 int             trap_BotGetMapLocationGoal(char *name, void /* struct bot_goal_s */ *goal);
01849 int             trap_BotGetLevelItemGoal(int index, char *classname, void /* struct bot_goal_s */ *goal);
01850 float   trap_BotAvoidGoalTime(int goalstate, int number);
01851 void    trap_BotSetAvoidGoalTime(int goalstate, int number, float avoidtime);
01852 void    trap_BotInitLevelItems(void);
01853 void    trap_BotUpdateEntityItems(void);
01854 int             trap_BotLoadItemWeights(int goalstate, char *filename);
01855 void    trap_BotFreeItemWeights(int goalstate);
01856 void    trap_BotInterbreedGoalFuzzyLogic(int parent1, int parent2, int child);
01857 void    trap_BotSaveGoalFuzzyLogic(int goalstate, char *filename);
01858 void    trap_BotMutateGoalFuzzyLogic(int goalstate, float range);
01859 int             trap_BotAllocGoalState(int state);
01860 void    trap_BotFreeGoalState(int handle);
01861 
01862 void    trap_BotResetMoveState(int movestate);
01863 void    trap_BotMoveToGoal(void /* struct bot_moveresult_s */ *result, int movestate, void /* struct bot_goal_s */ *goal, int travelflags);
01864 int             trap_BotMoveInDirection(int movestate, vec3_t dir, float speed, int type);
01865 void    trap_BotResetAvoidReach(int movestate);
01866 void    trap_BotResetLastAvoidReach(int movestate);
01867 int             trap_BotReachabilityArea(vec3_t origin, int testground);
01868 int             trap_BotMovementViewTarget(int movestate, void /* struct bot_goal_s */ *goal, int travelflags, float lookahead, vec3_t target);
01869 int             trap_BotPredictVisiblePosition(vec3_t origin, int areanum, void /* struct bot_goal_s */ *goal, int travelflags, vec3_t target);
01870 int             trap_BotAllocMoveState(void);
01871 void    trap_BotFreeMoveState(int handle);
01872 void    trap_BotInitMoveState(int handle, void /* struct bot_initmove_s */ *initmove);
01873 void    trap_BotAddAvoidSpot(int movestate, vec3_t origin, float radius, int type);
01874 
01875 int             trap_BotChooseBestFightWeapon(int weaponstate, int *inventory);
01876 void    trap_BotGetWeaponInfo(int weaponstate, int weapon, void /* struct weaponinfo_s */ *weaponinfo);
01877 int             trap_BotLoadWeaponWeights(int weaponstate, char *filename);
01878 int             trap_BotAllocWeaponState(void);
01879 void    trap_BotFreeWeaponState(int weaponstate);
01880 void    trap_BotResetWeaponState(int weaponstate);
01881 
01882 int             trap_GeneticParentsAndChildSelection(int numranks, float *ranks, int *parent1, int *parent2, int *child);
01883 
01884 void    trap_SnapVector( float *v );
01885 
01886 int trap_SP_GetStringTextString(const char *text, char *buffer, int bufferLength);
01887 
01888 qboolean        trap_ROFF_Clean( void );
01889 void            trap_ROFF_UpdateEntities( void );
01890 int                     trap_ROFF_Cache( char *file );
01891 qboolean        trap_ROFF_Play( int entID, int roffID, qboolean doTranslation );
01892 qboolean        trap_ROFF_Purge_Ent( int entID );
01893 
01894 //rww - dynamic vm memory allocation!
01895 void            trap_TrueMalloc(void **ptr, int size);
01896 void            trap_TrueFree(void **ptr);
01897 
01898 //rww - icarus traps
01899 int                     trap_ICARUS_RunScript( gentity_t *ent, const char *name );
01900 qboolean        trap_ICARUS_RegisterScript( const char *name, qboolean bCalledDuringInterrogate);
01901 
01902 void            trap_ICARUS_Init( void );
01903 qboolean        trap_ICARUS_ValidEnt( gentity_t *ent );
01904 qboolean        trap_ICARUS_IsInitialized( int entID );
01905 qboolean        trap_ICARUS_MaintainTaskManager( int entID );
01906 qboolean        trap_ICARUS_IsRunning( int entID );
01907 qboolean        trap_ICARUS_TaskIDPending(gentity_t *ent, int taskID);
01908 void            trap_ICARUS_InitEnt( gentity_t *ent );
01909 void            trap_ICARUS_FreeEnt( gentity_t *ent );
01910 void            trap_ICARUS_AssociateEnt( gentity_t *ent );
01911 void            trap_ICARUS_Shutdown( void );
01912 void            trap_ICARUS_TaskIDSet(gentity_t *ent, int taskType, int taskID);
01913 void            trap_ICARUS_TaskIDComplete(gentity_t *ent, int taskType);
01914 void            trap_ICARUS_SetVar(int taskID, int entID, const char *type_name, const char *data);
01915 int                     trap_ICARUS_VariableDeclared(const char *type_name);
01916 int                     trap_ICARUS_GetFloatVariable( const char *name, float *value );
01917 int                     trap_ICARUS_GetStringVariable( const char *name, const char *value );
01918 int                     trap_ICARUS_GetVectorVariable( const char *name, const vec3_t value );
01919 
01920 
01921 //rww - BEGIN NPC NAV TRAPS
01922 void            trap_Nav_Init( void );
01923 void            trap_Nav_Free( void );
01924 qboolean        trap_Nav_Load( const char *filename, int checksum );
01925 qboolean        trap_Nav_Save( const char *filename, int checksum );
01926 int                     trap_Nav_AddRawPoint( vec3_t point, int flags, int radius );
01927 void            trap_Nav_CalculatePaths( qboolean recalc ); //recalc = qfalse
01928 void            trap_Nav_HardConnect( int first, int second );
01929 
01930 void            trap_Nav_ShowNodes( void );
01931 void            trap_Nav_ShowEdges( void );
01932 void            trap_Nav_ShowPath( int start, int end );
01933 int                     trap_Nav_GetNearestNode( gentity_t *ent, int lastID, int flags, int targetID );
01934 int                     trap_Nav_GetBestNode( int startID, int endID, int rejectID ); //rejectID = NODE_NONE
01935 int                     trap_Nav_GetNodePosition( int nodeID, vec3_t out );
01936 int                     trap_Nav_GetNodeNumEdges( int nodeID );
01937 int                     trap_Nav_GetNodeEdge( int nodeID, int edge );
01938 int                     trap_Nav_GetNumNodes( void );
01939 qboolean        trap_Nav_Connected( int startID, int endID );
01940 int                     trap_Nav_GetPathCost( int startID, int endID );
01941 int                     trap_Nav_GetEdgeCost( int startID, int endID );
01942 int                     trap_Nav_GetProjectedNode( vec3_t origin, int nodeID );
01943 void            trap_Nav_CheckFailedNodes( gentity_t *ent );
01944 void            trap_Nav_AddFailedNode( gentity_t *ent, int nodeID );
01945 qboolean        trap_Nav_NodeFailed( gentity_t *ent, int nodeID );
01946 qboolean        trap_Nav_NodesAreNeighbors( int startID, int endID );
01947 void            trap_Nav_ClearFailedEdge( failedEdge_t  *failedEdge );
01948 void            trap_Nav_ClearAllFailedEdges( void );
01949 int                     trap_Nav_EdgeFailed( int startID, int endID );
01950 void            trap_Nav_AddFailedEdge( int entID, int startID, int endID );
01951 qboolean        trap_Nav_CheckFailedEdge( failedEdge_t *failedEdge );
01952 void            trap_Nav_CheckAllFailedEdges( void );
01953 qboolean        trap_Nav_RouteBlocked( int startID, int testEdgeID, int endID, int rejectRank );
01954 int                     trap_Nav_GetBestNodeAltRoute( int startID, int endID, int *pathCost, int rejectID ); //rejectID = NODE_NONE
01955 int                     trap_Nav_GetBestNodeAltRoute2( int startID, int endID, int rejectID ); //rejectID = NODE_NONE
01956 int                     trap_Nav_GetBestPathBetweenEnts( gentity_t *ent, gentity_t *goal, int flags );
01957 int                     trap_Nav_GetNodeRadius( int nodeID );
01958 void            trap_Nav_CheckBlockedEdges( void );
01959 void            trap_Nav_ClearCheckedNodes( void );
01960 int                     trap_Nav_CheckedNode(int wayPoint, int ent); //return int was byte
01961 void            trap_Nav_SetCheckedNode(int wayPoint, int ent, int value); //int value was byte value
01962 void            trap_Nav_FlagAllNodes( int newFlag );
01963 qboolean        trap_Nav_GetPathsCalculated(void);
01964 void            trap_Nav_SetPathsCalculated(qboolean newVal);
01965 //rww - END NPC NAV TRAPS
01966 
01967 void            trap_SV_RegisterSharedMemory(char *memory);
01968 
01969 void trap_SetActiveSubBSP(int index);
01970 int     trap_CM_RegisterTerrain(const char *config);
01971 void trap_RMG_Init(int terrainID);
01972 
01973 void trap_Bot_UpdateWaypoints(int wpnum, wpobject_t **wps);
01974 void trap_Bot_CalculatePaths(int rmg);
01975 
01976 #include "../namespace_end.h"