1 // Emacs style mode select -*- C++ -*-
2 //-----------------------------------------------------------------------------
4 // Copyright(C) 1993-1996 Id Software, Inc.
5 // Copyright(C) 2005 Simon Howard
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
23 // Play functions, animation, global header.
25 //-----------------------------------------------------------------------------
35 #define FLOATSPEED (FRACUNIT*4)
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
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
);
86 void P_SetupPsprites (player_t
* curplayer
);
87 void P_MovePsprites (player_t
* curplayer
);
88 void P_DropWeapon (player_t
* player
);
94 void P_PlayerThink (player_t
* player
);
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
];
112 void P_RespawnSpecials (void);
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
);
135 void P_NoiseAlert (mobj_t
* target
, mobj_t
* emmiter
);
152 fixed_t frac
; // along trace line
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
;
200 boolean (*trav
) (intercept_t
*));
202 void P_UnsetThingPosition (mobj_t
* thing
);
203 void P_SetThingPosition (mobj_t
* thing
);
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)
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
269 extern int maxammo
[NUMAMMO
];
270 extern int clipammo
[NUMAMMO
];
291 #endif // __P_LOCAL__