home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 25 / amigaformatcd25.iso / websites / amidoom / adoom_src-0.7.lha / ADoom_src / p_local.h < prev    next >
C/C++ Source or Header  |  1998-01-13  |  6KB  |  294 lines

  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. #ifdef __SASC
  119. __far void     P_MobjThinker (mobj_t* mobj);
  120. #else
  121. void     P_MobjThinker (mobj_t* mobj);
  122. #endif
  123.  
  124. void    P_SpawnPuff (fixed_t x, fixed_t y, fixed_t z);
  125. void     P_SpawnBlood (fixed_t x, fixed_t y, fixed_t z, int damage);
  126. mobj_t* P_SpawnMissile (mobj_t* source, mobj_t* dest, mobjtype_t type);
  127. void    P_SpawnPlayerMissile (mobj_t* source, mobjtype_t type);
  128.  
  129.  
  130. //
  131. // P_ENEMY
  132. //
  133. void P_NoiseAlert (mobj_t* target, mobj_t* emmiter);
  134.  
  135.  
  136. //
  137. // P_MAPUTL
  138. //
  139. typedef struct
  140. {
  141.     fixed_t    x;
  142.     fixed_t    y;
  143.     fixed_t    dx;
  144.     fixed_t    dy;
  145.     
  146. } divline_t;
  147.  
  148. typedef struct
  149. {
  150.     fixed_t    frac;        // along trace line
  151.     boolean    isaline;
  152.     union {
  153.     mobj_t*    thing;
  154.     line_t*    line;
  155.     }            d;
  156. } intercept_t;
  157.  
  158. #define MAXINTERCEPTS    128
  159.  
  160. extern intercept_t    intercepts[MAXINTERCEPTS];
  161. extern intercept_t*    intercept_p;
  162.  
  163. typedef boolean (*traverser_t) (intercept_t *in);
  164.  
  165. fixed_t P_AproxDistance (fixed_t dx, fixed_t dy);
  166. int     P_PointOnLineSide (fixed_t x, fixed_t y, line_t* line);
  167. int     P_PointOnDivlineSide (fixed_t x, fixed_t y, divline_t* line);
  168. void     P_MakeDivline (line_t* li, divline_t* dl);
  169. fixed_t P_InterceptVector (divline_t* v2, divline_t* v1);
  170. int     P_BoxOnLineSide (fixed_t* tmbox, line_t* ld);
  171.  
  172. extern fixed_t        opentop;
  173. extern fixed_t         openbottom;
  174. extern fixed_t        openrange;
  175. extern fixed_t        lowfloor;
  176.  
  177. void     P_LineOpening (line_t* linedef);
  178.  
  179. boolean P_BlockLinesIterator (int x, int y, boolean(*func)(line_t*) );
  180. boolean P_BlockThingsIterator (int x, int y, boolean(*func)(mobj_t*) );
  181.  
  182. #define PT_ADDLINES        1
  183. #define PT_ADDTHINGS    2
  184. #define PT_EARLYOUT        4
  185.  
  186. extern divline_t    trace;
  187.  
  188. boolean
  189. P_PathTraverse
  190. ( fixed_t    x1,
  191.   fixed_t    y1,
  192.   fixed_t    x2,
  193.   fixed_t    y2,
  194.   int        flags,
  195.   boolean    (*trav) (intercept_t *));
  196.  
  197. void P_UnsetThingPosition (mobj_t* thing);
  198. void P_SetThingPosition (mobj_t* thing);
  199.  
  200.  
  201. //
  202. // P_MAP
  203. //
  204.  
  205. // If "floatok" true, move would be ok
  206. // if within "tmfloorz - tmceilingz".
  207. extern boolean        floatok;
  208. extern fixed_t        tmfloorz;
  209. extern fixed_t        tmceilingz;
  210.  
  211.  
  212. extern    line_t*        ceilingline;
  213.  
  214. boolean P_CheckPosition (mobj_t *thing, fixed_t x, fixed_t y);
  215. boolean P_TryMove (mobj_t* thing, fixed_t x, fixed_t y);
  216. boolean P_TeleportMove (mobj_t* thing, fixed_t x, fixed_t y);
  217. void    P_SlideMove (mobj_t* mo);
  218. boolean P_CheckSight (mobj_t* t1, mobj_t* t2);
  219. void     P_UseLines (player_t* player);
  220.  
  221. boolean P_ChangeSector (sector_t* sector, boolean crunch);
  222.  
  223. extern mobj_t*    linetarget;    // who got hit (or NULL)
  224.  
  225. fixed_t
  226. P_AimLineAttack
  227. ( mobj_t*    t1,
  228.   angle_t    angle,
  229.   fixed_t    distance );
  230.  
  231. void
  232. P_LineAttack
  233. ( mobj_t*    t1,
  234.   angle_t    angle,
  235.   fixed_t    distance,
  236.   fixed_t    slope,
  237.   int        damage );
  238.  
  239. void
  240. P_RadiusAttack
  241. ( mobj_t*    spot,
  242.   mobj_t*    source,
  243.   int        damage );
  244.  
  245.  
  246.  
  247. //
  248. // P_SETUP
  249. //
  250. extern byte*        rejectmatrix;    // for fast sight rejection
  251. extern short*        blockmaplump;    // offsets in blockmap are from here
  252. extern short*        blockmap;
  253. extern int        bmapwidth;
  254. extern int        bmapheight;    // in mapblocks
  255. extern fixed_t        bmaporgx;
  256. extern fixed_t        bmaporgy;    // origin of block map
  257. extern mobj_t**        blocklinks;    // for thing chains
  258.  
  259.  
  260.  
  261. //
  262. // P_INTER
  263. //
  264. extern int        maxammo[NUMAMMO];
  265. extern int        clipammo[NUMAMMO];
  266.  
  267. void
  268. P_TouchSpecialThing
  269. ( mobj_t*    special,
  270.   mobj_t*    toucher );
  271.  
  272. void
  273. P_DamageMobj
  274. ( mobj_t*    target,
  275.   mobj_t*    inflictor,
  276.   mobj_t*    source,
  277.   int        damage );
  278.  
  279.  
  280. //
  281. // P_SPEC
  282. //
  283. #include "p_spec.h"
  284.  
  285.  
  286. #endif    // __P_LOCAL__
  287. //-----------------------------------------------------------------------------
  288. //
  289. // $Log:$
  290. //
  291. //-----------------------------------------------------------------------------
  292.  
  293.  
  294.