P_LOCAL.H 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263
  1. // P_local.h
  2. #ifndef __P_LOCAL__
  3. #define __P_LOCAL__
  4. #ifndef __R_LOCAL__
  5. #include "R_local.h"
  6. #endif
  7. #define STARTREDPALS 1
  8. #define STARTBONUSPALS 9
  9. #define NUMREDPALS 8
  10. #define NUMBONUSPALS 4
  11. #define FOOTCLIPSIZE 10*FRACUNIT
  12. #define TOCENTER -8
  13. #define FLOATSPEED (FRACUNIT*4)
  14. #define MAXHEALTH 100
  15. #define MAXCHICKENHEALTH 30
  16. #define VIEWHEIGHT (41*FRACUNIT)
  17. // mapblocks are used to check movement against lines and things
  18. #define MAPBLOCKUNITS 128
  19. #define MAPBLOCKSIZE (MAPBLOCKUNITS*FRACUNIT)
  20. #define MAPBLOCKSHIFT (FRACBITS+7)
  21. #define MAPBMASK (MAPBLOCKSIZE-1)
  22. #define MAPBTOFRAC (MAPBLOCKSHIFT-FRACBITS)
  23. // player radius for movement checking
  24. #define PLAYERRADIUS 16*FRACUNIT
  25. // MAXRADIUS is for precalculated sector block boxes
  26. // the spider demon is larger, but we don't have any moving sectors
  27. // nearby
  28. #define MAXRADIUS 32*FRACUNIT
  29. #define GRAVITY FRACUNIT
  30. #define MAXMOVE (30*FRACUNIT)
  31. #define USERANGE (64*FRACUNIT)
  32. #define MELEERANGE (64*FRACUNIT)
  33. #define MISSILERANGE (32*64*FRACUNIT)
  34. typedef enum
  35. {
  36. DI_EAST,
  37. DI_NORTHEAST,
  38. DI_NORTH,
  39. DI_NORTHWEST,
  40. DI_WEST,
  41. DI_SOUTHWEST,
  42. DI_SOUTH,
  43. DI_SOUTHEAST,
  44. DI_NODIR,
  45. NUMDIRS
  46. } dirtype_t;
  47. #define BASETHRESHOLD 100 // follow a player exlusively for 3 seconds
  48. // ***** P_TICK *****
  49. extern thinker_t thinkercap; // both the head and tail of the thinker list
  50. extern int TimerGame; // tic countdown for deathmatch
  51. void P_InitThinkers(void);
  52. void P_AddThinker(thinker_t *thinker);
  53. void P_RemoveThinker(thinker_t *thinker);
  54. // ***** P_PSPR *****
  55. #define USE_GWND_AMMO_1 1
  56. #define USE_GWND_AMMO_2 1
  57. #define USE_CBOW_AMMO_1 1
  58. #define USE_CBOW_AMMO_2 1
  59. #define USE_BLSR_AMMO_1 1
  60. #define USE_BLSR_AMMO_2 5
  61. #define USE_SKRD_AMMO_1 1
  62. #define USE_SKRD_AMMO_2 5
  63. #define USE_PHRD_AMMO_1 1
  64. #define USE_PHRD_AMMO_2 1
  65. #define USE_MACE_AMMO_1 1
  66. #define USE_MACE_AMMO_2 5
  67. void P_OpenWeapons(void);
  68. void P_CloseWeapons(void);
  69. void P_AddMaceSpot(mapthing_t *mthing);
  70. void P_RepositionMace(mobj_t *mo);
  71. void P_SetPsprite(player_t *player, int position, statenum_t stnum);
  72. void P_SetupPsprites(player_t *curplayer);
  73. void P_MovePsprites(player_t *curplayer);
  74. void P_DropWeapon(player_t *player);
  75. void P_ActivateBeak(player_t *player);
  76. void P_PostChickenWeapon(player_t *player, weapontype_t weapon);
  77. void P_UpdateBeak(player_t *player, pspdef_t *psp);
  78. // ***** P_USER *****
  79. void P_PlayerThink(player_t *player);
  80. void P_Thrust(player_t *player, angle_t angle, fixed_t move);
  81. void P_PlayerRemoveArtifact(player_t *player, int slot);
  82. void P_PlayerUseArtifact(player_t *player, artitype_t arti);
  83. boolean P_UseArtifact(player_t *player, artitype_t arti);
  84. int P_GetPlayerNum(player_t *player);
  85. // ***** P_MOBJ *****
  86. #define FLOOR_SOLID 0
  87. #define FLOOR_WATER 1
  88. #define FLOOR_LAVA 2
  89. #define FLOOR_SLUDGE 3
  90. #define ONFLOORZ MININT
  91. #define ONCEILINGZ MAXINT
  92. #define FLOATRANDZ (MAXINT-1)
  93. extern mobjtype_t PuffType;
  94. extern mobj_t *MissileMobj;
  95. mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type);
  96. void P_RemoveMobj(mobj_t *th);
  97. boolean P_SetMobjState(mobj_t *mobj, statenum_t state);
  98. boolean P_SetMobjStateNF(mobj_t *mobj, statenum_t state);
  99. void P_ThrustMobj(mobj_t *mo, angle_t angle, fixed_t move);
  100. int P_FaceMobj(mobj_t *source, mobj_t *target, angle_t *delta);
  101. boolean P_SeekerMissile(mobj_t *actor, angle_t thresh, angle_t turnMax);
  102. void P_MobjThinker(mobj_t *mobj);
  103. void P_BlasterMobjThinker(mobj_t *mobj);
  104. void P_SpawnPuff(fixed_t x, fixed_t y, fixed_t z);
  105. void P_SpawnBlood(fixed_t x, fixed_t y, fixed_t z, int damage);
  106. void P_BloodSplatter(fixed_t x, fixed_t y, fixed_t z, mobj_t *originator);
  107. void P_RipperBlood(mobj_t *mo);
  108. int P_GetThingFloorType(mobj_t *thing);
  109. int P_HitFloor(mobj_t *thing);
  110. boolean P_CheckMissileSpawn(mobj_t *missile);
  111. mobj_t *P_SpawnMissile(mobj_t *source, mobj_t *dest, mobjtype_t type);
  112. mobj_t *P_SpawnMissileAngle(mobj_t *source, mobjtype_t type,
  113. angle_t angle, fixed_t momz);
  114. mobj_t *P_SpawnPlayerMissile(mobj_t *source, mobjtype_t type);
  115. mobj_t *P_SPMAngle(mobj_t *source, mobjtype_t type, angle_t angle);
  116. // ***** P_ENEMY *****
  117. void P_NoiseAlert (mobj_t *target, mobj_t *emmiter);
  118. void P_InitMonsters(void);
  119. void P_AddBossSpot(fixed_t x, fixed_t y, angle_t angle);
  120. void P_Massacre(void);
  121. void P_DSparilTeleport(mobj_t *actor);
  122. // ***** P_MAPUTL *****
  123. typedef struct
  124. {
  125. fixed_t x, y, dx, dy;
  126. } divline_t;
  127. typedef struct
  128. {
  129. fixed_t frac; // along trace line
  130. boolean isaline;
  131. union {
  132. mobj_t *thing;
  133. line_t *line;
  134. } d;
  135. } intercept_t;
  136. #define MAXINTERCEPTS 128
  137. extern intercept_t intercepts[MAXINTERCEPTS], *intercept_p;
  138. typedef boolean (*traverser_t) (intercept_t *in);
  139. fixed_t P_AproxDistance (fixed_t dx, fixed_t dy);
  140. int P_PointOnLineSide (fixed_t x, fixed_t y, line_t *line);
  141. int P_PointOnDivlineSide (fixed_t x, fixed_t y, divline_t *line);
  142. void P_MakeDivline (line_t *li, divline_t *dl);
  143. fixed_t P_InterceptVector (divline_t *v2, divline_t *v1);
  144. int P_BoxOnLineSide (fixed_t *tmbox, line_t *ld);
  145. extern fixed_t opentop, openbottom, openrange;
  146. extern fixed_t lowfloor;
  147. void P_LineOpening (line_t *linedef);
  148. boolean P_BlockLinesIterator (int x, int y, boolean(*func)(line_t*) );
  149. boolean P_BlockThingsIterator (int x, int y, boolean(*func)(mobj_t*) );
  150. #define PT_ADDLINES 1
  151. #define PT_ADDTHINGS 2
  152. #define PT_EARLYOUT 4
  153. extern divline_t trace;
  154. boolean P_PathTraverse (fixed_t x1, fixed_t y1, fixed_t x2, fixed_t y2,
  155. int flags, boolean (*trav) (intercept_t *));
  156. void P_UnsetThingPosition (mobj_t *thing);
  157. void P_SetThingPosition (mobj_t *thing);
  158. // ***** P_MAP *****
  159. extern boolean floatok; // if true, move would be ok if
  160. extern fixed_t tmfloorz, tmceilingz; // within tmfloorz - tmceilingz
  161. extern line_t *ceilingline;
  162. boolean P_TestMobjLocation(mobj_t *mobj);
  163. boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y);
  164. mobj_t *P_CheckOnmobj(mobj_t *thing);
  165. void P_FakeZMovement(mobj_t *mo);
  166. boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y);
  167. boolean P_TeleportMove(mobj_t *thing, fixed_t x, fixed_t y);
  168. void P_SlideMove(mobj_t *mo);
  169. boolean P_CheckSight(mobj_t *t1, mobj_t *t2);
  170. void P_UseLines(player_t *player);
  171. boolean P_ChangeSector (sector_t *sector, boolean crunch);
  172. extern mobj_t *linetarget; // who got hit (or NULL)
  173. fixed_t P_AimLineAttack (mobj_t *t1, angle_t angle, fixed_t distance);
  174. void P_LineAttack (mobj_t *t1, angle_t angle, fixed_t distance, fixed_t slope, int damage);
  175. void P_RadiusAttack (mobj_t *spot, mobj_t *source, int damage);
  176. // ***** P_SETUP *****
  177. extern byte *rejectmatrix; // for fast sight rejection
  178. extern short *blockmaplump; // offsets in blockmap are from here
  179. extern short *blockmap;
  180. extern int bmapwidth, bmapheight; // in mapblocks
  181. extern fixed_t bmaporgx, bmaporgy; // origin of block map
  182. extern mobj_t **blocklinks; // for thing chains
  183. // ***** P_INTER *****
  184. extern int maxammo[NUMAMMO];
  185. extern int clipammo[NUMAMMO];
  186. void P_SetMessage(player_t *player, char *message, boolean ultmsg);
  187. void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher);
  188. void P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source,
  189. int damage);
  190. boolean P_GiveAmmo(player_t *player, ammotype_t ammo, int count);
  191. boolean P_GiveArtifact(player_t *player, artitype_t arti, mobj_t *mo);
  192. boolean P_GiveBody(player_t *player, int num);
  193. boolean P_GivePower(player_t *player, powertype_t power);
  194. boolean P_ChickenMorphPlayer(player_t *player);
  195. // ***** AM_MAP *****
  196. boolean AM_Responder(event_t *ev);
  197. void AM_Ticker(void);
  198. void AM_Drawer(void);
  199. // ***** SB_BAR *****
  200. extern int SB_state;
  201. extern int ArtifactFlash;
  202. void SB_PaletteFlash(void);
  203. #include "P_spec.h"
  204. #endif // __P_LOCAL__