Guest User

Untitled

a guest
Jan 12th, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 71.61 KB | None | 0 0
  1. // Copyright (C) 1999-2000 Id Software, Inc.
  2. //
  3. // g_local.h -- local definitions for game module
  4.  
  5. #include "q_shared.h"
  6. #include "bg_public.h"
  7. #include "bg_vehicles.h"
  8. #include "g_public.h"
  9.  
  10. #ifndef __LCC__
  11. #define GAME_INLINE ID_INLINE
  12. #else
  13. #define GAME_INLINE //none
  14. #endif
  15.  
  16. typedef struct gentity_s gentity_t;
  17. typedef struct gclient_s gclient_t;
  18.  
  19. //npc stuff
  20. #include "b_public.h"
  21.  
  22. extern int gPainMOD;
  23. extern int gPainHitLoc;
  24. extern vec3_t gPainPoint;
  25.  
  26. //==================================================================
  27.  
  28. // the "gameversion" client command will print this plus compile date
  29. #define GAMEVERSION "TestMod"
  30.  
  31. #define BODY_QUEUE_SIZE 8
  32.  
  33. #ifndef INFINITE
  34. #define INFINITE 1000000
  35. #endif
  36.  
  37. #define FRAMETIME 100 // msec
  38. #define CARNAGE_REWARD_TIME 3000
  39. #define REWARD_SPRITE_TIME 2000
  40.  
  41. #define INTERMISSION_DELAY_TIME 1000
  42. #define SP_INTERMISSION_DELAY_TIME 5000
  43.  
  44. //primarily used by NPCs
  45. #define START_TIME_LINK_ENTS FRAMETIME*1 // time-delay after map start at which all ents have been spawned, so can link them
  46. #define START_TIME_FIND_LINKS FRAMETIME*2 // time-delay after map start at which you can find linked entities
  47. #define START_TIME_MOVERS_SPAWNED FRAMETIME*2 // time-delay after map start at which all movers should be spawned
  48. #define START_TIME_REMOVE_ENTS FRAMETIME*3 // time-delay after map start to remove temporary ents
  49. #define START_TIME_NAV_CALC FRAMETIME*4 // time-delay after map start to connect waypoints and calc routes
  50. #define START_TIME_FIND_WAYPOINT FRAMETIME*5 // time-delay after map start after which it's okay to try to find your best waypoint
  51.  
  52. // gentity->flags
  53. #define FL_GODMODE 0x00000010
  54. #define FL_NOTARGET 0x00000020
  55. #define FL_TEAMSLAVE 0x00000400 // not the first on the team
  56. #define FL_NO_KNOCKBACK 0x00000800
  57. #define FL_DROPPED_ITEM 0x00001000
  58. #define FL_NO_BOTS 0x00002000 // spawn point not for bot use
  59. #define FL_NO_HUMANS 0x00004000 // spawn point just for bots
  60. #define FL_FORCE_GESTURE 0x00008000 // force gesture on client
  61. #define FL_INACTIVE 0x00010000 // inactive
  62. #define FL_NAVGOAL 0x00020000 // for npc nav stuff
  63. #define FL_DONT_SHOOT 0x00040000
  64. #define FL_SHIELDED 0x00080000
  65. #define FL_UNDYING 0x00100000 // takes damage down to 1, but never dies
  66.  
  67. //ex-eFlags -rww
  68. #define FL_BOUNCE 0x00100000 // for missiles
  69. #define FL_BOUNCE_HALF 0x00200000 // for missiles
  70. #define FL_BOUNCE_SHRAPNEL 0x00400000 // special shrapnel flag
  71.  
  72. //vehicle game-local stuff -rww
  73. #define FL_VEH_BOARDING 0x00800000 // special shrapnel flag
  74.  
  75. //breakable flags -rww
  76. #define FL_DMG_BY_SABER_ONLY 0x01000000 //only take dmg from saber
  77. #define FL_DMG_BY_HEAVY_WEAP_ONLY 0x02000000 //only take dmg from explosives
  78.  
  79. #define FL_BBRUSH 0x04000000 //I am a breakable brush
  80.  
  81. #ifndef FINAL_BUILD
  82. #define DEBUG_SABER_BOX
  83. #endif
  84.  
  85. #define MAX_G_SHARED_BUFFER_SIZE 8192
  86. extern char gSharedBuffer[MAX_G_SHARED_BUFFER_SIZE];
  87.  
  88. // movers are things like doors, plats, buttons, etc
  89. typedef enum {
  90. MOVER_POS1,
  91. MOVER_POS2,
  92. MOVER_1TO2,
  93. MOVER_2TO1
  94. } moverState_t;
  95.  
  96. #define SP_PODIUM_MODEL "models/mapobjects/podium/podium4.md3"
  97.  
  98. typedef enum
  99. {
  100. HL_NONE = 0,
  101. HL_FOOT_RT,
  102. HL_FOOT_LT,
  103. HL_LEG_RT,
  104. HL_LEG_LT,
  105. HL_WAIST,
  106. HL_BACK_RT,
  107. HL_BACK_LT,
  108. HL_BACK,
  109. HL_CHEST_RT,
  110. HL_CHEST_LT,
  111. HL_CHEST,
  112. HL_ARM_RT,
  113. HL_ARM_LT,
  114. HL_HAND_RT,
  115. HL_HAND_LT,
  116. HL_HEAD,
  117. HL_GENERIC1,
  118. HL_GENERIC2,
  119. HL_GENERIC3,
  120. HL_GENERIC4,
  121. HL_GENERIC5,
  122. HL_GENERIC6,
  123. HL_MAX
  124. } hitLocation_t;
  125.  
  126. //============================================================================
  127. extern void *precachedKyle;
  128. extern void *g2SaberInstance;
  129.  
  130. extern qboolean gEscaping;
  131. extern int gEscapeTime;
  132.  
  133. struct gentity_s {
  134. //rww - entstate must be first, to correspond with the bg shared entity structure
  135. entityState_t s; // communicated by server to clients
  136. playerState_t *playerState; //ptr to playerstate if applicable (for bg ents)
  137. Vehicle_t *m_pVehicle; //vehicle data
  138. void *ghoul2; //g2 instance
  139. int localAnimIndex; //index locally (game/cgame) to anim data for this skel
  140. vec3_t modelScale; //needed for g2 collision
  141.  
  142. //From here up must be the same as centity_t/bgEntity_t
  143.  
  144. entityShared_t r; // shared by both the server system and game
  145.  
  146. //rww - these are shared icarus things. They must be in this order as well in relation to the entityshared structure.
  147. int taskID[NUM_TIDS];
  148. parms_t *parms;
  149. char *behaviorSet[NUM_BSETS];
  150. char *script_targetname;
  151. int delayScriptTime;
  152. char *fullName;
  153.  
  154. //rww - targetname and classname are now shared as well. ICARUS needs access to them.
  155. char *targetname;
  156. char *classname; // set in QuakeEd
  157.  
  158. //rww - and yet more things to share. This is because the nav code is in the exe because it's all C++.
  159. int waypoint; //Set once per frame, if you've moved, and if someone asks
  160. int lastWaypoint; //To make sure you don't double-back
  161. int lastValidWaypoint; //ALWAYS valid -used for tracking someone you lost
  162. int noWaypointTime; //Debouncer - so don't keep checking every waypoint in existance every frame that you can't find one
  163. int combatPoint;
  164. int failedWaypoints[MAX_FAILED_NODES];
  165. int failedWaypointCheckTime;
  166.  
  167. int next_roff_time; //rww - npc's need to know when they're getting roff'd
  168.  
  169. // DO NOT MODIFY ANYTHING ABOVE THIS, THE SERVER
  170. // EXPECTS THE FIELDS IN THAT ORDER!
  171. //================================
  172.  
  173. struct gclient_s *client; // NULL if not a client
  174.  
  175. gNPC_t *NPC;//Only allocated if the entity becomes an NPC
  176. int cantHitEnemyCounter;//HACK - Makes them look for another enemy on the same team if the one they're after can't be hit
  177.  
  178. qboolean noLumbar; //see note in cg_local.h
  179.  
  180. qboolean inuse;
  181.  
  182. int lockCount; //used by NPCs
  183.  
  184. int spawnflags; // set in QuakeEd
  185.  
  186. int teamnodmg; // damage will be ignored if it comes from this team
  187.  
  188. char *roffname; // set in QuakeEd
  189. char *rofftarget; // set in QuakeEd
  190.  
  191. char *healingclass; //set in quakeed
  192. char *healingsound; //set in quakeed
  193. int healingrate; //set in quakeed
  194. int healingDebounce; //debounce for generic object healing shiz
  195.  
  196. char *ownername;
  197.  
  198. int objective;
  199. int side;
  200.  
  201. int passThroughNum; // set to index to pass through (+1) for missiles
  202.  
  203. int aimDebounceTime;
  204. int painDebounceTime;
  205. int attackDebounceTime;
  206. int alliedTeam; // only useable by this team, never target this team
  207.  
  208. int roffid; // if roffname != NULL then set on spawn
  209.  
  210. qboolean neverFree; // if true, FreeEntity will only unlink
  211. // bodyque uses this
  212.  
  213. int flags; // FL_* variables
  214.  
  215. char *model;
  216. char *model2;
  217. int freetime; // level.time when the object was freed
  218.  
  219. int eventTime; // events will be cleared EVENT_VALID_MSEC after set
  220. qboolean freeAfterEvent;
  221. qboolean unlinkAfterEvent;
  222.  
  223. qboolean physicsObject; // if true, it can be pushed by movers and fall off edges
  224. // all game items are physicsObjects,
  225. float physicsBounce; // 1.0 = continuous bounce, 0.0 = no bounce
  226. int clipmask; // brushes with this content value will be collided against
  227. // when moving. items and corpses do not collide against
  228. // players, for instance
  229.  
  230. //Only used by NPC_spawners
  231. char *NPC_type;
  232. char *NPC_targetname;
  233. char *NPC_target;
  234.  
  235. // movers
  236. moverState_t moverState;
  237. int soundPos1;
  238. int sound1to2;
  239. int sound2to1;
  240. int soundPos2;
  241. int soundLoop;
  242. gentity_t *parent;
  243. gentity_t *nextTrain;
  244. gentity_t *prevTrain;
  245. vec3_t pos1, pos2;
  246.  
  247. //for npc's
  248. vec3_t pos3;
  249.  
  250. char *message;
  251.  
  252. int timestamp; // body queue sinking, etc
  253.  
  254. float angle; // set in editor, -1 = up, -2 = down
  255. char *target;
  256. char *target2;
  257. char *target3; //For multiple targets, not used for firing/triggering/using, though, only for path branches
  258. char *target4; //For multiple targets, not used for firing/triggering/using, though, only for path branches
  259. char *target5; //mainly added for siege items
  260. char *target6; //mainly added for siege items
  261.  
  262. char *team;
  263. char *targetShaderName;
  264. char *targetShaderNewName;
  265. gentity_t *target_ent;
  266.  
  267. char *closetarget;
  268. char *opentarget;
  269. char *paintarget;
  270.  
  271. char *goaltarget;
  272. char *idealclass;
  273.  
  274. float radius;
  275.  
  276. int maxHealth; //used as a base for crosshair health display
  277.  
  278. float speed;
  279. vec3_t movedir;
  280. float mass;
  281. int setTime;
  282.  
  283. //Think Functions
  284. int nextthink;
  285. void (*think)(gentity_t *self);
  286. void (*reached)(gentity_t *self); // movers call this when hitting endpoint
  287. void (*blocked)(gentity_t *self, gentity_t *other);
  288. void (*touch)(gentity_t *self, gentity_t *other, trace_t *trace);
  289. void (*use)(gentity_t *self, gentity_t *other, gentity_t *activator);
  290. void (*pain)(gentity_t *self, gentity_t *attacker, int damage);
  291. void (*die)(gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int damage, int mod);
  292.  
  293. int pain_debounce_time;
  294. int fly_sound_debounce_time; // wind tunnel
  295. int last_move_time;
  296.  
  297. //Health and damage fields
  298. int health;
  299. qboolean takedamage;
  300. material_t material;
  301.  
  302. int damage;
  303. int dflags;
  304. int splashDamage; // quad will increase this without increasing radius
  305. int splashRadius;
  306. int methodOfDeath;
  307. int splashMethodOfDeath;
  308.  
  309. int locationDamage[HL_MAX]; // Damage accumulated on different body locations
  310.  
  311. int count;
  312. int bounceCount;
  313. qboolean alt_fire;
  314.  
  315. gentity_t *chain;
  316. gentity_t *enemy;
  317. gentity_t *lastEnemy;
  318. gentity_t *activator;
  319. gentity_t *teamchain; // next entity in team
  320. gentity_t *teammaster; // master of the team
  321.  
  322. int watertype;
  323. int waterlevel;
  324.  
  325. int noise_index;
  326.  
  327. // timing variables
  328. float wait;
  329. float random;
  330. int delay;
  331.  
  332. //generic values used by various entities for different purposes.
  333. int genericValue1;
  334. int genericValue2;
  335. int genericValue3;
  336. int genericValue4;
  337. int genericValue5;
  338. int genericValue6;
  339. int genericValue7;
  340. int genericValue8;
  341. int genericValue9;
  342. int genericValue10;
  343. int genericValue11;
  344. int genericValue12;
  345. int genericValue13;
  346. int genericValue14;
  347. int genericValue15;
  348.  
  349. char *soundSet;
  350.  
  351. qboolean isSaberEntity;
  352.  
  353. int damageRedirect; //if entity takes damage, redirect to..
  354. int damageRedirectTo; //this entity number
  355.  
  356. vec3_t epVelocity;
  357. float epGravFactor;
  358.  
  359. gitem_t *item; // for bonus items
  360.  
  361. int killStreak;
  362. };
  363.  
  364. #define DAMAGEREDIRECT_HEAD 1
  365. #define DAMAGEREDIRECT_RLEG 2
  366. #define DAMAGEREDIRECT_LLEG 3
  367.  
  368. typedef enum {
  369. CON_DISCONNECTED,
  370. CON_CONNECTING,
  371. CON_CONNECTED
  372. } clientConnected_t;
  373.  
  374. typedef enum {
  375. SPECTATOR_NOT,
  376. SPECTATOR_FREE,
  377. SPECTATOR_FOLLOW,
  378. SPECTATOR_SCOREBOARD
  379. } spectatorState_t;
  380.  
  381. typedef enum {
  382. TEAM_BEGIN, // Beginning a team game, spawn at base
  383. TEAM_ACTIVE // Now actively playing
  384. } playerTeamStateState_t;
  385.  
  386. typedef struct {
  387. playerTeamStateState_t state;
  388.  
  389. int location;
  390.  
  391. int captures;
  392. int basedefense;
  393. int carrierdefense;
  394. int flagrecovery;
  395. int fragcarrier;
  396. int assists;
  397.  
  398. float lasthurtcarrier;
  399. float lastreturnedflag;
  400. float flagsince;
  401. float lastfraggedcarrier;
  402. } playerTeamState_t;
  403.  
  404. // the auto following clients don't follow a specific client
  405. // number, but instead follow the first two active players
  406. #define FOLLOW_ACTIVE1 -1
  407. #define FOLLOW_ACTIVE2 -2
  408.  
  409. // client data that stays across multiple levels or tournament restarts
  410. // this is achieved by writing all the data to cvar strings at game shutdown
  411. // time and reading them back at connection time. Anything added here
  412. // MUST be dealt with in G_InitSessionData() / G_ReadSessionData() / G_WriteSessionData()
  413. typedef struct {
  414. team_t sessionTeam;
  415. int spectatorTime; // for determining next-in-line to play
  416. spectatorState_t spectatorState;
  417. int spectatorClient; // for chasecam and follow mode
  418. int wins, losses; // tournament stats
  419. int selectedFP; // check against this, if doesn't match value in playerstate then update userinfo
  420. int saberLevel; // similar to above method, but for current saber attack level
  421. int setForce; // set to true once player is given the chance to set force powers
  422. int updateUITime; // only update userinfo for FP/SL if < level.time
  423. qboolean teamLeader; // true when this client is a team leader
  424. char siegeClass[64];
  425. char saberType[64];
  426. char saber2Type[64];
  427. int duelTeam;
  428. int siegeDesiredTeam;
  429. } clientSession_t;
  430.  
  431. // playerstate mGameFlags
  432. #define PSG_VOTED (1<<0) // already cast a vote
  433. #define PSG_TEAMVOTED (1<<1) // already cast a team vote
  434.  
  435. //
  436. #define MAX_NETNAME 36
  437. #define MAX_VOTE_COUNT 3
  438.  
  439. // client data that stays across multiple respawns, but is cleared
  440. // on each level change or team change at ClientBegin()
  441. typedef struct {
  442. clientConnected_t connected;
  443. usercmd_t cmd; // we would lose angles if not persistant
  444. qboolean localClient; // true if "ip" info key is "localhost"
  445. qboolean initialSpawn; // the first spawn should be at a cool location
  446. qboolean predictItemPickup; // based on cg_predictItems userinfo
  447. qboolean pmoveFixed; //
  448. char netname[MAX_NETNAME];
  449. int netnameTime; // Last time the name was changed
  450. int maxHealth; // for handicapping
  451. int enterTime; // level.time the client entered the game
  452. playerTeamState_t teamState; // status in teamplay games
  453. int voteCount; // to prevent people from constantly calling votes
  454. int teamVoteCount; // to prevent people from constantly calling votes
  455. qboolean teamInfo; // send team overlay updates?
  456. } clientPersistant_t;
  457.  
  458. typedef struct renderInfo_s
  459. {
  460. //In whole degrees, How far to let the different model parts yaw and pitch
  461. int headYawRangeLeft;
  462. int headYawRangeRight;
  463. int headPitchRangeUp;
  464. int headPitchRangeDown;
  465.  
  466. int torsoYawRangeLeft;
  467. int torsoYawRangeRight;
  468. int torsoPitchRangeUp;
  469. int torsoPitchRangeDown;
  470.  
  471. int legsFrame;
  472. int torsoFrame;
  473.  
  474. float legsFpsMod;
  475. float torsoFpsMod;
  476.  
  477. //Fields to apply to entire model set, individual model's equivalents will modify this value
  478. vec3_t customRGB;//Red Green Blue, 0 = don't apply
  479. int customAlpha;//Alpha to apply, 0 = none?
  480.  
  481. //RF?
  482. int renderFlags;
  483.  
  484. //
  485. vec3_t muzzlePoint;
  486. vec3_t muzzleDir;
  487. vec3_t muzzlePointOld;
  488. vec3_t muzzleDirOld;
  489. //vec3_t muzzlePointNext; // Muzzle point one server frame in the future!
  490. //vec3_t muzzleDirNext;
  491. int mPCalcTime;//Last time muzzle point was calced
  492.  
  493. //
  494. float lockYaw;//
  495.  
  496. //
  497. vec3_t headPoint;//Where your tag_head is
  498. vec3_t headAngles;//where the tag_head in the torso is pointing
  499. vec3_t handRPoint;//where your right hand is
  500. vec3_t handLPoint;//where your left hand is
  501. vec3_t crotchPoint;//Where your crotch is
  502. vec3_t footRPoint;//where your right hand is
  503. vec3_t footLPoint;//where your left hand is
  504. vec3_t torsoPoint;//Where your chest is
  505. vec3_t torsoAngles;//Where the chest is pointing
  506. vec3_t eyePoint;//Where your eyes are
  507. vec3_t eyeAngles;//Where your eyes face
  508. int lookTarget;//Which ent to look at with lookAngles
  509. lookMode_t lookMode;
  510. int lookTargetClearTime;//Time to clear the lookTarget
  511. int lastVoiceVolume;//Last frame's voice volume
  512. vec3_t lastHeadAngles;//Last headAngles, NOT actual facing of head model
  513. vec3_t headBobAngles;//headAngle offsets
  514. vec3_t targetHeadBobAngles;//head bob angles will try to get to targetHeadBobAngles
  515. int lookingDebounceTime;//When we can stop using head looking angle behavior
  516. float legsYaw;//yaw angle your legs are actually rendering at
  517.  
  518. //for tracking legitimate bolt indecies
  519. void *lastG2; //if it doesn't match ent->ghoul2, the bolts are considered invalid.
  520. int headBolt;
  521. int handRBolt;
  522. int handLBolt;
  523. int torsoBolt;
  524. int crotchBolt;
  525. int footRBolt;
  526. int footLBolt;
  527. int motionBolt;
  528.  
  529. int boltValidityTime;
  530. } renderInfo_t;
  531.  
  532. // this structure is cleared on each ClientSpawn(),
  533. // except for 'client->pers' and 'client->sess'
  534. struct gclient_s {
  535. // ps MUST be the first element, because the server expects it
  536. playerState_t ps; // communicated by server to clients
  537.  
  538. // the rest of the structure is private to game
  539. clientPersistant_t pers;
  540. clientSession_t sess;
  541.  
  542. saberInfo_t saber[MAX_SABERS];
  543. void *weaponGhoul2[MAX_SABERS];
  544.  
  545. int tossableItemDebounce;
  546.  
  547. int bodyGrabTime;
  548. int bodyGrabIndex;
  549.  
  550. int pushEffectTime;
  551.  
  552. int invulnerableTimer;
  553.  
  554. int saberCycleQueue;
  555.  
  556. int legsAnimExecute;
  557. int torsoAnimExecute;
  558. qboolean legsLastFlip;
  559. qboolean torsoLastFlip;
  560.  
  561. qboolean readyToExit; // wishes to leave the intermission
  562.  
  563. qboolean noclip;
  564.  
  565. int lastCmdTime; // level.time of last usercmd_t, for EF_CONNECTION
  566. // we can't just use pers.lastCommand.time, because
  567. // of the g_sycronousclients case
  568. int buttons;
  569. int oldbuttons;
  570. int latched_buttons;
  571.  
  572. vec3_t oldOrigin;
  573.  
  574. // sum up damage over an entire frame, so
  575. // shotgun blasts give a single big kick
  576. int damage_armor; // damage absorbed by armor
  577. int damage_blood; // damage taken out of health
  578. int damage_knockback; // impact damage
  579. vec3_t damage_from; // origin for vector calculation
  580. qboolean damage_fromWorld; // if true, don't use the damage_from vector
  581.  
  582. int damageBoxHandle_Head; //entity number of head damage box
  583. int damageBoxHandle_RLeg; //entity number of right leg damage box
  584. int damageBoxHandle_LLeg; //entity number of left leg damage box
  585.  
  586. int accurateCount; // for "impressive" reward sound
  587.  
  588. int accuracy_shots; // total number of shots
  589. int accuracy_hits; // total number of hits
  590.  
  591. //
  592. int lastkilled_client; // last client that this client killed
  593. int lasthurt_client; // last client that damaged this client
  594. int lasthurt_mod; // type of damage the client did
  595.  
  596. // timers
  597. int respawnTime; // can respawn when time > this, force after g_forcerespwan
  598. int inactivityTime; // kick players when time > this
  599. qboolean inactivityWarning; // qtrue if the five seoond warning has been given
  600. int rewardTime; // clear the EF_AWARD_IMPRESSIVE, etc when time > this
  601.  
  602. int airOutTime;
  603.  
  604. int lastKillTime; // for multiple kill rewards
  605.  
  606. qboolean fireHeld; // used for hook
  607. gentity_t *hook; // grapple hook if out
  608.  
  609. int switchTeamTime; // time the player switched teams
  610.  
  611. int switchDuelTeamTime; // time the player switched duel teams
  612.  
  613. int switchClassTime; // class changed debounce timer
  614.  
  615. // timeResidual is used to handle events that happen every second
  616. // like health / armor countdowns and regeneration
  617. int timeResidual;
  618.  
  619. char *areabits;
  620.  
  621. int g2LastSurfaceHit; //index of surface hit during the most recent ghoul2 collision performed on this client.
  622. int g2LastSurfaceTime; //time when the surface index was set (to make sure it's up to date)
  623.  
  624. int corrTime;
  625.  
  626. vec3_t lastHeadAngles;
  627. int lookTime;
  628.  
  629. int brokenLimbs;
  630.  
  631. qboolean noCorpse; //don't leave a corpse on respawn this time.
  632.  
  633. int jetPackTime;
  634.  
  635. qboolean jetPackOn;
  636. int jetPackToggleTime;
  637. int jetPackDebRecharge;
  638. int jetPackDebReduce;
  639.  
  640. int cloakToggleTime;
  641. int cloakDebRecharge;
  642. int cloakDebReduce;
  643.  
  644. int saberStoredIndex; //stores saberEntityNum from playerstate for when it's set to 0 (indicating saber was knocked out of the air)
  645.  
  646. int saberKnockedTime; //if saber gets knocked away, can't pull it back until this value is < level.time
  647.  
  648. vec3_t olderSaberBase; //Set before lastSaberBase_Always, to whatever lastSaberBase_Always was previously
  649. qboolean olderIsValid; //is it valid?
  650.  
  651. vec3_t lastSaberDir_Always; //every getboltmatrix, set to saber dir
  652. vec3_t lastSaberBase_Always; //every getboltmatrix, set to saber base
  653. int lastSaberStorageTime; //server time that the above two values were updated (for making sure they aren't out of date)
  654.  
  655. qboolean hasCurrentPosition; //are lastSaberTip and lastSaberBase valid?
  656.  
  657. int dangerTime; // level.time when last attack occured
  658.  
  659. int idleTime; //keep track of when to play an idle anim on the client.
  660.  
  661. int idleHealth; //stop idling if health decreases
  662. vec3_t idleViewAngles; //stop idling if viewangles change
  663.  
  664. int forcePowerSoundDebounce; //if > level.time, don't do certain sound events again (drain sound, absorb sound, etc)
  665.  
  666. char modelname[MAX_QPATH];
  667.  
  668. qboolean fjDidJump;
  669.  
  670. qboolean ikStatus;
  671.  
  672. int throwingIndex;
  673. int beingThrown;
  674. int doingThrow;
  675.  
  676. float hiddenDist;//How close ents have to be to pick you up as an enemy
  677. vec3_t hiddenDir;//Normalized direction in which NPCs can't see you (you are hidden)
  678.  
  679. renderInfo_t renderInfo;
  680.  
  681. //mostly NPC stuff:
  682. npcteam_t playerTeam;
  683. npcteam_t enemyTeam;
  684. char *squadname;
  685. gentity_t *team_leader;
  686. gentity_t *leader;
  687. gentity_t *follower;
  688. int numFollowers;
  689. gentity_t *formationGoal;
  690. int nextFormGoal;
  691. class_t NPC_class;
  692.  
  693. vec3_t pushVec;
  694. int pushVecTime;
  695.  
  696. int siegeClass;
  697. int holdingObjectiveItem;
  698.  
  699. //time values for when being healed/supplied by supplier class
  700. int isMedHealed;
  701. int isMedSupplied;
  702.  
  703. //seperate debounce time for refilling someone's ammo as a supplier
  704. int medSupplyDebounce;
  705.  
  706. //used in conjunction with ps.hackingTime
  707. int isHacking;
  708. vec3_t hackingAngles;
  709.  
  710. //debounce time for sending extended siege data to certain classes
  711. int siegeEDataSend;
  712.  
  713. int ewebIndex; //index of e-web gun if spawned
  714. int ewebTime; //e-web use debounce
  715. int ewebHealth; //health of e-web (to keep track between deployments)
  716.  
  717. int inSpaceIndex; //ent index of space trigger if inside one
  718. int inSpaceSuffocation; //suffocation timer
  719.  
  720. int tempSpectate; //time to force spectator mode
  721.  
  722. //keep track of last person kicked and the time so we don't hit multiple times per kick
  723. int jediKickIndex;
  724. int jediKickTime;
  725.  
  726. //special moves (designed for kyle boss npc, but useable by players in mp)
  727. int grappleIndex;
  728. int grappleState;
  729.  
  730. int solidHack;
  731.  
  732. int noLightningTime;
  733.  
  734. unsigned mGameFlags;
  735.  
  736. //fallen duelist
  737. qboolean iAmALoser;
  738.  
  739. int lastGenCmd;
  740. int lastGenCmdTime;
  741. };
  742.  
  743. //Interest points
  744.  
  745. #define MAX_INTEREST_POINTS 64
  746.  
  747. typedef struct
  748. {
  749. vec3_t origin;
  750. char *target;
  751. } interestPoint_t;
  752.  
  753. //Combat points
  754.  
  755. #define MAX_COMBAT_POINTS 512
  756.  
  757. typedef struct
  758. {
  759. vec3_t origin;
  760. int flags;
  761. // char *NPC_targetname;
  762. // team_t team;
  763. qboolean occupied;
  764. int waypoint;
  765. int dangerTime;
  766. } combatPoint_t;
  767.  
  768. // Alert events
  769.  
  770. #define MAX_ALERT_EVENTS 32
  771.  
  772. typedef enum
  773. {
  774. AET_SIGHT,
  775. AET_SOUND,
  776. } alertEventType_e;
  777.  
  778. typedef enum
  779. {
  780. AEL_MINOR, //Enemy responds to the sound, but only by looking
  781. AEL_SUSPICIOUS, //Enemy looks at the sound, and will also investigate it
  782. AEL_DISCOVERED, //Enemy knows the player is around, and will actively hunt
  783. AEL_DANGER, //Enemy should try to find cover
  784. AEL_DANGER_GREAT, //Enemy should run like hell!
  785. } alertEventLevel_e;
  786.  
  787. typedef struct alertEvent_s
  788. {
  789. vec3_t position; //Where the event is located
  790. float radius; //Consideration radius
  791. alertEventLevel_e level; //Priority level of the event
  792. alertEventType_e type; //Event type (sound,sight)
  793. gentity_t *owner; //Who made the sound
  794. float light; //ambient light level at point
  795. float addLight; //additional light- makes it more noticable, even in darkness
  796. 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
  797. int timestamp; //when it was created
  798. } alertEvent_t;
  799.  
  800. //
  801. // this structure is cleared as each map is entered
  802. //
  803. typedef struct
  804. {
  805. char targetname[MAX_QPATH];
  806. char target[MAX_QPATH];
  807. char target2[MAX_QPATH];
  808. char target3[MAX_QPATH];
  809. char target4[MAX_QPATH];
  810. int nodeID;
  811. } waypointData_t;
  812.  
  813. typedef struct {
  814. struct gclient_s *clients; // [maxclients]
  815.  
  816. struct gentity_s *gentities;
  817. int gentitySize;
  818. int num_entities; // current number, <= MAX_GENTITIES
  819.  
  820. int warmupTime; // restart match at this time
  821.  
  822. fileHandle_t logFile;
  823.  
  824. // store latched cvars here that we want to get at often
  825. int maxclients;
  826.  
  827. int framenum;
  828. int time; // in msec
  829. int previousTime; // so movers can back up when blocked
  830.  
  831. int startTime; // level.time the map was started
  832.  
  833. int teamScores[TEAM_NUM_TEAMS];
  834. int lastTeamLocationTime; // last time of client team location update
  835.  
  836. qboolean newSession; // don't use any old session data, because
  837. // we changed gametype
  838.  
  839. qboolean restarted; // waiting for a map_restart to fire
  840.  
  841. int numConnectedClients;
  842. int numNonSpectatorClients; // includes connecting clients
  843. int numPlayingClients; // connected, non-spectators
  844. int sortedClients[MAX_CLIENTS]; // sorted by score
  845. int follow1, follow2; // clientNums for auto-follow spectators
  846.  
  847. int snd_fry; // sound index for standing in lava
  848.  
  849. int snd_hack; //hacking loop sound
  850. int snd_medHealed; //being healed by supply class
  851. int snd_medSupplied; //being supplied by supply class
  852.  
  853. int warmupModificationCount; // for detecting if g_warmup is changed
  854.  
  855. // voting state
  856. char voteString[MAX_STRING_CHARS];
  857. char voteDisplayString[MAX_STRING_CHARS];
  858. int voteTime; // level.time vote was called
  859. int voteExecuteTime; // time the vote is executed
  860. int voteYes;
  861. int voteNo;
  862. int numVotingClients; // set by CalculateRanks
  863.  
  864. qboolean votingGametype;
  865. int votingGametypeTo;
  866.  
  867. // team voting state
  868. char teamVoteString[2][MAX_STRING_CHARS];
  869. int teamVoteTime[2]; // level.time vote was called
  870. int teamVoteYes[2];
  871. int teamVoteNo[2];
  872. int numteamVotingClients[2];// set by CalculateRanks
  873.  
  874. // spawn variables
  875. qboolean spawning; // the G_Spawn*() functions are valid
  876. int numSpawnVars;
  877. char *spawnVars[MAX_SPAWN_VARS][2]; // key / value pairs
  878. int numSpawnVarChars;
  879. char spawnVarChars[MAX_SPAWN_VARS_CHARS];
  880.  
  881. // intermission state
  882. int intermissionQueued; // intermission was qualified, but
  883. // wait INTERMISSION_DELAY_TIME before
  884. // actually going there so the last
  885. // frag can be watched. Disable future
  886. // kills during this delay
  887. int intermissiontime; // time the intermission was started
  888. char *changemap;
  889. qboolean readyToExit; // at least one client wants to exit
  890. int exitTime;
  891. vec3_t intermission_origin; // also used for spectator spawns
  892. vec3_t intermission_angle;
  893.  
  894. qboolean locationLinked; // target_locations get linked
  895. gentity_t *locationHead; // head of the location list
  896. int bodyQueIndex; // dead bodies
  897. gentity_t *bodyQue[BODY_QUEUE_SIZE];
  898. int portalSequence;
  899.  
  900. alertEvent_t alertEvents[ MAX_ALERT_EVENTS ];
  901. int numAlertEvents;
  902. int curAlertID;
  903.  
  904. AIGroupInfo_t groups[MAX_FRAME_GROUPS];
  905.  
  906. //Interest points- squadmates automatically look at these if standing around and close to them
  907. interestPoint_t interestPoints[MAX_INTEREST_POINTS];
  908. int numInterestPoints;
  909.  
  910. //Combat points- NPCs in bState BS_COMBAT_POINT will find their closest empty combat_point
  911. combatPoint_t combatPoints[MAX_COMBAT_POINTS];
  912. int numCombatPoints;
  913.  
  914. //rwwRMG - added:
  915. int mNumBSPInstances;
  916. int mBSPInstanceDepth;
  917. vec3_t mOriginAdjust;
  918. float mRotationAdjust;
  919. char *mTargetAdjust;
  920.  
  921. char mTeamFilter[MAX_QPATH];
  922.  
  923. } level_locals_t;
  924.  
  925.  
  926. //
  927. // g_spawn.c
  928. //
  929. qboolean G_SpawnString( const char *key, const char *defaultString, char **out );
  930. // spawn string returns a temporary reference, you must CopyString() if you want to keep it
  931. qboolean G_SpawnFloat( const char *key, const char *defaultString, float *out );
  932. qboolean G_SpawnInt( const char *key, const char *defaultString, int *out );
  933. qboolean G_SpawnVector( const char *key, const char *defaultString, float *out );
  934. void G_SpawnEntitiesFromString( qboolean inSubBSP );
  935. char *G_NewString( const char *string );
  936.  
  937. //
  938. // g_cmds.c
  939. //
  940. void Cmd_Score_f (gentity_t *ent);
  941. void StopFollowing( gentity_t *ent );
  942. void BroadcastTeamChange( gclient_t *client, int oldTeam );
  943. void SetTeam( gentity_t *ent, char *s );
  944. void Cmd_FollowCycle_f( gentity_t *ent, int dir );
  945. void Cmd_SaberAttackCycle_f(gentity_t *ent);
  946. int G_ItemUsable(playerState_t *ps, int forcedUse);
  947. void Cmd_ToggleSaber_f(gentity_t *ent);
  948. void Cmd_EngageDuel_f(gentity_t *ent);
  949.  
  950. gentity_t *G_GetDuelWinner(gclient_t *client);
  951.  
  952. //
  953. // g_items.c
  954. //
  955. void ItemUse_Binoculars(gentity_t *ent);
  956. void ItemUse_Shield(gentity_t *ent);
  957. void ItemUse_Sentry(gentity_t *ent);
  958.  
  959. void Jetpack_Off(gentity_t *ent);
  960. void Jetpack_On(gentity_t *ent);
  961. void ItemUse_Jetpack(gentity_t *ent);
  962. void ItemUse_UseCloak( gentity_t *ent );
  963. void ItemUse_UseDisp(gentity_t *ent, int type);
  964. void ItemUse_UseEWeb(gentity_t *ent);
  965. void G_PrecacheDispensers(void);
  966.  
  967. void ItemUse_Seeker(gentity_t *ent);
  968. void ItemUse_MedPack(gentity_t *ent);
  969. void ItemUse_MedPack_Big(gentity_t *ent);
  970.  
  971. void G_CheckTeamItems( void );
  972. void G_RunItem( gentity_t *ent );
  973. void RespawnItem( gentity_t *ent );
  974.  
  975. void UseHoldableItem( gentity_t *ent );
  976. void PrecacheItem (gitem_t *it);
  977. gentity_t *Drop_Item( gentity_t *ent, gitem_t *item, float angle );
  978. gentity_t *LaunchItem( gitem_t *item, vec3_t origin, vec3_t velocity );
  979. void SetRespawn (gentity_t *ent, float delay);
  980. void G_SpawnItem (gentity_t *ent, gitem_t *item);
  981. void FinishSpawningItem( gentity_t *ent );
  982. void Think_Weapon (gentity_t *ent);
  983. int ArmorIndex (gentity_t *ent);
  984. void Add_Ammo (gentity_t *ent, int weapon, int count);
  985. void Touch_Item (gentity_t *ent, gentity_t *other, trace_t *trace);
  986.  
  987. void ClearRegisteredItems( void );
  988. void RegisterItem( gitem_t *item );
  989. void SaveRegisteredItems( void );
  990.  
  991. //
  992. // g_utils.c
  993. //
  994. int G_ModelIndex( const char *name );
  995. int G_SoundIndex( const char *name );
  996. int G_SoundSetIndex(const char *name);
  997. int G_EffectIndex( const char *name );
  998. int G_BSPIndex( const char *name );
  999. int G_IconIndex( const char* name );
  1000.  
  1001. qboolean G_PlayerHasCustomSkeleton(gentity_t *ent);
  1002.  
  1003. void G_TeamCommand( team_t team, char *cmd );
  1004. void G_ScaleNetHealth(gentity_t *self);
  1005. void G_KillBox (gentity_t *ent);
  1006. gentity_t *G_Find (gentity_t *from, int fieldofs, const char *match);
  1007. int G_RadiusList ( vec3_t origin, float radius, gentity_t *ignore, qboolean takeDamage, gentity_t *ent_list[MAX_GENTITIES]);
  1008.  
  1009. void G_Throw( gentity_t *targ, vec3_t newDir, float push );
  1010.  
  1011. void G_FreeFakeClient(gclient_t **cl);
  1012. void G_CreateFakeClient(int entNum, gclient_t **cl);
  1013. void G_CleanAllFakeClients(void);
  1014.  
  1015. void G_SetAnim(gentity_t *ent, usercmd_t *ucmd, int setAnimParts, int anim, int setAnimFlags, int blendTime);
  1016. gentity_t *G_PickTarget (char *targetname);
  1017. void GlobalUse(gentity_t *self, gentity_t *other, gentity_t *activator);
  1018. void G_UseTargets2( gentity_t *ent, gentity_t *activator, const char *string );
  1019. void G_UseTargets (gentity_t *ent, gentity_t *activator);
  1020. void G_SetMovedir ( vec3_t angles, vec3_t movedir);
  1021. void G_SetAngles( gentity_t *ent, vec3_t angles );
  1022.  
  1023. void G_InitGentity( gentity_t *e );
  1024. gentity_t *G_Spawn (void);
  1025. gentity_t *G_TempEntity( vec3_t origin, int event );
  1026. gentity_t *G_PlayEffect(int fxID, vec3_t org, vec3_t ang);
  1027. gentity_t *G_PlayEffectID(const int fxID, vec3_t org, vec3_t ang);
  1028. gentity_t *G_ScreenShake(vec3_t org, gentity_t *target, float intensity, int duration, qboolean global);
  1029. void G_MuteSound( int entnum, int channel );
  1030. void G_Sound( gentity_t *ent, int channel, int soundIndex );
  1031. void G_SoundAtLoc( vec3_t loc, int channel, int soundIndex );
  1032. void G_EntitySound( gentity_t *ent, int channel, int soundIndex );
  1033. void TryUse( gentity_t *ent );
  1034. void G_SendG2KillQueue(void);
  1035. void G_KillG2Queue(int entNum);
  1036. void G_FreeEntity( gentity_t *e );
  1037. qboolean G_EntitiesFree( void );
  1038.  
  1039. qboolean G_ActivateBehavior (gentity_t *self, int bset );
  1040.  
  1041. void G_TouchTriggers (gentity_t *ent);
  1042. void G_TouchSolids (gentity_t *ent);
  1043. void GetAnglesForDirection( const vec3_t p1, const vec3_t p2, vec3_t out );
  1044.  
  1045. //
  1046. // g_object.c
  1047. //
  1048.  
  1049. extern void G_RunObject ( gentity_t *ent );
  1050.  
  1051.  
  1052. float *tv (float x, float y, float z);
  1053. char *vtos( const vec3_t v );
  1054.  
  1055. void G_AddPredictableEvent( gentity_t *ent, int event, int eventParm );
  1056. void G_AddEvent( gentity_t *ent, int event, int eventParm );
  1057. void G_SetOrigin( gentity_t *ent, vec3_t origin );
  1058. qboolean G_CheckInSolid (gentity_t *self, qboolean fix);
  1059. void AddRemap(const char *oldShader, const char *newShader, float timeOffset);
  1060. const char *BuildShaderStateConfig(void);
  1061. /*
  1062. Ghoul2 Insert Start
  1063. */
  1064. int G_BoneIndex( const char *name );
  1065.  
  1066.  
  1067. qhandle_t trap_R_RegisterSkin( const char *name );
  1068.  
  1069. // CG specific API access
  1070. void trap_G2_ListModelSurfaces(void *ghlInfo);
  1071. void trap_G2_ListModelBones(void *ghlInfo, int frame);
  1072. void trap_G2_SetGhoul2ModelIndexes(void *ghoul2, qhandle_t *modelList, qhandle_t *skinList);
  1073. qboolean trap_G2_HaveWeGhoul2Models(void *ghoul2);
  1074. qboolean trap_G2API_GetBoltMatrix(void *ghoul2, const int modelIndex, const int boltIndex, mdxaBone_t *matrix,
  1075. const vec3_t angles, const vec3_t position, const int frameNum, qhandle_t *modelList, vec3_t scale);
  1076. qboolean trap_G2API_GetBoltMatrix_NoReconstruct(void *ghoul2, const int modelIndex, const int boltIndex, mdxaBone_t *matrix,
  1077. const vec3_t angles, const vec3_t position, const int frameNum, qhandle_t *modelList, vec3_t scale);
  1078. qboolean trap_G2API_GetBoltMatrix_NoRecNoRot(void *ghoul2, const int modelIndex, const int boltIndex, mdxaBone_t *matrix,
  1079. const vec3_t angles, const vec3_t position, const int frameNum, qhandle_t *modelList, vec3_t scale);
  1080. int trap_G2API_InitGhoul2Model(void **ghoul2Ptr, const char *fileName, int modelIndex, qhandle_t customSkin,
  1081. qhandle_t customShader, int modelFlags, int lodBias);
  1082. qboolean trap_G2API_SetSkin(void *ghoul2, int modelIndex, qhandle_t customSkin, qhandle_t renderSkin);
  1083.  
  1084. int trap_G2API_Ghoul2Size ( void* ghlInfo );
  1085.  
  1086. int trap_G2API_AddBolt(void *ghoul2, int modelIndex, const char *boneName);
  1087. void trap_G2API_SetBoltInfo(void *ghoul2, int modelIndex, int boltInfo);
  1088.  
  1089. int trap_G2API_CopyGhoul2Instance(void *g2From, void *g2To, int modelIndex);
  1090. void trap_G2API_CopySpecificGhoul2Model(void *g2From, int modelFrom, void *g2To, int modelTo);
  1091. void trap_G2API_DuplicateGhoul2Instance(void *g2From, void **g2To);
  1092. qboolean trap_G2API_HasGhoul2ModelOnIndex(void *ghlInfo, int modelIndex);
  1093. qboolean trap_G2API_RemoveGhoul2Model(void *ghlInfo, int modelIndex);
  1094. qboolean trap_G2API_RemoveGhoul2Models(void *ghlInfo);
  1095. void trap_G2API_CleanGhoul2Models(void **ghoul2Ptr);
  1096. void trap_G2API_CollisionDetect ( CollisionRecord_t *collRecMap, void* ghoul2, const vec3_t angles, const vec3_t position,
  1097. int frameNumber, int entNum, vec3_t rayStart, vec3_t rayEnd, vec3_t scale, int traceFlags, int useLod, float fRadius );
  1098. void trap_G2API_CollisionDetectCache ( CollisionRecord_t *collRecMap, void* ghoul2, const vec3_t angles, const vec3_t position,
  1099. int frameNumber, int entNum, vec3_t rayStart, vec3_t rayEnd, vec3_t scale, int traceFlags, int useLod, float fRadius );
  1100.  
  1101. qboolean trap_G2API_SetBoneAngles(void *ghoul2, int modelIndex, const char *boneName, const vec3_t angles, const int flags,
  1102. const int up, const int right, const int forward, qhandle_t *modelList,
  1103. int blendTime , int currentTime );
  1104. void trap_G2API_GetGLAName(void *ghoul2, int modelIndex, char *fillBuf);
  1105. qboolean trap_G2API_SetBoneAnim(void *ghoul2, const int modelIndex, const char *boneName, const int startFrame, const int endFrame,
  1106. const int flags, const float animSpeed, const int currentTime, const float setFrame , const int blendTime );
  1107. qboolean trap_G2API_GetBoneAnim(void *ghoul2, const char *boneName, const int currentTime, float *currentFrame, int *startFrame,
  1108. int *endFrame, int *flags, float *animSpeed, int *modelList, const int modelIndex);
  1109. void trap_G2API_GetSurfaceName(void *ghoul2, int surfNumber, int modelIndex, char *fillBuf);
  1110. qboolean trap_G2API_SetRootSurface(void *ghoul2, const int modelIndex, const char *surfaceName);
  1111. qboolean trap_G2API_SetSurfaceOnOff(void *ghoul2, const char *surfaceName, const int flags);
  1112. qboolean trap_G2API_SetNewOrigin(void *ghoul2, const int boltIndex);
  1113. qboolean trap_G2API_DoesBoneExist(void *ghoul2, int modelIndex, const char *boneName);
  1114. int trap_G2API_GetSurfaceRenderStatus(void *ghoul2, const int modelIndex, const char *surfaceName);
  1115.  
  1116. void trap_G2API_AbsurdSmoothing(void *ghoul2, qboolean status);
  1117.  
  1118. void trap_G2API_SetRagDoll(void *ghoul2, sharedRagDollParams_t *params);
  1119. void trap_G2API_AnimateG2Models(void *ghoul2, int time, sharedRagDollUpdateParams_t *params);
  1120.  
  1121. //additional ragdoll options -rww
  1122. qboolean trap_G2API_RagPCJConstraint(void *ghoul2, const char *boneName, vec3_t min, vec3_t max); //override default pcj bonee constraints
  1123. qboolean trap_G2API_RagPCJGradientSpeed(void *ghoul2, const char *boneName, const float speed); //override the default gradient movespeed for a pcj bone
  1124. qboolean trap_G2API_RagEffectorGoal(void *ghoul2, const char *boneName, vec3_t pos); //override an effector bone's goal position (world coordinates)
  1125. 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)
  1126. qboolean trap_G2API_RagEffectorKick(void *ghoul2, const char *boneName, vec3_t velocity); //add velocity to a rag bone
  1127. qboolean trap_G2API_RagForceSolve(void *ghoul2, qboolean force); //make sure we are actively performing solve/settle routines, if desired
  1128.  
  1129. qboolean trap_G2API_SetBoneIKState(void *ghoul2, int time, const char *boneName, int ikState, sharedSetBoneIKStateParams_t *params);
  1130. qboolean trap_G2API_IKMove(void *ghoul2, int time, sharedIKMoveParams_t *params);
  1131.  
  1132. //for removing bones so they no longer have their own seperate animation hierarchy. Or whatever reason you may have. -rww
  1133. qboolean trap_G2API_RemoveBone(void *ghoul2, const char *boneName, int modelIndex);
  1134.  
  1135. void trap_G2API_AttachInstanceToEntNum(void *ghoul2, int entityNum, qboolean server);
  1136. void trap_G2API_ClearAttachedInstance(int entityNum);
  1137. void trap_G2API_CleanEntAttachments(void);
  1138. qboolean trap_G2API_OverrideServer(void *serverInstance);
  1139.  
  1140.  
  1141. /*
  1142. Ghoul2 Insert End
  1143. */
  1144.  
  1145. //
  1146. // g_combat.c
  1147. //
  1148. qboolean CanDamage (gentity_t *targ, vec3_t origin);
  1149. void G_Damage (gentity_t *targ, gentity_t *inflictor, gentity_t *attacker, vec3_t dir, vec3_t point, int damage, int dflags, int mod);
  1150. qboolean G_RadiusDamage (vec3_t origin, gentity_t *attacker, float damage, float radius, gentity_t *ignore, gentity_t *missile, int mod);
  1151. void body_die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int damage, int meansOfDeath );
  1152. void TossClientWeapon(gentity_t *self, vec3_t direction, float speed);
  1153. void TossClientItems( gentity_t *self );
  1154. void TossClientCubes( gentity_t *self );
  1155. void ExplodeDeath( gentity_t *self );
  1156. void G_CheckForDismemberment(gentity_t *ent, gentity_t *enemy, vec3_t point, int damage, int deathAnim, qboolean postDeath);
  1157. extern int gGAvoidDismember;
  1158.  
  1159.  
  1160. // damage flags
  1161. #define DAMAGE_NORMAL 0x00000000 // No flags set.
  1162. #define DAMAGE_RADIUS 0x00000001 // damage was indirect
  1163. #define DAMAGE_NO_ARMOR 0x00000002 // armour does not protect from this damage
  1164. #define DAMAGE_NO_KNOCKBACK 0x00000004 // do not affect velocity, just view angles
  1165. #define DAMAGE_NO_PROTECTION 0x00000008 // armor, shields, invulnerability, and godmode have no effect
  1166. #define DAMAGE_NO_TEAM_PROTECTION 0x00000010 // armor, shields, invulnerability, and godmode have no effect
  1167. //JK2 flags
  1168. #define DAMAGE_EXTRA_KNOCKBACK 0x00000040 // add extra knockback to this damage
  1169. #define DAMAGE_DEATH_KNOCKBACK 0x00000080 // only does knockback on death of target
  1170. #define DAMAGE_IGNORE_TEAM 0x00000100 // damage is always done, regardless of teams
  1171. #define DAMAGE_NO_DAMAGE 0x00000200 // do no actual damage but react as if damage was taken
  1172. #define DAMAGE_HALF_ABSORB 0x00000400 // half shields, half health
  1173. #define DAMAGE_HALF_ARMOR_REDUCTION 0x00000800 // This damage doesn't whittle down armor as efficiently.
  1174. #define DAMAGE_HEAVY_WEAP_CLASS 0x00001000 // Heavy damage
  1175. #define DAMAGE_NO_HIT_LOC 0x00002000 // No hit location
  1176. #define DAMAGE_NO_SELF_PROTECTION 0x00004000 // Dont apply half damage to self attacks
  1177. #define DAMAGE_NO_DISMEMBER 0x00008000 // Dont do dismemberment
  1178. #define DAMAGE_SABER_KNOCKBACK1 0x00010000 // Check the attacker's first saber for a knockbackScale
  1179. #define DAMAGE_SABER_KNOCKBACK2 0x00020000 // Check the attacker's second saber for a knockbackScale
  1180. #define DAMAGE_SABER_KNOCKBACK1_B2 0x00040000 // Check the attacker's first saber for a knockbackScale2
  1181. #define DAMAGE_SABER_KNOCKBACK2_B2 0x00080000 // Check the attacker's second saber for a knockbackScale2
  1182. //
  1183. // g_exphysics.c
  1184. //
  1185. void G_RunExPhys(gentity_t *ent, float gravity, float mass, float bounce, qboolean autoKill, int *g2Bolts, int numG2Bolts);
  1186.  
  1187. //
  1188. // g_missile.c
  1189. //
  1190. void G_ReflectMissile( gentity_t *ent, gentity_t *missile, vec3_t forward );
  1191.  
  1192. void G_RunMissile( gentity_t *ent );
  1193.  
  1194. gentity_t *CreateMissile( vec3_t org, vec3_t dir, float vel, int life,
  1195. gentity_t *owner, qboolean altFire);
  1196. void G_BounceProjectile( vec3_t start, vec3_t impact, vec3_t dir, vec3_t endout );
  1197. void G_ExplodeMissile( gentity_t *ent );
  1198.  
  1199. void WP_FireBlasterMissile( gentity_t *ent, vec3_t start, vec3_t dir, qboolean altFire );
  1200.  
  1201.  
  1202. //
  1203. // g_mover.c
  1204. //
  1205. extern int BMS_START;
  1206. extern int BMS_MID;
  1207. extern int BMS_END;
  1208.  
  1209. #define SPF_BUTTON_USABLE 1
  1210. #define SPF_BUTTON_FPUSHABLE 2
  1211. void G_PlayDoorLoopSound( gentity_t *ent );
  1212. void G_PlayDoorSound( gentity_t *ent, int type );
  1213. void G_RunMover( gentity_t *ent );
  1214. void Touch_DoorTrigger( gentity_t *ent, gentity_t *other, trace_t *trace );
  1215.  
  1216. //
  1217. // g_trigger.c
  1218. //
  1219. void trigger_teleporter_touch (gentity_t *self, gentity_t *other, trace_t *trace );
  1220.  
  1221.  
  1222. //
  1223. // g_misc.c
  1224. //
  1225. #define MAX_REFNAME 32
  1226. #define START_TIME_LINK_ENTS FRAMETIME*1
  1227.  
  1228. #define RTF_NONE 0
  1229. #define RTF_NAVGOAL 0x00000001
  1230.  
  1231. typedef struct reference_tag_s
  1232. {
  1233. char name[MAX_REFNAME];
  1234. vec3_t origin;
  1235. vec3_t angles;
  1236. int flags; //Just in case
  1237. int radius; //For nav goals
  1238. qboolean inuse;
  1239. } reference_tag_t;
  1240.  
  1241. void TAG_Init( void );
  1242. reference_tag_t *TAG_Find( const char *owner, const char *name );
  1243. reference_tag_t *TAG_Add( const char *name, const char *owner, vec3_t origin, vec3_t angles, int radius, int flags );
  1244. int TAG_GetOrigin( const char *owner, const char *name, vec3_t origin );
  1245. int TAG_GetOrigin2( const char *owner, const char *name, vec3_t origin );
  1246. int TAG_GetAngles( const char *owner, const char *name, vec3_t angles );
  1247. int TAG_GetRadius( const char *owner, const char *name );
  1248. int TAG_GetFlags( const char *owner, const char *name );
  1249.  
  1250. void TeleportPlayer( gentity_t *player, vec3_t origin, vec3_t angles );
  1251.  
  1252. //
  1253. // g_weapon.c
  1254. //
  1255. void WP_FireTurretMissile( gentity_t *ent, vec3_t start, vec3_t dir, qboolean altFire, int damage, int velocity, int mod, gentity_t *ignore );
  1256. void WP_FireGenericBlasterMissile( gentity_t *ent, vec3_t start, vec3_t dir, qboolean altFire, int damage, int velocity, int mod );
  1257. qboolean LogAccuracyHit( gentity_t *target, gentity_t *attacker );
  1258. void CalcMuzzlePoint ( gentity_t *ent, vec3_t forward, vec3_t right, vec3_t up, vec3_t muzzlePoint );
  1259. void SnapVectorTowards( vec3_t v, vec3_t to );
  1260. qboolean CheckGauntletAttack( gentity_t *ent );
  1261.  
  1262.  
  1263. //
  1264. // g_client.c
  1265. //
  1266. team_t TeamCount( int ignoreClientNum, int team );
  1267. int TeamLeader( int team );
  1268. team_t PickTeam( int ignoreClientNum );
  1269. void SetClientViewAngle( gentity_t *ent, vec3_t angle );
  1270. gentity_t *SelectSpawnPoint ( vec3_t avoidPoint, vec3_t origin, vec3_t angles, team_t team );
  1271. void MaintainBodyQueue(gentity_t *ent);
  1272. void respawn (gentity_t *ent);
  1273. void BeginIntermission (void);
  1274. void InitBodyQue (void);
  1275. void ClientSpawn( gentity_t *ent );
  1276. void player_die (gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int damage, int mod);
  1277. void AddScore( gentity_t *ent, vec3_t origin, int score );
  1278. void CalculateRanks( void );
  1279. qboolean SpotWouldTelefrag( gentity_t *spot );
  1280.  
  1281. extern gentity_t *gJMSaberEnt;
  1282.  
  1283. //
  1284. // g_svcmds.c
  1285. //
  1286. qboolean ConsoleCommand( void );
  1287. void G_ProcessIPBans(void);
  1288. qboolean G_FilterPacket (char *from);
  1289.  
  1290. //
  1291. // g_weapon.c
  1292. //
  1293. void FireWeapon( gentity_t *ent, qboolean altFire );
  1294. void BlowDetpacks(gentity_t *ent);
  1295.  
  1296. //
  1297. // p_hud.c
  1298. //
  1299. void MoveClientToIntermission (gentity_t *client);
  1300. void G_SetStats (gentity_t *ent);
  1301. void DeathmatchScoreboardMessage (gentity_t *client);
  1302.  
  1303. //
  1304. // g_cmds.c
  1305. //
  1306.  
  1307. //
  1308. // g_pweapon.c
  1309. //
  1310.  
  1311.  
  1312. //
  1313. // g_main.c
  1314. //
  1315. extern vmCvar_t g_ff_objectives;
  1316. extern qboolean gDoSlowMoDuel;
  1317. extern int gSlowMoDuelTime;
  1318.  
  1319. void G_PowerDuelCount(int *loners, int *doubles, qboolean countSpec);
  1320.  
  1321. void FindIntermissionPoint( void );
  1322. void SetLeader(int team, int client);
  1323. void CheckTeamLeader( int team );
  1324. void G_RunThink (gentity_t *ent);
  1325. void QDECL G_LogPrintf( const char *fmt, ... );
  1326. void SendScoreboardMessageToAllClients( void );
  1327. void QDECL G_Printf( const char *fmt, ... );
  1328. void QDECL G_Error( const char *fmt, ... );
  1329. const char *G_GetStringEdString(char *refSection, char *refName);
  1330.  
  1331. //
  1332. // g_client.c
  1333. //
  1334. char *ClientConnect( int clientNum, qboolean firstTime, qboolean isBot );
  1335. void ClientUserinfoChanged( int clientNum );
  1336. void ClientDisconnect( int clientNum );
  1337. void ClientBegin( int clientNum, qboolean allowTeamReset );
  1338. void G_BreakArm(gentity_t *ent, int arm);
  1339. void G_UpdateClientAnims(gentity_t *self, float animSpeedScale);
  1340. void ClientCommand( int clientNum );
  1341.  
  1342. //
  1343. // g_active.c
  1344. //
  1345. void G_CheckClientTimeouts ( gentity_t *ent );
  1346. void ClientThink ( int clientNum, usercmd_t *ucmd );
  1347. void ClientEndFrame ( gentity_t *ent );
  1348. void G_RunClient ( gentity_t *ent );
  1349.  
  1350. //
  1351. // g_team.c
  1352. //
  1353. qboolean OnSameTeam( gentity_t *ent1, gentity_t *ent2 );
  1354. void Team_CheckDroppedItem( gentity_t *dropped );
  1355.  
  1356. //
  1357. // g_mem.c
  1358. //
  1359. void *G_Alloc( int size );
  1360. void G_InitMemory( void );
  1361. void Svcmd_GameMem_f( void );
  1362.  
  1363. //
  1364. // g_session.c
  1365. //
  1366. void G_ReadSessionData( gclient_t *client );
  1367. void G_InitSessionData( gclient_t *client, char *userinfo, qboolean isBot );
  1368.  
  1369. void G_InitWorldSession( void );
  1370. void G_WriteSessionData( void );
  1371.  
  1372. //
  1373. // NPC_senses.cpp
  1374. //
  1375. extern void AddSightEvent( gentity_t *owner, vec3_t position, float radius, alertEventLevel_e alertLevel, float addLight ); //addLight = 0.0f
  1376. extern void AddSoundEvent( gentity_t *owner, vec3_t position, float radius, alertEventLevel_e alertLevel, qboolean needLOS ); //needLOS = qfalse
  1377. extern qboolean G_CheckForDanger( gentity_t *self, int alertEvent );
  1378. 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
  1379. extern qboolean G_CheckForDanger( gentity_t *self, int alertEvent );
  1380. extern qboolean G_ClearLOS( gentity_t *self, const vec3_t start, const vec3_t end );
  1381. extern qboolean G_ClearLOS2( gentity_t *self, gentity_t *ent, const vec3_t end );
  1382. extern qboolean G_ClearLOS3( gentity_t *self, const vec3_t start, gentity_t *ent );
  1383. extern qboolean G_ClearLOS4( gentity_t *self, gentity_t *ent );
  1384. extern qboolean G_ClearLOS5( gentity_t *self, const vec3_t end );
  1385.  
  1386. //
  1387. // g_arenas.c
  1388. //
  1389. void UpdateTournamentInfo( void );
  1390. //void SpawnModelsOnVictoryPads( void );
  1391. //void Svcmd_AbortPodium_f( void );
  1392.  
  1393. //
  1394. // g_bot.c
  1395. //
  1396. void G_InitBots( qboolean restart );
  1397. char *G_GetBotInfoByNumber( int num );
  1398. char *G_GetBotInfoByName( const char *name );
  1399. void G_CheckBotSpawn( void );
  1400. void G_RemoveQueuedBotBegin( int clientNum );
  1401. qboolean G_BotConnect( int clientNum, qboolean restart );
  1402. void Svcmd_AddBot_f( void );
  1403. void Svcmd_BotList_f( void );
  1404. void BotInterbreedEndMatch( void );
  1405. qboolean G_DoesMapSupportGametype(const char *mapname, int gametype);
  1406. const char *G_RefreshNextMap(int gametype, qboolean forced);
  1407.  
  1408. // w_force.c / w_saber.c
  1409. gentity_t *G_PreDefSound(vec3_t org, int pdSound);
  1410. qboolean HasSetSaberOnly(void);
  1411. void WP_ForcePowerStop( gentity_t *self, forcePowers_t forcePower );
  1412. void WP_SaberPositionUpdate( gentity_t *self, usercmd_t *ucmd );
  1413. int WP_SaberCanBlock(gentity_t *self, vec3_t point, int dflags, int mod, qboolean projectile, int attackStr);
  1414. void WP_SaberInitBladeData( gentity_t *ent );
  1415. void WP_InitForcePowers( gentity_t *ent );
  1416. void WP_SpawnInitForcePowers( gentity_t *ent );
  1417. void WP_ForcePowersUpdate( gentity_t *self, usercmd_t *ucmd );
  1418. int ForcePowerUsableOn(gentity_t *attacker, gentity_t *other, forcePowers_t forcePower);
  1419. void ForceHeal( gentity_t *self );
  1420. void ForceSpeed( gentity_t *self, int forceDuration );
  1421. void ForceRage( gentity_t *self );
  1422. void ForceGrip( gentity_t *self );
  1423. void ForceProtect( gentity_t *self );
  1424. void ForceAbsorb( gentity_t *self );
  1425. void ForceTeamHeal( gentity_t *self );
  1426. void ForceTeamForceReplenish( gentity_t *self );
  1427. void ForceSeeing( gentity_t *self );
  1428. void ForceThrow( gentity_t *self, qboolean pull );
  1429. void ForceTelepathy(gentity_t *self);
  1430. qboolean Jedi_DodgeEvasion( gentity_t *self, gentity_t *shooter, trace_t *tr, int hitLoc );
  1431.  
  1432. // g_log.c
  1433. void QDECL G_LogPrintf( const char *fmt, ... );
  1434. void QDECL G_LogWeaponPickup(int client, int weaponid);
  1435. void QDECL G_LogWeaponFire(int client, int weaponid);
  1436. void QDECL G_LogWeaponDamage(int client, int mod, int amount);
  1437. void QDECL G_LogWeaponKill(int client, int mod);
  1438. void QDECL G_LogWeaponDeath(int client, int weaponid);
  1439. void QDECL G_LogWeaponFrag(int attacker, int deadguy);
  1440. void QDECL G_LogWeaponPowerup(int client, int powerupid);
  1441. void QDECL G_LogWeaponItem(int client, int itemid);
  1442. void QDECL G_LogWeaponInit(void);
  1443. void QDECL G_LogWeaponOutput(void);
  1444. void QDECL G_LogExit( const char *string );
  1445. void QDECL G_ClearClientLog(int client);
  1446.  
  1447. // g_siege.c
  1448. void InitSiegeMode(void);
  1449. void G_SiegeClientExData(gentity_t *msgTarg);
  1450.  
  1451. // g_timer
  1452. //Timing information
  1453. void TIMER_Clear( void );
  1454. void TIMER_Clear2( gentity_t *ent );
  1455. void TIMER_Set( gentity_t *ent, const char *identifier, int duration );
  1456. int TIMER_Get( gentity_t *ent, const char *identifier );
  1457. qboolean TIMER_Done( gentity_t *ent, const char *identifier );
  1458. qboolean TIMER_Start( gentity_t *self, const char *identifier, int duration );
  1459. qboolean TIMER_Done2( gentity_t *ent, const char *identifier, qboolean remove );
  1460. qboolean TIMER_Exists( gentity_t *ent, const char *identifier );
  1461. void TIMER_Remove( gentity_t *ent, const char *identifier );
  1462.  
  1463. float NPC_GetHFOVPercentage( vec3_t spot, vec3_t from, vec3_t facing, float hFOV );
  1464. float NPC_GetVFOVPercentage( vec3_t spot, vec3_t from, vec3_t facing, float vFOV );
  1465.  
  1466.  
  1467. extern void G_SetEnemy (gentity_t *self, gentity_t *enemy);
  1468. qboolean InFront( vec3_t spot, vec3_t from, vec3_t fromAngles, float threshHold );
  1469.  
  1470. // ai_main.c
  1471. #define MAX_FILEPATH 144
  1472.  
  1473. int OrgVisible ( vec3_t org1, vec3_t org2, int ignore);
  1474. void BotOrder ( gentity_t *ent, int clientnum, int ordernum);
  1475. int InFieldOfVision ( vec3_t viewangles, float fov, vec3_t angles);
  1476.  
  1477. // ai_util.c
  1478. void B_InitAlloc(void);
  1479. void B_CleanupAlloc(void);
  1480.  
  1481. //bot settings
  1482. typedef struct bot_settings_s
  1483. {
  1484. char personalityfile[MAX_FILEPATH];
  1485. float skill;
  1486. char team[MAX_FILEPATH];
  1487. } bot_settings_t;
  1488.  
  1489. int BotAISetup( int restart );
  1490. int BotAIShutdown( int restart );
  1491. int BotAILoadMap( int restart );
  1492. int BotAISetupClient(int client, struct bot_settings_s *settings, qboolean restart);
  1493. int BotAIShutdownClient( int client, qboolean restart );
  1494. int BotAIStartFrame( int time );
  1495.  
  1496. #include "g_team.h" // teamplay specific stuff
  1497.  
  1498.  
  1499. extern level_locals_t level;
  1500. extern gentity_t g_entities[MAX_GENTITIES];
  1501.  
  1502. #define FOFS(x) ((int)&(((gentity_t *)0)->x))
  1503.  
  1504. extern vmCvar_t g_gametype;
  1505. extern vmCvar_t g_dedicated;
  1506. extern vmCvar_t g_developer;
  1507. extern vmCvar_t g_cheats;
  1508. extern vmCvar_t g_maxclients; // allow this many total, including spectators
  1509. extern vmCvar_t g_maxGameClients; // allow this many active
  1510. extern vmCvar_t g_restarted;
  1511.  
  1512. extern vmCvar_t g_trueJedi;
  1513.  
  1514. extern vmCvar_t g_autoMapCycle;
  1515. extern vmCvar_t g_dmflags;
  1516. extern vmCvar_t g_maxForceRank;
  1517. extern vmCvar_t g_forceBasedTeams;
  1518. extern vmCvar_t g_privateDuel;
  1519.  
  1520. extern vmCvar_t g_allowNPC;
  1521.  
  1522. extern vmCvar_t g_armBreakage;
  1523.  
  1524. extern vmCvar_t g_saberLocking;
  1525. extern vmCvar_t g_saberLockFactor;
  1526. extern vmCvar_t g_saberTraceSaberFirst;
  1527.  
  1528. extern vmCvar_t d_saberKickTweak;
  1529.  
  1530. extern vmCvar_t d_powerDuelPrint;
  1531.  
  1532. extern vmCvar_t d_saberGhoul2Collision;
  1533. extern vmCvar_t g_saberBladeFaces;
  1534. extern vmCvar_t d_saberAlwaysBoxTrace;
  1535. extern vmCvar_t d_saberBoxTraceSize;
  1536.  
  1537. extern vmCvar_t d_siegeSeekerNPC;
  1538.  
  1539. extern vmCvar_t g_debugMelee;
  1540. extern vmCvar_t g_stepSlideFix;
  1541.  
  1542. extern vmCvar_t g_noSpecMove;
  1543.  
  1544. #ifdef _DEBUG
  1545. extern vmCvar_t g_disableServerG2;
  1546. #endif
  1547.  
  1548. extern vmCvar_t d_perPlayerGhoul2;
  1549.  
  1550. extern vmCvar_t d_projectileGhoul2Collision;
  1551.  
  1552. extern vmCvar_t g_g2TraceLod;
  1553.  
  1554. extern vmCvar_t g_optvehtrace;
  1555.  
  1556. extern vmCvar_t g_locationBasedDamage;
  1557.  
  1558. extern vmCvar_t g_allowHighPingDuelist;
  1559.  
  1560. extern vmCvar_t g_logClientInfo;
  1561.  
  1562. extern vmCvar_t g_slowmoDuelEnd;
  1563.  
  1564. extern vmCvar_t g_saberDamageScale;
  1565.  
  1566. extern vmCvar_t g_useWhileThrowing;
  1567.  
  1568. extern vmCvar_t g_RMG;
  1569.  
  1570. extern vmCvar_t g_svfps;
  1571.  
  1572. extern vmCvar_t g_forceRegenTime;
  1573. extern vmCvar_t g_spawnInvulnerability;
  1574. extern vmCvar_t g_forcePowerDisable;
  1575. extern vmCvar_t g_weaponDisable;
  1576.  
  1577. extern vmCvar_t g_allowDuelSuicide;
  1578. extern vmCvar_t g_fraglimitVoteCorrection;
  1579.  
  1580. extern vmCvar_t g_duelWeaponDisable;
  1581. extern vmCvar_t g_fraglimit;
  1582. extern vmCvar_t g_duel_fraglimit;
  1583. extern vmCvar_t g_timelimit;
  1584. extern vmCvar_t g_capturelimit;
  1585. extern vmCvar_t d_saberInterpolate;
  1586. extern vmCvar_t g_friendlyFire;
  1587. extern vmCvar_t g_friendlySaber;
  1588. extern vmCvar_t g_password;
  1589. extern vmCvar_t g_needpass;
  1590. extern vmCvar_t g_gravity;
  1591. extern vmCvar_t g_speed;
  1592. extern vmCvar_t g_knockback;
  1593. extern vmCvar_t g_quadfactor;
  1594. extern vmCvar_t g_forcerespawn;
  1595. extern vmCvar_t g_siegeRespawn;
  1596. extern vmCvar_t g_inactivity;
  1597. extern vmCvar_t g_debugMove;
  1598. extern vmCvar_t g_debugAlloc;
  1599. #ifndef FINAL_BUILD
  1600. extern vmCvar_t g_debugDamage;
  1601. #endif
  1602. extern vmCvar_t g_debugServerSkel;
  1603. extern vmCvar_t g_weaponRespawn;
  1604. extern vmCvar_t g_weaponTeamRespawn;
  1605. extern vmCvar_t g_adaptRespawn;
  1606. extern vmCvar_t g_synchronousClients;
  1607. extern vmCvar_t g_motd;
  1608. extern vmCvar_t g_warmup;
  1609. extern vmCvar_t g_doWarmup;
  1610. extern vmCvar_t g_blood;
  1611. extern vmCvar_t g_allowVote;
  1612. extern vmCvar_t g_teamAutoJoin;
  1613. extern vmCvar_t g_teamForceBalance;
  1614. extern vmCvar_t g_banIPs;
  1615. extern vmCvar_t g_filterBan;
  1616. extern vmCvar_t g_debugForward;
  1617. extern vmCvar_t g_debugRight;
  1618. extern vmCvar_t g_debugUp;
  1619. //extern vmCvar_t g_redteam;
  1620. //extern vmCvar_t g_blueteam;
  1621. extern vmCvar_t g_smoothClients;
  1622.  
  1623. extern vmCvar_t pmove_fixed;
  1624. extern vmCvar_t pmove_msec;
  1625.  
  1626. extern vmCvar_t g_enableBreath;
  1627. extern vmCvar_t g_singlePlayer;
  1628. extern vmCvar_t g_dismember;
  1629. extern vmCvar_t g_forceDodge;
  1630. extern vmCvar_t g_timeouttospec;
  1631.  
  1632. extern vmCvar_t g_saberDmgVelocityScale;
  1633. extern vmCvar_t g_saberDmgDelay_Idle;
  1634. extern vmCvar_t g_saberDmgDelay_Wound;
  1635.  
  1636. #ifndef FINAL_BUILD
  1637. extern vmCvar_t g_saberDebugPrint;
  1638. #endif
  1639.  
  1640. extern vmCvar_t g_siegeTeamSwitch;
  1641.  
  1642. extern vmCvar_t bg_fighterAltControl;
  1643.  
  1644. #ifdef DEBUG_SABER_BOX
  1645. extern vmCvar_t g_saberDebugBox;
  1646. #endif
  1647.  
  1648. //NPC nav debug
  1649. extern vmCvar_t d_altRoutes;
  1650. extern vmCvar_t d_patched;
  1651. extern vmCvar_t d_noIntermissionWait;
  1652.  
  1653. extern vmCvar_t g_siegeTeam1;
  1654. extern vmCvar_t g_siegeTeam2;
  1655.  
  1656. extern vmCvar_t g_austrian;
  1657.  
  1658. extern vmCvar_t g_powerDuelStartHealth;
  1659. extern vmCvar_t g_powerDuelEndHealth;
  1660.  
  1661. extern vmCvar_t g_showDuelHealths;
  1662.  
  1663.  
  1664. void trap_Printf( const char *fmt );
  1665. void trap_Error( const char *fmt );
  1666. int trap_Milliseconds( void );
  1667. void trap_PrecisionTimer_Start(void **theNewTimer);
  1668. int trap_PrecisionTimer_End(void *theTimer);
  1669. int trap_Argc( void );
  1670. void trap_Argv( int n, char *buffer, int bufferLength );
  1671. void trap_Args( char *buffer, int bufferLength );
  1672. int trap_FS_FOpenFile( const char *qpath, fileHandle_t *f, fsMode_t mode );
  1673. void trap_FS_Read( void *buffer, int len, fileHandle_t f );
  1674. void trap_FS_Write( const void *buffer, int len, fileHandle_t f );
  1675. void trap_FS_FCloseFile( fileHandle_t f );
  1676. int trap_FS_GetFileList( const char *path, const char *extension, char *listbuf, int bufsize );
  1677. void trap_SendConsoleCommand( int exec_when, const char *text );
  1678. void trap_Cvar_Register( vmCvar_t *cvar, const char *var_name, const char *value, int flags );
  1679. void trap_Cvar_Update( vmCvar_t *cvar );
  1680. void trap_Cvar_Set( const char *var_name, const char *value );
  1681. int trap_Cvar_VariableIntegerValue( const char *var_name );
  1682. float trap_Cvar_VariableValue( const char *var_name );
  1683. void trap_Cvar_VariableStringBuffer( const char *var_name, char *buffer, int bufsize );
  1684. void trap_LocateGameData( gentity_t *gEnts, int numGEntities, int sizeofGEntity_t, playerState_t *gameClients, int sizeofGameClient );
  1685. void trap_DropClient( int clientNum, const char *reason );
  1686. void trap_SendServerCommand( int clientNum, const char *text );
  1687. void trap_SetConfigstring( int num, const char *string );
  1688. void trap_GetConfigstring( int num, char *buffer, int bufferSize );
  1689. void trap_GetUserinfo( int num, char *buffer, int bufferSize );
  1690. void trap_SetUserinfo( int num, const char *buffer );
  1691. void trap_GetServerinfo( char *buffer, int bufferSize );
  1692. void trap_SetServerCull(float cullDistance);
  1693. void trap_SetBrushModel( gentity_t *ent, const char *name );
  1694. 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 );
  1695. 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 );
  1696. int trap_PointContents( const vec3_t point, int passEntityNum );
  1697. qboolean trap_InPVS( const vec3_t p1, const vec3_t p2 );
  1698. qboolean trap_InPVSIgnorePortals( const vec3_t p1, const vec3_t p2 );
  1699. void trap_AdjustAreaPortalState( gentity_t *ent, qboolean open );
  1700. qboolean trap_AreasConnected( int area1, int area2 );
  1701. void trap_LinkEntity( gentity_t *ent );
  1702. void trap_UnlinkEntity( gentity_t *ent );
  1703. int trap_EntitiesInBox( const vec3_t mins, const vec3_t maxs, int *entityList, int maxcount );
  1704. qboolean trap_EntityContact( const vec3_t mins, const vec3_t maxs, const gentity_t *ent );
  1705. int trap_BotAllocateClient( void );
  1706. void trap_BotFreeClient( int clientNum );
  1707. void trap_GetUsercmd( int clientNum, usercmd_t *cmd );
  1708. qboolean trap_GetEntityToken( char *buffer, int bufferSize );
  1709.  
  1710. //adding giant gamebreaking features post-alpha is fun!
  1711. void trap_SiegePersSet(siegePers_t *pers);
  1712. void trap_SiegePersGet(siegePers_t *pers);
  1713.  
  1714. #ifdef BOT_ZMALLOC
  1715. void *trap_BotGetMemoryGame(int size);
  1716. void trap_BotFreeMemoryGame(void *ptr);
  1717. #endif
  1718.  
  1719. int trap_DebugPolygonCreate(int color, int numPoints, vec3_t *points);
  1720. void trap_DebugPolygonDelete(int id);
  1721.  
  1722. int trap_BotLibSetup( void );
  1723. int trap_BotLibShutdown( void );
  1724. int trap_BotLibVarSet(char *var_name, char *value);
  1725. int trap_BotLibVarGet(char *var_name, char *value, int size);
  1726. int trap_BotLibDefine(char *string);
  1727. int trap_BotLibStartFrame(float time);
  1728. int trap_BotLibLoadMap(const char *mapname);
  1729. int trap_BotLibUpdateEntity(int ent, void /* struct bot_updateentity_s */ *bue);
  1730. int trap_BotLibTest(int parm0, char *parm1, vec3_t parm2, vec3_t parm3);
  1731.  
  1732. int trap_BotGetSnapshotEntity( int clientNum, int sequence );
  1733. int trap_BotGetServerCommand(int clientNum, char *message, int size);
  1734. void trap_BotUserCommand(int client, usercmd_t *ucmd);
  1735.  
  1736. int trap_AAS_BBoxAreas(vec3_t absmins, vec3_t absmaxs, int *areas, int maxareas);
  1737. int trap_AAS_AreaInfo( int areanum, void /* struct aas_areainfo_s */ *info );
  1738. void trap_AAS_EntityInfo(int entnum, void /* struct aas_entityinfo_s */ *info);
  1739.  
  1740. int trap_AAS_Initialized(void);
  1741. void trap_AAS_PresenceTypeBoundingBox(int presencetype, vec3_t mins, vec3_t maxs);
  1742. float trap_AAS_Time(void);
  1743.  
  1744. int trap_AAS_PointAreaNum(vec3_t point);
  1745. int trap_AAS_PointReachabilityAreaIndex(vec3_t point);
  1746. int trap_AAS_TraceAreas(vec3_t start, vec3_t end, int *areas, vec3_t *points, int maxareas);
  1747.  
  1748. int trap_AAS_PointContents(vec3_t point);
  1749. int trap_AAS_NextBSPEntity(int ent);
  1750. int trap_AAS_ValueForBSPEpairKey(int ent, char *key, char *value, int size);
  1751. int trap_AAS_VectorForBSPEpairKey(int ent, char *key, vec3_t v);
  1752. int trap_AAS_FloatForBSPEpairKey(int ent, char *key, float *value);
  1753. int trap_AAS_IntForBSPEpairKey(int ent, char *key, int *value);
  1754.  
  1755. int trap_AAS_AreaReachability(int areanum);
  1756.  
  1757. int trap_AAS_AreaTravelTimeToGoalArea(int areanum, vec3_t origin, int goalareanum, int travelflags);
  1758. int trap_AAS_EnableRoutingArea( int areanum, int enable );
  1759. int trap_AAS_PredictRoute(void /*struct aas_predictroute_s*/ *route, int areanum, vec3_t origin,
  1760. int goalareanum, int travelflags, int maxareas, int maxtime,
  1761. int stopevent, int stopcontents, int stoptfl, int stopareanum);
  1762.  
  1763. int trap_AAS_AlternativeRouteGoals(vec3_t start, int startareanum, vec3_t goal, int goalareanum, int travelflags,
  1764. void /*struct aas_altroutegoal_s*/ *altroutegoals, int maxaltroutegoals,
  1765. int type);
  1766. int trap_AAS_Swimming(vec3_t origin);
  1767. 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);
  1768.  
  1769.  
  1770. void trap_EA_Say(int client, char *str);
  1771. void trap_EA_SayTeam(int client, char *str);
  1772. void trap_EA_Command(int client, char *command);
  1773.  
  1774. void trap_EA_Action(int client, int action);
  1775. void trap_EA_Gesture(int client);
  1776. void trap_EA_Talk(int client);
  1777. void trap_EA_Attack(int client);
  1778. void trap_EA_Use(int client);
  1779. void trap_EA_Respawn(int client);
  1780. void trap_EA_Crouch(int client);
  1781. void trap_EA_MoveUp(int client);
  1782. void trap_EA_MoveDown(int client);
  1783. void trap_EA_MoveForward(int client);
  1784. void trap_EA_MoveBack(int client);
  1785. void trap_EA_MoveLeft(int client);
  1786. void trap_EA_MoveRight(int client);
  1787. void trap_EA_SelectWeapon(int client, int weapon);
  1788. void trap_EA_Jump(int client);
  1789. void trap_EA_DelayedJump(int client);
  1790. void trap_EA_Move(int client, vec3_t dir, float speed);
  1791. void trap_EA_View(int client, vec3_t viewangles);
  1792. void trap_EA_Alt_Attack(int client);
  1793. void trap_EA_ForcePower(int client);
  1794.  
  1795. void trap_EA_EndRegular(int client, float thinktime);
  1796. void trap_EA_GetInput(int client, float thinktime, void /* struct bot_input_s */ *input);
  1797. void trap_EA_ResetInput(int client);
  1798.  
  1799.  
  1800. int trap_BotLoadCharacter(char *charfile, float skill);
  1801. void trap_BotFreeCharacter(int character);
  1802. float trap_Characteristic_Float(int character, int index);
  1803. float trap_Characteristic_BFloat(int character, int index, float min, float max);
  1804. int trap_Characteristic_Integer(int character, int index);
  1805. int trap_Characteristic_BInteger(int character, int index, int min, int max);
  1806. void trap_Characteristic_String(int character, int index, char *buf, int size);
  1807.  
  1808. int trap_BotAllocChatState(void);
  1809. void trap_BotFreeChatState(int handle);
  1810. void trap_BotQueueConsoleMessage(int chatstate, int type, char *message);
  1811. void trap_BotRemoveConsoleMessage(int chatstate, int handle);
  1812. int trap_BotNextConsoleMessage(int chatstate, void /* struct bot_consolemessage_s */ *cm);
  1813. int trap_BotNumConsoleMessages(int chatstate);
  1814. 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 );
  1815. int trap_BotNumInitialChats(int chatstate, char *type);
  1816. 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 );
  1817. int trap_BotChatLength(int chatstate);
  1818. void trap_BotEnterChat(int chatstate, int client, int sendto);
  1819. void trap_BotGetChatMessage(int chatstate, char *buf, int size);
  1820. int trap_StringContains(char *str1, char *str2, int casesensitive);
  1821. int trap_BotFindMatch(char *str, void /* struct bot_match_s */ *match, unsigned long int context);
  1822. void trap_BotMatchVariable(void /* struct bot_match_s */ *match, int variable, char *buf, int size);
  1823. void trap_UnifyWhiteSpaces(char *string);
  1824. void trap_BotReplaceSynonyms(char *string, unsigned long int context);
  1825. int trap_BotLoadChatFile(int chatstate, char *chatfile, char *chatname);
  1826. void trap_BotSetChatGender(int chatstate, int gender);
  1827. void trap_BotSetChatName(int chatstate, char *name, int client);
  1828. void trap_BotResetGoalState(int goalstate);
  1829. void trap_BotRemoveFromAvoidGoals(int goalstate, int number);
  1830. void trap_BotResetAvoidGoals(int goalstate);
  1831. void trap_BotPushGoal(int goalstate, void /* struct bot_goal_s */ *goal);
  1832. void trap_BotPopGoal(int goalstate);
  1833. void trap_BotEmptyGoalStack(int goalstate);
  1834. void trap_BotDumpAvoidGoals(int goalstate);
  1835. void trap_BotDumpGoalStack(int goalstate);
  1836. void trap_BotGoalName(int number, char *name, int size);
  1837. int trap_BotGetTopGoal(int goalstate, void /* struct bot_goal_s */ *goal);
  1838. int trap_BotGetSecondGoal(int goalstate, void /* struct bot_goal_s */ *goal);
  1839. int trap_BotChooseLTGItem(int goalstate, vec3_t origin, int *inventory, int travelflags);
  1840. int trap_BotChooseNBGItem(int goalstate, vec3_t origin, int *inventory, int travelflags, void /* struct bot_goal_s */ *ltg, float maxtime);
  1841. int trap_BotTouchingGoal(vec3_t origin, void /* struct bot_goal_s */ *goal);
  1842. int trap_BotItemGoalInVisButNotVisible(int viewer, vec3_t eye, vec3_t viewangles, void /* struct bot_goal_s */ *goal);
  1843. int trap_BotGetNextCampSpotGoal(int num, void /* struct bot_goal_s */ *goal);
  1844. int trap_BotGetMapLocationGoal(char *name, void /* struct bot_goal_s */ *goal);
  1845. int trap_BotGetLevelItemGoal(int index, char *classname, void /* struct bot_goal_s */ *goal);
  1846. float trap_BotAvoidGoalTime(int goalstate, int number);
  1847. void trap_BotSetAvoidGoalTime(int goalstate, int number, float avoidtime);
  1848. void trap_BotInitLevelItems(void);
  1849. void trap_BotUpdateEntityItems(void);
  1850. int trap_BotLoadItemWeights(int goalstate, char *filename);
  1851. void trap_BotFreeItemWeights(int goalstate);
  1852. void trap_BotInterbreedGoalFuzzyLogic(int parent1, int parent2, int child);
  1853. void trap_BotSaveGoalFuzzyLogic(int goalstate, char *filename);
  1854. void trap_BotMutateGoalFuzzyLogic(int goalstate, float range);
  1855. int trap_BotAllocGoalState(int state);
  1856. void trap_BotFreeGoalState(int handle);
  1857.  
  1858. void trap_BotResetMoveState(int movestate);
  1859. void trap_BotMoveToGoal(void /* struct bot_moveresult_s */ *result, int movestate, void /* struct bot_goal_s */ *goal, int travelflags);
  1860. int trap_BotMoveInDirection(int movestate, vec3_t dir, float speed, int type);
  1861. void trap_BotResetAvoidReach(int movestate);
  1862. void trap_BotResetLastAvoidReach(int movestate);
  1863. int trap_BotReachabilityArea(vec3_t origin, int testground);
  1864. int trap_BotMovementViewTarget(int movestate, void /* struct bot_goal_s */ *goal, int travelflags, float lookahead, vec3_t target);
  1865. int trap_BotPredictVisiblePosition(vec3_t origin, int areanum, void /* struct bot_goal_s */ *goal, int travelflags, vec3_t target);
  1866. int trap_BotAllocMoveState(void);
  1867. void trap_BotFreeMoveState(int handle);
  1868. void trap_BotInitMoveState(int handle, void /* struct bot_initmove_s */ *initmove);
  1869. void trap_BotAddAvoidSpot(int movestate, vec3_t origin, float radius, int type);
  1870.  
  1871. int trap_BotChooseBestFightWeapon(int weaponstate, int *inventory);
  1872. void trap_BotGetWeaponInfo(int weaponstate, int weapon, void /* struct weaponinfo_s */ *weaponinfo);
  1873. int trap_BotLoadWeaponWeights(int weaponstate, char *filename);
  1874. int trap_BotAllocWeaponState(void);
  1875. void trap_BotFreeWeaponState(int weaponstate);
  1876. void trap_BotResetWeaponState(int weaponstate);
  1877.  
  1878. int trap_GeneticParentsAndChildSelection(int numranks, float *ranks, int *parent1, int *parent2, int *child);
  1879.  
  1880. void trap_SnapVector( float *v );
  1881.  
  1882. int trap_SP_GetStringTextString(const char *text, char *buffer, int bufferLength);
  1883.  
  1884. qboolean trap_ROFF_Clean( void );
  1885. void trap_ROFF_UpdateEntities( void );
  1886. int trap_ROFF_Cache( char *file );
  1887. qboolean trap_ROFF_Play( int entID, int roffID, qboolean doTranslation );
  1888. qboolean trap_ROFF_Purge_Ent( int entID );
  1889.  
  1890. //rww - dynamic vm memory allocation!
  1891. void trap_TrueMalloc(void **ptr, int size);
  1892. void trap_TrueFree(void **ptr);
  1893.  
  1894. //rww - icarus traps
  1895. int trap_ICARUS_RunScript( gentity_t *ent, const char *name );
  1896. qboolean trap_ICARUS_RegisterScript( const char *name, qboolean bCalledDuringInterrogate);
  1897.  
  1898. void trap_ICARUS_Init( void );
  1899. qboolean trap_ICARUS_ValidEnt( gentity_t *ent );
  1900. qboolean trap_ICARUS_IsInitialized( int entID );
  1901. qboolean trap_ICARUS_MaintainTaskManager( int entID );
  1902. qboolean trap_ICARUS_IsRunning( int entID );
  1903. qboolean trap_ICARUS_TaskIDPending(gentity_t *ent, int taskID);
  1904. void trap_ICARUS_InitEnt( gentity_t *ent );
  1905. void trap_ICARUS_FreeEnt( gentity_t *ent );
  1906. void trap_ICARUS_AssociateEnt( gentity_t *ent );
  1907. void trap_ICARUS_Shutdown( void );
  1908. void trap_ICARUS_TaskIDSet(gentity_t *ent, int taskType, int taskID);
  1909. void trap_ICARUS_TaskIDComplete(gentity_t *ent, int taskType);
  1910. void trap_ICARUS_SetVar(int taskID, int entID, const char *type_name, const char *data);
  1911. int trap_ICARUS_VariableDeclared(const char *type_name);
  1912. int trap_ICARUS_GetFloatVariable( const char *name, float *value );
  1913. int trap_ICARUS_GetStringVariable( const char *name, const char *value );
  1914. int trap_ICARUS_GetVectorVariable( const char *name, const vec3_t value );
  1915.  
  1916.  
  1917. //rww - BEGIN NPC NAV TRAPS
  1918. void trap_Nav_Init( void );
  1919. void trap_Nav_Free( void );
  1920. qboolean trap_Nav_Load( const char *filename, int checksum );
  1921. qboolean trap_Nav_Save( const char *filename, int checksum );
  1922. int trap_Nav_AddRawPoint( vec3_t point, int flags, int radius );
  1923. void trap_Nav_CalculatePaths( qboolean recalc ); //recalc = qfalse
  1924. void trap_Nav_HardConnect( int first, int second );
  1925.  
  1926. void trap_Nav_ShowNodes( void );
  1927. void trap_Nav_ShowEdges( void );
  1928. void trap_Nav_ShowPath( int start, int end );
  1929. int trap_Nav_GetNearestNode( gentity_t *ent, int lastID, int flags, int targetID );
  1930. int trap_Nav_GetBestNode( int startID, int endID, int rejectID ); //rejectID = NODE_NONE
  1931. int trap_Nav_GetNodePosition( int nodeID, vec3_t out );
  1932. int trap_Nav_GetNodeNumEdges( int nodeID );
  1933. int trap_Nav_GetNodeEdge( int nodeID, int edge );
  1934. int trap_Nav_GetNumNodes( void );
  1935. qboolean trap_Nav_Connected( int startID, int endID );
  1936. int trap_Nav_GetPathCost( int startID, int endID );
  1937. int trap_Nav_GetEdgeCost( int startID, int endID );
  1938. int trap_Nav_GetProjectedNode( vec3_t origin, int nodeID );
  1939. void trap_Nav_CheckFailedNodes( gentity_t *ent );
  1940. void trap_Nav_AddFailedNode( gentity_t *ent, int nodeID );
  1941. qboolean trap_Nav_NodeFailed( gentity_t *ent, int nodeID );
  1942. qboolean trap_Nav_NodesAreNeighbors( int startID, int endID );
  1943. void trap_Nav_ClearFailedEdge( failedEdge_t *failedEdge );
  1944. void trap_Nav_ClearAllFailedEdges( void );
  1945. int trap_Nav_EdgeFailed( int startID, int endID );
  1946. void trap_Nav_AddFailedEdge( int entID, int startID, int endID );
  1947. qboolean trap_Nav_CheckFailedEdge( failedEdge_t *failedEdge );
  1948. void trap_Nav_CheckAllFailedEdges( void );
  1949. qboolean trap_Nav_RouteBlocked( int startID, int testEdgeID, int endID, int rejectRank );
  1950. int trap_Nav_GetBestNodeAltRoute( int startID, int endID, int *pathCost, int rejectID ); //rejectID = NODE_NONE
  1951. int trap_Nav_GetBestNodeAltRoute2( int startID, int endID, int rejectID ); //rejectID = NODE_NONE
  1952. int trap_Nav_GetBestPathBetweenEnts( gentity_t *ent, gentity_t *goal, int flags );
  1953. int trap_Nav_GetNodeRadius( int nodeID );
  1954. void trap_Nav_CheckBlockedEdges( void );
  1955. void trap_Nav_ClearCheckedNodes( void );
  1956. int trap_Nav_CheckedNode(int wayPoint, int ent); //return int was byte
  1957. void trap_Nav_SetCheckedNode(int wayPoint, int ent, int value); //int value was byte value
  1958. void trap_Nav_FlagAllNodes( int newFlag );
  1959. qboolean trap_Nav_GetPathsCalculated(void);
  1960. void trap_Nav_SetPathsCalculated(qboolean newVal);
  1961. //rww - END NPC NAV TRAPS
  1962.  
  1963. void trap_SV_RegisterSharedMemory(char *memory);
  1964.  
  1965. void trap_SetActiveSubBSP(int index);
  1966. int trap_CM_RegisterTerrain(const char *config);
  1967. void trap_RMG_Init(int terrainID);
  1968.  
  1969. void trap_Bot_UpdateWaypoints(int wpnum, wpobject_t **wps);
  1970. void trap_Bot_CalculatePaths(int rmg);
Add Comment
Please, Sign In to add comment