g_local.h 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628
  1. #ifndef __G_LOCAL_H__
  2. #define __G_LOCAL_H__
  3. // g_local.h -- local definitions for game module
  4. // define GAME_INCLUDE so that g_public.h does not define the
  5. // short, server-visible gclient_t and gentity_t structures,
  6. // because we define the full size ones in this file
  7. #define GAME_INCLUDE
  8. #include "../ui/gameinfo.h"
  9. #include "g_shared.h"
  10. #include "anims.h"
  11. #include "dmstates.h"
  12. //==================================================================
  13. // the "gameversion" client command will print this plus compile date
  14. #define GAMEVERSION "base"
  15. #define BODY_QUEUE_SIZE 8
  16. #define Q3_INFINITE 16777216
  17. #define FRAMETIME 100 // msec
  18. #define EVENT_VALID_MSEC 300
  19. #define CARNAGE_REWARD_TIME 3000
  20. #define INTERMISSION_DELAY_TIME 1000
  21. #define START_TIME_LINK_ENTS FRAMETIME*1 // time-delay after map start at which all ents have been spawned, so can link them
  22. #define START_TIME_FIND_LINKS FRAMETIME*2 // time-delay after map start at which you can find linked entities
  23. #define START_TIME_MOVERS_SPAWNED FRAMETIME*2 // time-delay after map start at which all movers should be spawned
  24. #define START_TIME_REMOVE_ENTS FRAMETIME*3 // time-delay after map start to remove temporary ents
  25. #define START_TIME_NAV_CALC FRAMETIME*4 // time-delay after map start to connect waypoints and calc routes
  26. #define START_TIME_FIND_WAYPOINT FRAMETIME*5 // time-delay after map start after which it's okay to try to find your best waypoint
  27. // gentity->flags
  28. #define FL_SHIELDED 0x00000001 // protected from all damage except lightsabers
  29. #define FL_DMG_BY_HEAVY_WEAP_ONLY 0x00000002 // protected from all damage except heavy weap class missiles
  30. #define FL_DMG_BY_SABER_ONLY 0x00000004 //protected from all damage except saber damage
  31. #define FL_GODMODE 0x00000010
  32. #define FL_NOTARGET 0x00000020
  33. #define FL_TEAMSLAVE 0x00000400 // not the first on the team
  34. #define FL_NO_KNOCKBACK 0x00000800
  35. #define FL_DROPPED_ITEM 0x00001000
  36. #define FL_DONT_SHOOT 0x00002000 // Can target him, but not shoot him
  37. #define FL_UNDYING 0x00004000 // Takes damage down to 1 point, but does not die
  38. //#define FL_OVERCHARGED 0x00008000 // weapon shot is an overcharged version....probably a lame place to be putting this flag...
  39. #define FL_LOCK_PLAYER_WEAPONS 0x00010000 // player can't switch weapons... ask james if there's a better spot for this
  40. #define FL_DISINTEGRATED 0x00020000 // marks that the corpse has already been disintegrated
  41. #define FL_FORCE_PULLABLE_ONLY 0x00040000 // cannot be force pushed
  42. #define FL_NO_IMPACT_DMG 0x00080000 // Will not take impact damage
  43. #define FL_OVERCHARGED_HEALTH 0x00100000 // Reduce health back to max
  44. #define FL_NO_ANGLES 0x00200000 // No bone angle overrides, no pitch or roll in full angles
  45. #define FL_RED_CROSSHAIR 0x00400000 // Crosshair red on me
  46. //Pointer safety utilities
  47. #define VALID( a ) ( a != NULL )
  48. #define VALIDATE( a ) ( assert( a ) )
  49. #define VALIDATEV( a ) if ( a == NULL ) { assert(0); return; }
  50. #define VALIDATEB( a ) if ( a == NULL ) { assert(0); return qfalse; }
  51. #define VALIDATEP( a ) if ( a == NULL ) { assert(0); return NULL; }
  52. #define VALIDSTRING( a ) ( ( a != NULL ) && ( a[0] != NULL ) )
  53. //animations
  54. typedef struct
  55. {
  56. char filename[MAX_QPATH];
  57. animation_t animations[MAX_ANIMATIONS];
  58. animevent_t torsoAnimEvents[MAX_ANIM_EVENTS];
  59. animevent_t legsAnimEvents[MAX_ANIM_EVENTS];
  60. unsigned char torsoAnimEventCount;
  61. unsigned char legsAnimEventCount;
  62. } animFileSet_t;
  63. extern stringID_table_t animTable [MAX_ANIMATIONS+1];
  64. //Interest points
  65. #define MAX_INTEREST_POINTS 64
  66. typedef struct
  67. {
  68. vec3_t origin;
  69. char *target;
  70. } interestPoint_t;
  71. //Combat points
  72. #define MAX_COMBAT_POINTS 512
  73. typedef struct
  74. {
  75. vec3_t origin;
  76. int flags;
  77. // char *NPC_targetname;
  78. // team_t team;
  79. qboolean occupied;
  80. int waypoint;
  81. int dangerTime;
  82. } combatPoint_t;
  83. // Alert events
  84. #define MAX_ALERT_EVENTS 32
  85. enum alertEventType_e
  86. {
  87. AET_SIGHT,
  88. AET_SOUND,
  89. };
  90. enum alertEventLevel_e
  91. {
  92. AEL_MINOR, //Enemy responds to the sound, but only by looking
  93. AEL_SUSPICIOUS, //Enemy looks at the sound, and will also investigate it
  94. AEL_DISCOVERED, //Enemy knows the player is around, and will actively hunt
  95. AEL_DANGER, //Enemy should try to find cover
  96. AEL_DANGER_GREAT, //Enemy should run like hell!
  97. };
  98. // !!!!!!!!! LOADSAVE-affecting struct !!!!!!!!!!
  99. typedef struct alertEvent_s
  100. {
  101. vec3_t position; //Where the event is located
  102. float radius; //Consideration radius
  103. alertEventLevel_e level; //Priority level of the event
  104. alertEventType_e type; //Event type (sound,sight)
  105. gentity_t *owner; //Who made the sound
  106. float light; //ambient light level at point
  107. float addLight; //additional light- makes it more noticable, even in darkness
  108. 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
  109. int timestamp; //when it was created
  110. qboolean onGround; //alert is on the ground (only used for sounds)
  111. } alertEvent_t;
  112. //
  113. // this structure is cleared as each map is entered
  114. //
  115. #define MAX_SPAWN_VARS 64
  116. #define MAX_SPAWN_VARS_CHARS 2048
  117. typedef struct
  118. {
  119. char targetname[MAX_QPATH];
  120. char target[MAX_QPATH];
  121. char target2[MAX_QPATH];
  122. char target3[MAX_QPATH];
  123. char target4[MAX_QPATH];
  124. int nodeID;
  125. } waypointData_t;
  126. #define WF_RAINING 0x00000001 // raining
  127. #define WF_SNOWING 0x00000002 // snowing
  128. #define WF_PUFFING 0x00000004 // puffing something
  129. // !!!!!!!!!! LOADSAVE-affecting structure !!!!!!!!!!
  130. typedef struct
  131. {
  132. gclient_t *clients; // [maxclients]
  133. // store latched cvars here that we want to get at often
  134. int maxclients;
  135. int framenum;
  136. int time; // in msec
  137. int previousTime; // so movers can back up when blocked
  138. int globalTime; // global time at level initialization
  139. char mapname[MAX_QPATH]; // the server name (base1, etc)
  140. qboolean locationLinked; // target_locations get linked
  141. gentity_t *locationHead; // head of the location list
  142. alertEvent_t alertEvents[ MAX_ALERT_EVENTS ];
  143. int numAlertEvents;
  144. int curAlertID;
  145. AIGroupInfo_t groups[MAX_FRAME_GROUPS];
  146. animFileSet_t knownAnimFileSets[MAX_ANIM_FILES];
  147. int numKnownAnimFileSets;
  148. int worldFlags;
  149. int dmState; //actually, we do want save/load the dynamic music state
  150. // =====================================
  151. //
  152. // NOTE!!!!!! The only things beyond this point in the structure should be the ones you do NOT wish to be
  153. // affected by loading saved-games. Since loading a game first starts the map and then loads
  154. // over things like entities etc then these fields are usually the ones setup by the map loader.
  155. // If they ever get modified in-game let me know and I'll include them in the save. -Ste
  156. //
  157. #define LEVEL_LOCALS_T_SAVESTOP logFile // name of whichever field is next below this in the source
  158. fileHandle_t logFile;
  159. //Interest points- squadmates automatically look at these if standing around and close to them
  160. interestPoint_t interestPoints[MAX_INTEREST_POINTS];
  161. int numInterestPoints;
  162. //Combat points- NPCs in bState BS_COMBAT_POINT will find their closest empty combat_point
  163. combatPoint_t combatPoints[MAX_COMBAT_POINTS];
  164. int numCombatPoints;
  165. char spawntarget[MAX_QPATH]; // the targetname of the spawnpoint you want the player to start at
  166. int dmDebounceTime;
  167. int dmBeatTime;
  168. int mNumBSPInstances;
  169. int mBSPInstanceDepth;
  170. vec3_t mOriginAdjust;
  171. float mRotationAdjust;
  172. char *mTargetAdjust;
  173. qboolean hasBspInstances;
  174. } level_locals_t;
  175. extern level_locals_t level;
  176. extern game_export_t globals;
  177. extern cvar_t *g_gravity;
  178. extern cvar_t *g_speed;
  179. extern cvar_t *g_cheats;
  180. extern cvar_t *g_developer;
  181. extern cvar_t *g_knockback;
  182. extern cvar_t *g_inactivity;
  183. extern cvar_t *g_debugMove;
  184. extern cvar_t *g_subtitles;
  185. extern cvar_t *g_removeDoors;
  186. extern cvar_t *g_ICARUSDebug;
  187. extern cvar_t *g_npcdebug;
  188. extern gentity_t *player;
  189. //
  190. // g_spawn.c
  191. //
  192. qboolean G_SpawnField( unsigned int uiField, char **ppKey, char **ppValue );
  193. qboolean G_SpawnString( const char *key, const char *defaultString, char **out );
  194. // spawn string returns a temporary reference, you must CopyString() if you want to keep it
  195. qboolean G_SpawnFloat( const char *key, const char *defaultString, float *out );
  196. qboolean G_SpawnInt( const char *key, const char *defaultString, int *out );
  197. qboolean G_SpawnVector( const char *key, const char *defaultString, float *out );
  198. qboolean G_SpawnVector4( const char *key, const char *defaultString, float *out );
  199. qboolean G_SpawnAngleHack( const char *key, const char *defaultString, float *out );
  200. void G_SpawnEntitiesFromString( const char *entities );
  201. //
  202. // g_cmds.c
  203. //
  204. void Cmd_Score_f (gentity_t *ent);
  205. //
  206. // g_items.c
  207. //
  208. void G_RunItem( gentity_t *ent );
  209. void RespawnItem( gentity_t *ent );
  210. void UseHoldableItem( gentity_t *ent );
  211. void PrecacheItem (gitem_t *it);
  212. gentity_t *Drop_Item( gentity_t *ent, gitem_t *item, float angle, qboolean copytarget );
  213. void SetRespawn (gentity_t *ent, float delay);
  214. void G_SpawnItem (gentity_t *ent, gitem_t *item);
  215. void FinishSpawningItem( gentity_t *ent );
  216. void Think_Weapon (gentity_t *ent);
  217. int ArmorIndex (gentity_t *ent);
  218. void Add_Ammo (gentity_t *ent, int weapon, int count);
  219. void Touch_Item (gentity_t *ent, gentity_t *other, trace_t *trace);
  220. void ClearRegisteredItems( void );
  221. void RegisterItem( gitem_t *item );
  222. void SaveRegisteredItems( void );
  223. //
  224. // g_utils.c
  225. //
  226. int G_ModelIndex( const char *name );
  227. int G_SoundIndex( const char *name );
  228. /*
  229. Ghoul2 Insert Start
  230. */
  231. int G_SkinIndex( const char *name );
  232. void G_SetBoltSurfaceRemoval( const int entNum, const int modelIndex, const int boltIndex, const int surfaceIndex = -1, float duration = 5000 );
  233. /*
  234. Ghoul2 Insert End
  235. */
  236. int G_EffectIndex( const char *name );
  237. void G_PlayEffect( const char *name, const vec3_t origin );
  238. void G_PlayEffect( const char *name, int clientNum );
  239. void G_PlayEffect( const char *name, const vec3_t origin, const vec3_t fwd );
  240. void G_PlayEffect( const char *name, const vec3_t origin, const vec3_t axis[3] );
  241. void G_PlayEffect( int fxID, const vec3_t origin, const vec3_t fwd );
  242. void G_PlayEffect( int fxID, const vec3_t origin, const vec3_t axis[3] );
  243. void G_PlayEffect( int fxID, const int modelIndex, const int boltIndex, const int entNum, const vec3_t origin, int iLoopTime = qfalse, qboolean isRelative = qfalse );//iLoopTime 0 = not looping, 1 for infinite, else duration
  244. void G_PlayEffect( int fxID, int entNum, const vec3_t fwd );
  245. #ifdef _IMMERSION
  246. void G_PlayEffect( const char *name, int clientNum, const vec3_t origin, const vec3_t fwd );
  247. void G_PlayEffect( int fxID, int clientNum, const vec3_t origin, const vec3_t fwd );
  248. #endif // _IMMERSION
  249. void G_StopEffect( int fxID, const int modelIndex, const int boltIndex, const int entNum );
  250. void G_StopEffect(const char *name, const int modelIndex, const int boltIndex, const int entNum );
  251. int G_BSPIndex( char *name );
  252. void G_KillBox (gentity_t *ent);
  253. gentity_t *G_Find (gentity_t *from, int fieldofs, const char *match);
  254. int G_RadiusList ( vec3_t origin, float radius, gentity_t *ignore, qboolean takeDamage, gentity_t *ent_list[MAX_GENTITIES]);
  255. gentity_t *G_PickTarget (char *targetname);
  256. void G_UseTargets (gentity_t *ent, gentity_t *activator);
  257. void G_UseTargets2 (gentity_t *ent, gentity_t *activator, const char *string);
  258. void G_SetMovedir ( vec3_t angles, vec3_t movedir);
  259. void G_InitGentity( gentity_t *e, qboolean bFreeG2 );
  260. gentity_t *G_Spawn ( int itr = 1);
  261. gentity_t *G_TempEntity( const vec3_t origin, int event );
  262. void G_Sound( gentity_t *ent, int soundIndex );
  263. void G_FreeEntity( gentity_t *e );
  264. #ifdef _IMMERSION
  265. int G_ForceIndex( const char *name, int channel );
  266. void G_Force( gentity_t *ent, int forceIndex );
  267. void G_ForceArea( gentity_t *ent, int forceIndex );
  268. void G_ForceBroadcast( gentity_t *ent, int forceIndex );
  269. void G_ForceStop( gentity_t* ent, int forceIndex );
  270. #endif // _IMMERSION
  271. void G_TouchTriggers (gentity_t *ent);
  272. void G_TouchTeamClients (gentity_t *ent);
  273. void G_TouchSolids (gentity_t *ent);
  274. char *vtos( const vec3_t v );
  275. float vectoyaw( const vec3_t vec );
  276. void G_AddEvent( gentity_t *ent, int event, int eventParm );
  277. void G_SetOrigin( gentity_t *ent, const vec3_t origin );
  278. void G_SetAngles( gentity_t *ent, const vec3_t angles );
  279. void G_DebugLine(vec3_t A, vec3_t B, int duration, int color, qboolean deleteornot);
  280. //
  281. // g_combat.c
  282. //
  283. qboolean CanDamage (gentity_t *targ, const vec3_t origin);
  284. void G_Damage( gentity_t *targ, gentity_t *inflictor, gentity_t *attacker, const vec3_t dir, const vec3_t point, int damage, int dflags, int mod, int hitLoc=HL_NONE );
  285. void G_RadiusDamage (const vec3_t origin, gentity_t *attacker, float damage, float radius, gentity_t *ignore, int mod);
  286. gentity_t *TossClientItems( gentity_t *self );
  287. void ExplodeDeath_Wait( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int damage, int meansOfDeath,int dFlags,int hitLoc );
  288. void ExplodeDeath( gentity_t *self );
  289. void GoExplodeDeath( gentity_t *self, gentity_t *other, gentity_t *activator);
  290. void G_ApplyKnockback( gentity_t *targ, const vec3_t newDir, float knockback );
  291. void G_Throw( gentity_t *targ, const vec3_t newDir, float push );
  292. // damage flags
  293. #define DAMAGE_RADIUS 0x00000001 // damage was indirect
  294. #define DAMAGE_NO_ARMOR 0x00000002 // armour does not protect from this damage
  295. #define DAMAGE_NO_KNOCKBACK 0x00000008 // do not affect velocity, just view angles
  296. #define DAMAGE_NO_HIT_LOC 0x00000010 // do not modify damage by hit loc
  297. #define DAMAGE_NO_PROTECTION 0x00000020 // armor, shields, invulnerability, and godmode have no effect
  298. #define DAMAGE_EXTRA_KNOCKBACK 0x00000040 // add extra knockback to this damage
  299. #define DAMAGE_DEATH_KNOCKBACK 0x00000080 // only does knockback on death of target
  300. #define DAMAGE_IGNORE_TEAM 0x00000100 // damage is always done, regardless of teams
  301. #define DAMAGE_NO_DAMAGE 0x00000200 // do no actual damage but react as if damage was taken
  302. #define DAMAGE_DISMEMBER 0x00000400 // do dismemberment
  303. #define DAMAGE_NO_KILL 0x00000800 // do damage, but don't kill them
  304. #define DAMAGE_HEAVY_WEAP_CLASS 0x00001000 // doing heavy weapon type damage, certain objects may only take damage by missiles containing this flag
  305. #define DAMAGE_CUSTOM_HUD 0x00002000 // really dumb, but....
  306. #define DAMAGE_IMPACT_DIE 0x00004000 // if a vehicle hits a wall it should instantly die
  307. #define DAMAGE_DIE_ON_IMPACT 0x00008000 // ignores force-power based protection
  308. //
  309. // g_missile.c
  310. //
  311. void G_RunMissile( gentity_t *ent );
  312. gentity_t *fire_blaster (gentity_t *self, vec3_t start, vec3_t aimdir);
  313. gentity_t *fire_plasma (gentity_t *self, vec3_t start, vec3_t aimdir);
  314. gentity_t *fire_grenade (gentity_t *self, vec3_t start, vec3_t aimdir);
  315. gentity_t *fire_rocket (gentity_t *self, vec3_t start, vec3_t dir);
  316. //
  317. // g_mover.c
  318. //
  319. #define MOVER_START_ON 1
  320. #define MOVER_FORCE_ACTIVATE 2
  321. #define MOVER_CRUSHER 4
  322. #define MOVER_TOGGLE 8
  323. #define MOVER_LOCKED 16
  324. #define MOVER_GOODIE 32
  325. #define MOVER_PLAYER_USE 64
  326. #define MOVER_INACTIVE 128
  327. void G_RunMover( gentity_t *ent );
  328. //
  329. // g_misc.c
  330. //
  331. void TeleportPlayer( gentity_t *player, vec3_t origin, vec3_t angles );
  332. //
  333. // g_weapon.c
  334. //
  335. //void CalcMuzzlePoint ( gentity_t *ent, vec3_t forward, vec3_t right, vec3_t up, vec3_t muzzlePoint );
  336. //void SnapVectorTowards( vec3_t v, vec3_t to );
  337. //qboolean CheckGauntletAttack( gentity_t *ent );
  338. void WP_LoadWeaponParms (void);
  339. void IT_LoadItemParms( void );
  340. //
  341. // g_client.c
  342. //
  343. team_t PickTeam( int ignoreClientNum );
  344. void SetClientViewAngle( gentity_t *ent, vec3_t angle );
  345. gentity_t *SelectSpawnPoint ( vec3_t avoidPoint, team_t team, vec3_t origin, vec3_t angles );
  346. void respawn (gentity_t *ent);
  347. void InitClientPersistant (gclient_t *client);
  348. void InitClientResp (gclient_t *client);
  349. qboolean ClientSpawn( gentity_t *ent, SavedGameJustLoaded_e eSavedGameJustLoaded );
  350. void player_die (gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int damage, int mod, int dFlags, int hitLoc);
  351. void AddScore( gentity_t *ent, int score );
  352. qboolean SpotWouldTelefrag( gentity_t *spot, team_t checkteam );
  353. void G_RemoveWeaponModels( gentity_t *ent );
  354. //
  355. // g_svcmds.c
  356. //
  357. qboolean ConsoleCommand( void );
  358. //
  359. // g_weapon.c
  360. //
  361. void FireWeapon( gentity_t *ent, qboolean alt_fire );
  362. //
  363. // p_hud.c
  364. //
  365. void MoveClientToIntermission (gentity_t *client);
  366. void G_SetStats (gentity_t *ent);
  367. void DeathmatchScoreboardMessage (gentity_t *client);
  368. //
  369. // g_cmds.c
  370. //
  371. static void G_SayTo( gentity_t *ent, gentity_t *other, int mode, int color, const char *name, const char *message );
  372. //
  373. // g_pweapon.c
  374. //
  375. //
  376. // g_main.c
  377. //
  378. void G_RunThink (gentity_t *ent);
  379. void QDECL G_Error( const char *fmt, ... );
  380. void SetInUse(gentity_t *ent);
  381. void ClearInUse(gentity_t *ent);
  382. qboolean PInUse(unsigned int entNum);
  383. qboolean PInUse2(gentity_t *ent);
  384. void WriteInUseBits(void);
  385. void ReadInUseBits(void);
  386. //
  387. // g_nav.cpp
  388. //
  389. void Svcmd_Nav_f (void);
  390. //
  391. // g_squad.cpp
  392. //
  393. void Svcmd_Comm_f (void);
  394. void Svcmd_Hail_f (void);
  395. void Svcmd_Form_f (void);
  396. //
  397. // g_utils.cpp
  398. //
  399. void Svcmd_Use_f (void);
  400. extern void G_SoundOnEnt( gentity_t *ent, soundChannel_t channel, const char *soundPath );
  401. extern void G_SoundIndexOnEnt( gentity_t *ent, soundChannel_t channel, int index );
  402. //
  403. // g_weapons.cpp
  404. //
  405. //
  406. // g_client.c
  407. //
  408. char *ClientConnect( int clientNum, qboolean firstTime, SavedGameJustLoaded_e eSavedGameJustLoaded );
  409. void ClientUserinfoChanged( int clientNum );
  410. void ClientDisconnect( int clientNum );
  411. void ClientBegin( int clientNum, usercmd_t *cmd, SavedGameJustLoaded_e eSavedGameJustLoaded );
  412. void ClientCommand( int clientNum );
  413. //
  414. // g_active.c
  415. //
  416. void ClientThink( int clientNum, usercmd_t *cmd );
  417. void ClientEndFrame (gentity_t *ent);
  418. //
  419. // g_inventory.cpp
  420. //
  421. extern qboolean INV_GoodieKeyGive( gentity_t *target );
  422. extern qboolean INV_GoodieKeyTake( gentity_t *target );
  423. extern int INV_GoodieKeyCheck( gentity_t *target );
  424. extern qboolean INV_SecurityKeyGive( gentity_t *target, const char *keyname );
  425. extern void INV_SecurityKeyTake( gentity_t *target, char *keyname );
  426. extern qboolean INV_SecurityKeyCheck( gentity_t *target, char *keyname );
  427. //
  428. // g_team.c
  429. //
  430. qboolean OnSameTeam( gentity_t *ent1, gentity_t *ent2 );
  431. //
  432. // g_mem.c
  433. //
  434. void *G_Alloc( int size );
  435. void G_InitMemory( void );
  436. void Svcmd_GameMem_f( void );
  437. //
  438. // g_session.c
  439. //
  440. void G_ReadSessionData( gclient_t *client );
  441. void G_InitSessionData( gclient_t *client, char *userinfo );
  442. void G_InitWorldSession( void );
  443. void G_WriteSessionData( void );
  444. //
  445. // NPC_senses.cpp
  446. //
  447. extern void AddSightEvent( gentity_t *owner, vec3_t position, float radius, alertEventLevel_e alertLevel, float addLight=0.0f );
  448. extern void AddSoundEvent( gentity_t *owner, vec3_t position, float radius, alertEventLevel_e alertLevel, qboolean needLOS = qfalse, qboolean onGround = qfalse );
  449. extern qboolean G_CheckForDanger( gentity_t *self, int alertEvent );
  450. extern int G_CheckAlertEvents( gentity_t *self, qboolean checkSight, qboolean checkSound, float maxSeeDist, float maxHearDist, int ignoreAlert = -1, qboolean mustHaveOwner = qfalse, int minAlertLevel = AEL_MINOR, qboolean onGroundOnly = qfalse );
  451. extern qboolean G_CheckForDanger( gentity_t *self, int alertEvent );
  452. extern qboolean G_ClearLOS( gentity_t *self, const vec3_t start, const vec3_t end );
  453. extern qboolean G_ClearLOS( gentity_t *self, gentity_t *ent, const vec3_t end );
  454. extern qboolean G_ClearLOS( gentity_t *self, const vec3_t start, gentity_t *ent );
  455. extern qboolean G_ClearLOS( gentity_t *self, gentity_t *ent );
  456. extern qboolean G_ClearLOS( gentity_t *self, const vec3_t end );
  457. //============================================================================
  458. //Tags
  459. // Reference tags
  460. #define MAX_REFTAGS 128 // Probably more than we'll ever need
  461. #define MAX_REFNAME 32
  462. #define RTF_NONE 0
  463. #define RTF_NAVGOAL 0x00000001
  464. typedef struct reference_tag_s
  465. {
  466. char name[MAX_REFNAME];
  467. vec3_t origin;
  468. vec3_t angles;
  469. int flags; //Just in case
  470. int radius; //For nav goals
  471. } reference_tag_t;
  472. extern void TAG_Init( void );
  473. extern reference_tag_t *TAG_Add( const char *name, const char *owner, vec3_t origin, vec3_t angles, int radius, int flags );
  474. extern int TAG_GetOrigin( const char *owner, const char *name, vec3_t origin );
  475. extern int TAG_GetAngles( const char *owner, const char *name, vec3_t angles );
  476. extern int TAG_GetRadius( const char *owner, const char *name );
  477. extern int TAG_GetFlags( const char *owner, const char *name );
  478. void TAG_ShowTags( int flags );
  479. // Reference tags END
  480. extern char *G_NewString( const char *string );
  481. // some stuff for savegames...
  482. //
  483. void WriteLevel(qboolean qbAutosave);
  484. void ReadLevel(qboolean qbAutosave, qboolean qbLoadTransition);
  485. qboolean GameAllowedToSaveHere(void);
  486. extern qboolean G_ActivateBehavior( gentity_t *ent, int bset );
  487. //Timing information
  488. void TIMER_Clear( void );
  489. void TIMER_Clear( int idx );
  490. void TIMER_Save( void );
  491. void TIMER_Load( void );
  492. void TIMER_Set( gentity_t *ent, const char *identifier, int duration );
  493. int TIMER_Get( gentity_t *ent, const char *identifier );
  494. qboolean TIMER_Done( gentity_t *ent, const char *identifier );
  495. qboolean TIMER_Start( gentity_t *self, const char *identifier, int duration );
  496. qboolean TIMER_Done2( gentity_t *ent, const char *identifier, qboolean remove = qfalse );
  497. qboolean TIMER_Exists( gentity_t *ent, const char *identifier );
  498. void TIMER_Remove( gentity_t *ent, const char *identifier );
  499. float NPC_GetHFOVPercentage( vec3_t spot, vec3_t from, vec3_t facing, float hFOV );
  500. float NPC_GetVFOVPercentage( vec3_t spot, vec3_t from, vec3_t facing, float vFOV );
  501. #ifdef _XBOX
  502. // data used for NPC water detection
  503. #define MAX_NPC_WATER_UPDATE 64 // maximum npcs that can be waiting for a water update
  504. #define MAX_NPC_WATER_UPDATES_PER_FRAME 2 // updates per frame
  505. extern short npcsToUpdate[MAX_NPC_WATER_UPDATE]; // queue of npcs
  506. extern short npcsToUpdateTop; // top of the queue
  507. extern short npcsToUpdateCount; // number of npcs in the queue
  508. #endif // _XBOX
  509. #endif//#ifndef __G_LOCAL_H__