p_local.h 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290
  1. // Emacs style mode select -*- C++ -*-
  2. //-----------------------------------------------------------------------------
  3. //
  4. // $Id:$
  5. //
  6. // Copyright (C) 1993-1996 by id Software, Inc.
  7. //
  8. // This source is available for distribution and/or modification
  9. // only under the terms of the DOOM Source Code License as
  10. // published by id Software. All rights reserved.
  11. //
  12. // The source is distributed in the hope that it will be useful,
  13. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
  15. // for more details.
  16. //
  17. // DESCRIPTION:
  18. // Play functions, animation, global header.
  19. //
  20. //-----------------------------------------------------------------------------
  21. #ifndef __P_LOCAL__
  22. #define __P_LOCAL__
  23. #ifndef __R_LOCAL__
  24. #include "r_local.h"
  25. #endif
  26. #define FLOATSPEED (FRACUNIT*4)
  27. #define MAXHEALTH 100
  28. #define VIEWHEIGHT (41*FRACUNIT)
  29. // mapblocks are used to check movement
  30. // against lines and things
  31. #define MAPBLOCKUNITS 128
  32. #define MAPBLOCKSIZE (MAPBLOCKUNITS*FRACUNIT)
  33. #define MAPBLOCKSHIFT (FRACBITS+7)
  34. #define MAPBMASK (MAPBLOCKSIZE-1)
  35. #define MAPBTOFRAC (MAPBLOCKSHIFT-FRACBITS)
  36. // player radius for movement checking
  37. #define PLAYERRADIUS 16*FRACUNIT
  38. // MAXRADIUS is for precalculated sector block boxes
  39. // the spider demon is larger,
  40. // but we do not have any moving sectors nearby
  41. #define MAXRADIUS 32*FRACUNIT
  42. #define GRAVITY FRACUNIT
  43. #define MAXMOVE (30*FRACUNIT)
  44. #define USERANGE (64*FRACUNIT)
  45. #define MELEERANGE (64*FRACUNIT)
  46. #define MISSILERANGE (32*64*FRACUNIT)
  47. // follow a player exlusively for 3 seconds
  48. #define BASETHRESHOLD 100
  49. //
  50. // P_TICK
  51. //
  52. // both the head and tail of the thinker list
  53. extern thinker_t thinkercap;
  54. void P_InitThinkers (void);
  55. void P_AddThinker (thinker_t* thinker);
  56. void P_RemoveThinker (thinker_t* thinker);
  57. //
  58. // P_PSPR
  59. //
  60. void P_SetupPsprites (player_t* curplayer);
  61. void P_MovePsprites (player_t* curplayer);
  62. void P_DropWeapon (player_t* player);
  63. //
  64. // P_USER
  65. //
  66. void P_PlayerThink (player_t* player);
  67. //
  68. // P_MOBJ
  69. //
  70. #define ONFLOORZ MININT
  71. #define ONCEILINGZ MAXINT
  72. // Time interval for item respawning.
  73. #define ITEMQUESIZE 128
  74. extern mapthing_t itemrespawnque[ITEMQUESIZE];
  75. extern int itemrespawntime[ITEMQUESIZE];
  76. extern int iquehead;
  77. extern int iquetail;
  78. void P_RespawnSpecials (void);
  79. mobj_t*
  80. P_SpawnMobj
  81. ( fixed_t x,
  82. fixed_t y,
  83. fixed_t z,
  84. mobjtype_t type );
  85. void P_RemoveMobj (mobj_t* th);
  86. boolean P_SetMobjState (mobj_t* mobj, statenum_t state);
  87. void P_MobjThinker (mobj_t* mobj);
  88. void P_SpawnPuff (fixed_t x, fixed_t y, fixed_t z);
  89. void P_SpawnBlood (fixed_t x, fixed_t y, fixed_t z, int damage);
  90. mobj_t* P_SpawnMissile (mobj_t* source, mobj_t* dest, mobjtype_t type);
  91. void P_SpawnPlayerMissile (mobj_t* source, mobjtype_t type);
  92. //
  93. // P_ENEMY
  94. //
  95. void P_NoiseAlert (mobj_t* target, mobj_t* emmiter);
  96. //
  97. // P_MAPUTL
  98. //
  99. typedef struct
  100. {
  101. fixed_t x;
  102. fixed_t y;
  103. fixed_t dx;
  104. fixed_t dy;
  105. } divline_t;
  106. typedef struct
  107. {
  108. fixed_t frac; // along trace line
  109. boolean isaline;
  110. union {
  111. mobj_t* thing;
  112. line_t* line;
  113. } d;
  114. } intercept_t;
  115. #define MAXINTERCEPTS 128
  116. extern intercept_t intercepts[MAXINTERCEPTS];
  117. extern intercept_t* intercept_p;
  118. typedef boolean (*traverser_t) (intercept_t *in);
  119. fixed_t P_AproxDistance (fixed_t dx, fixed_t dy);
  120. int P_PointOnLineSide (fixed_t x, fixed_t y, line_t* line);
  121. int P_PointOnDivlineSide (fixed_t x, fixed_t y, divline_t* line);
  122. void P_MakeDivline (line_t* li, divline_t* dl);
  123. fixed_t P_InterceptVector (divline_t* v2, divline_t* v1);
  124. int P_BoxOnLineSide (fixed_t* tmbox, line_t* ld);
  125. extern fixed_t opentop;
  126. extern fixed_t openbottom;
  127. extern fixed_t openrange;
  128. extern fixed_t lowfloor;
  129. void P_LineOpening (line_t* linedef);
  130. boolean P_BlockLinesIterator (int x, int y, boolean(*func)(line_t*) );
  131. boolean P_BlockThingsIterator (int x, int y, boolean(*func)(mobj_t*) );
  132. #define PT_ADDLINES 1
  133. #define PT_ADDTHINGS 2
  134. #define PT_EARLYOUT 4
  135. extern divline_t trace;
  136. boolean
  137. P_PathTraverse
  138. ( fixed_t x1,
  139. fixed_t y1,
  140. fixed_t x2,
  141. fixed_t y2,
  142. int flags,
  143. boolean (*trav) (intercept_t *));
  144. void P_UnsetThingPosition (mobj_t* thing);
  145. void P_SetThingPosition (mobj_t* thing);
  146. //
  147. // P_MAP
  148. //
  149. // If "floatok" true, move would be ok
  150. // if within "tmfloorz - tmceilingz".
  151. extern boolean floatok;
  152. extern fixed_t tmfloorz;
  153. extern fixed_t tmceilingz;
  154. extern line_t* ceilingline;
  155. boolean P_CheckPosition (mobj_t *thing, fixed_t x, fixed_t y);
  156. boolean P_TryMove (mobj_t* thing, fixed_t x, fixed_t y);
  157. boolean P_TeleportMove (mobj_t* thing, fixed_t x, fixed_t y);
  158. void P_SlideMove (mobj_t* mo);
  159. boolean P_CheckSight (mobj_t* t1, mobj_t* t2);
  160. void P_UseLines (player_t* player);
  161. boolean P_ChangeSector (sector_t* sector, boolean crunch);
  162. extern mobj_t* linetarget; // who got hit (or NULL)
  163. fixed_t
  164. P_AimLineAttack
  165. ( mobj_t* t1,
  166. angle_t angle,
  167. fixed_t distance );
  168. void
  169. P_LineAttack
  170. ( mobj_t* t1,
  171. angle_t angle,
  172. fixed_t distance,
  173. fixed_t slope,
  174. int damage );
  175. void
  176. P_RadiusAttack
  177. ( mobj_t* spot,
  178. mobj_t* source,
  179. int damage );
  180. //
  181. // P_SETUP
  182. //
  183. extern byte* rejectmatrix; // for fast sight rejection
  184. extern short* blockmaplump; // offsets in blockmap are from here
  185. extern short* blockmap;
  186. extern int bmapwidth;
  187. extern int bmapheight; // in mapblocks
  188. extern fixed_t bmaporgx;
  189. extern fixed_t bmaporgy; // origin of block map
  190. extern mobj_t** blocklinks; // for thing chains
  191. //
  192. // P_INTER
  193. //
  194. extern int maxammo[NUMAMMO];
  195. extern int clipammo[NUMAMMO];
  196. void
  197. P_TouchSpecialThing
  198. ( mobj_t* special,
  199. mobj_t* toucher );
  200. void
  201. P_DamageMobj
  202. ( mobj_t* target,
  203. mobj_t* inflictor,
  204. mobj_t* source,
  205. int damage );
  206. //
  207. // P_SPEC
  208. //
  209. #include "p_spec.h"
  210. #endif // __P_LOCAL__
  211. //-----------------------------------------------------------------------------
  212. //
  213. // $Log:$
  214. //
  215. //-----------------------------------------------------------------------------