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
63 extern boolean noztele;
64 extern boolean nobounce;
71 // both the head and tail of the thinker list
72 extern thinker_t thinkercap;
75 void P_InitThinkers (void);
76 void P_AddThinker (thinker_t* thinker);
77 void P_RemoveThinker (thinker_t* thinker);
83 void P_SetupPsprites (player_t* curplayer);
84 void P_MovePsprites (player_t* curplayer);
85 void P_DropWeapon (player_t* player);
91 void P_PlayerThink (player_t* player);
97 #define ONFLOORZ MININT
98 #define ONCEILINGZ MAXINT
100 // Time interval for item respawning.
101 #define ITEMQUESIZE 128
103 extern mapthing_t itemrespawnque[ITEMQUESIZE];
104 extern int itemrespawntime[ITEMQUESIZE];
109 void P_RespawnSpecials (void);
118 void P_RemoveMobj (mobj_t* th);
119 boolean P_SetMobjState (mobj_t* mobj, statenum_t state);
120 void P_MobjThinker (void *mobj, void*);
122 void P_SpawnPuff (fixed_t x, fixed_t y, fixed_t z);
123 void P_SpawnBlood (fixed_t x, fixed_t y, fixed_t z, int damage);
124 mobj_t* P_SpawnMissile (mobj_t* source, mobj_t* dest, mobjtype_t type);
125 void P_SpawnPlayerMissile (mobj_t* source, mobjtype_t type);
131 void P_NoiseAlert (mobj_t* target, mobj_t* emmiter);
148 fixed_t frac; // along trace line
156 #define MAXINTERCEPTS 128
158 extern intercept_t intercepts[MAXINTERCEPTS];
159 extern intercept_t* intercept_p;
161 typedef boolean (*traverser_t) (intercept_t *in);
163 fixed_t P_AproxDistance (fixed_t dx, fixed_t dy);
164 int P_PointOnLineSide (fixed_t x, fixed_t y, line_t* line);
165 int P_PointOnDivlineSide (fixed_t x, fixed_t y, divline_t* line);
166 void P_MakeDivline (line_t* li, divline_t* dl);
167 fixed_t P_InterceptVector (divline_t* v2, divline_t* v1);
168 int P_BoxOnLineSide (fixed_t* tmbox, line_t* ld);
170 extern fixed_t opentop;
171 extern fixed_t openbottom;
172 extern fixed_t openrange;
173 extern fixed_t lowfloor;
175 void P_LineOpening (line_t* linedef);
177 boolean P_BlockLinesIterator (int x, int y, boolean(*func)(line_t*) );
178 boolean P_BlockThingsIterator (int x, int y, boolean(*func)(mobj_t*) );
180 #define PT_ADDLINES 1
181 #define PT_ADDTHINGS 2
182 #define PT_EARLYOUT 4
184 extern divline_t trace;
193 boolean (*trav) (intercept_t *));
195 void P_UnsetThingPosition (mobj_t* thing);
196 void P_SetThingPosition (mobj_t* thing);
203 // If "floatok" true, move would be ok
204 // if within "tmfloorz - tmceilingz".
205 extern boolean floatok;
206 extern fixed_t tmfloorz;
207 extern fixed_t tmceilingz;
210 extern line_t* ceilingline;
212 boolean P_CheckPosition (mobj_t *thing, fixed_t x, fixed_t y);
213 boolean P_TryMove (mobj_t* thing, fixed_t x, fixed_t y);
214 boolean P_TeleportMove (mobj_t* thing, fixed_t x, fixed_t y);
215 void P_SlideMove (mobj_t* mo);
216 boolean P_CheckSight (mobj_t* t1, mobj_t* t2);
217 void P_UseLines (player_t* player);
219 boolean P_ChangeSector (sector_t* sector, boolean crunch);
221 extern mobj_t* linetarget; // who got hit (or NULL)
248 extern byte* rejectmatrix; // for fast sight rejection
249 extern short* blockmaplump; // offsets in blockmap are from here
250 extern short* blockmap;
251 extern int bmapwidth;
252 extern int bmapheight; // in mapblocks
253 extern fixed_t bmaporgx;
254 extern fixed_t bmaporgy; // origin of block map
255 extern mobj_t** blocklinks; // for thing chains
262 extern int maxammo[NUMAMMO];
263 extern int clipammo[NUMAMMO];
284 #endif // __P_LOCAL__
285 //-----------------------------------------------------------------------------
289 //-----------------------------------------------------------------------------