p_local.h 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283
  1. /*
  2. ===========================================================================
  3. Doom 3 BFG Edition GPL Source Code
  4. Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
  5. This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
  6. Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
  7. it under the terms of the GNU General Public License as published by
  8. the Free Software Foundation, either version 3 of the License, or
  9. (at your option) any later version.
  10. Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
  11. but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. GNU General Public License for more details.
  14. You should have received a copy of the GNU General Public License
  15. along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
  16. In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
  17. If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
  18. ===========================================================================
  19. */
  20. #ifndef __P_LOCAL__
  21. #define __P_LOCAL__
  22. #ifndef __R_LOCAL__
  23. #include "r_local.h"
  24. #endif
  25. #define FLOATSPEED (FRACUNIT*4)
  26. #define MAXHEALTH 100
  27. #define VIEWHEIGHT (41*FRACUNIT)
  28. // mapblocks are used to check movement
  29. // against lines and things
  30. #define MAPBLOCKUNITS 128
  31. #define MAPBLOCKSIZE (MAPBLOCKUNITS*FRACUNIT)
  32. #define MAPBLOCKSHIFT (FRACBITS+7)
  33. #define MAPBMASK (MAPBLOCKSIZE-1)
  34. #define MAPBTOFRAC (MAPBLOCKSHIFT-FRACBITS)
  35. // player radius for movement checking
  36. #define PLAYERRADIUS 16*FRACUNIT
  37. // MAXRADIUS is for precalculated sector block boxes
  38. // the spider demon is larger,
  39. // but we do not have any moving sectors nearby
  40. #define MAXRADIUS 32*FRACUNIT
  41. #define GRAVITY FRACUNIT
  42. #define MAXMOVE (30*FRACUNIT)
  43. #define USERANGE (64*FRACUNIT)
  44. #define MELEERANGE (64*FRACUNIT)
  45. #define MISSILERANGE (32*64*FRACUNIT)
  46. // follow a player exlusively for 3 seconds
  47. #define BASETHRESHOLD 100
  48. //
  49. // P_TICK
  50. //
  51. // both the head and tail of the thinker list
  52. extern thinker_t thinkercap;
  53. void P_InitThinkers (void);
  54. void P_AddThinker (thinker_t* thinker);
  55. void P_RemoveThinker (thinker_t* thinker);
  56. //
  57. // P_PSPR
  58. //
  59. void P_SetupPsprites (player_t* curplayer);
  60. void P_MovePsprites (player_t* curplayer);
  61. void P_DropWeapon (player_t* player);
  62. //
  63. // P_USER
  64. //
  65. void P_PlayerThink (player_t* player);
  66. //
  67. // P_MOBJ
  68. //
  69. #define ONFLOORZ MININT
  70. #define ONCEILINGZ MAXINT
  71. // Time interval for item respawning.
  72. #define ITEMQUESIZE 128
  73. extern mapthing_t itemrespawnque[ITEMQUESIZE];
  74. extern int itemrespawntime[ITEMQUESIZE];
  75. extern int iquehead;
  76. extern int iquetail;
  77. void P_RespawnSpecials (void);
  78. mobj_t*
  79. P_SpawnMobj
  80. ( fixed_t x,
  81. fixed_t y,
  82. fixed_t z,
  83. mobjtype_t type );
  84. void P_RemoveMobj (mobj_t* th);
  85. qboolean P_SetMobjState (mobj_t* mobj, statenum_t state);
  86. void P_MobjThinker (mobj_t* mobj);
  87. void P_SpawnPuff (fixed_t x, fixed_t y, fixed_t z);
  88. void P_SpawnBlood (fixed_t x, fixed_t y, fixed_t z, int damage);
  89. mobj_t* P_SpawnMissile (mobj_t* source, mobj_t* dest, mobjtype_t type);
  90. void P_SpawnPlayerMissile (mobj_t* source, mobjtype_t type);
  91. //
  92. // P_ENEMY
  93. //
  94. void P_NoiseAlert (mobj_t* target, mobj_t* emmiter);
  95. //
  96. // P_MAPUTL
  97. //
  98. typedef struct
  99. {
  100. fixed_t x;
  101. fixed_t y;
  102. fixed_t dx;
  103. fixed_t dy;
  104. } divline_t;
  105. typedef struct
  106. {
  107. fixed_t frac; // along trace line
  108. qboolean isaline;
  109. union {
  110. mobj_t* thing;
  111. line_t* line;
  112. } d;
  113. } intercept_t;
  114. #define MAXINTERCEPTS 128
  115. extern intercept_t intercepts[MAXINTERCEPTS];
  116. extern intercept_t* intercept_p;
  117. typedef qboolean (*traverser_t) (intercept_t *in);
  118. fixed_t P_AproxDistance (fixed_t dx, fixed_t dy);
  119. int P_PointOnLineSide (fixed_t x, fixed_t y, line_t* line);
  120. int P_PointOnDivlineSide (fixed_t x, fixed_t y, divline_t* line);
  121. void P_MakeDivline (line_t* li, divline_t* dl);
  122. fixed_t P_InterceptVector (divline_t* v2, divline_t* v1);
  123. int P_BoxOnLineSide (fixed_t* tmbox, line_t* ld);
  124. extern fixed_t opentop;
  125. extern fixed_t openbottom;
  126. extern fixed_t openrange;
  127. extern fixed_t lowfloor;
  128. void P_LineOpening (line_t* linedef);
  129. qboolean P_BlockLinesIterator (int x, int y, qboolean(*func)(line_t*) );
  130. qboolean P_BlockThingsIterator (int x, int y, qboolean(*func)(mobj_t*) );
  131. #define PT_ADDLINES 1
  132. #define PT_ADDTHINGS 2
  133. #define PT_EARLYOUT 4
  134. extern divline_t trace;
  135. qboolean
  136. P_PathTraverse
  137. ( fixed_t x1,
  138. fixed_t y1,
  139. fixed_t x2,
  140. fixed_t y2,
  141. int flags,
  142. qboolean (*trav) (intercept_t *));
  143. void P_UnsetThingPosition (mobj_t* thing);
  144. void P_SetThingPosition (mobj_t* thing);
  145. //
  146. // P_MAP
  147. //
  148. // If "floatok" true, move would be ok
  149. // if within "tmfloorz - tmceilingz".
  150. extern qboolean floatok;
  151. extern fixed_t tmfloorz;
  152. extern fixed_t tmceilingz;
  153. extern line_t* ceilingline;
  154. qboolean P_CheckPosition (mobj_t *thing, fixed_t x, fixed_t y);
  155. qboolean P_TryMove (mobj_t* thing, fixed_t x, fixed_t y);
  156. qboolean P_TeleportMove (mobj_t* thing, fixed_t x, fixed_t y);
  157. void P_SlideMove (mobj_t* mo);
  158. qboolean P_CheckSight (mobj_t* t1, mobj_t* t2);
  159. void P_UseLines (player_t* player);
  160. qboolean P_ChangeSector (sector_t* sector, qboolean crunch);
  161. extern mobj_t* linetarget; // who got hit (or NULL)
  162. fixed_t
  163. P_AimLineAttack
  164. ( mobj_t* t1,
  165. angle_t angle,
  166. fixed_t distance );
  167. void
  168. P_LineAttack
  169. ( mobj_t* t1,
  170. angle_t angle,
  171. fixed_t distance,
  172. fixed_t slope,
  173. int damage );
  174. void
  175. P_RadiusAttack
  176. ( mobj_t* spot,
  177. mobj_t* source,
  178. int damage );
  179. //
  180. // P_SETUP
  181. //
  182. //
  183. // P_INTER
  184. //
  185. extern const int maxammo[NUMAMMO];
  186. extern const int clipammo[NUMAMMO];
  187. void
  188. P_TouchSpecialThing
  189. ( mobj_t* special,
  190. mobj_t* toucher );
  191. void
  192. P_DamageMobj
  193. ( mobj_t* target,
  194. mobj_t* inflictor,
  195. mobj_t* source,
  196. int damage );
  197. //
  198. // P_SPEC
  199. //
  200. #include "p_spec.h"
  201. #endif // __P_LOCAL__