-
-
Notifications
You must be signed in to change notification settings - Fork 31
/
p_local.h
345 lines (273 loc) · 9.27 KB
/
p_local.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id$
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// DESCRIPTION:
// Play functions, animation, global header.
//
//-----------------------------------------------------------------------------
#ifndef __P_LOCAL__
#define __P_LOCAL__
#ifndef __R_LOCAL__
#include "r_local.h"
#endif
#include "p_start.h"
#include "p_actor.h"
#include "p_xg.h"
// Palette indices.
// For damage/bonus red-/gold-shifts
#define STARTREDPALS 1
#define STARTBONUSPALS 9
#define NUMREDPALS 8
#define NUMBONUSPALS 4
#define FLOATSPEED (FRACUNIT*4)
#define DELTAMUL 6.324555320 // Used when calculating ticcmd_t.lookdirdelta
#define bmapwidth (*gi.bmapwidth)
#define bmapheight (*gi.bmapheight)
#define bmaporgx (*gi.bmaporgx)
#define bmaporgy (*gi.bmaporgy)
#define MAXHEALTH maxhealth //100
#define VIEWHEIGHT (41*FRACUNIT)
// mapblocks are used to check movement
// against lines and things
#define MAPBLOCKUNITS 128
#define MAPBLOCKSIZE (MAPBLOCKUNITS*FRACUNIT)
#define MAPBLOCKSHIFT (FRACBITS+7)
#define MAPBMASK (MAPBLOCKSIZE-1)
#define MAPBTOFRAC (MAPBLOCKSHIFT-FRACBITS)
#define TOCENTER -8
// player radius for movement checking
#define PLAYERRADIUS 16*FRACUNIT
// MAXRADIUS is for precalculated sector block boxes
// the spider demon is larger,
// but we do not have any moving sectors nearby
#define MAXRADIUS 32*FRACUNIT
#define GRAVITY Get(DD_GRAVITY) //FRACUNIT
#define MAXMOVE (30*FRACUNIT)
#define USERANGE (64*FRACUNIT)
#define MELEERANGE (64*FRACUNIT)
#define MISSILERANGE (32*64*FRACUNIT)
// follow a player exlusively for 3 seconds
#define BASETHRESHOLD 100
#define MAXSPECIALCROSS 64
// GMJ 02/02/02
#define sentient(mobj) ((mobj)->health > 0 && (mobj)->info->seestate)
//
// P_TICK
//
// both the head and tail of the thinker list
//extern thinker_t thinkercap;
/*void P_InitThinkers (void);
void P_AddThinker (thinker_t* thinker);
void P_RemoveThinker (thinker_t* thinker); */
#define thinkercap (*gi.thinkercap)
/*#define P_InitThinkers gi.InitThinkers
#define P_AddThinker gi.AddThinker
#define P_RemoveThinker gi.RemoveThinker
#define P_RunThinkers gi.RunThinkers */
//
// P_PSPR
//
void P_SetupPsprites(player_t * curplayer);
void P_MovePsprites(player_t * curplayer);
void P_DropWeapon(player_t * player);
void P_SetPsprite(player_t * player, int position,
statenum_t stnum);
//
// P_USER
//
void P_PlayerThink(player_t * player);
void P_SetMessage(player_t * pl, char *msg);
extern int maxhealth, healthlimit;
extern int armorpoints[2]; // Green and blue points.
//
// P_MOBJ
//
#define ONFLOORZ MININT
#define ONCEILINGZ MAXINT
// Time interval for item respawning.
#define ITEMQUESIZE 128
extern mapthing_t itemrespawnque[ITEMQUESIZE];
extern int itemrespawntime[ITEMQUESIZE];
extern int iquehead;
extern int iquetail;
void P_RespawnSpecials(void);
mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type);
void P_RemoveMobj(mobj_t *th);
boolean P_SetMobjState(mobj_t *mobj, statenum_t state);
void P_MobjThinker(mobj_t *mobj);
void P_SpawnPuff(fixed_t x, fixed_t y, fixed_t z);
mobj_t *P_SpawnCustomPuff(fixed_t x, fixed_t y, fixed_t z,
mobjtype_t type);
void P_SpawnBlood(fixed_t x, fixed_t y, fixed_t z, int damage);
mobj_t *P_SpawnMissile(mobj_t *source, mobj_t *dest, mobjtype_t type);
void P_SpawnPlayerMissile(mobj_t *source, mobjtype_t type);
void P_SpawnPlayer(mapthing_t * mthing, int pnum);
mobj_t *P_SpawnTeleFog(int x, int y);
void P_SetDoomsdayFlags(mobj_t *mo);
//
// P_ENEMY
//
void P_NoiseAlert(mobj_t *target, mobj_t *emmiter);
extern mobj_t *braintargets[64];
extern int numbraintargets;
extern int braintargeton;
//
// P_MAPUTL
//
/*typedef struct
{
fixed_t x;
fixed_t y;
fixed_t dx;
fixed_t dy;
} divline_t;
typedef struct
{
fixed_t frac; // along trace line
boolean isaline;
union {
mobj_t* thing;
line_t* line;
} d;
} intercept_t; */
/*#define MAXINTERCEPTS 128
extern intercept_t intercepts[MAXINTERCEPTS];
extern intercept_t* intercept_p;
typedef boolean (*traverser_t) (intercept_t *in); */
/*fixed_t P_AproxDistance (fixed_t dx, fixed_t dy);
int P_PointOnLineSide (fixed_t x, fixed_t y, line_t* line);
int P_PointOnDivlineSide (fixed_t x, fixed_t y, divline_t* line);
void P_MakeDivline (line_t* li, divline_t* dl);
fixed_t P_InterceptVector (divline_t* v2, divline_t* v1);
int P_BoxOnLineSide (fixed_t* tmbox, line_t* ld);
extern fixed_t opentop;
extern fixed_t openbottom;
extern fixed_t openrange;
extern fixed_t lowfloor;
void P_LineOpening (line_t* linedef);
boolean P_BlockLinesIterator (int x, int y, boolean(*func)(line_t*) );
boolean P_BlockThingsIterator (int x, int y, boolean(*func)(mobj_t*) );
#define PT_ADDLINES 1
#define PT_ADDTHINGS 2
#define PT_EARLYOUT 4
extern divline_t trace;
boolean
P_PathTraverse
( fixed_t x1,
fixed_t y1,
fixed_t x2,
fixed_t y2,
int flags,
boolean (*trav) (intercept_t *));
*/
/*#define P_AproxDistance gi.ApproxDistance
#define P_PointOnLineSide gi.PointOnLineSide
#define P_BoxOnLineSide gi.BoxOnLineSide */
#define openrange Get(DD_OPENRANGE)
#define opentop Get(DD_OPENTOP)
#define openbottom Get(DD_OPENBOTTOM)
#define lowfloor Get(DD_LOWFLOOR)
//#define P_LineOpening gi.LineOpening
/*#define P_BlockLinesIterator gi.BlockLinesIterator
#define P_BlockThingsIterator gi.BlockThingsIterator
#define P_PathTraverse gi.PathTraverse */
void P_UnsetThingPosition(mobj_t *thing);
void P_SetThingPosition(mobj_t *thing);
int P_Massacre(void);
//
// P_MAP
//
// If "floatok" true, move would be ok
// if within "tmfloorz - tmceilingz".
extern boolean floatok;
extern fixed_t tmfloorz;
extern fixed_t tmceilingz;
extern line_t *ceilingline;
boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y);
boolean P_CheckPosition2(mobj_t *thing, fixed_t x, fixed_t y,
fixed_t z);
boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y,
boolean dropoff);
boolean P_TeleportMove(mobj_t *thing, fixed_t x, fixed_t y);
void P_SlideMove(mobj_t *mo);
//boolean P_CheckSight (mobj_t* t1, mobj_t* t2);
void P_UseLines(player_t * player);
//#define P_CheckSight gi.CheckSight
boolean P_ChangeSector(sector_t *sector, boolean crunch);
extern mobj_t *linetarget; // who got hit (or NULL)
fixed_t P_AimLineAttack(mobj_t *t1, angle_t angle, fixed_t distance);
void P_LineAttack(mobj_t *t1, angle_t angle, fixed_t distance,
fixed_t slope, int damage);
void P_RadiusAttack(mobj_t *spot, mobj_t *source, int damage);
//
// P_SETUP
//
/*extern byte* rejectmatrix; // for fast sight rejection
extern short* blockmaplump; // offsets in blockmap are from here
extern short* blockmap;
extern int bmapwidth;
extern int bmapheight; // in mapblocks
extern fixed_t bmaporgx;
extern fixed_t bmaporgy; // origin of block map
extern mobj_t** blocklinks; // for thing chains */
//
// P_INTER
//
extern int maxammo[NUMAMMO];
extern int clipammo[NUMAMMO];
void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher);
void P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source,
int damage);
void P_DamageMobj2(mobj_t *target, mobj_t *inflictor, mobj_t *source,
int damage, boolean stomping);
void P_ExplodeMissile(mobj_t *mo);
//
// P_SPEC
//
#include "p_spec.h"
#endif // __P_LOCAL__
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.7 2004/06/16 18:21:34 skyjake
// Added a separate killmsg for telestomp
//
// Revision 1.6 2004/05/30 08:42:35 skyjake
// Tweaked indentation style
//
// Revision 1.5 2004/05/29 09:53:11 skyjake
// Consistent style (using GNU Indent)
//
// Revision 1.4 2004/05/28 17:16:35 skyjake
// Resolved conflicts (branch-1-7 overrides)
//
// Revision 1.2.2.1 2004/05/16 10:01:30 skyjake
// Merged good stuff from branch-nix for the final 1.7.15
//
// Revision 1.2.4.1 2003/11/19 17:08:47 skyjake
// Modified to compile with gcc and -DUNIX
//
// Revision 1.2 2003/04/29 13:10:56 skyjake
// Missile puff ptcgen issue fixed
//
// Revision 1.1 2003/02/26 19:18:32 skyjake
// Initial checkin
//
// Revision 1.1 2002/09/29 01:04:13 Jaakko
// Added all headers
//
//
//-----------------------------------------------------------------------------