2 //**************************************************************************
4 //** p_local.h : Heretic 2 : Raven Software, Corp.
11 //**************************************************************************
20 #define STARTREDPALS 1
21 #define STARTBONUSPALS 9
22 #define STARTPOISONPALS 13
23 #define STARTICEPAL 21
24 #define STARTHOLYPAL 22
25 #define STARTSCOURGEPAL 25
27 #define NUMBONUSPALS 4
28 #define NUMPOISONPALS 8
31 #define FLOATSPEED (FRACUNIT*4)
34 #define MAXMORPHHEALTH 30
35 #define VIEWHEIGHT (48*FRACUNIT)
37 // mapblocks are used to check movement 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)
44 // player radius for movement checking
45 #define PLAYERRADIUS 16*FRACUNIT
47 // MAXRADIUS is for precalculated sector block boxes
48 // the spider demon is larger, but we don't have any moving sectors
50 #define MAXRADIUS 32*FRACUNIT
52 #define GRAVITY FRACUNIT
53 #define MAXMOVE (30*FRACUNIT)
55 #define USERANGE (64*FRACUNIT)
56 #define MELEERANGE (64*FRACUNIT)
57 #define MISSILERANGE (32*64*FRACUNIT)
73 #define BASETHRESHOLD 100 // follow a player exlusively for 3 seconds
77 extern thinker_t thinkercap; // both the head and tail of the thinker list
78 extern int TimerGame; // tic countdown for deathmatch
80 void P_InitThinkers(void);
81 void P_AddThinker(thinker_t *thinker);
82 void P_RemoveThinker(thinker_t *thinker);
89 void P_SetPsprite(player_t *player, int position, statenum_t stnum);
90 void P_SetPspriteNF(player_t *player, int position, statenum_t stnum);
91 void P_SetupPsprites(player_t *curplayer);
92 void P_MovePsprites(player_t *curplayer);
93 void P_DropWeapon(player_t *player);
94 void P_ActivateMorphWeapon(player_t *player);
95 void P_PostMorphWeapon(player_t *player, weapontype_t weapon);
99 extern int PStateNormal[NUMCLASSES];
100 extern int PStateRun[NUMCLASSES];
101 extern int PStateAttack[NUMCLASSES];
102 extern int PStateAttackEnd[NUMCLASSES];
104 void P_PlayerThink(player_t *player);
105 void P_Thrust(player_t *player, angle_t angle, fixed_t move);
106 void P_PlayerRemoveArtifact(player_t *player, int slot);
107 void P_PlayerUseArtifact(player_t *player, artitype_t arti);
108 boolean P_UseArtifact(player_t *player, artitype_t arti);
109 int P_GetPlayerNum(player_t *player);
110 void P_TeleportOther(mobj_t *victim);
111 void ResetBlasted(mobj_t *mo);
113 // ***** P_MOBJ *****
115 // Any floor type >= FLOOR_LIQUID will floorclip sprites
126 #define ONFLOORZ MININT
127 #define ONCEILINGZ MAXINT
128 #define FLOATRANDZ (MAXINT-1)
129 #define FROMCEILINGZ128 (MAXINT-2)
131 extern mobjtype_t PuffType;
132 extern mobj_t *MissileMobj;
134 mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type);
135 void P_RemoveMobj(mobj_t *th);
136 boolean P_SetMobjState(mobj_t *mobj, statenum_t state);
137 boolean P_SetMobjStateNF(mobj_t *mobj, statenum_t state);
138 void P_ThrustMobj(mobj_t *mo, angle_t angle, fixed_t move);
139 int P_FaceMobj(mobj_t *source, mobj_t *target, angle_t *delta);
140 boolean P_SeekerMissile(mobj_t *actor, angle_t thresh, angle_t turnMax);
141 void P_MobjThinker(mobj_t *mobj);
142 void P_BlasterMobjThinker(mobj_t *mobj);
143 void P_SpawnPuff(fixed_t x, fixed_t y, fixed_t z);
144 void P_SpawnBlood(fixed_t x, fixed_t y, fixed_t z, int damage);
145 void P_BloodSplatter(fixed_t x, fixed_t y, fixed_t z, mobj_t *originator);
146 void P_BloodSplatter2(fixed_t x, fixed_t y, fixed_t z, mobj_t *originator);
147 void P_RipperBlood(mobj_t *mo);
148 int P_GetThingFloorType(mobj_t *thing);
149 int P_HitFloor(mobj_t *thing);
150 boolean P_CheckMissileSpawn(mobj_t *missile);
151 mobj_t *P_SpawnMissile(mobj_t *source, mobj_t *dest, mobjtype_t type);
152 mobj_t *P_SpawnMissileXYZ(fixed_t x, fixed_t y, fixed_t z,
153 mobj_t *source, mobj_t *dest, mobjtype_t type);
154 mobj_t *P_SpawnMissileAngle(mobj_t *source, mobjtype_t type,
155 angle_t angle, fixed_t momz);
156 mobj_t *P_SpawnMissileAngleSpeed(mobj_t *source, mobjtype_t type,
157 angle_t angle, fixed_t momz, fixed_t speed);
158 mobj_t *P_SpawnPlayerMissile(mobj_t *source, mobjtype_t type);
159 mobj_t *P_SPMAngle(mobj_t *source, mobjtype_t type, angle_t angle);
160 mobj_t *P_SPMAngleXYZ(mobj_t *source, fixed_t x, fixed_t y,
161 fixed_t z, mobjtype_t type, angle_t angle);
162 void P_CreateTIDList(void);
163 void P_RemoveMobjFromTIDList(mobj_t *mobj);
164 void P_InsertMobjIntoTIDList(mobj_t *mobj, int tid);
165 mobj_t *P_FindMobjFromTID(int tid, int *searchPosition);
166 mobj_t *P_SpawnKoraxMissile(fixed_t x, fixed_t y, fixed_t z,
167 mobj_t *source, mobj_t *dest, mobjtype_t type);
169 // ***** P_ENEMY *****
171 void P_NoiseAlert (mobj_t *target, mobj_t *emmiter);
172 int P_Massacre(void);
173 boolean A_RaiseMobj(mobj_t *actor);
174 boolean A_SinkMobj(mobj_t *actor);
175 void A_NoBlocking(mobj_t *actor);
176 boolean P_LookForMonsters(mobj_t *actor);
177 void P_InitCreatureCorpseQueue(boolean corpseScan);
178 void A_DeQueueCorpse(mobj_t *actor);
181 // ***** P_MAPUTL *****
185 fixed_t x, y, dx, dy;
197 fixed_t frac; // along trace line
205 #define MAXINTERCEPTS 128
206 extern intercept_t intercepts[MAXINTERCEPTS], *intercept_p;
207 typedef boolean (*traverser_t) (intercept_t *in);
210 fixed_t P_AproxDistance (fixed_t dx, fixed_t dy);
211 int P_PointOnLineSide (fixed_t x, fixed_t y, line_t *line);
212 int P_PointOnDivlineSide (fixed_t x, fixed_t y, divline_t *line);
213 void P_MakeDivline (line_t *li, divline_t *dl);
214 fixed_t P_InterceptVector (divline_t *v2, divline_t *v1);
215 int P_BoxOnLineSide (fixed_t *tmbox, line_t *ld);
217 extern fixed_t opentop, openbottom, openrange;
218 extern fixed_t lowfloor;
219 void P_LineOpening (line_t *linedef);
221 boolean P_BlockLinesIterator (int x, int y, boolean(*func)(line_t*) );
222 boolean P_BlockThingsIterator (int x, int y, boolean(*func)(mobj_t*) );
224 #define PT_ADDLINES 1
225 #define PT_ADDTHINGS 2
226 #define PT_EARLYOUT 4
228 extern divline_t trace;
229 boolean P_PathTraverse (fixed_t x1, fixed_t y1, fixed_t x2, fixed_t y2,
230 int flags, boolean (*trav) (intercept_t *));
232 void P_UnsetThingPosition (mobj_t *thing);
233 void P_SetThingPosition (mobj_t *thing);
234 mobj_t *P_RoughMonsterSearch(mobj_t *mo, int distance);
238 extern boolean floatok; // if true, move would be ok if
239 extern fixed_t tmfloorz, tmceilingz; // within tmfloorz - tmceilingz
240 extern int tmfloorpic;
241 extern mobj_t *BlockingMobj;
243 extern line_t *ceilingline;
244 boolean P_TestMobjLocation(mobj_t *mobj);
245 boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y);
246 mobj_t *P_CheckOnmobj(mobj_t *thing);
247 void P_FakeZMovement(mobj_t *mo);
248 boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y);
249 boolean P_TeleportMove(mobj_t *thing, fixed_t x, fixed_t y);
250 void P_SlideMove(mobj_t *mo);
251 void P_BounceWall(mobj_t *mo);
252 boolean P_CheckSight(mobj_t *t1, mobj_t *t2);
253 void P_UseLines(player_t *player);
254 boolean P_UsePuzzleItem(player_t *player, int itemType);
255 void PIT_ThrustSpike(mobj_t *actor);
257 boolean P_ChangeSector (sector_t *sector, int crunch);
259 extern mobj_t *PuffSpawned; // true if a puff was spawned
260 extern mobj_t *linetarget; // who got hit (or NULL)
261 fixed_t P_AimLineAttack (mobj_t *t1, angle_t angle, fixed_t distance);
263 void P_LineAttack (mobj_t *t1, angle_t angle, fixed_t distance, fixed_t slope, int damage);
265 void P_RadiusAttack (mobj_t *spot, mobj_t *source, int damage, int distance,
266 boolean damageSource);
268 // ***** P_SETUP *****
270 extern byte *rejectmatrix; // for fast sight rejection
271 extern short *blockmaplump; // offsets in blockmap are from here
272 extern short *blockmap;
273 extern int bmapwidth, bmapheight; // in mapblocks
274 extern fixed_t bmaporgx, bmaporgy; // origin of block map
275 extern mobj_t **blocklinks; // for thing chains
277 // ***** P_INTER *****
279 extern int clipmana[NUMMANA];
281 void P_SetMessage(player_t *player, char *message, boolean ultmsg);
282 void P_SetYellowMessage(player_t *player, char *message, boolean ultmsg);
283 void P_ClearMessage(player_t *player);
284 void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher);
285 void P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source,
287 void P_FallingDamage(player_t *player);
288 void P_PoisonPlayer(player_t *player, mobj_t *poisoner, int poison);
289 void P_PoisonDamage(player_t *player, mobj_t *source, int damage,
290 boolean playPainSound);
291 boolean P_GiveMana(player_t *player, manatype_t mana, int count);
292 boolean P_GiveArtifact(player_t *player, artitype_t arti, mobj_t *mo);
293 boolean P_GiveArmor(player_t *player, armortype_t armortype, int amount);
294 boolean P_GiveBody(player_t *player, int num);
295 boolean P_GivePower(player_t *player, powertype_t power);
296 boolean P_MorphPlayer(player_t *player);
298 // ***** AM_MAP *****
300 boolean AM_Responder(event_t *ev);
301 void AM_Ticker(void);
302 void AM_Drawer(void);
304 // ***** A_ACTION *****
305 boolean A_LocalQuake(byte *args, mobj_t *victim);
306 void P_SpawnDirt(mobj_t *actor, fixed_t radius);
307 void A_BridgeRemove(mobj_t *actor);
309 // ***** SB_BAR *****
312 extern int ArtifactFlash;
313 void SB_PaletteFlash(boolean forceChange);
315 // ===== PO_MAN =====
331 fixed_t xSpeed; // for sliding walls
343 fixed_t xSpeed, ySpeed;
352 PO_ANCHOR_TYPE = 3000,
357 #define PO_LINE_START 1 // polyobj line start special
358 #define PO_LINE_EXPLICIT 5
360 extern polyobj_t *polyobjs; // list of all poly-objects on the level
361 extern int po_NumPolyobjs;
363 void T_PolyDoor(polydoor_t *pd);
364 void T_RotatePoly(polyevent_t *pe);
365 boolean EV_RotatePoly(line_t *line, byte *args, int direction, boolean
367 void T_MovePoly(polyevent_t *pe);
368 boolean EV_MovePoly(line_t *line, byte *args, boolean timesEight, boolean
370 boolean EV_OpenPolyDoor(line_t *line, byte *args, podoortype_t type);
372 boolean PO_MovePolyobj(int num, int x, int y);
373 boolean PO_RotatePolyobj(int num, angle_t angle);
374 void PO_Init(int lump);
375 boolean PO_Busy(int polyobj);
379 #endif // __P_LOCAL__