Add key bindings for pause, message refresh.
[chocolate-doom.git] / src / p_local.h
blob5ffefa3ae253386da09d5f3bc80ef02320f69a53
1 // Emacs style mode select -*- C++ -*-
2 //-----------------------------------------------------------------------------
3 //
4 // Copyright(C) 1993-1996 Id Software, Inc.
5 // Copyright(C) 2005 Simon Howard
6 //
7 // This program is free software; you can redistribute it and/or
8 // modify it under the terms of the GNU General Public License
9 // as published by the Free Software Foundation; either version 2
10 // of the License, or (at your option) any later version.
12 // This program is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
17 // You should have received a copy of the GNU General Public License
18 // along with this program; if not, write to the Free Software
19 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
20 // 02111-1307, USA.
22 // DESCRIPTION:
23 // Play functions, animation, global header.
25 //-----------------------------------------------------------------------------
28 #ifndef __P_LOCAL__
29 #define __P_LOCAL__
31 #ifndef __R_LOCAL__
32 #include "r_local.h"
33 #endif
35 #define FLOATSPEED (FRACUNIT*4)
38 #define MAXHEALTH 100
39 #define VIEWHEIGHT (41*FRACUNIT)
41 // mapblocks are used to check movement
42 // against lines and things
43 #define MAPBLOCKUNITS 128
44 #define MAPBLOCKSIZE (MAPBLOCKUNITS*FRACUNIT)
45 #define MAPBLOCKSHIFT (FRACBITS+7)
46 #define MAPBMASK (MAPBLOCKSIZE-1)
47 #define MAPBTOFRAC (MAPBLOCKSHIFT-FRACBITS)
50 // player radius for movement checking
51 #define PLAYERRADIUS 16*FRACUNIT
53 // MAXRADIUS is for precalculated sector block boxes
54 // the spider demon is larger,
55 // but we do not have any moving sectors nearby
56 #define MAXRADIUS 32*FRACUNIT
58 #define GRAVITY FRACUNIT
59 #define MAXMOVE (30*FRACUNIT)
61 #define USERANGE (64*FRACUNIT)
62 #define MELEERANGE (64*FRACUNIT)
63 #define MISSILERANGE (32*64*FRACUNIT)
65 // follow a player exlusively for 3 seconds
66 #define BASETHRESHOLD 100
71 // P_TICK
74 // both the head and tail of the thinker list
75 extern thinker_t thinkercap;
78 void P_InitThinkers (void);
79 void P_AddThinker (thinker_t* thinker);
80 void P_RemoveThinker (thinker_t* thinker);
84 // P_PSPR
86 void P_SetupPsprites (player_t* curplayer);
87 void P_MovePsprites (player_t* curplayer);
88 void P_DropWeapon (player_t* player);
92 // P_USER
94 void P_PlayerThink (player_t* player);
98 // P_MOBJ
100 #define ONFLOORZ INT_MIN
101 #define ONCEILINGZ INT_MAX
103 // Time interval for item respawning.
104 #define ITEMQUESIZE 128
106 extern mapthing_t itemrespawnque[ITEMQUESIZE];
107 extern int itemrespawntime[ITEMQUESIZE];
108 extern int iquehead;
109 extern int iquetail;
112 void P_RespawnSpecials (void);
114 mobj_t*
115 P_SpawnMobj
116 ( fixed_t x,
117 fixed_t y,
118 fixed_t z,
119 mobjtype_t type );
121 void P_RemoveMobj (mobj_t* th);
122 mobj_t* P_SubstNullMobj (mobj_t* th);
123 boolean P_SetMobjState (mobj_t* mobj, statenum_t state);
124 void P_MobjThinker (mobj_t* mobj);
126 void P_SpawnPuff (fixed_t x, fixed_t y, fixed_t z);
127 void P_SpawnBlood (fixed_t x, fixed_t y, fixed_t z, int damage);
128 mobj_t* P_SpawnMissile (mobj_t* source, mobj_t* dest, mobjtype_t type);
129 void P_SpawnPlayerMissile (mobj_t* source, mobjtype_t type);
133 // P_ENEMY
135 void P_NoiseAlert (mobj_t* target, mobj_t* emmiter);
139 // P_MAPUTL
141 typedef struct
143 fixed_t x;
144 fixed_t y;
145 fixed_t dx;
146 fixed_t dy;
148 } divline_t;
150 typedef struct
152 fixed_t frac; // along trace line
153 boolean isaline;
154 union {
155 mobj_t* thing;
156 line_t* line;
157 } d;
158 } intercept_t;
160 // Extended MAXINTERCEPTS, to allow for intercepts overrun emulation.
162 #define MAXINTERCEPTS_ORIGINAL 128
163 #define MAXINTERCEPTS (MAXINTERCEPTS_ORIGINAL + 61)
165 extern intercept_t intercepts[MAXINTERCEPTS];
166 extern intercept_t* intercept_p;
168 typedef boolean (*traverser_t) (intercept_t *in);
170 fixed_t P_AproxDistance (fixed_t dx, fixed_t dy);
171 int P_PointOnLineSide (fixed_t x, fixed_t y, line_t* line);
172 int P_PointOnDivlineSide (fixed_t x, fixed_t y, divline_t* line);
173 void P_MakeDivline (line_t* li, divline_t* dl);
174 fixed_t P_InterceptVector (divline_t* v2, divline_t* v1);
175 int P_BoxOnLineSide (fixed_t* tmbox, line_t* ld);
177 extern fixed_t opentop;
178 extern fixed_t openbottom;
179 extern fixed_t openrange;
180 extern fixed_t lowfloor;
182 void P_LineOpening (line_t* linedef);
184 boolean P_BlockLinesIterator (int x, int y, boolean(*func)(line_t*) );
185 boolean P_BlockThingsIterator (int x, int y, boolean(*func)(mobj_t*) );
187 #define PT_ADDLINES 1
188 #define PT_ADDTHINGS 2
189 #define PT_EARLYOUT 4
191 extern divline_t trace;
193 boolean
194 P_PathTraverse
195 ( fixed_t x1,
196 fixed_t y1,
197 fixed_t x2,
198 fixed_t y2,
199 int flags,
200 boolean (*trav) (intercept_t *));
202 void P_UnsetThingPosition (mobj_t* thing);
203 void P_SetThingPosition (mobj_t* thing);
207 // P_MAP
210 // If "floatok" true, move would be ok
211 // if within "tmfloorz - tmceilingz".
212 extern boolean floatok;
213 extern fixed_t tmfloorz;
214 extern fixed_t tmceilingz;
217 extern line_t* ceilingline;
219 boolean P_CheckPosition (mobj_t *thing, fixed_t x, fixed_t y);
220 boolean P_TryMove (mobj_t* thing, fixed_t x, fixed_t y);
221 boolean P_TeleportMove (mobj_t* thing, fixed_t x, fixed_t y);
222 void P_SlideMove (mobj_t* mo);
223 boolean P_CheckSight (mobj_t* t1, mobj_t* t2);
224 void P_UseLines (player_t* player);
226 boolean P_ChangeSector (sector_t* sector, boolean crunch);
228 extern mobj_t* linetarget; // who got hit (or NULL)
230 fixed_t
231 P_AimLineAttack
232 ( mobj_t* t1,
233 angle_t angle,
234 fixed_t distance );
236 void
237 P_LineAttack
238 ( mobj_t* t1,
239 angle_t angle,
240 fixed_t distance,
241 fixed_t slope,
242 int damage );
244 void
245 P_RadiusAttack
246 ( mobj_t* spot,
247 mobj_t* source,
248 int damage );
253 // P_SETUP
255 extern byte* rejectmatrix; // for fast sight rejection
256 extern short* blockmaplump; // offsets in blockmap are from here
257 extern short* blockmap;
258 extern int bmapwidth;
259 extern int bmapheight; // in mapblocks
260 extern fixed_t bmaporgx;
261 extern fixed_t bmaporgy; // origin of block map
262 extern mobj_t** blocklinks; // for thing chains
267 // P_INTER
269 extern int maxammo[NUMAMMO];
270 extern int clipammo[NUMAMMO];
272 void
273 P_TouchSpecialThing
274 ( mobj_t* special,
275 mobj_t* toucher );
277 void
278 P_DamageMobj
279 ( mobj_t* target,
280 mobj_t* inflictor,
281 mobj_t* source,
282 int damage );
286 // P_SPEC
288 #include "p_spec.h"
291 #endif // __P_LOCAL__