|
|
1.1.1.4 root 1: // Emacs style mode select -*- C++ -*-
2: //-----------------------------------------------------------------------------
3: //
4: // $Id:$
5: //
6: // Copyright (C) 1993-1996 by id Software, Inc.
7: //
1.1.1.5 ! root 8: // This program is free software; you can redistribute it and/or
! 9: // modify it under the terms of the GNU General Public License
! 10: // as published by the Free Software Foundation; either version 2
! 11: // of the License, or (at your option) any later version.
1.1.1.4 root 12: //
1.1.1.5 ! root 13: // This program is distributed in the hope that it will be useful,
1.1.1.4 root 14: // but WITHOUT ANY WARRANTY; without even the implied warranty of
1.1.1.5 ! root 15: // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! 16: // GNU General Public License for more details.
1.1.1.4 root 17: //
18: // DESCRIPTION:
19: // Play functions, animation, global header.
20: //
21: //-----------------------------------------------------------------------------
1.1.1.2 root 22:
1.1 root 23:
24: #ifndef __P_LOCAL__
25: #define __P_LOCAL__
26:
27: #ifndef __R_LOCAL__
1.1.1.3 root 28: #include "r_local.h"
1.1 root 29: #endif
30:
1.1.1.4 root 31: #define FLOATSPEED (FRACUNIT*4)
32:
33:
34: #define MAXHEALTH 100
35: #define VIEWHEIGHT (41*FRACUNIT)
36:
37: // mapblocks are used to check movement
38: // against lines and things
39: #define MAPBLOCKUNITS 128
40: #define MAPBLOCKSIZE (MAPBLOCKUNITS*FRACUNIT)
41: #define MAPBLOCKSHIFT (FRACBITS+7)
42: #define MAPBMASK (MAPBLOCKSIZE-1)
43: #define MAPBTOFRAC (MAPBLOCKSHIFT-FRACBITS)
44:
1.1 root 45:
1.1.1.2 root 46: // player radius for movement checking
1.1.1.4 root 47: #define PLAYERRADIUS 16*FRACUNIT
1.1 root 48:
1.1.1.2 root 49: // MAXRADIUS is for precalculated sector block boxes
1.1.1.4 root 50: // the spider demon is larger,
51: // but we do not have any moving sectors nearby
52: #define MAXRADIUS 32*FRACUNIT
1.1 root 53:
1.1.1.4 root 54: #define GRAVITY FRACUNIT
55: #define MAXMOVE (30*FRACUNIT)
1.1.1.2 root 56:
1.1.1.4 root 57: #define USERANGE (64*FRACUNIT)
58: #define MELEERANGE (64*FRACUNIT)
59: #define MISSILERANGE (32*64*FRACUNIT)
60:
61: // follow a player exlusively for 3 seconds
62: #define BASETHRESHOLD 100
63:
64:
65:
66: //
67: // P_TICK
68: //
69:
70: // both the head and tail of the thinker list
71: extern thinker_t thinkercap;
72:
73:
74: void P_InitThinkers (void);
75: void P_AddThinker (thinker_t* thinker);
76: void P_RemoveThinker (thinker_t* thinker);
77:
78:
79: //
80: // P_PSPR
81: //
82: void P_SetupPsprites (player_t* curplayer);
83: void P_MovePsprites (player_t* curplayer);
84: void P_DropWeapon (player_t* player);
85:
86:
87: //
88: // P_USER
89: //
90: void P_PlayerThink (player_t* player);
91:
92:
93: //
94: // P_MOBJ
95: //
96: #define ONFLOORZ MININT
97: #define ONCEILINGZ MAXINT
98:
99: // Time interval for item respawning.
100: #define ITEMQUESIZE 128
101:
102: extern mapthing_t itemrespawnque[ITEMQUESIZE];
103: extern int itemrespawntime[ITEMQUESIZE];
104: extern int iquehead;
105: extern int iquetail;
1.1.1.2 root 106:
1.1.1.3 root 107:
1.1.1.4 root 108: void P_RespawnSpecials (void);
1.1 root 109:
1.1.1.4 root 110: mobj_t*
111: P_SpawnMobj
112: ( fixed_t x,
113: fixed_t y,
114: fixed_t z,
115: mobjtype_t type );
1.1 root 116:
1.1.1.4 root 117: void P_RemoveMobj (mobj_t* th);
118: boolean P_SetMobjState (mobj_t* mobj, statenum_t state);
119: void P_MobjThinker (mobj_t* mobj);
120:
121: void P_SpawnPuff (fixed_t x, fixed_t y, fixed_t z);
122: void P_SpawnBlood (fixed_t x, fixed_t y, fixed_t z, int damage);
123: mobj_t* P_SpawnMissile (mobj_t* source, mobj_t* dest, mobjtype_t type);
124: void P_SpawnPlayerMissile (mobj_t* source, mobjtype_t type);
125:
126:
127: //
128: // P_ENEMY
129: //
130: void P_NoiseAlert (mobj_t* target, mobj_t* emmiter);
131:
132:
133: //
134: // P_MAPUTL
135: //
1.1 root 136: typedef struct
137: {
1.1.1.4 root 138: fixed_t x;
139: fixed_t y;
140: fixed_t dx;
141: fixed_t dy;
142:
1.1 root 143: } divline_t;
144:
1.1.1.2 root 145: typedef struct
146: {
1.1.1.4 root 147: fixed_t frac; // along trace line
148: boolean isaline;
149: union {
150: mobj_t* thing;
151: line_t* line;
152: } d;
1.1.1.2 root 153: } intercept_t;
154:
1.1.1.4 root 155: #define MAXINTERCEPTS 128
156:
157: extern intercept_t intercepts[MAXINTERCEPTS];
158: extern intercept_t* intercept_p;
1.1.1.2 root 159:
1.1.1.4 root 160: typedef boolean (*traverser_t) (intercept_t *in);
1.1 root 161:
162: fixed_t P_AproxDistance (fixed_t dx, fixed_t dy);
1.1.1.4 root 163: int P_PointOnLineSide (fixed_t x, fixed_t y, line_t* line);
164: int P_PointOnDivlineSide (fixed_t x, fixed_t y, divline_t* line);
165: void P_MakeDivline (line_t* li, divline_t* dl);
166: fixed_t P_InterceptVector (divline_t* v2, divline_t* v1);
167: int P_BoxOnLineSide (fixed_t* tmbox, line_t* ld);
168:
169: extern fixed_t opentop;
170: extern fixed_t openbottom;
171: extern fixed_t openrange;
172: extern fixed_t lowfloor;
173:
174: void P_LineOpening (line_t* linedef);
1.1 root 175:
176: boolean P_BlockLinesIterator (int x, int y, boolean(*func)(line_t*) );
177: boolean P_BlockThingsIterator (int x, int y, boolean(*func)(mobj_t*) );
178:
1.1.1.4 root 179: #define PT_ADDLINES 1
180: #define PT_ADDTHINGS 2
181: #define PT_EARLYOUT 4
182:
183: extern divline_t trace;
184:
185: boolean
186: P_PathTraverse
187: ( fixed_t x1,
188: fixed_t y1,
189: fixed_t x2,
190: fixed_t y2,
191: int flags,
192: boolean (*trav) (intercept_t *));
193:
194: void P_UnsetThingPosition (mobj_t* thing);
195: void P_SetThingPosition (mobj_t* thing);
196:
197:
198: //
199: // P_MAP
200: //
201:
202: // If "floatok" true, move would be ok
203: // if within "tmfloorz - tmceilingz".
204: extern boolean floatok;
205: extern fixed_t tmfloorz;
206: extern fixed_t tmceilingz;
207:
208:
209: extern line_t* ceilingline;
210:
211: boolean P_CheckPosition (mobj_t *thing, fixed_t x, fixed_t y);
212: boolean P_TryMove (mobj_t* thing, fixed_t x, fixed_t y);
213: boolean P_TeleportMove (mobj_t* thing, fixed_t x, fixed_t y);
214: void P_SlideMove (mobj_t* mo);
215: boolean P_CheckSight (mobj_t* t1, mobj_t* t2);
216: void P_UseLines (player_t* player);
217:
218: boolean P_ChangeSector (sector_t* sector, boolean crunch);
219:
220: extern mobj_t* linetarget; // who got hit (or NULL)
221:
222: fixed_t
223: P_AimLineAttack
224: ( mobj_t* t1,
225: angle_t angle,
226: fixed_t distance );
227:
228: void
229: P_LineAttack
230: ( mobj_t* t1,
231: angle_t angle,
232: fixed_t distance,
233: fixed_t slope,
234: int damage );
235:
236: void
237: P_RadiusAttack
238: ( mobj_t* spot,
239: mobj_t* source,
240: int damage );
241:
242:
243:
244: //
245: // P_SETUP
246: //
247: extern byte* rejectmatrix; // for fast sight rejection
248: extern short* blockmaplump; // offsets in blockmap are from here
249: extern short* blockmap;
250: extern int bmapwidth;
251: extern int bmapheight; // in mapblocks
252: extern fixed_t bmaporgx;
253: extern fixed_t bmaporgy; // origin of block map
254: extern mobj_t** blocklinks; // for thing chains
255:
256:
257:
258: //
259: // P_INTER
260: //
261: extern int maxammo[NUMAMMO];
262: extern int clipammo[NUMAMMO];
263:
264: void
265: P_TouchSpecialThing
266: ( mobj_t* special,
267: mobj_t* toucher );
268:
269: void
270: P_DamageMobj
271: ( mobj_t* target,
272: mobj_t* inflictor,
273: mobj_t* source,
274: int damage );
275:
276:
277: //
278: // P_SPEC
279: //
280: #include "p_spec.h"
1.1.1.3 root 281:
282:
1.1.1.4 root 283: #endif // __P_LOCAL__
284: //-----------------------------------------------------------------------------
285: //
286: // $Log:$
287: //
288: //-----------------------------------------------------------------------------
1.1 root 289:
290:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.