1 // SONIC ROBO BLAST 2
2 //-----------------------------------------------------------------------------
3 // Copyright (C) 1993-1996 by id Software, Inc.
4 // Copyright (C) 1998-2000 by DooM Legacy Team.
5 // Copyright (C) 1999-2020 by Sonic Team Junior.
6 //
7 // This program is free software distributed under the
8 // terms of the GNU General Public License, version 2.
9 // See the 'LICENSE' file for more details.
10 //-----------------------------------------------------------------------------
11 /// \file  p_local.h
12 /// \brief Play functions, animation, global header
13 
14 #ifndef __P_LOCAL__
15 #define __P_LOCAL__
16 
17 #include "command.h"
18 #include "d_player.h"
19 #include "d_think.h"
20 #include "m_fixed.h"
21 #include "m_bbox.h"
22 #include "p_tick.h"
23 #include "r_defs.h"
24 #include "p_maputl.h"
25 
26 #define FLOATSPEED (FRACUNIT*4)
27 
28 // Maximum player score.
29 #define MAXSCORE 99999990 // 999999990
30 
31 // mapblocks are used to check movement
32 // against lines and things
33 #define MAPBLOCKUNITS 128
34 #define MAPBLOCKSIZE  (MAPBLOCKUNITS*FRACUNIT)
35 #define MAPBLOCKSHIFT (FRACBITS+7)
36 #define MAPBMASK      (MAPBLOCKSIZE-1)
37 #define MAPBTOFRAC    (MAPBLOCKSHIFT-FRACBITS)
38 
39 // Convenience macro to fix issue with collision along bottom/left edges of blockmap -Red
40 #define BMBOUNDFIX(xl, xh, yl, yh) {if (xl > xh) xl = 0; if (yl > yh) yl = 0;}
41 
42 // MAXRADIUS is for precalculated sector block boxes
43 // the spider demon is larger,
44 // but we do not have any moving sectors nearby
45 #define MAXRADIUS (32*FRACUNIT)
46 
47 // max Z move up or down without jumping
48 // above this, a height difference is considered as a 'dropoff'
49 #define MAXSTEPMOVE (24*FRACUNIT)
50 
51 #define USERANGE (64*FRACUNIT)
52 #define MELEERANGE (64*FRACUNIT)
53 #define MISSILERANGE (32*64*FRACUNIT)
54 
55 #define AIMINGTOSLOPE(aiming) FINESINE((aiming>>ANGLETOFINESHIFT) & FINEMASK)
56 
57 #define twodlevel (maptol & TOL_2D)
58 
59 #define mariomode (maptol & TOL_MARIO)
60 
61 #define P_GetPlayerHeight(player) FixedMul(player->height, player->mo->scale)
62 #define P_GetPlayerSpinHeight(player) FixedMul(player->spinheight, player->mo->scale)
63 
64 typedef enum
65 {
66 	THINK_POLYOBJ,
67 	THINK_MAIN,
68 	THINK_MOBJ,
69 	THINK_DYNSLOPE,
70 	THINK_PRECIP,
71 	NUM_THINKERLISTS
72 } thinklistnum_t; /**< Thinker lists. */
73 extern thinker_t thlist[];
74 
75 void P_InitThinkers(void);
76 void P_AddThinker(const thinklistnum_t n, thinker_t *thinker);
77 void P_RemoveThinker(thinker_t *thinker);
78 
79 //
80 // P_USER
81 //
82 typedef struct camera_s
83 {
84 	boolean chase;
85 	angle_t aiming;
86 
87 	// Things used by FS cameras.
88 	fixed_t viewheight;
89 	angle_t startangle;
90 
91 	// Camera demobjerization
92 	// Info for drawing: position.
93 	fixed_t x, y, z;
94 
95 	//More drawing info: to determine current sprite.
96 	angle_t angle; // orientation
97 
98 	struct subsector_s *subsector;
99 
100 	// The closest interval over all contacted Sectors (or Things).
101 	fixed_t floorz;
102 	fixed_t ceilingz;
103 
104 	// For movement checking.
105 	fixed_t radius;
106 	fixed_t height;
107 
108 	fixed_t relativex;
109 
110 	// Momentums, used to update position.
111 	fixed_t momx, momy, momz;
112 } camera_t;
113 
114 extern camera_t camera, camera2;
115 extern consvar_t cv_cam_dist, cv_cam_still, cv_cam_height;
116 extern consvar_t cv_cam_speed, cv_cam_rotate, cv_cam_rotspeed, cv_cam_turnmultiplier, cv_cam_orbit, cv_cam_adjust;
117 
118 extern consvar_t cv_cam2_dist, cv_cam2_still, cv_cam2_height;
119 extern consvar_t cv_cam2_speed, cv_cam2_rotate, cv_cam2_rotspeed, cv_cam2_turnmultiplier, cv_cam2_orbit, cv_cam2_adjust;
120 
121 extern consvar_t cv_cam_savedist[2][2], cv_cam_saveheight[2][2];
122 void CV_UpdateCamDist(void);
123 void CV_UpdateCam2Dist(void);
124 
125 extern fixed_t t_cam_dist, t_cam_height, t_cam_rotate;
126 extern fixed_t t_cam2_dist, t_cam2_height, t_cam2_rotate;
127 
128 INT32 P_GetPlayerControlDirection(player_t *player);
129 void P_AddPlayerScore(player_t *player, UINT32 amount);
130 void P_StealPlayerScore(player_t *player, UINT32 amount);
131 void P_ResetCamera(player_t *player, camera_t *thiscam);
132 boolean P_TryCameraMove(fixed_t x, fixed_t y, camera_t *thiscam);
133 void P_SlideCameraMove(camera_t *thiscam);
134 boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcalled);
135 pflags_t P_GetJumpFlags(player_t *player);
136 boolean P_PlayerInPain(player_t *player);
137 void P_DoPlayerPain(player_t *player, mobj_t *source, mobj_t *inflictor);
138 void P_ResetPlayer(player_t *player);
139 boolean P_PlayerCanDamage(player_t *player, mobj_t *thing);
140 boolean P_IsLocalPlayer(player_t *player);
141 void P_SetPlayerAngle(player_t *player, angle_t angle);
142 angle_t P_GetLocalAngle(player_t *player);
143 void P_SetLocalAngle(player_t *player, angle_t angle);
144 void P_ForceLocalAngle(player_t *player, angle_t angle);
145 boolean P_PlayerFullbright(player_t *player);
146 boolean P_PlayerCanEnterSpinGaps(player_t *player);
147 boolean P_PlayerShouldUseSpinHeight(player_t *player);
148 
149 boolean P_IsObjectInGoop(mobj_t *mo);
150 boolean P_IsObjectOnGround(mobj_t *mo);
151 boolean P_IsObjectOnGroundIn(mobj_t *mo, sector_t *sec);
152 boolean P_InSpaceSector(mobj_t *mo);
153 boolean P_InQuicksand(mobj_t *mo);
154 boolean P_PlayerHitFloor(player_t *player, boolean dorollstuff);
155 
156 void P_SetObjectMomZ(mobj_t *mo, fixed_t value, boolean relative);
157 void P_RestoreMusic(player_t *player);
158 void P_SpawnShieldOrb(player_t *player);
159 void P_SwitchShield(player_t *player, UINT16 shieldtype);
160 mobj_t *P_SpawnGhostMobj(mobj_t *mobj);
161 void P_GivePlayerRings(player_t *player, INT32 num_rings);
162 void P_GivePlayerSpheres(player_t *player, INT32 num_spheres);
163 void P_GivePlayerLives(player_t *player, INT32 numlives);
164 void P_GiveCoopLives(player_t *player, INT32 numlives, boolean sound);
165 UINT8 P_GetNextEmerald(void);
166 void P_GiveEmerald(boolean spawnObj);
167 void P_GiveFinishFlags(player_t *player);
168 #if 0
169 void P_ResetScore(player_t *player);
170 #else
171 #define P_ResetScore(player) player->scoreadd = 0
172 #endif
173 boolean P_AutoPause(void);
174 
175 void P_DoJumpShield(player_t *player);
176 void P_DoBubbleBounce(player_t *player);
177 void P_DoAbilityBounce(player_t *player, boolean changemomz);
178 void P_TwinSpinRejuvenate(player_t *player, mobjtype_t type);
179 void P_BlackOw(player_t *player);
180 void P_ElementalFire(player_t *player, boolean cropcircle);
181 void P_SpawnSkidDust(player_t *player, fixed_t radius, boolean sound);
182 
183 void P_MovePlayer(player_t *player);
184 void P_DoPityCheck(player_t *player);
185 void P_PlayerThink(player_t *player);
186 void P_PlayerAfterThink(player_t *player);
187 void P_DoPlayerFinish(player_t *player);
188 void P_DoPlayerExit(player_t *player);
189 void P_NightserizePlayer(player_t *player, INT32 ptime);
190 
191 void P_InstaThrust(mobj_t *mo, angle_t angle, fixed_t move);
192 fixed_t P_ReturnThrustX(mobj_t *mo, angle_t angle, fixed_t move);
193 fixed_t P_ReturnThrustY(mobj_t *mo, angle_t angle, fixed_t move);
194 void P_InstaThrustEvenIn2D(mobj_t *mo, angle_t angle, fixed_t move);
195 
196 mobj_t *P_LookForFocusTarget(player_t *player, mobj_t *exclude, SINT8 direction, UINT8 lockonflags);
197 
198 mobj_t *P_LookForEnemies(player_t *player, boolean nonenemies, boolean bullet);
199 void P_NukeEnemies(mobj_t *inflictor, mobj_t *source, fixed_t radius);
200 void P_Earthquake(mobj_t *inflictor, mobj_t *source, fixed_t radius);
201 boolean P_HomingAttack(mobj_t *source, mobj_t *enemy); /// \todo doesn't belong in p_user
202 boolean P_SuperReady(player_t *player);
203 void P_DoJump(player_t *player, boolean soundandstate);
204 #define P_AnalogMove(player) (P_ControlStyle(player) == CS_LMAOGALOG)
205 boolean P_TransferToNextMare(player_t *player);
206 UINT8 P_FindLowestMare(void);
207 void P_FindEmerald(void);
208 void P_TransferToAxis(player_t *player, INT32 axisnum);
209 boolean P_PlayerMoving(INT32 pnum);
210 void P_SpawnThokMobj(player_t *player);
211 void P_SpawnSpinMobj(player_t *player, mobjtype_t type);
212 void P_Telekinesis(player_t *player, fixed_t thrust, fixed_t range);
213 
214 void P_PlayLivesJingle(player_t *player);
215 #define P_PlayRinglossSound(s)	S_StartSound(s, (mariomode) ? sfx_mario8 : sfx_altow1 + P_RandomKey(4));
216 #define P_PlayDeathSound(s)		S_StartSound(s, sfx_altdi1 + P_RandomKey(4));
217 #define P_PlayVictorySound(s)	S_StartSound(s, sfx_victr1 + P_RandomKey(4));
218 
219 boolean P_GetLives(player_t *player);
220 boolean P_SpectatorJoinGame(player_t *player);
221 void P_RestoreMultiMusic(player_t *player);
222 
223 /// ------------------------
224 /// Jingle stuff
225 /// ------------------------
226 
227 typedef enum
228 {
229 	JT_NONE,   // Null state
230 	JT_OTHER,  // Other state
231 	JT_MASTER, // Main level music
232 	JT_1UP, // Extra life
233 	JT_SHOES,  // Speed shoes
234 	JT_INV, // Invincibility
235 	JT_MINV, // Mario Invincibility
236 	JT_DROWN,  // Drowning
237 	JT_SUPER,  // Super Sonic
238 	JT_GOVER, // Game Over
239 	JT_NIGHTSTIMEOUT, // NiGHTS Time Out (10 seconds)
240 	JT_SSTIMEOUT, // NiGHTS Special Stage Time Out (10 seconds)
241 
242 	// these are not jingles
243 	// JT_LCLEAR, // Level Clear
244 	// JT_RACENT, // Multiplayer Intermission
245 	// JT_CONTSC, // Continue
246 
247 	NUMJINGLES
248 } jingletype_t;
249 
250 typedef struct
251 {
252 	char musname[7];
253 	boolean looping;
254 } jingle_t;
255 
256 extern jingle_t jingleinfo[NUMJINGLES];
257 
258 #define JINGLEPOSTFADE 1000
259 
260 void P_PlayJingle(player_t *player, jingletype_t jingletype);
261 boolean P_EvaluateMusicStatus(UINT16 status, const char *musname);
262 void P_PlayJingleMusic(player_t *player, const char *musname, UINT16 musflags, boolean looping, UINT16 status);
263 
264 //
265 // P_MOBJ
266 //
267 #define ONFLOORZ INT32_MIN
268 #define ONCEILINGZ INT32_MAX
269 
270 // Time interval for item respawning.
271 // WARNING MUST be a power of 2
272 #define ITEMQUESIZE 1024
273 
274 extern mapthing_t *itemrespawnque[ITEMQUESIZE];
275 extern tic_t itemrespawntime[ITEMQUESIZE];
276 extern size_t iquehead, iquetail;
277 extern consvar_t cv_gravity, cv_movebob;
278 
279 mobjtype_t P_GetMobjtype(UINT16 mthingtype);
280 
281 void P_RespawnSpecials(void);
282 
283 mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type);
284 
285 void P_RecalcPrecipInSector(sector_t *sector);
286 void P_PrecipitationEffects(void);
287 
288 void P_RemoveMobj(mobj_t *th);
289 boolean P_MobjWasRemoved(mobj_t *th);
290 void P_RemoveSavegameMobj(mobj_t *th);
291 boolean P_SetPlayerMobjState(mobj_t *mobj, statenum_t state);
292 boolean P_SetMobjState(mobj_t *mobj, statenum_t state);
293 void P_RunShields(void);
294 void P_RunOverlays(void);
295 void P_HandleMinecartSegments(mobj_t *mobj);
296 void P_MobjThinker(mobj_t *mobj);
297 boolean P_RailThinker(mobj_t *mobj);
298 void P_PushableThinker(mobj_t *mobj);
299 void P_SceneryThinker(mobj_t *mobj);
300 
301 
302 fixed_t P_MobjFloorZ(mobj_t *mobj, sector_t *sector, sector_t *boundsec, fixed_t x, fixed_t y, line_t *line, boolean lowest, boolean perfect);
303 fixed_t P_MobjCeilingZ(mobj_t *mobj, sector_t *sector, sector_t *boundsec, fixed_t x, fixed_t y, line_t *line, boolean lowest, boolean perfect);
304 #define P_GetFloorZ(mobj, sector, x, y, line) P_MobjFloorZ(mobj, sector, NULL, x, y, line, false, false)
305 #define P_GetCeilingZ(mobj, sector, x, y, line) P_MobjCeilingZ(mobj, sector, NULL, x, y, line, true, false)
306 #define P_GetFOFTopZ(mobj, sector, fof, x, y, line) P_MobjCeilingZ(mobj, sectors + fof->secnum, sector, x, y, line, false, false)
307 #define P_GetFOFBottomZ(mobj, sector, fof, x, y, line) P_MobjFloorZ(mobj, sectors + fof->secnum, sector, x, y, line, true, false)
308 #define P_GetSpecialBottomZ(mobj, src, bound) P_MobjFloorZ(mobj, src, bound, mobj->x, mobj->y, NULL, src != bound, true)
309 #define P_GetSpecialTopZ(mobj, src, bound) P_MobjCeilingZ(mobj, src, bound, mobj->x, mobj->y, NULL, src == bound, true)
310 
311 fixed_t P_CameraFloorZ(camera_t *mobj, sector_t *sector, sector_t *boundsec, fixed_t x, fixed_t y, line_t *line, boolean lowest, boolean perfect);
312 fixed_t P_CameraCeilingZ(camera_t *mobj, sector_t *sector, sector_t *boundsec, fixed_t x, fixed_t y, line_t *line, boolean lowest, boolean perfect);
313 #define P_CameraGetFloorZ(mobj, sector, x, y, line) P_CameraFloorZ(mobj, sector, NULL, x, y, line, false, false)
314 #define P_CameraGetCeilingZ(mobj, sector, x, y, line) P_CameraCeilingZ(mobj, sector, NULL, x, y, line, true, false)
315 #define P_CameraGetFOFTopZ(mobj, sector, fof, x, y, line) P_CameraCeilingZ(mobj, sectors + fof->secnum, sector, x, y, line, false, false)
316 #define P_CameraGetFOFBottomZ(mobj, sector, fof, x, y, line) P_CameraFloorZ(mobj, sectors + fof->secnum, sector, x, y, line, true, false)
317 
318 boolean P_InsideANonSolidFFloor(mobj_t *mobj, ffloor_t *rover);
319 boolean P_CheckDeathPitCollide(mobj_t *mo);
320 boolean P_CheckSolidLava(ffloor_t *rover);
321 void P_AdjustMobjFloorZ_FFloors(mobj_t *mo, sector_t *sector, UINT8 motype);
322 
323 mobj_t *P_SpawnMobjFromMobj(mobj_t *mobj, fixed_t xofs, fixed_t yofs, fixed_t zofs, mobjtype_t type);
324 
325 mobj_t *P_SpawnMissile(mobj_t *source, mobj_t *dest, mobjtype_t type);
326 mobj_t *P_SpawnXYZMissile(mobj_t *source, mobj_t *dest, mobjtype_t type, fixed_t x, fixed_t y, fixed_t z);
327 mobj_t *P_SpawnPointMissile(mobj_t *source, fixed_t xa, fixed_t ya, fixed_t za, mobjtype_t type, fixed_t x, fixed_t y, fixed_t z);
328 mobj_t *P_SpawnAlteredDirectionMissile(mobj_t *source, mobjtype_t type, fixed_t x, fixed_t y, fixed_t z, INT32 shiftingAngle);
329 mobj_t *P_SPMAngle(mobj_t *source, mobjtype_t type, angle_t angle, UINT8 aimtype, UINT32 flags2);
330 #define P_SpawnPlayerMissile(s,t,f) P_SPMAngle(s,t,s->angle,true,f)
331 #define P_SpawnNameFinder(s,t) P_SPMAngle(s,t,s->angle,true,0)
332 void P_ColorTeamMissile(mobj_t *missile, player_t *source);
333 SINT8 P_MobjFlip(mobj_t *mobj);
334 fixed_t P_GetMobjGravity(mobj_t *mo);
335 FUNCMATH boolean P_WeaponOrPanel(mobjtype_t type);
336 
337 void P_CalcChasePostImg(player_t *player, camera_t *thiscam);
338 boolean P_CameraThinker(player_t *player, camera_t *thiscam, boolean resetcalled);
339 
340 void P_Attract(mobj_t *source, mobj_t *enemy, boolean nightsgrab);
341 mobj_t *P_GetClosestAxis(mobj_t *source);
342 
343 boolean P_CanRunOnWater(player_t *player, ffloor_t *rover);
344 
345 void P_MaceRotate(mobj_t *center, INT32 baserot, INT32 baseprevrot);
346 
347 void P_FlashPal(player_t *pl, UINT16 type, UINT16 duration);
348 #define PAL_WHITE    1
349 #define PAL_MIXUP    2
350 #define PAL_RECYCLE  3
351 #define PAL_NUKE     4
352 
353 //
354 // P_ENEMY
355 //
356 
357 // main player in game
358 extern player_t *stplyr; // for splitscreen correct palette changes and overlay
359 
360 // Is there a better place for these?
361 extern INT32 var1;
362 extern INT32 var2;
363 
364 boolean P_CheckMeleeRange(mobj_t *actor);
365 boolean P_JetbCheckMeleeRange(mobj_t *actor);
366 boolean P_FaceStabCheckMeleeRange(mobj_t *actor);
367 boolean P_SkimCheckMeleeRange(mobj_t *actor);
368 boolean P_CheckMissileRange(mobj_t *actor);
369 
370 void P_NewChaseDir(mobj_t *actor);
371 boolean P_LookForPlayers(mobj_t *actor, boolean allaround, boolean tracer, fixed_t dist);
372 
373 mobj_t *P_InternalFlickySpawn(mobj_t *actor, mobjtype_t flickytype, fixed_t momz, boolean lookforplayers, SINT8 moveforward);
374 void P_InternalFlickySetColor(mobj_t *actor, UINT8 extrainfo);
375 #define P_IsFlickyCenter(type) (type > MT_FLICKY_01 && type < MT_SEED && (type - MT_FLICKY_01) % 2 ? 1 : 0)
376 void P_InternalFlickyBubble(mobj_t *actor);
377 void P_InternalFlickyFly(mobj_t *actor, fixed_t flyspeed, fixed_t targetdist, fixed_t chasez);
378 void P_InternalFlickyHop(mobj_t *actor, fixed_t momz, fixed_t momh, angle_t angle);
379 
380 //
381 // P_MAP
382 //
383 
384 // If "floatok" true, move would be ok
385 // if within "tmfloorz - tmceilingz".
386 extern boolean floatok;
387 extern fixed_t tmfloorz;
388 extern fixed_t tmceilingz;
389 extern ffloor_t *tmfloorrover, *tmceilingrover;
390 extern mobj_t *tmfloorthing, *tmhitthing, *tmthing;
391 extern camera_t *mapcampointer;
392 extern fixed_t tmx;
393 extern fixed_t tmy;
394 extern pslope_t *tmfloorslope, *tmceilingslope;
395 
396 /* cphipps 2004/08/30 */
397 extern void P_MapStart(void);
398 extern void P_MapEnd(void);
399 
400 extern line_t *ceilingline;
401 extern line_t *blockingline;
402 extern msecnode_t *sector_list;
403 
404 extern mprecipsecnode_t *precipsector_list;
405 
406 void P_UnsetThingPosition(mobj_t *thing);
407 void P_SetThingPosition(mobj_t *thing);
408 void P_SetUnderlayPosition(mobj_t *thing);
409 
410 boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y);
411 boolean P_CheckCameraPosition(fixed_t x, fixed_t y, camera_t *thiscam);
412 boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff);
413 boolean P_Move(mobj_t *actor, fixed_t speed);
414 boolean P_TeleportMove(mobj_t *thing, fixed_t x, fixed_t y, fixed_t z);
415 void P_SlideMove(mobj_t *mo);
416 void P_BounceMove(mobj_t *mo);
417 boolean P_CheckSight(mobj_t *t1, mobj_t *t2);
418 void P_CheckHoopPosition(mobj_t *hoopthing, fixed_t x, fixed_t y, fixed_t z, fixed_t radius);
419 
420 boolean P_CheckSector(sector_t *sector, boolean crunch);
421 
422 void P_DelSeclist(msecnode_t *node);
423 void P_DelPrecipSeclist(mprecipsecnode_t *node);
424 
425 void P_CreateSecNodeList(mobj_t *thing, fixed_t x, fixed_t y);
426 void P_Initsecnode(void);
427 
428 void P_RadiusAttack(mobj_t *spot, mobj_t *source, fixed_t damagedist, UINT8 damagetype, boolean sightcheck);
429 
430 fixed_t P_FloorzAtPos(fixed_t x, fixed_t y, fixed_t z, fixed_t height);
431 fixed_t P_CeilingzAtPos(fixed_t x, fixed_t y, fixed_t z, fixed_t height);
432 boolean PIT_PushableMoved(mobj_t *thing);
433 
434 boolean P_DoSpring(mobj_t *spring, mobj_t *object);
435 
436 //
437 // P_SETUP
438 //
439 extern UINT8 *rejectmatrix; // for fast sight rejection
440 extern INT32 *blockmaplump; // offsets in blockmap are from here
441 extern INT32 *blockmap; // Big blockmap
442 extern INT32 bmapwidth;
443 extern INT32 bmapheight; // in mapblocks
444 extern fixed_t bmaporgx;
445 extern fixed_t bmaporgy; // origin of block map
446 extern mobj_t **blocklinks; // for thing chains
447 
448 //
449 // P_INTER
450 //
451 typedef struct BasicFF_s
452 {
453 	INT32 ForceX; ///< The X of the Force's Vel
454 	INT32 ForceY; ///< The Y of the Force's Vel
455 	const player_t *player; ///< Player of Rumble
456 	//All
457 	UINT32 Duration; ///< The total duration of the effect, in microseconds
458 	INT32 Gain; ///< /The gain to be applied to the effect, in the range from 0 through 10,000.
459 	//All, CONSTANTFORCE �10,000 to 10,000
460 	INT32 Magnitude; ///< Magnitude of the effect, in the range from 0 through 10,000.
461 } BasicFF_t;
462 
463 /* Damage/death types, for P_DamageMobj and related */
464 //// Damage types
465 //#define DMG_NORMAL 0 (unneeded?)
466 #define DMG_WATER     1
467 #define DMG_FIRE      2
468 #define DMG_ELECTRIC  3
469 #define DMG_SPIKE     4
470 #define DMG_NUKE      5 // bomb shield
471 //#define DMG_SPECIALSTAGE 6
472 //// Death types - cannot be combined with damage types
473 #define DMG_INSTAKILL  0x80
474 #define DMG_DROWNED    0x80+1
475 #define DMG_SPACEDROWN 0x80+2
476 #define DMG_DEATHPIT   0x80+3
477 #define DMG_CRUSHED    0x80+4
478 #define DMG_SPECTATOR  0x80+5
479 // Masks
480 #define DMG_CANHURTSELF 0x40 // Flag - can hurt self/team indirectly, such as through mines
481 #define DMG_DEATHMASK  DMG_INSTAKILL // if bit 7 is set, this is a death type instead of a damage type
482 
483 void P_ForceFeed(const player_t *player, INT32 attack, INT32 fade, tic_t duration, INT32 period);
484 void P_ForceConstant(const BasicFF_t *FFInfo);
485 void P_RampConstant(const BasicFF_t *FFInfo, INT32 Start, INT32 End);
486 void P_RemoveShield(player_t *player);
487 void P_SpecialStageDamage(player_t *player, mobj_t *inflictor, mobj_t *source);
488 boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 damage, UINT8 damagetype);
489 void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, UINT8 damagetype);
490 void P_PlayerRingBurst(player_t *player, INT32 num_rings); /// \todo better fit in p_user.c
491 void P_PlayerWeaponPanelBurst(player_t *player);
492 void P_PlayerWeaponAmmoBurst(player_t *player);
493 void P_PlayerWeaponPanelOrAmmoBurst(player_t *player);
494 void P_PlayerEmeraldBurst(player_t *player, boolean toss);
495 
496 void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck);
497 void P_TouchStarPost(mobj_t *starpost, player_t *player, boolean snaptopost);
498 void P_PlayerFlagBurst(player_t *player, boolean toss);
499 void P_CheckTimeLimit(void);
500 void P_CheckPointLimit(void);
501 void P_CheckSurvivors(void);
502 boolean P_CheckRacers(void);
503 
504 void P_ClearStarPost(INT32 postnum);
505 void P_ResetStarposts(void);
506 
507 boolean P_CanPickupItem(player_t *player, boolean weapon);
508 void P_DoNightsScore(player_t *player);
509 void P_DoMatchSuper(player_t *player);
510 
511 //
512 // P_SPEC
513 //
514 #include "p_spec.h"
515 
516 extern INT32 ceilmovesound;
517 
518 // Factor to scale scrolling effect into mobj-carrying properties = 3/32.
519 // (This is so scrolling floors and objects on them can move at same speed.)
520 #define CARRYFACTOR ((3*FRACUNIT)/32)
521 
522 void P_MixUp(mobj_t *thing, fixed_t x, fixed_t y, fixed_t z, angle_t angle,
523 			INT16 starpostx, INT16 starposty, INT16 starpostz,
524 			INT32 starpostnum, tic_t starposttime, angle_t starpostangle,
525 			fixed_t starpostscale, angle_t drawangle, INT32 flags2);
526 boolean P_Teleport(mobj_t *thing, fixed_t x, fixed_t y, fixed_t z, angle_t angle, boolean flash, boolean dontstopmove);
527 boolean P_SetMobjStateNF(mobj_t *mobj, statenum_t state);
528 boolean P_CheckMissileSpawn(mobj_t *th);
529 void P_Thrust(mobj_t *mo, angle_t angle, fixed_t move);
530 void P_DoSuperTransformation(player_t *player, boolean giverings);
531 void P_ExplodeMissile(mobj_t *mo);
532 void P_CheckGravity(mobj_t *mo, boolean affect);
533 
534 #endif // __P_LOCAL__
535