DOOM64-RE

DOOM 64 Reverse Engineering
Log | Files | Refs | README | LICENSE

p_local.h (8850B)


      1 /* P_local.h */
      2 
      3 #ifndef __P_LOCAL__
      4 #define __P_LOCAL__
      5 
      6 #ifndef __R_LOCAL__
      7 #include "r_local.h"
      8 #endif
      9 
     10 #define	FLOATSPEED		(FRACUNIT*4)
     11 
     12 #define	GRAVITY			(FRACUNIT*4)    //like JagDoom
     13 #define	MAXMOVE			(16*FRACUNIT)
     14 
     15 
     16 #define	MAXHEALTH			100
     17 #define	VIEWHEIGHT			(56*FRACUNIT) //  D64 change to 41
     18 
     19 /* mapblocks are used to check movement against lines and things */
     20 #define MAPBLOCKUNITS	128
     21 #define	MAPBLOCKSIZE	(MAPBLOCKUNITS*FRACUNIT)
     22 #define	MAPBLOCKSHIFT	(FRACBITS+7)
     23 #define	MAPBMASK		(MAPBLOCKSIZE-1)
     24 #define	MAPBTOFRAC		(MAPBLOCKSHIFT-FRACBITS)
     25 
     26 
     27 /* player radius for movement checking */
     28 #define	PLAYERRADIUS	16*FRACUNIT
     29 
     30 /* MAXRADIUS is for precalculated sector block boxes */
     31 /* the spider demon is larger, but we don't have any moving sectors */
     32 /* nearby */
     33 #define	MAXRADIUS		32*FRACUNIT
     34 
     35 
     36 #define	USERANGE		(70*FRACUNIT)
     37 #define	MELEERANGE		(80*FRACUNIT)
     38 #define	MISSILERANGE	(32*64*FRACUNIT)
     39 
     40 
     41 typedef enum
     42 {
     43 	DI_EAST,
     44 	DI_NORTHEAST,
     45 	DI_NORTH,
     46 	DI_NORTHWEST,
     47 	DI_WEST,
     48 	DI_SOUTHWEST,
     49 	DI_SOUTH,
     50 	DI_SOUTHEAST,
     51 	DI_NODIR,
     52 	NUMDIRS
     53 } dirtype_t;
     54 
     55 #define	BASETHRESHOLD	90		/* follow a player exlusively for 3 seconds */
     56 
     57 
     58 
     59 /*
     60 ===============================================================================
     61 
     62 							P_TICK
     63 
     64 ===============================================================================
     65 */
     66 
     67 extern	thinker_t	thinkercap;	/* both the head and tail of the thinker list */
     68 
     69 
     70 void P_InitThinkers (void);
     71 void P_AddThinker (thinker_t *thinker);
     72 void P_RemoveThinker (thinker_t *thinker);
     73 
     74 /*
     75 ===============================================================================
     76 
     77 							P_PSPR
     78 
     79 ===============================================================================
     80 */
     81 
     82 void P_SetupPsprites (int curplayer); //(player_t *curplayer);
     83 void P_MovePsprites (player_t *curplayer);
     84 
     85 void P_SetPsprite (player_t *player, int position, statenum_t stnum);
     86 void P_BringUpWeapon (player_t *player);
     87 void P_DropWeapon (player_t *player);
     88 
     89 /*
     90 ===============================================================================
     91 
     92 							P_USER
     93 
     94 ===============================================================================
     95 */
     96 
     97 void	P_PlayerThink (player_t *player);
     98 
     99 
    100 /*
    101 ===============================================================================
    102 
    103 							P_MOBJ
    104 
    105 ===============================================================================
    106 */
    107 
    108 extern	mobj_t	mobjhead;
    109 
    110 extern	int			activethinkers;	/* debug count */
    111 extern	int			activemobjs;	/* debug count */
    112 
    113 #define ONFLOORZ	MININT
    114 #define	ONCEILINGZ	MAXINT
    115 
    116 mobj_t *P_SpawnMobj (fixed_t x, fixed_t y, fixed_t z, mobjtype_t type);
    117 
    118 void 	P_RemoveMobj (mobj_t *th);
    119 boolean	P_SetMobjState (mobj_t *mobj, statenum_t state);
    120 void 	P_MobjThinker (mobj_t *mobj);
    121 
    122 void	P_SpawnPuff (fixed_t x, fixed_t y, fixed_t z);
    123 void 	P_SpawnBlood (fixed_t x, fixed_t y, fixed_t z, int damage);
    124 //mobj_t *P_SpawnMissile (mobj_t *source, mobj_t *dest, mobjtype_t type);
    125 mobj_t *P_SpawnMissile (mobj_t *source, mobj_t *dest, fixed_t xoffs, fixed_t yoffs, fixed_t heightoffs, mobjtype_t type);
    126 
    127 void	P_SpawnPlayerMissile (mobj_t *source, mobjtype_t type);
    128 
    129 void	P_RunMobjBase (void);//P_RunMobjBase2 (void);
    130 void	P_RunMobjExtra (void);
    131 
    132 void L_SkullBash (mobj_t *mo);
    133 void L_MissileHit (mobj_t *mo);
    134 void L_CrossSpecial (mobj_t *mo);
    135 
    136 void P_ExplodeMissile (mobj_t *mo);
    137 
    138 /*
    139 ===============================================================================
    140 
    141 							P_ENEMY
    142 
    143 ===============================================================================
    144 */
    145 
    146 void A_MissileExplode (mobj_t *mo);
    147 void A_SkullBash (mobj_t *mo);
    148 
    149 /*
    150 ===============================================================================
    151 
    152 							P_MAPUTL
    153 
    154 ===============================================================================
    155 */
    156 
    157 /*typedef struct
    158 {
    159 	fixed_t	x,y, dx, dy;
    160 } divline_t;*/
    161 
    162 typedef struct
    163 {
    164 	fixed_t     frac;
    165     boolean     isaline;
    166     union {
    167 		line_t  *line;
    168 		mobj_t  *thing;
    169 	} d;//8
    170 } intercept_t;
    171 
    172 typedef boolean(*traverser_t)(intercept_t *in);
    173 
    174 
    175 fixed_t P_AproxDistance (fixed_t dx, fixed_t dy);
    176 int 	P_PointOnLineSide (fixed_t x, fixed_t y, line_t *line);
    177 int 	P_PointOnDivlineSide (fixed_t x, fixed_t y, divline_t *line);
    178 void 	P_MakeDivline (line_t *li, divline_t *dl);
    179 fixed_t P_InterceptVector (divline_t *v2, divline_t *v1);
    180 int 	P_BoxOnLineSide (fixed_t *tmbox, line_t *ld);
    181 boolean P_CheckUseHeight(line_t *line);
    182 
    183 extern	fixed_t opentop, openbottom, openrange;//,,800A5748
    184 extern	fixed_t	lowfloor;
    185 void 	P_LineOpening (line_t *linedef);
    186 
    187 boolean P_BlockLinesIterator (int x, int y, boolean(*func)(line_t*) );
    188 boolean P_BlockThingsIterator (int x, int y, boolean(*func)(mobj_t*) );
    189 
    190 extern	divline_t 	trace;  // 800A5D58
    191 
    192 #define PT_ADDLINES         1
    193 #define PT_ADDTHINGS        2
    194 #define PT_EARLYOUT         4
    195 
    196 #define MAXINTERCEPTS       128
    197 
    198 boolean P_PathTraverse(fixed_t x1, fixed_t y1, fixed_t x2, fixed_t y2, int flags, boolean(*trav)(intercept_t *));
    199 boolean PIT_AddLineIntercepts(line_t* ld); // 80018574
    200 boolean PIT_AddThingIntercepts(mobj_t* thing); // 8001860C
    201 fixed_t P_InterceptLine(line_t *line, divline_t *trace); // 8001872C
    202 boolean P_TraverseIntercepts(traverser_t func, fixed_t maxfrac);
    203 
    204 /*
    205 ===============================================================================
    206 
    207 							P_MAP
    208 
    209 ===============================================================================
    210 */
    211 
    212 extern	boolean		floatok;				/* if true, move would be ok if */  //80077ea8
    213 extern	fixed_t		tmfloorz, tmceilingz;	/* within tmfloorz - tmceilingz */  //80078010, 80077d30
    214 
    215 extern	line_t	*specialline;//80077dc8
    216 extern	mobj_t	*movething;
    217 
    218 
    219 boolean P_CheckPosition (mobj_t *thing, fixed_t x, fixed_t y);
    220 boolean P_TryMove (mobj_t *thing, fixed_t x, fixed_t y);
    221 boolean P_CheckSight (mobj_t *t1, mobj_t *t2);
    222 void 	P_UseLines (player_t *player);
    223 
    224 boolean P_ChangeSector (sector_t *sector, boolean crunch);
    225 
    226 extern	mobj_t		*linetarget;			/* who got hit (or NULL) */
    227 fixed_t P_AimLineAttack (mobj_t *t1, angle_t angle, fixed_t zheight, fixed_t distance);
    228 
    229 void P_LineAttack (mobj_t *t1, angle_t angle, fixed_t zheight, fixed_t distance, fixed_t slope, int damage);
    230 
    231 void P_RadiusAttack (mobj_t *spot, mobj_t *source, int damage);
    232 
    233 /*
    234 ===============================================================================
    235 
    236 							P_SETUP
    237 
    238 ===============================================================================
    239 */
    240 
    241 extern	byte		*rejectmatrix;			/* for fast sight rejection */
    242 extern	short		*blockmaplump;		/* offsets in blockmap are from here */
    243 extern	short		*blockmap;
    244 extern	int			bmapwidth, bmapheight;	/* in mapblocks */
    245 extern	fixed_t		bmaporgx, bmaporgy;		/* origin of block map */
    246 extern	mobj_t		**blocklinks;			/* for thing chains */
    247 
    248 /*
    249 ===============================================================================
    250 
    251 							P_INTER
    252 
    253 ===============================================================================
    254 */
    255 
    256 extern	int		maxammo[NUMAMMO];
    257 extern	int		clipammo[NUMAMMO];
    258 
    259 void P_TouchSpecialThing (mobj_t *special, mobj_t *toucher);
    260 
    261 void P_DamageMobj (mobj_t *target, mobj_t *inflictor, mobj_t *source, int damage);
    262 
    263 #include "p_spec.h"
    264 
    265 /*
    266 ===============================================================================
    267 
    268 							P_MOVE
    269 
    270 ===============================================================================
    271 */
    272 
    273 //PSX NEW
    274 #define MAXTHINGSPEC 8
    275 extern line_t  *thingspec[8];
    276 extern int		numthingspec;//80077ee8
    277 
    278 extern mobj_t  *tmthing;
    279 extern fixed_t  tmx, tmy;
    280 extern boolean  checkposonly;
    281 
    282 void	P_TryMove2(void);
    283 int     PM_PointOnLineSide(fixed_t x, fixed_t y, line_t *line);
    284 void 	P_UnsetThingPosition (mobj_t *thing);
    285 void	P_SetThingPosition (mobj_t *thing);
    286 void	PM_CheckPosition(void);
    287 boolean PM_BoxCrossLine(line_t *ld);
    288 boolean PIT_CheckLine(line_t *ld);
    289 boolean PIT_CheckThing(mobj_t *thing);
    290 boolean PM_BlockLinesIterator(int x, int y);
    291 boolean PM_BlockThingsIterator(int x, int y);
    292 
    293 
    294 /*
    295 ===============================================================================
    296 
    297 							P_SHOOT
    298 
    299 ===============================================================================
    300 */
    301 
    302 void P_Shoot2(void);
    303 boolean PA_DoIntercept(void *value, boolean isline, int frac);
    304 boolean	PA_ShootLine(line_t *li, fixed_t interceptfrac);
    305 boolean PA_ShootThing(mobj_t *th, fixed_t interceptfrac);
    306 fixed_t PA_SightCrossLine(line_t *line);
    307 boolean PA_CrossSubsector(subsector_t *sub);
    308 int PA_DivlineSide(fixed_t x, fixed_t y, divline_t *line);
    309 boolean PA_CrossBSPNode(int bspnum);
    310 
    311 /*
    312 ===============================================================================
    313 
    314 							P_SIGHT
    315 
    316 ===============================================================================
    317 */
    318 
    319 void P_CheckSights(void);
    320 boolean P_CheckSight(mobj_t *t1, mobj_t *t2);
    321 boolean PS_CrossBSPNode(int bspnum);
    322 boolean PS_CrossSubsector(subsector_t *sub);
    323 fixed_t PS_SightCrossLine (line_t *line);
    324 
    325 #endif	/* __P_LOCAL__ */
    326 
    327