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