1 // Emacs style mode select -*- C++ -*-
2 //-----------------------------------------------------------------------------
6 // Copyright (C) 1993-1996 by id Software, Inc.
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.
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
18 // Play functions, animation, global header.
20 //-----------------------------------------------------------------------------
30 #define FLOATSPEED (FRACUNIT*4)
34 #define VIEWHEIGHT (41*FRACUNIT)
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)
45 // player radius for movement checking
46 #define PLAYERRADIUS 16*FRACUNIT
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
53 #define GRAVITY FRACUNIT
54 #define MAXMOVE (30*FRACUNIT)
56 #define USERANGE (64*FRACUNIT)
57 #define MELEERANGE (64*FRACUNIT)
58 #define MISSILERANGE (32*64*FRACUNIT)
60 // follow a player exlusively for 3 seconds
61 #define BASETHRESHOLD 100
69 // both the head and tail of the thinker list
70 extern thinker_t thinkercap;
73 void P_InitThinkers (void);
74 void P_AddThinker (thinker_t* thinker);
75 void P_RemoveThinker (thinker_t* thinker);
81 void P_SetupPsprites (player_t* curplayer);
82 void P_MovePsprites (player_t* curplayer);
83 void P_DropWeapon (player_t* player);
89 void P_PlayerThink (player_t* player);
95 #define ONFLOORZ MININT
96 #define ONCEILINGZ MAXINT
98 // Time interval for item respawning.
99 #define ITEMQUESIZE 128
101 extern mapthing_t itemrespawnque[ITEMQUESIZE];
102 extern int itemrespawntime[ITEMQUESIZE];
107 void P_RespawnSpecials (void);
116 void P_RemoveMobj (mobj_t* th);
117 boolean P_SetMobjState (mobj_t* mobj, statenum_t state);
118 void P_MobjThinker (void *mobj, void*);
120 void P_SpawnPuff (fixed_t x, fixed_t y, fixed_t z);
121 void P_SpawnBlood (fixed_t x, fixed_t y, fixed_t z, int damage);
122 mobj_t* P_SpawnMissile (mobj_t* source, mobj_t* dest, mobjtype_t type);
123 void P_SpawnPlayerMissile (mobj_t* source, mobjtype_t type);
129 void P_NoiseAlert (mobj_t* target, mobj_t* emmiter);
146 fixed_t frac; // along trace line
154 #define MAXINTERCEPTS 128
156 extern intercept_t intercepts[MAXINTERCEPTS];
157 extern intercept_t* intercept_p;
159 typedef boolean (*traverser_t) (intercept_t *in);
161 fixed_t P_AproxDistance (fixed_t dx, fixed_t dy);
162 int P_PointOnLineSide (fixed_t x, fixed_t y, line_t* line);
163 int P_PointOnDivlineSide (fixed_t x, fixed_t y, divline_t* line);
164 void P_MakeDivline (line_t* li, divline_t* dl);
165 fixed_t P_InterceptVector (divline_t* v2, divline_t* v1);
166 int P_BoxOnLineSide (fixed_t* tmbox, line_t* ld);
168 extern fixed_t opentop;
169 extern fixed_t openbottom;
170 extern fixed_t openrange;
171 extern fixed_t lowfloor;
173 void P_LineOpening (line_t* linedef);
175 boolean P_BlockLinesIterator (int x, int y, boolean(*func)(line_t*) );
176 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
182 extern divline_t trace;
191 boolean (*trav) (intercept_t *));
193 void P_UnsetThingPosition (mobj_t* thing);
194 void P_SetThingPosition (mobj_t* thing);
201 // If "floatok" true, move would be ok
202 // if within "tmfloorz - tmceilingz".
203 extern boolean floatok;
204 extern fixed_t tmfloorz;
205 extern fixed_t tmceilingz;
208 extern line_t* ceilingline;
210 boolean P_CheckPosition (mobj_t *thing, fixed_t x, fixed_t y);
211 boolean P_TryMove (mobj_t* thing, fixed_t x, fixed_t y);
212 boolean P_TeleportMove (mobj_t* thing, fixed_t x, fixed_t y);
213 void P_SlideMove (mobj_t* mo);
214 boolean P_CheckSight (mobj_t* t1, mobj_t* t2);
215 void P_UseLines (player_t* player);
217 boolean P_ChangeSector (sector_t* sector, boolean crunch);
219 extern mobj_t* linetarget; // who got hit (or NULL)
246 extern byte* rejectmatrix; // for fast sight rejection
247 extern short* blockmaplump; // offsets in blockmap are from here
248 extern short* blockmap;
249 extern int bmapwidth;
250 extern int bmapheight; // in mapblocks
251 extern fixed_t bmaporgx;
252 extern fixed_t bmaporgy; // origin of block map
253 extern mobj_t** blocklinks; // for thing chains
260 extern int maxammo[NUMAMMO];
261 extern int clipammo[NUMAMMO];
282 #endif // __P_LOCAL__
283 //-----------------------------------------------------------------------------
287 //-----------------------------------------------------------------------------