DOOM-3-BFG

DOOM 3 BFG Edition
Log | Files | Refs

p_local.h (6327B)


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