g_shared.h 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932
  1. #ifndef __G_SHARED_H__
  2. #define __G_SHARED_H__
  3. #include "bg_public.h"
  4. #include "g_public.h"
  5. #include "b_public.h"
  6. #include "../Icarus/Stdafx.h" //need stl
  7. #include "../renderer/tr_types.h"
  8. #include "../cgame/cg_public.h"
  9. #include "G_Vehicles.h"
  10. #include "hitlocs.h"
  11. #include "bset.h"
  12. #define FOFS(x) ((int)&(((gentity_t *)0)->x))
  13. #ifdef _XBOX
  14. #define MAX_NPC_WATER_UPDATE_PER_FRAME 2 // maxmum number of NPCs that will get updated water infromation per frame
  15. #endif
  16. typedef enum //# taskID_e
  17. {
  18. TID_CHAN_VOICE = 0, // Waiting for a voice sound to complete
  19. TID_ANIM_UPPER, // Waiting to finish a lower anim holdtime
  20. TID_ANIM_LOWER, // Waiting to finish a lower anim holdtime
  21. TID_ANIM_BOTH, // Waiting to finish lower and upper anim holdtimes or normal md3 animating
  22. TID_MOVE_NAV, // Trying to get to a navgoal or For ET_MOVERS
  23. TID_ANGLE_FACE, // Turning to an angle or facing
  24. TID_BSTATE, // Waiting for a certain bState to finish
  25. TID_LOCATION, // Waiting for ent to enter a specific trigger_location
  26. // TID_MISSIONSTATUS, // Waiting for player to finish reading MISSION STATUS SCREEN
  27. TID_RESIZE, // Waiting for clear bbox to inflate size
  28. TID_SHOOT, // Waiting for fire event
  29. NUM_TIDS, // for def of taskID array
  30. } taskID_t;
  31. typedef enum //# material_e
  32. {
  33. MAT_METAL = 0, // scorched blue-grey metal
  34. MAT_GLASS, // not a real chunk type, just plays an effect with glass sprites
  35. MAT_ELECTRICAL, // sparks only
  36. MAT_ELEC_METAL, // sparks/electrical type metal
  37. MAT_DRK_STONE, // brown
  38. MAT_LT_STONE, // tan
  39. MAT_GLASS_METAL,// glass sprites and METAl chunk
  40. MAT_METAL2, // electrical metal type
  41. MAT_NONE, // no chunks
  42. MAT_GREY_STONE, // grey
  43. MAT_METAL3, // METAL and METAL2 chunks
  44. MAT_CRATE1, // yellow multi-colored crate chunks
  45. MAT_GRATE1, // grate chunks
  46. MAT_ROPE, // for yavin trial...no chunks, just wispy bits
  47. MAT_CRATE2, // read multi-colored crate chunks
  48. MAT_WHITE_METAL,// white angular chunks
  49. NUM_MATERIALS
  50. } material_t;
  51. //===From cg_local.h================================================
  52. #define DEFAULT_HEADMODEL ""
  53. #define DEFAULT_TORSOMODEL ""
  54. #define DEFAULT_LEGSMODEL "mouse"
  55. // each client has an associated clientInfo_t
  56. // that contains media references necessary to present the
  57. // client model and other color coded effects
  58. // this is regenerated each time a userinfo configstring changes
  59. #define MAX_CUSTOM_BASIC_SOUNDS 14
  60. #define MAX_CUSTOM_COMBAT_SOUNDS 17
  61. #define MAX_CUSTOM_EXTRA_SOUNDS 36
  62. #define MAX_CUSTOM_JEDI_SOUNDS 22
  63. #define MAX_CUSTOM_SOUNDS (MAX_CUSTOM_JEDI_SOUNDS + MAX_CUSTOM_EXTRA_SOUNDS + MAX_CUSTOM_COMBAT_SOUNDS + MAX_CUSTOM_BASIC_SOUNDS)
  64. // !!!!!!!!!! LOADSAVE-affecting structure !!!!!!!!!!
  65. typedef struct {
  66. qboolean infoValid;
  67. char name[MAX_QPATH];
  68. team_t team;
  69. int score; // updated by score servercmds
  70. int handicap;
  71. qhandle_t legsModel;
  72. qhandle_t legsSkin;
  73. qhandle_t torsoModel;
  74. qhandle_t torsoSkin;
  75. qhandle_t headModel;
  76. qhandle_t headSkin;
  77. int animFileIndex;
  78. sfxHandle_t sounds[MAX_CUSTOM_SOUNDS];
  79. char *customBasicSoundDir;
  80. char *customCombatSoundDir;
  81. char *customExtraSoundDir;
  82. char *customJediSoundDir;
  83. } clientInfo_t;
  84. //==================================================================
  85. typedef enum
  86. {
  87. MOVER_POS1,
  88. MOVER_POS2,
  89. MOVER_1TO2,
  90. MOVER_2TO1
  91. } moverState_t;
  92. // Rendering information structure
  93. typedef enum
  94. {
  95. MODEL_LEGS = 0,
  96. MODEL_TORSO,
  97. MODEL_HEAD,
  98. MODEL_WEAPON1,
  99. MODEL_WEAPON2,
  100. MODEL_WEAPON3,
  101. MODEL_EXTRA1,
  102. MODEL_EXTRA2,
  103. NUM_TARGET_MODELS
  104. } targetModel_t;
  105. //renderFlags
  106. #define RF_LOCKEDANGLE 1
  107. // !!!!!!!!!! LOADSAVE-affecting structure !!!!!!!!!!
  108. typedef struct renderInfo_s
  109. {
  110. // Legs model, or full model on one piece entities
  111. union
  112. {
  113. char legsModelName[32]; // -slc[]
  114. char modelName[32]; // -slc[]
  115. };
  116. char torsoModelName[32]; // -slc[]
  117. char headModelName[32]; // -slc[]
  118. //In whole degrees, How far to let the different model parts yaw and pitch
  119. int headYawRangeLeft;
  120. int headYawRangeRight;
  121. int headPitchRangeUp;
  122. int headPitchRangeDown;
  123. int torsoYawRangeLeft;
  124. int torsoYawRangeRight;
  125. int torsoPitchRangeUp;
  126. int torsoPitchRangeDown;
  127. int legsFrame;
  128. int torsoFrame;
  129. float legsFpsMod;
  130. float torsoFpsMod;
  131. //Fields to apply to entire model set, individual model's equivalents will modify this value
  132. byte customRGBA[4];//Red Green Blue, 0 = don't apply
  133. //Allow up to 4 PCJ lookup values to be stored here.
  134. //The resolve to configstrings which contain the name of the
  135. //desired bone.
  136. int boneIndex1;
  137. int boneIndex2;
  138. int boneIndex3;
  139. int boneIndex4;
  140. //packed with x, y, z orientations for bone angles
  141. int boneOrient;
  142. //I.. feel bad for doing this, but NPCs really just need to
  143. //be able to control this sort of thing from the server sometimes.
  144. //At least it's at the end so this stuff is never going to get sent
  145. //over for anything that isn't an NPC.
  146. vec3_t boneAngles1; //angles of boneIndex1
  147. vec3_t boneAngles2; //angles of boneIndex2
  148. vec3_t boneAngles3; //angles of boneIndex3
  149. vec3_t boneAngles4; //angles of boneIndex4
  150. //RF?
  151. int renderFlags;
  152. //
  153. vec3_t muzzlePoint;
  154. vec3_t muzzleDir;
  155. vec3_t muzzlePointOld;
  156. vec3_t muzzleDirOld;
  157. //vec3_t muzzlePointNext; // Muzzle point one server frame in the future!
  158. //vec3_t muzzleDirNext;
  159. int mPCalcTime;//Last time muzzle point was calced
  160. //
  161. float lockYaw;//
  162. //
  163. vec3_t headPoint;//Where your tag_head is
  164. vec3_t headAngles;//where the tag_head in the torso is pointing
  165. vec3_t handRPoint;//where your right hand is
  166. vec3_t handLPoint;//where your left hand is
  167. vec3_t crotchPoint;//Where your crotch is
  168. vec3_t footRPoint;//where your right hand is
  169. vec3_t footLPoint;//where your left hand is
  170. vec3_t torsoPoint;//Where your chest is
  171. vec3_t torsoAngles;//Where the chest is pointing
  172. vec3_t eyePoint;//Where your eyes are
  173. vec3_t eyeAngles;//Where your eyes face
  174. int lookTarget;//Which ent to look at with lookAngles
  175. lookMode_t lookMode;
  176. int lookTargetClearTime;//Time to clear the lookTarget
  177. int lastVoiceVolume;//Last frame's voice volume
  178. vec3_t lastHeadAngles;//Last headAngles, NOT actual facing of head model
  179. vec3_t headBobAngles;//headAngle offsets
  180. vec3_t targetHeadBobAngles;//head bob angles will try to get to targetHeadBobAngles
  181. int lookingDebounceTime;//When we can stop using head looking angle behavior
  182. float legsYaw;//yaw angle your legs are actually rendering at
  183. } renderInfo_t;
  184. // Movement information structure
  185. /*
  186. typedef struct moveInfo_s // !!!!!!!!!! LOADSAVE-affecting struct !!!!!!!!
  187. {
  188. vec3_t desiredAngles; // Desired facing angles
  189. float speed; // Speed of movement
  190. float aspeed; // Speed of angular movement
  191. vec3_t moveDir; // Direction of movement
  192. vec3_t velocity; // movement velocity
  193. int flags; // Special state flags
  194. } moveInfo_t;
  195. */
  196. typedef enum {
  197. CON_DISCONNECTED,
  198. CON_CONNECTING,
  199. CON_CONNECTED
  200. } clientConnected_t;
  201. typedef enum {
  202. TEAM_BEGIN, // Beginning a team game, spawn at base
  203. TEAM_ACTIVE // Now actively playing
  204. } playerTeamStateState_t;
  205. /*
  206. typedef enum //# race_e
  207. {
  208. RACE_NONE = 0,
  209. RACE_HUMAN,
  210. RACE_BORG,
  211. RACE_KLINGON,
  212. RACE_HIROGEN,
  213. RACE_MALON,
  214. RACE_STASIS,
  215. RACE_8472,
  216. RACE_BOT,
  217. RACE_HARVESTER,
  218. RACE_REAVER,
  219. RACE_AVATAR,
  220. RACE_PARASITE,
  221. RACE_VULCAN,
  222. RACE_BETAZOID,
  223. RACE_BOLIAN,
  224. RACE_TALAXIAN,
  225. RACE_BAJORAN,
  226. RACE_HOLOGRAM
  227. } race_t;
  228. */
  229. // !!!!!!!!!! LOADSAVE-affecting structure !!!!!!!!!!
  230. typedef struct {
  231. playerTeamStateState_t state;
  232. int captures;
  233. int basedefense;
  234. int carrierdefense;
  235. int flagrecovery;
  236. int fragcarrier;
  237. int assists;
  238. float lasthurtcarrier;
  239. float lastreturnedflag;
  240. float flagsince;
  241. float lastfraggedcarrier;
  242. } playerTeamState_t;
  243. // !!!!!!!!!! LOADSAVE-affecting structure !!!!!!!!!!
  244. typedef struct objectives_s
  245. {
  246. qboolean display; // A displayable objective?
  247. int status; // Succeed or fail or pending
  248. } objectives_t;
  249. // NOTE: This is an arbitrary number greater than our current number of objectives with
  250. // some fluff just in case we add more in the future.
  251. #define MAX_MISSION_OBJ 100
  252. // !!!!!!!!!! LOADSAVE-affecting structure !!!!!!!!!!
  253. typedef struct missionStats_s
  254. {
  255. int secretsFound; // # of secret areas found
  256. int totalSecrets; // # of secret areas that could have been found
  257. int shotsFired; // total number of shots fired
  258. int hits; // Shots that did damage
  259. int enemiesSpawned; // # of enemies spawned
  260. int enemiesKilled; // # of enemies killed
  261. int saberThrownCnt; // # of times saber was thrown
  262. int saberBlocksCnt; // # of times saber was used to block
  263. int legAttacksCnt; // # of times legs were hit with saber
  264. int armAttacksCnt; // # of times arm were hit with saber
  265. int torsoAttacksCnt; // # of times torso was hit with saber
  266. int otherAttacksCnt; // # of times anything else on a monster was hit with saber
  267. int forceUsed[NUM_FORCE_POWERS]; // # of times each force power was used
  268. int weaponUsed[WP_NUM_WEAPONS]; // # of times each weapon was used
  269. } missionStats_t;
  270. // the auto following clients don't follow a specific client
  271. // number, but instead follow the first two active players
  272. #define FOLLOW_ACTIVE1 -1
  273. #define FOLLOW_ACTIVE2 -2
  274. // client data that stays across multiple levels or tournament restarts
  275. // this is achieved by writing all the data to cvar strings at game shutdown
  276. // time and reading them back at connection time. Anything added here
  277. // MUST be dealt with in G_InitSessionData() / G_ReadSessionData() / G_WriteSessionData()
  278. //
  279. // !!!!!!!!!! LOADSAVE-affecting structure !!!!!!!!!!
  280. typedef struct {
  281. int missionObjectivesShown; // Number of times mission objectives have been updated
  282. team_t sessionTeam;
  283. objectives_t mission_objectives[MAX_MISSION_OBJ];
  284. missionStats_t missionStats; // Various totals while on a mission
  285. } clientSession_t;
  286. // client data that stays across multiple respawns, but is cleared
  287. // on each level change or team change at ClientBegin()
  288. // !!!!!!!!!! LOADSAVE-affecting structure !!!!!!!!!!
  289. typedef struct {
  290. clientConnected_t connected;
  291. usercmd_t lastCommand;
  292. char netname[34];
  293. int maxHealth; // for handicapping
  294. int enterTime; // level.time the client entered the game
  295. short cmd_angles[3]; // angles sent over in the last command
  296. playerTeamState_t teamState; // status in teamplay games
  297. } clientPersistant_t;
  298. typedef enum {
  299. BLK_NO,
  300. BLK_TIGHT, // Block only attacks and shots around the saber itself, a bbox of around 12x12x12
  301. BLK_WIDE // Block all attacks in an area around the player in a rough arc of 180 degrees
  302. } saberBlockType_t;
  303. typedef enum {
  304. BLOCKED_NONE,
  305. BLOCKED_PARRY_BROKEN,
  306. BLOCKED_ATK_BOUNCE,
  307. BLOCKED_UPPER_RIGHT,
  308. BLOCKED_UPPER_LEFT,
  309. BLOCKED_LOWER_RIGHT,
  310. BLOCKED_LOWER_LEFT,
  311. BLOCKED_TOP,
  312. BLOCKED_UPPER_RIGHT_PROJ,
  313. BLOCKED_UPPER_LEFT_PROJ,
  314. BLOCKED_LOWER_RIGHT_PROJ,
  315. BLOCKED_LOWER_LEFT_PROJ,
  316. BLOCKED_TOP_PROJ
  317. } saberBlockedType_t;
  318. typedef enum //# movetype_e
  319. {
  320. MT_STATIC = 0,
  321. MT_WALK,
  322. MT_RUNJUMP,
  323. MT_FLYSWIM,
  324. NUM_MOVETYPES
  325. } movetype_t;
  326. // !!!!!!!!!! LOADSAVE-affecting structure !!!!!!!!!!
  327. // this structure is cleared on each ClientSpawn(),
  328. // except for 'client->pers' and 'client->sess'
  329. struct gclient_s {
  330. // ps MUST be the first element, because the server expects it
  331. playerState_t ps; // communicated by server to clients
  332. // private to game
  333. clientPersistant_t pers;
  334. clientSession_t sess;
  335. int lastCmdTime; // level.time of last usercmd_t, for EF_CONNECTION
  336. usercmd_t usercmd; // most recent usercmd
  337. int buttons;
  338. int oldbuttons;
  339. int latched_buttons;
  340. // sum up damage over an entire frame, so
  341. // shotgun blasts give a single big kick
  342. int damage_armor; // damage absorbed by armor
  343. int damage_blood; // damage taken out of health
  344. vec3_t damage_from; // origin for vector calculation
  345. bool damage_fromWorld; // if true, don't use the damage_from vector
  346. bool noclip;
  347. //icarus forced moving. is this still used?
  348. signed char forced_forwardmove;
  349. signed char forced_rightmove;
  350. // timers
  351. int respawnTime; // can respawn when time > this, force after g_forcerespwan
  352. int idleTime; // for playing idleAnims
  353. int airOutTime;
  354. // timeResidual is used to handle events that happen every second
  355. // like health / armor countdowns and regeneration
  356. int timeResidual;
  357. // Facial Expression Timers
  358. float facial_blink; // time before next blink. If a minus value, we are in blink mode
  359. float facial_timer; // time before next alert, frown or smile. If a minus value, we are in anim mode
  360. int facial_anim; // anim to show in anim mode
  361. //Client info - updated when ClientInfoChanged is called, instead of using configstrings
  362. clientInfo_t clientInfo;
  363. movetype_t moveType;
  364. int jetPackTime;
  365. int fireDelay; //msec to delay calling G_FireWeapon after EV_FIREWEAPON event is called
  366. // The time at which a breath should be triggered. -Aurelio
  367. int breathPuffTime;
  368. //Used to be in gentity_t, now here.. mostly formation stuff
  369. team_t playerTeam;
  370. team_t enemyTeam;
  371. gentity_t *leader;
  372. class_t NPC_class;
  373. //FIXME: could combine these
  374. float hiddenDist;//How close ents have to be to pick you up as an enemy
  375. vec3_t hiddenDir;//Normalized direction in which NPCs can't see you (you are hidden)
  376. renderInfo_t renderInfo;
  377. //dismember tracker
  378. bool dismembered;
  379. char dismemberProbLegs; // probability of the legs being dismembered (located in NPC.cfg, 0 = never, 100 = always)
  380. char dismemberProbHead; // probability of the head being dismembered (located in NPC.cfg, 0 = never, 100 = always)
  381. char dismemberProbArms; // probability of the arms being dismembered (located in NPC.cfg, 0 = never, 100 = always)
  382. char dismemberProbHands; // probability of the hands being dismembered (located in NPC.cfg, 0 = never, 100 = always)
  383. char dismemberProbWaist; // probability of the waist being dismembered (located in NPC.cfg, 0 = never, 100 = always)
  384. int standheight;
  385. int crouchheight;
  386. int poisonDamage; // Amount of poison damage to be given
  387. int poisonTime; // When to apply poison damage
  388. int slopeRecalcTime; // debouncer for slope-foot-height-diff calcing
  389. vec3_t pushVec;
  390. int pushVecTime;
  391. int noRagTime; //don't do ragdoll stuff if > level.time
  392. qboolean isRagging;
  393. int overridingBones; //dragging body or doing something else to override one or more ragdoll effector's/pcj's
  394. vec3_t ragLastOrigin; //keeping track of positions between rags while dragging corpses
  395. int ragLastOriginTime;
  396. //push refraction effect vars
  397. int pushEffectFadeTime;
  398. vec3_t pushEffectOrigin;
  399. //Rocket locking vars for non-player clients (only Vehicles use these right now...)
  400. int rocketLockIndex;
  401. float rocketLastValidTime;
  402. float rocketLockTime;
  403. float rocketTargetTime;
  404. //for trigger_space brushes
  405. int inSpaceSuffocation;
  406. int inSpaceIndex;
  407. };
  408. #define MAX_PARMS 16
  409. #define MAX_PARM_STRING_LENGTH MAX_QPATH//was 16, had to lengthen it so they could take a valid file path
  410. typedef struct
  411. {
  412. char parm[MAX_PARMS][MAX_PARM_STRING_LENGTH];
  413. } parms_t;
  414. #ifdef GAME_INCLUDE
  415. //these hold the place for the enums in functions.h so i don't have to recompile everytime it changes
  416. #define thinkFunc_t int
  417. #define clThinkFunc_t int
  418. #define reachedFunc_t int
  419. #define blockedFunc_t int
  420. #define touchFunc_t int
  421. #define useFunc_t int
  422. #define painFunc_t int
  423. #define dieFunc_t int
  424. #define MAX_FAILED_NODES 8
  425. #define MAX_INHAND_WEAPONS 2
  426. typedef struct centity_s centity_t;
  427. // !!!!!!!!!!! LOADSAVE-affecting struct !!!!!!!!!!!!!
  428. struct gentity_s {
  429. entityState_t s; // communicated by server to clients
  430. struct gclient_s *client; // NULL if not a player (unless it's NPC ( if (this->NPC != NULL) ) <sigh>... -slc)
  431. qboolean inuse;
  432. qboolean linked; // qfalse if not in any good cluster
  433. int svFlags; // SVF_NOCLIENT, SVF_BROADCAST, etc
  434. qboolean bmodel; // if false, assume an explicit mins / maxs bounding box
  435. // only set by gi.SetBrushModel
  436. vec3_t mins, maxs;
  437. int contents; // CONTENTS_TRIGGER, CONTENTS_SOLID, CONTENTS_BODY, etc
  438. // a non-solid entity should set to 0
  439. vec3_t absmin, absmax; // derived from mins/maxs and origin + rotation
  440. // currentOrigin will be used for all collision detection and world linking.
  441. // it will not necessarily be the same as the trajectory evaluation for the current
  442. // time, because each entity must be moved one at a time after time is advanced
  443. // to avoid simultanious collision issues
  444. vec3_t currentOrigin;
  445. vec3_t currentAngles;
  446. gentity_t *owner; // objects never interact with their owners, to
  447. // prevent player missiles from immediately
  448. // colliding with their owner
  449. /*
  450. Ghoul2 Insert Start
  451. */
  452. // this marker thing of Jake's is used for memcpy() length calcs, so don't put any ordinary fields (like above)
  453. // below this point or they won't work, and will mess up all sorts of stuff.
  454. //
  455. CGhoul2Info_v ghoul2;
  456. vec3_t modelScale; //needed for g2 collision
  457. /*
  458. Ghoul2 Insert End
  459. */
  460. // DO NOT MODIFY ANYTHING ABOVE THIS, THE SERVER
  461. // EXPECTS THE FIELDS IN THAT ORDER!
  462. //==========================================================================================
  463. //Essential entity fields
  464. // note: all the char* fields from here on should be left as ptrs, not declared, because of the way that ent-parsing
  465. // works by forcing field offset ptrs as char* and using G_NewString()!! (see G_ParseField() in gmae/g_spawn.cpp -slc
  466. //
  467. char *classname; // set in QuakeEd
  468. int spawnflags; // set in QuakeEd
  469. int flags; // FL_* variables
  470. char *model; // Normal model, or legs model on tri-models
  471. char *model2; // Torso model
  472. int freetime; // sv.time when the object was freed
  473. int eventTime; // events will be cleared EVENT_VALID_MSEC after set
  474. qboolean freeAfterEvent;
  475. // qboolean unlinkAfterEvent;
  476. //Physics and movement fields
  477. float physicsBounce; // 1.0 = continuous bounce, 0.0 = no bounce
  478. int clipmask; // brushes with this content value will be collided against
  479. // when moving. items and corpses do not collide against
  480. // players, for instance
  481. // moveInfo_t moveInfo; //FIXME: use this more?
  482. float speed;
  483. float resultspeed;
  484. int lastMoveTime;
  485. vec3_t movedir;
  486. vec3_t lastOrigin; //Where you were last frame
  487. vec3_t lastAngles; //Where you were looking last frame
  488. float mass; //How heavy you are
  489. int lastImpact; //Last time you impacted something
  490. //Variables reflecting environment
  491. int watertype;
  492. int waterlevel;
  493. short wupdate;
  494. short prev_waterlevel;
  495. //Targeting/linking fields
  496. float angle; // set in editor, -1 = up, -2 = down
  497. char *target;
  498. char *target2; //For multiple targets, not used for firing/triggering/using, though, only for path branches
  499. char *target3; //For multiple targets, not used for firing/triggering/using, though, only for path branches
  500. char *target4; //For multiple targets, not used for firing/triggering/using, though, only for path branches
  501. char *targetJump;
  502. char *targetname;
  503. char *team;
  504. union
  505. {
  506. char *roff; // the roff file to use, if there is one
  507. char *fxFile; // name of the external effect file
  508. };
  509. int roff_ctr; // current roff frame we are playing
  510. int next_roff_time;
  511. int fx_time; // timer for beam in/out effects.
  512. //Think Functions
  513. int nextthink;//Used to determine if it's time to call e_ThinkFunc again
  514. thinkFunc_t e_ThinkFunc;//Called once every game frame for every ent
  515. clThinkFunc_t e_clThinkFunc;//Think func for equivalent centity
  516. reachedFunc_t e_ReachedFunc;// movers call this when hitting endpoint
  517. blockedFunc_t e_BlockedFunc;
  518. touchFunc_t e_TouchFunc;
  519. useFunc_t e_UseFunc; //Called by G_UseTargets
  520. painFunc_t e_PainFunc; //Called by G_Damage when damage is taken
  521. dieFunc_t e_DieFunc; //Called by G_Damage when health reaches <= 0
  522. //Health and damage fields
  523. int health;
  524. int max_health;
  525. qboolean takedamage;
  526. material_t material;
  527. int damage;
  528. int dflags;
  529. //explosives, breakable brushes
  530. int splashDamage; // quad will increase this without increasing radius
  531. int splashRadius;
  532. int methodOfDeath;
  533. int splashMethodOfDeath;
  534. //int hitLoc;//where you were last hit
  535. int locationDamage[HL_MAX]; // Damage accumulated on different body locations
  536. //Entity pointers
  537. gentity_t *chain;
  538. gentity_t *enemy;
  539. gentity_t *activator;
  540. gentity_t *teamchain; // next entity in team
  541. gentity_t *teammaster; // master of the team
  542. gentity_t *lastEnemy;
  543. //Timing variables, counters and debounce times
  544. float wait;
  545. float random;
  546. int delay;
  547. qboolean alt_fire;
  548. int count;
  549. int bounceCount;
  550. int fly_sound_debounce_time; // wind tunnel
  551. int painDebounceTime;
  552. int disconnectDebounceTime;
  553. int attackDebounceTime;
  554. int pushDebounceTime;
  555. int aimDebounceTime;
  556. int useDebounceTime;
  557. //Unions for miscellaneous fields used under very specific circumstances
  558. union
  559. {
  560. qboolean trigger_formation;
  561. qboolean misc_dlight_active;
  562. qboolean has_bounced; // for thermal Det. we force at least one bounce to happen before it can do proximity checks
  563. };
  564. //Navigation
  565. int spawnContents; // store contents of ents on spawn so nav system can restore them
  566. int waypoint; //Set once per frame, if you've moved, and if someone asks
  567. int wayedge; //Used by doors and breakable things to know what edge goes through them
  568. int lastWaypoint; //To make sure you don't double-back
  569. int lastInAirTime;
  570. int noWaypointTime; //Debouncer - so don't keep checking every waypoint in existance every frame that you can't find one
  571. int combatPoint;
  572. vec3_t followPos;
  573. int followPosRecalcTime;
  574. int followPosWaypoint;
  575. //Animation
  576. qboolean loopAnim;
  577. int startFrame;
  578. int endFrame;
  579. //Script/ICARUS-related fields
  580. int m_iIcarusID;
  581. int taskID[NUM_TIDS];
  582. parms_t *parms;
  583. char *behaviorSet[NUM_BSETS];
  584. char *script_targetname;
  585. int delayScriptTime;
  586. // Ambient sound info
  587. char *soundSet; //Only used for local sets
  588. int setTime;
  589. //Used by cameras to locate subjects
  590. char *cameraGroup;
  591. //For damage
  592. team_t noDamageTeam;
  593. // Ghoul2 Animation info
  594. short playerModel;
  595. short weaponModel[MAX_INHAND_WEAPONS];
  596. short handRBolt;
  597. short handLBolt;
  598. short headBolt;
  599. short cervicalBolt;
  600. short chestBolt;
  601. short gutBolt;
  602. short torsoBolt;
  603. short crotchBolt;
  604. short motionBolt;
  605. short kneeLBolt;
  606. short kneeRBolt;
  607. short elbowLBolt;
  608. short elbowRBolt;
  609. short footLBolt;
  610. short footRBolt;
  611. short faceBone;
  612. short craniumBone;
  613. short cervicalBone;
  614. short thoracicBone;
  615. short upperLumbarBone;
  616. short lowerLumbarBone;
  617. short hipsBone;
  618. short motionBone;
  619. short rootBone;
  620. short footLBone;
  621. short footRBone;
  622. short humerusRBone;
  623. short genericBone1; // For bones special to an entity
  624. short genericBone2;
  625. short genericBone3;
  626. short genericBolt1; // For bolts special to an entity
  627. short genericBolt2;
  628. short genericBolt3;
  629. short genericBolt4;
  630. short genericBolt5;
  631. qhandle_t cinematicModel;
  632. //==========================================================================================
  633. //FIELDS USED EXCLUSIVELY BY SPECIFIC CLASSES OF ENTITIES
  634. // Vehicle information.
  635. // The vehicle object.
  636. Vehicle_t *m_pVehicle;
  637. //NPC/Player entity fields
  638. //FIXME: Make these client only?
  639. gNPC_t *NPC;//Only allocated if the entity becomes an NPC
  640. //Other NPC/Player-related entity fields
  641. char *ownername;//Used by squadpaths to locate owning NPC
  642. //FIXME: Only used by NPCs, move it to gNPC_t
  643. int cantHitEnemyCounter;//HACK - Makes them look for another enemy on the same team if the one they're after can't be hit
  644. //Only used by NPC_spawners
  645. char *NPC_type;
  646. char *NPC_targetname;
  647. char *NPC_target;
  648. //Variables used by movers (most likely exclusively by them)
  649. moverState_t moverState;
  650. int soundPos1;
  651. int sound1to2;
  652. int sound2to1;
  653. int soundPos2;
  654. int soundLoop;
  655. gentity_t *nextTrain;
  656. gentity_t *prevTrain;
  657. vec3_t pos1, pos2;
  658. vec3_t pos3;
  659. int sounds;
  660. char *closetarget;
  661. char *opentarget;
  662. char *paintarget;
  663. int lockCount; //for maglocks- actually get put on the trigger for the door
  664. //Variables used only by waypoints (for the most part)
  665. float radius;
  666. union
  667. {
  668. int wpIndex;
  669. int fxID; // id of the external effect file
  670. };
  671. int noise_index;
  672. vec4_t startRGBA;
  673. union
  674. {
  675. vec4_t finalRGBA;
  676. vec3_t pos4;
  677. vec3_t modelAngles; //for brush entities with an attached md3 model, as an offset to the brush's angles
  678. };
  679. //FIXME: Are these being used anymore?
  680. gitem_t *item; // for bonus items -
  681. char *message; //Used by triggers to print a message when activated
  682. float lightLevel;
  683. //FIXME: can these be removed/condensed/absorbed?
  684. //Rendering info
  685. //int color;
  686. //Force effects
  687. int forcePushTime;
  688. int forcePuller; //who force-pulled me (so we don't damage them if we hit them)
  689. };
  690. #endif //#ifdef GAME_INCLUDE
  691. //extern gentity_t g_entities[MAX_GENTITIES];
  692. extern gentity_t *g_entities;
  693. #ifndef _USRDLL
  694. extern game_import_t gi;
  695. #endif
  696. // each WP_* weapon enum has an associated weaponInfo_t
  697. // that contains media references necessary to present the
  698. // weapon and its effects
  699. typedef struct weaponInfo_s {
  700. qboolean registered;
  701. gitem_t *item;
  702. qhandle_t handsModel; // the hands don't actually draw, they just position the weapon
  703. qhandle_t weaponModel; //for in view
  704. qhandle_t weaponWorldModel; //for in their hands
  705. qhandle_t barrelModel[4];
  706. vec3_t weaponMidpoint; // so it will rotate centered instead of by tag
  707. qhandle_t weaponIcon; // The version of the icon with a glowy background
  708. qhandle_t weaponIconNoAmmo; // The version of the icon with no ammo warning
  709. qhandle_t ammoIcon;
  710. qhandle_t ammoModel;
  711. qhandle_t missileModel;
  712. sfxHandle_t missileSound;
  713. void (*missileTrailFunc)( centity_t *, const struct weaponInfo_s *wi );
  714. qhandle_t alt_missileModel;
  715. sfxHandle_t alt_missileSound;
  716. void (*alt_missileTrailFunc)( centity_t *, const struct weaponInfo_s *wi );
  717. // sfxHandle_t flashSound;
  718. // sfxHandle_t altFlashSound;
  719. sfxHandle_t firingSound;
  720. sfxHandle_t altFiringSound;
  721. sfxHandle_t stopSound;
  722. sfxHandle_t missileHitSound;
  723. sfxHandle_t altmissileHitSound;
  724. sfxHandle_t chargeSound;
  725. sfxHandle_t altChargeSound;
  726. sfxHandle_t selectSound; // sound played when weapon is selected
  727. #ifdef _IMMERSION
  728. ffHandle_t firingForce;
  729. ffHandle_t altFiringForce;
  730. ffHandle_t stopForce;
  731. ffHandle_t chargeForce;
  732. ffHandle_t altChargeForce;
  733. ffHandle_t selectForce;
  734. #endif // _IMMERSION
  735. } weaponInfo_t;
  736. extern sfxHandle_t CAS_GetBModelSound( const char *name, int stage );
  737. enum
  738. {
  739. EDGE_NORMAL,
  740. EDGE_PATH,
  741. EDGE_BLOCKED,
  742. EDGE_FAILED,
  743. EDGE_FLY,
  744. EDGE_JUMP,
  745. EDGE_LARGE,
  746. EDGE_PATHBLOCKED,
  747. EDGE_NEARESTVALID,
  748. EDGE_NEARESTINVALID,
  749. EDGE_NODE_FLOATING,
  750. EDGE_NODE_NORMAL,
  751. EDGE_NODE_GOAL,
  752. EDGE_NODE_COMBAT,
  753. EDGE_CELL,
  754. EDGE_CELL_EMPTY,
  755. EDGE_IMPACT_SAFE,
  756. EDGE_IMPACT_POSSIBLE,
  757. EDGE_THRUST,
  758. EDGE_VELOCITY,
  759. EDGE_FOLLOWPOS,
  760. EDGE_WHITE_ONESECOND,
  761. EDGE_WHITE_TWOSECOND,
  762. EDGE_RED_ONESECOND,
  763. EDGE_RED_TWOSECOND,
  764. };
  765. enum
  766. {
  767. NODE_NORMAL,
  768. NODE_FLOATING,
  769. NODE_GOAL,
  770. NODE_NAVGOAL,
  771. };
  772. #endif // #ifndef __G_SHARED_H__