Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | RSS feed

  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.  
  22.  
  23. #ifndef __P_LOCAL__
  24. #define __P_LOCAL__
  25.  
  26. #ifndef __R_LOCAL__
  27. #include "r_local.h"
  28. #endif
  29.  
  30. #define FLOATSPEED              (FRACUNIT*4)
  31.  
  32.  
  33. #define MAXHEALTH               100
  34. #define VIEWHEIGHT              (41*FRACUNIT)
  35.  
  36. // mapblocks are used to check movement
  37. // against lines and things
  38. #define MAPBLOCKUNITS   128
  39. #define MAPBLOCKSIZE    (MAPBLOCKUNITS*FRACUNIT)
  40. #define MAPBLOCKSHIFT   (FRACBITS+7)
  41. #define MAPBMASK                (MAPBLOCKSIZE-1)
  42. #define MAPBTOFRAC              (MAPBLOCKSHIFT-FRACBITS)
  43.  
  44.  
  45. // player radius for movement checking
  46. #define PLAYERRADIUS    16*FRACUNIT
  47.  
  48. // MAXRADIUS is for precalculated sector block boxes
  49. // the spider demon is larger,
  50. // but we do not have any moving sectors nearby
  51. #define MAXRADIUS               32*FRACUNIT
  52.  
  53. #define GRAVITY         FRACUNIT
  54. #define MAXMOVE         (30*FRACUNIT)
  55.  
  56. #define USERANGE                (64*FRACUNIT)
  57. #define MELEERANGE              (64*FRACUNIT)
  58. #define MISSILERANGE    (32*64*FRACUNIT)
  59.  
  60. // follow a player exlusively for 3 seconds
  61. #define BASETHRESHOLD           100
  62.  
  63.  
  64.  
  65. //
  66. // P_TICK
  67. //
  68.  
  69. // both the head and tail of the thinker list
  70. extern  thinker_t       thinkercap;    
  71.  
  72.  
  73. void P_InitThinkers (void);
  74. void P_AddThinker (thinker_t* thinker);
  75. void P_RemoveThinker (thinker_t* thinker);
  76.  
  77.  
  78. //
  79. // P_PSPR
  80. //
  81. void P_SetupPsprites (player_t* curplayer);
  82. void P_MovePsprites (player_t* curplayer);
  83. void P_DropWeapon (player_t* player);
  84.  
  85.  
  86. //
  87. // P_USER
  88. //
  89. void    P_PlayerThink (player_t* player);
  90.  
  91.  
  92. //
  93. // P_MOBJ
  94. //
  95. #define ONFLOORZ                MININT
  96. #define ONCEILINGZ              MAXINT
  97.  
  98. // Time interval for item respawning.
  99. #define ITEMQUESIZE             128
  100.  
  101. extern mapthing_t       itemrespawnque[ITEMQUESIZE];
  102. extern int              itemrespawntime[ITEMQUESIZE];
  103. extern int              iquehead;
  104. extern int              iquetail;
  105.  
  106.  
  107. void P_RespawnSpecials (void);
  108.  
  109. mobj_t*
  110. P_SpawnMobj
  111. ( fixed_t       x,
  112.   fixed_t       y,
  113.   fixed_t       z,
  114.   mobjtype_t    type );
  115.  
  116. void    P_RemoveMobj (mobj_t* th);
  117. boolean P_SetMobjState (mobj_t* mobj, statenum_t state);
  118. void    P_MobjThinker (mobj_t* mobj);
  119.  
  120. void    P_SpawnPuff (fixed_t x, fixed_t y, fixed_t z);
  121. void    P_SpawnBlood (fixed_t x, fixed_t y, fixed_t z, int damage);
  122. mobj_t* P_SpawnMissile (mobj_t* source, mobj_t* dest, mobjtype_t type);
  123. void    P_SpawnPlayerMissile (mobj_t* source, mobjtype_t type);
  124.  
  125.  
  126. //
  127. // P_ENEMY
  128. //
  129. void P_NoiseAlert (mobj_t* target, mobj_t* emmiter);
  130.  
  131.  
  132. //
  133. // P_MAPUTL
  134. //
  135. typedef struct
  136. {
  137.     fixed_t     x;
  138.     fixed_t     y;
  139.     fixed_t     dx;
  140.     fixed_t     dy;
  141.    
  142. } divline_t;
  143.  
  144. typedef struct
  145. {
  146.     fixed_t     frac;           // along trace line
  147.     boolean     isaline;
  148.     union {
  149.         mobj_t* thing;
  150.         line_t* line;
  151.     }                   d;
  152. } intercept_t;
  153.  
  154. #define MAXINTERCEPTS   128
  155.  
  156. extern intercept_t      intercepts[MAXINTERCEPTS];
  157. extern intercept_t*     intercept_p;
  158.  
  159. typedef boolean (*traverser_t) (intercept_t *in);
  160.  
  161. fixed_t P_AproxDistance (fixed_t dx, fixed_t dy);
  162. int     P_PointOnLineSide (fixed_t x, fixed_t y, line_t* line);
  163. int     P_PointOnDivlineSide (fixed_t x, fixed_t y, divline_t* line);
  164. void    P_MakeDivline (line_t* li, divline_t* dl);
  165. fixed_t P_InterceptVector (divline_t* v2, divline_t* v1);
  166. int     P_BoxOnLineSide (fixed_t* tmbox, line_t* ld);
  167.  
  168. extern fixed_t          opentop;
  169. extern fixed_t          openbottom;
  170. extern fixed_t          openrange;
  171. extern fixed_t          lowfloor;
  172.  
  173. void    P_LineOpening (line_t* linedef);
  174.  
  175. boolean P_BlockLinesIterator (int x, int y, boolean(*func)(line_t*) );
  176. boolean P_BlockThingsIterator (int x, int y, boolean(*func)(mobj_t*) );
  177.  
  178. #define PT_ADDLINES             1
  179. #define PT_ADDTHINGS    2
  180. #define PT_EARLYOUT             4
  181.  
  182. extern divline_t        trace;
  183.  
  184. boolean
  185. P_PathTraverse
  186. ( fixed_t       x1,
  187.   fixed_t       y1,
  188.   fixed_t       x2,
  189.   fixed_t       y2,
  190.   int           flags,
  191.   boolean       (*trav) (intercept_t *));
  192.  
  193. void P_UnsetThingPosition (mobj_t* thing);
  194. void P_SetThingPosition (mobj_t* thing);
  195.  
  196.  
  197. //
  198. // P_MAP
  199. //
  200.  
  201. // If "floatok" true, move would be ok
  202. // if within "tmfloorz - tmceilingz".
  203. extern boolean          floatok;
  204. extern fixed_t          tmfloorz;
  205. extern fixed_t          tmceilingz;
  206.  
  207.  
  208. extern  line_t*         ceilingline;
  209.  
  210. boolean P_CheckPosition (mobj_t *thing, fixed_t x, fixed_t y);
  211. boolean P_TryMove (mobj_t* thing, fixed_t x, fixed_t y);
  212. boolean P_TeleportMove (mobj_t* thing, fixed_t x, fixed_t y);
  213. void    P_SlideMove (mobj_t* mo);
  214. boolean P_CheckSight (mobj_t* t1, mobj_t* t2);
  215. void    P_UseLines (player_t* player);
  216.  
  217. boolean P_ChangeSector (sector_t* sector, boolean crunch);
  218.  
  219. extern mobj_t*  linetarget;     // who got hit (or NULL)
  220.  
  221. fixed_t
  222. P_AimLineAttack
  223. ( mobj_t*       t1,
  224.   angle_t       angle,
  225.   fixed_t       distance );
  226.  
  227. void
  228. P_LineAttack
  229. ( mobj_t*       t1,
  230.   angle_t       angle,
  231.   fixed_t       distance,
  232.   fixed_t       slope,
  233.   int           damage );
  234.  
  235. void
  236. P_RadiusAttack
  237. ( mobj_t*       spot,
  238.   mobj_t*       source,
  239.   int           damage );
  240.  
  241.  
  242.  
  243. //
  244. // P_SETUP
  245. //
  246. extern byte*            rejectmatrix;   // for fast sight rejection
  247. extern short*           blockmaplump;   // offsets in blockmap are from here
  248. extern short*           blockmap;
  249. extern int              bmapwidth;
  250. extern int              bmapheight;     // in mapblocks
  251. extern fixed_t          bmaporgx;
  252. extern fixed_t          bmaporgy;       // origin of block map
  253. extern mobj_t**         blocklinks;     // for thing chains
  254.  
  255.  
  256.  
  257. //
  258. // P_INTER
  259. //
  260. extern int              maxammo[NUMAMMO];
  261. extern int              clipammo[NUMAMMO];
  262.  
  263. void
  264. P_TouchSpecialThing
  265. ( mobj_t*       special,
  266.   mobj_t*       toucher );
  267.  
  268. void
  269. P_DamageMobj
  270. ( mobj_t*       target,
  271.   mobj_t*       inflictor,
  272.   mobj_t*       source,
  273.   int           damage );
  274.  
  275.  
  276. //
  277. // P_SPEC
  278. //
  279. #include "p_spec.h"
  280.  
  281.  
  282. #endif  // __P_LOCAL__
  283. //-----------------------------------------------------------------------------
  284. //
  285. // $Log:$
  286. //
  287. //-----------------------------------------------------------------------------
  288.  
  289.  
  290.