doom

a minimalistic implementation of doom
git clone git://ssnf.xyz/doom
Log | Files | Refs

p_local.h (4310B)


      1 #ifndef __P_LOCAL__
      2 #define __P_LOCAL__
      3 
      4 #ifndef __R_LOCAL__
      5 #include "r_local.h"
      6 #endif
      7 
      8 
      9 #define FLOATSPEED		(FRACUNIT*4)
     10 
     11 
     12 #define MAXHEALTH		100
     13 #define VIEWHEIGHT		(41*FRACUNIT)
     14 
     15 
     16 
     17 #define MAPBLOCKUNITS	128
     18 #define MAPBLOCKSIZE	(MAPBLOCKUNITS*FRACUNIT)
     19 #define MAPBLOCKSHIFT	(FRACBITS+7)
     20 #define MAPBMASK		(MAPBLOCKSIZE-1)
     21 #define MAPBTOFRAC		(MAPBLOCKSHIFT-FRACBITS)
     22 
     23 
     24 
     25 #define PLAYERRADIUS	16*FRACUNIT
     26 
     27 
     28 
     29 
     30 #define MAXRADIUS		32*FRACUNIT
     31 
     32 #define GRAVITY		FRACUNIT
     33 #define MAXMOVE		(30*FRACUNIT)
     34 
     35 #define USERANGE		(64*FRACUNIT)
     36 #define MELEERANGE		(64*FRACUNIT)
     37 #define MISSILERANGE	(32*64*FRACUNIT)
     38 
     39 
     40 #define	BASETHRESHOLD	 	100
     41 
     42 
     43 
     44 
     45 
     46 
     47 
     48 
     49 extern	thinker_t	thinkercap;	
     50 
     51 
     52 void P_InitThinkers (void);
     53 void P_AddThinker (thinker_t* thinker);
     54 void P_RemoveThinker (thinker_t* thinker);
     55 
     56 
     57 
     58 
     59 
     60 void P_SetupPsprites (player_t* curplayer);
     61 void P_MovePsprites (player_t* curplayer);
     62 void P_DropWeapon (player_t* player);
     63 
     64 
     65 
     66 
     67 
     68 void	P_PlayerThink (player_t* player);
     69 
     70 
     71 
     72 
     73 
     74 #define ONFLOORZ		INT_MIN
     75 #define ONCEILINGZ		INT_MAX
     76 
     77 
     78 #define ITEMQUESIZE		128
     79 
     80 extern mapthing_t	itemrespawnque[ITEMQUESIZE];
     81 extern int		itemrespawntime[ITEMQUESIZE];
     82 extern int		iquehead;
     83 extern int		iquetail;
     84 
     85 
     86 void P_RespawnSpecials (void);
     87 
     88 mobj_t*
     89 P_SpawnMobj
     90 ( fixed_t	x,
     91   fixed_t	y,
     92   fixed_t	z,
     93   mobjtype_t	type );
     94 
     95 void 	P_RemoveMobj (mobj_t* th);
     96 boolean	P_SetMobjState (mobj_t* mobj, statenum_t state);
     97 void 	P_MobjThinker (mobj_t* mobj);
     98 
     99 void	P_SpawnPuff (fixed_t x, fixed_t y, fixed_t z);
    100 void 	P_SpawnBlood (fixed_t x, fixed_t y, fixed_t z, int damage);
    101 mobj_t* P_SpawnMissile (mobj_t* source, mobj_t* dest, mobjtype_t type);
    102 void	P_SpawnPlayerMissile (mobj_t* source, mobjtype_t type);
    103 
    104 
    105 
    106 
    107 
    108 void P_NoiseAlert (mobj_t* target, mobj_t* emmiter);
    109 
    110 
    111 
    112 
    113 
    114 typedef struct
    115 {
    116     fixed_t	x;
    117     fixed_t	y;
    118     fixed_t	dx;
    119     fixed_t	dy;
    120     
    121 } divline_t;
    122 
    123 typedef struct
    124 {
    125     fixed_t	frac;		
    126     boolean	isaline;
    127     union {
    128 	mobj_t*	thing;
    129 	line_t*	line;
    130     }			d;
    131 } intercept_t;
    132 
    133 #define INT_MAXERCEPTS	128
    134 
    135 extern intercept_t	intercepts[INT_MAXERCEPTS];
    136 extern intercept_t*	intercept_p;
    137 
    138 typedef boolean (*traverser_t) (intercept_t *in);
    139 
    140 fixed_t P_AproxDistance (fixed_t dx, fixed_t dy);
    141 int 	P_PointOnLineSide (fixed_t x, fixed_t y, line_t* line);
    142 int 	P_PointOnDivlineSide (fixed_t x, fixed_t y, divline_t* line);
    143 void 	P_MakeDivline (line_t* li, divline_t* dl);
    144 fixed_t P_InterceptVector (divline_t* v2, divline_t* v1);
    145 int 	P_BoxOnLineSide (fixed_t* tmbox, line_t* ld);
    146 
    147 extern fixed_t		opentop;
    148 extern fixed_t 		openbottom;
    149 extern fixed_t		openrange;
    150 extern fixed_t		lowfloor;
    151 
    152 void 	P_LineOpening (line_t* linedef);
    153 
    154 boolean P_BlockLinesIterator (int x, int y, boolean(*func)(line_t*) );
    155 boolean P_BlockThingsIterator (int x, int y, boolean(*func)(mobj_t*) );
    156 
    157 #define PT_ADDLINES		1
    158 #define PT_ADDTHINGS	2
    159 #define PT_EARLYOUT		4
    160 
    161 extern divline_t	trace;
    162 
    163 boolean
    164 P_PathTraverse
    165 ( fixed_t	x1,
    166   fixed_t	y1,
    167   fixed_t	x2,
    168   fixed_t	y2,
    169   int		flags,
    170   boolean	(*trav) (intercept_t *));
    171 
    172 void P_UnsetThingPosition (mobj_t* thing);
    173 void P_SetThingPosition (mobj_t* thing);
    174 
    175 
    176 
    177 
    178 
    179 
    180 
    181 
    182 extern boolean		floatok;
    183 extern fixed_t		tmfloorz;
    184 extern fixed_t		tmceilingz;
    185 
    186 
    187 extern	line_t*		ceilingline;
    188 
    189 boolean P_CheckPosition (mobj_t *thing, fixed_t x, fixed_t y);
    190 boolean P_TryMove (mobj_t* thing, fixed_t x, fixed_t y);
    191 boolean P_TeleportMove (mobj_t* thing, fixed_t x, fixed_t y);
    192 void	P_SlideMove (mobj_t* mo);
    193 boolean P_CheckSight (mobj_t* t1, mobj_t* t2);
    194 void 	P_UseLines (player_t* player);
    195 
    196 boolean P_ChangeSector (sector_t* sector, boolean crunch);
    197 
    198 extern mobj_t*	linetarget;	
    199 
    200 fixed_t
    201 P_AimLineAttack
    202 ( mobj_t*	t1,
    203   angle_t	angle,
    204   fixed_t	distance );
    205 
    206 void
    207 P_LineAttack
    208 ( mobj_t*	t1,
    209   angle_t	angle,
    210   fixed_t	distance,
    211   fixed_t	slope,
    212   int		damage );
    213 
    214 void
    215 P_RadiusAttack
    216 ( mobj_t*	spot,
    217   mobj_t*	source,
    218   int		damage );
    219 
    220 
    221 
    222 
    223 
    224 
    225 extern byte*		rejectmatrix;	
    226 extern short*		blockmaplump;	
    227 extern short*		blockmap;
    228 extern int		bmapwidth;
    229 extern int		bmapheight;	
    230 extern fixed_t		bmaporgx;
    231 extern fixed_t		bmaporgy;	
    232 extern mobj_t**		blocklinks;	
    233 
    234 
    235 
    236 
    237 
    238 
    239 extern int		maxammo[NUMAMMO];
    240 extern int		clipammo[NUMAMMO];
    241 
    242 void
    243 P_TouchSpecialThing
    244 ( mobj_t*	special,
    245   mobj_t*	toucher );
    246 
    247 void
    248 P_DamageMobj
    249 ( mobj_t*	target,
    250   mobj_t*	inflictor,
    251   mobj_t*	source,
    252   int		damage );
    253 
    254 
    255 
    256 
    257 
    258 #include "p_spec.h"
    259 
    260 
    261 #endif	
    262 
    263 
    264 
    265 
    266 
    267 
    268