P_LOCAL.H 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373
  1. //**************************************************************************
  2. //**
  3. //** p_local.h : Heretic 2 : Raven Software, Corp.
  4. //**
  5. //** $RCSfile: p_local.h,v $
  6. //** $Revision: 1.64 $
  7. //** $Date: 95/10/13 03:00:16 $
  8. //** $Author: cjr $
  9. //**
  10. //**************************************************************************
  11. #ifndef __P_LOCAL__
  12. #define __P_LOCAL__
  13. #ifndef __R_LOCAL__
  14. #include "r_local.h"
  15. #endif
  16. #define STARTREDPALS 1
  17. #define STARTBONUSPALS 9
  18. #define STARTPOISONPALS 13
  19. #define STARTICEPAL 21
  20. #define STARTHOLYPAL 22
  21. #define STARTSCOURGEPAL 25
  22. #define NUMREDPALS 8
  23. #define NUMBONUSPALS 4
  24. #define NUMPOISONPALS 8
  25. #define TOCENTER -8
  26. #define FLOATSPEED (FRACUNIT*4)
  27. #define MAXHEALTH 100
  28. #define MAXMORPHHEALTH 30
  29. #define VIEWHEIGHT (48*FRACUNIT)
  30. // mapblocks are used to check movement 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, but we don't have any moving sectors
  40. // 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. typedef enum
  48. {
  49. DI_EAST,
  50. DI_NORTHEAST,
  51. DI_NORTH,
  52. DI_NORTHWEST,
  53. DI_WEST,
  54. DI_SOUTHWEST,
  55. DI_SOUTH,
  56. DI_SOUTHEAST,
  57. DI_NODIR,
  58. NUMDIRS
  59. } dirtype_t;
  60. #define BASETHRESHOLD 100 // follow a player exlusively for 3 seconds
  61. // ***** P_TICK *****
  62. extern thinker_t thinkercap; // both the head and tail of the thinker list
  63. extern int TimerGame; // tic countdown for deathmatch
  64. void P_InitThinkers(void);
  65. void P_AddThinker(thinker_t *thinker);
  66. void P_RemoveThinker(thinker_t *thinker);
  67. // ***** P_PSPR *****
  68. #define USE_MANA1 1
  69. #define USE_MANA2 1
  70. void P_SetPsprite(player_t *player, int position, statenum_t stnum);
  71. void P_SetPspriteNF(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_ActivateMorphWeapon(player_t *player);
  76. void P_PostMorphWeapon(player_t *player, weapontype_t weapon);
  77. // ***** P_USER *****
  78. extern int PStateNormal[NUMCLASSES];
  79. extern int PStateRun[NUMCLASSES];
  80. extern int PStateAttack[NUMCLASSES];
  81. extern int PStateAttackEnd[NUMCLASSES];
  82. void P_PlayerThink(player_t *player);
  83. void P_Thrust(player_t *player, angle_t angle, fixed_t move);
  84. void P_PlayerRemoveArtifact(player_t *player, int slot);
  85. void P_PlayerUseArtifact(player_t *player, artitype_t arti);
  86. boolean P_UseArtifact(player_t *player, artitype_t arti);
  87. int P_GetPlayerNum(player_t *player);
  88. void P_TeleportOther(mobj_t *victim);
  89. void ResetBlasted(mobj_t *mo);
  90. // ***** P_MOBJ *****
  91. // Any floor type >= FLOOR_LIQUID will floorclip sprites
  92. enum
  93. {
  94. FLOOR_SOLID,
  95. FLOOR_ICE,
  96. FLOOR_LIQUID,
  97. FLOOR_WATER,
  98. FLOOR_LAVA,
  99. FLOOR_SLUDGE
  100. };
  101. #define ONFLOORZ MININT
  102. #define ONCEILINGZ MAXINT
  103. #define FLOATRANDZ (MAXINT-1)
  104. #define FROMCEILINGZ128 (MAXINT-2)
  105. extern mobjtype_t PuffType;
  106. extern mobj_t *MissileMobj;
  107. mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type);
  108. void P_RemoveMobj(mobj_t *th);
  109. boolean P_SetMobjState(mobj_t *mobj, statenum_t state);
  110. boolean P_SetMobjStateNF(mobj_t *mobj, statenum_t state);
  111. void P_ThrustMobj(mobj_t *mo, angle_t angle, fixed_t move);
  112. int P_FaceMobj(mobj_t *source, mobj_t *target, angle_t *delta);
  113. boolean P_SeekerMissile(mobj_t *actor, angle_t thresh, angle_t turnMax);
  114. void P_MobjThinker(mobj_t *mobj);
  115. void P_BlasterMobjThinker(mobj_t *mobj);
  116. void P_SpawnPuff(fixed_t x, fixed_t y, fixed_t z);
  117. void P_SpawnBlood(fixed_t x, fixed_t y, fixed_t z, int damage);
  118. void P_BloodSplatter(fixed_t x, fixed_t y, fixed_t z, mobj_t *originator);
  119. void P_BloodSplatter2(fixed_t x, fixed_t y, fixed_t z, mobj_t *originator);
  120. void P_RipperBlood(mobj_t *mo);
  121. int P_GetThingFloorType(mobj_t *thing);
  122. int P_HitFloor(mobj_t *thing);
  123. boolean P_CheckMissileSpawn(mobj_t *missile);
  124. mobj_t *P_SpawnMissile(mobj_t *source, mobj_t *dest, mobjtype_t type);
  125. mobj_t *P_SpawnMissileXYZ(fixed_t x, fixed_t y, fixed_t z,
  126. mobj_t *source, mobj_t *dest, mobjtype_t type);
  127. mobj_t *P_SpawnMissileAngle(mobj_t *source, mobjtype_t type,
  128. angle_t angle, fixed_t momz);
  129. mobj_t *P_SpawnMissileAngleSpeed(mobj_t *source, mobjtype_t type,
  130. angle_t angle, fixed_t momz, fixed_t speed);
  131. mobj_t *P_SpawnPlayerMissile(mobj_t *source, mobjtype_t type);
  132. mobj_t *P_SPMAngle(mobj_t *source, mobjtype_t type, angle_t angle);
  133. mobj_t *P_SPMAngleXYZ(mobj_t *source, fixed_t x, fixed_t y,
  134. fixed_t z, mobjtype_t type, angle_t angle);
  135. void P_CreateTIDList(void);
  136. void P_RemoveMobjFromTIDList(mobj_t *mobj);
  137. void P_InsertMobjIntoTIDList(mobj_t *mobj, int tid);
  138. mobj_t *P_FindMobjFromTID(int tid, int *searchPosition);
  139. mobj_t *P_SpawnKoraxMissile(fixed_t x, fixed_t y, fixed_t z,
  140. mobj_t *source, mobj_t *dest, mobjtype_t type);
  141. // ***** P_ENEMY *****
  142. void P_NoiseAlert (mobj_t *target, mobj_t *emmiter);
  143. int P_Massacre(void);
  144. boolean A_RaiseMobj(mobj_t *actor);
  145. boolean A_SinkMobj(mobj_t *actor);
  146. void A_NoBlocking(mobj_t *actor);
  147. boolean P_LookForMonsters(mobj_t *actor);
  148. void P_InitCreatureCorpseQueue(boolean corpseScan);
  149. void A_DeQueueCorpse(mobj_t *actor);
  150. // ***** P_MAPUTL *****
  151. typedef struct
  152. {
  153. fixed_t x, y, dx, dy;
  154. } divline_t;
  155. typedef struct
  156. {
  157. fixed_t frac; // along trace line
  158. boolean isaline;
  159. union {
  160. mobj_t *thing;
  161. line_t *line;
  162. } d;
  163. } intercept_t;
  164. #define MAXINTERCEPTS 128
  165. extern intercept_t intercepts[MAXINTERCEPTS], *intercept_p;
  166. typedef boolean (*traverser_t) (intercept_t *in);
  167. fixed_t P_AproxDistance (fixed_t dx, fixed_t dy);
  168. int P_PointOnLineSide (fixed_t x, fixed_t y, line_t *line);
  169. int P_PointOnDivlineSide (fixed_t x, fixed_t y, divline_t *line);
  170. void P_MakeDivline (line_t *li, divline_t *dl);
  171. fixed_t P_InterceptVector (divline_t *v2, divline_t *v1);
  172. int P_BoxOnLineSide (fixed_t *tmbox, line_t *ld);
  173. extern fixed_t opentop, openbottom, openrange;
  174. extern fixed_t lowfloor;
  175. void P_LineOpening (line_t *linedef);
  176. boolean P_BlockLinesIterator (int x, int y, boolean(*func)(line_t*) );
  177. boolean P_BlockThingsIterator (int x, int y, boolean(*func)(mobj_t*) );
  178. #define PT_ADDLINES 1
  179. #define PT_ADDTHINGS 2
  180. #define PT_EARLYOUT 4
  181. extern divline_t trace;
  182. boolean P_PathTraverse (fixed_t x1, fixed_t y1, fixed_t x2, fixed_t y2,
  183. int flags, boolean (*trav) (intercept_t *));
  184. void P_UnsetThingPosition (mobj_t *thing);
  185. void P_SetThingPosition (mobj_t *thing);
  186. mobj_t *P_RoughMonsterSearch(mobj_t *mo, int distance);
  187. // ***** P_MAP *****
  188. extern boolean floatok; // if true, move would be ok if
  189. extern fixed_t tmfloorz, tmceilingz; // within tmfloorz - tmceilingz
  190. extern int tmfloorpic;
  191. extern mobj_t *BlockingMobj;
  192. extern line_t *ceilingline;
  193. boolean P_TestMobjLocation(mobj_t *mobj);
  194. boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y);
  195. mobj_t *P_CheckOnmobj(mobj_t *thing);
  196. void P_FakeZMovement(mobj_t *mo);
  197. boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y);
  198. boolean P_TeleportMove(mobj_t *thing, fixed_t x, fixed_t y);
  199. void P_SlideMove(mobj_t *mo);
  200. void P_BounceWall(mobj_t *mo);
  201. boolean P_CheckSight(mobj_t *t1, mobj_t *t2);
  202. void P_UseLines(player_t *player);
  203. boolean P_UsePuzzleItem(player_t *player, int itemType);
  204. void PIT_ThrustSpike(mobj_t *actor);
  205. boolean P_ChangeSector (sector_t *sector, int crunch);
  206. extern mobj_t *PuffSpawned; // true if a puff was spawned
  207. extern mobj_t *linetarget; // who got hit (or NULL)
  208. fixed_t P_AimLineAttack (mobj_t *t1, angle_t angle, fixed_t distance);
  209. void P_LineAttack (mobj_t *t1, angle_t angle, fixed_t distance, fixed_t slope, int damage);
  210. void P_RadiusAttack (mobj_t *spot, mobj_t *source, int damage, int distance,
  211. boolean damageSource);
  212. // ***** P_SETUP *****
  213. extern byte *rejectmatrix; // for fast sight rejection
  214. extern short *blockmaplump; // offsets in blockmap are from here
  215. extern short *blockmap;
  216. extern int bmapwidth, bmapheight; // in mapblocks
  217. extern fixed_t bmaporgx, bmaporgy; // origin of block map
  218. extern mobj_t **blocklinks; // for thing chains
  219. // ***** P_INTER *****
  220. extern int clipmana[NUMMANA];
  221. void P_SetMessage(player_t *player, char *message, boolean ultmsg);
  222. void P_SetYellowMessage(player_t *player, char *message, boolean ultmsg);
  223. void P_ClearMessage(player_t *player);
  224. void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher);
  225. void P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source,
  226. int damage);
  227. void P_FallingDamage(player_t *player);
  228. void P_PoisonPlayer(player_t *player, mobj_t *poisoner, int poison);
  229. void P_PoisonDamage(player_t *player, mobj_t *source, int damage,
  230. boolean playPainSound);
  231. boolean P_GiveMana(player_t *player, manatype_t mana, int count);
  232. boolean P_GiveArtifact(player_t *player, artitype_t arti, mobj_t *mo);
  233. boolean P_GiveArmor(player_t *player, armortype_t armortype, int amount);
  234. boolean P_GiveBody(player_t *player, int num);
  235. boolean P_GivePower(player_t *player, powertype_t power);
  236. boolean P_MorphPlayer(player_t *player);
  237. // ***** AM_MAP *****
  238. boolean AM_Responder(event_t *ev);
  239. void AM_Ticker(void);
  240. void AM_Drawer(void);
  241. // ***** A_ACTION *****
  242. boolean A_LocalQuake(byte *args, mobj_t *victim);
  243. void P_SpawnDirt(mobj_t *actor, fixed_t radius);
  244. void A_BridgeRemove(mobj_t *actor);
  245. // ***** SB_BAR *****
  246. extern int SB_state;
  247. extern int ArtifactFlash;
  248. void SB_PaletteFlash(boolean forceChange);
  249. // ===== PO_MAN =====
  250. typedef enum
  251. {
  252. PODOOR_NONE,
  253. PODOOR_SLIDE,
  254. PODOOR_SWING,
  255. } podoortype_t;
  256. typedef struct
  257. {
  258. thinker_t thinker;
  259. int polyobj;
  260. int speed;
  261. unsigned int dist;
  262. int angle;
  263. fixed_t xSpeed; // for sliding walls
  264. fixed_t ySpeed;
  265. } polyevent_t;
  266. typedef struct
  267. {
  268. thinker_t thinker;
  269. int polyobj;
  270. int speed;
  271. int dist;
  272. int totalDist;
  273. int direction;
  274. fixed_t xSpeed, ySpeed;
  275. int tics;
  276. int waitTics;
  277. podoortype_t type;
  278. boolean close;
  279. } polydoor_t;
  280. enum
  281. {
  282. PO_ANCHOR_TYPE = 3000,
  283. PO_SPAWN_TYPE,
  284. PO_SPAWNCRUSH_TYPE
  285. };
  286. #define PO_LINE_START 1 // polyobj line start special
  287. #define PO_LINE_EXPLICIT 5
  288. extern polyobj_t *polyobjs; // list of all poly-objects on the level
  289. extern int po_NumPolyobjs;
  290. void T_PolyDoor(polydoor_t *pd);
  291. void T_RotatePoly(polyevent_t *pe);
  292. boolean EV_RotatePoly(line_t *line, byte *args, int direction, boolean
  293. overRide);
  294. void T_MovePoly(polyevent_t *pe);
  295. boolean EV_MovePoly(line_t *line, byte *args, boolean timesEight, boolean
  296. overRide);
  297. boolean EV_OpenPolyDoor(line_t *line, byte *args, podoortype_t type);
  298. boolean PO_MovePolyobj(int num, int x, int y);
  299. boolean PO_RotatePolyobj(int num, angle_t angle);
  300. void PO_Init(int lump);
  301. boolean PO_Busy(int polyobj);
  302. #include "p_spec.h"
  303. #endif // __P_LOCAL__