1 2 /* P_local.h */ 3 4 #ifndef __P_LOCAL__ 5 #define __P_LOCAL__ 6 7 #ifndef __R_LOCAL__ 8 #include "r_local.h" 9 #endif 10 11 #include "doomdef.h" 12 #include "p_spec.h" 13 14 #define STARTREDPALS 1 15 #define STARTBONUSPALS 9 16 #define NUMREDPALS 8 17 #define NUMBONUSPALS 4 18 19 #define FOOTCLIPSIZE 10*FRACUNIT 20 21 #define TOCENTER -8 22 #define FLOATSPEED (FRACUNIT*4) 23 24 #define MAXHEALTH 100 25 #define MAXCHICKENHEALTH 30 26 #define VIEWHEIGHT (41*FRACUNIT) 27 28 /* mapblocks are used to check movement against lines and things */ 29 #define MAPBLOCKUNITS 128 30 #define MAPBLOCKSIZE (MAPBLOCKUNITS*FRACUNIT) 31 #define MAPBLOCKSHIFT (FRACBITS+7) 32 #define MAPBMASK (MAPBLOCKSIZE-1) 33 #define MAPBTOFRAC (MAPBLOCKSHIFT-FRACBITS) 34 35 /* player radius for movement checking */ 36 #define PLAYERRADIUS 16*FRACUNIT 37 38 /* 39 * MAXRADIUS is for precalculated sector block boxes 40 * the spider demon is larger, but we don't have any moving sectors 41 * nearby 42 */ 43 #define MAXRADIUS 32*FRACUNIT 44 45 #define GRAVITY FRACUNIT 46 #define MAXMOVE (30*FRACUNIT) 47 48 #define USERANGE (64*FRACUNIT) 49 #define MELEERANGE (64*FRACUNIT) 50 #define MISSILERANGE (32*64*FRACUNIT) 51 52 typedef enum 53 { 54 DI_EAST, 55 DI_NORTHEAST, 56 DI_NORTH, 57 DI_NORTHWEST, 58 DI_WEST, 59 DI_SOUTHWEST, 60 DI_SOUTH, 61 DI_SOUTHEAST, 62 DI_NODIR, 63 NUMDIRS 64 } dirtype_t; 65 66 #define BASETHRESHOLD 100 /* follow a player exlusively for 3 seconds */ 67 68 /* ***** P_TICK ***** */ 69 70 extern thinker_t thinkercap; /* both the head and tail of the thinker list */ 71 extern int TimerGame; /* tic countdown for deathmatch */ 72 73 void P_InitThinkers(void); 74 void P_AddThinker(thinker_t *thinker); 75 void P_RemoveThinker(thinker_t *thinker); 76 77 /* ***** P_PSPR ***** */ 78 79 #define USE_GWND_AMMO_1 1 80 #define USE_GWND_AMMO_2 1 81 #define USE_CBOW_AMMO_1 1 82 #define USE_CBOW_AMMO_2 1 83 #define USE_BLSR_AMMO_1 1 84 #define USE_BLSR_AMMO_2 5 85 #define USE_SKRD_AMMO_1 1 86 #define USE_SKRD_AMMO_2 5 87 #define USE_PHRD_AMMO_1 1 88 #define USE_PHRD_AMMO_2 1 89 #define USE_MACE_AMMO_1 1 90 #define USE_MACE_AMMO_2 5 91 92 void P_OpenWeapons(void); 93 void P_CloseWeapons(void); 94 void P_AddMaceSpot(mapthing_t *mthing); 95 void P_RepositionMace(mobj_t *mo); 96 void P_SetPsprite(player_t *player, int position, statenum_t stnum); 97 void P_SetupPsprites(player_t *curplayer); 98 void P_MovePsprites(player_t *curplayer); 99 void P_DropWeapon(player_t *player); 100 void P_ActivateBeak(player_t *player); 101 void P_PostChickenWeapon(player_t *player, weapontype_t weapon); 102 void P_UpdateBeak(player_t *player, pspdef_t *psp); 103 104 /* ***** P_USER ***** */ 105 106 void P_PlayerThink(player_t *player); 107 void P_Thrust(player_t *player, angle_t angle, fixed_t move); 108 void P_PlayerRemoveArtifact(player_t *player, int slot); 109 void P_PlayerUseArtifact(player_t *player, artitype_t arti); 110 boolean P_UseArtifact(player_t *player, artitype_t arti); 111 int P_GetPlayerNum(player_t *player); 112 113 /* ***** P_MOBJ ***** */ 114 115 #define FLOOR_SOLID 0 116 #define FLOOR_WATER 1 117 #define FLOOR_LAVA 2 118 #define FLOOR_SLUDGE 3 119 120 #define ONFLOORZ MININT 121 #define ONCEILINGZ MAXINT 122 #define FLOATRANDZ (MAXINT-1) 123 124 extern mobjtype_t PuffType; 125 extern mobj_t *MissileMobj; 126 127 mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type); 128 void P_RemoveMobj(mobj_t *th); 129 boolean P_SetMobjState(mobj_t *mobj, statenum_t state); 130 boolean P_SetMobjStateNF(mobj_t *mobj, statenum_t state); 131 void P_ThrustMobj(mobj_t *mo, angle_t angle, fixed_t move); 132 int P_FaceMobj(mobj_t *source, mobj_t *target, angle_t *delta); 133 boolean P_SeekerMissile(mobj_t *actor, angle_t thresh, angle_t turnMax); 134 void P_MobjThinker(mobj_t *mobj); 135 void P_BlasterMobjThinker(mobj_t *mobj); 136 void P_SpawnPuff(fixed_t x, fixed_t y, fixed_t z); 137 void P_SpawnBlood(fixed_t x, fixed_t y, fixed_t z, int damage); 138 void P_BloodSplatter(fixed_t x, fixed_t y, fixed_t z, mobj_t *originator); 139 void P_RipperBlood(mobj_t *mo); 140 int P_GetThingFloorType(mobj_t *thing); 141 int P_HitFloor(mobj_t *thing); 142 boolean P_CheckMissileSpawn(mobj_t *missile); 143 mobj_t *P_SpawnMissile(mobj_t *source, mobj_t *dest, mobjtype_t type); 144 mobj_t *P_SpawnMissileAngle(mobj_t *source, mobjtype_t type, 145 angle_t angle, fixed_t momz); 146 mobj_t *P_SpawnPlayerMissile(mobj_t *source, mobjtype_t type); 147 mobj_t *P_SPMAngle(mobj_t *source, mobjtype_t type, angle_t angle); 148 149 /* ***** P_ENEMY ***** */ 150 151 void P_NoiseAlert (mobj_t *target, mobj_t *emmiter); 152 void P_InitMonsters(void); 153 void P_AddBossSpot(fixed_t x, fixed_t y, angle_t angle); 154 void P_Massacre(void); 155 void P_DSparilTeleport(mobj_t *actor); 156 157 /* ***** P_MAPUTL ***** */ 158 159 typedef struct 160 { 161 fixed_t x, y, dx, dy; 162 } divline_t; 163 164 typedef struct 165 { 166 fixed_t frac; /* along trace line */ 167 boolean isaline; 168 union { 169 mobj_t *thing; 170 line_t *line; 171 } d; 172 } intercept_t; 173 174 #define MAXINTERCEPTS 128 175 extern intercept_t intercepts[MAXINTERCEPTS], *intercept_p; 176 typedef boolean (*traverser_t) (intercept_t *in); 177 178 179 fixed_t P_AproxDistance (fixed_t dx, fixed_t dy); 180 int P_PointOnLineSide (fixed_t x, fixed_t y, line_t *line); 181 int P_PointOnDivlineSide (fixed_t x, fixed_t y, divline_t *line); 182 void P_MakeDivline (line_t *li, divline_t *dl); 183 fixed_t P_InterceptVector (divline_t *v2, divline_t *v1); 184 int P_BoxOnLineSide (fixed_t *tmbox, line_t *ld); 185 186 extern fixed_t opentop, openbottom, openrange; 187 extern fixed_t lowfloor; 188 void P_LineOpening (line_t *linedef); 189 190 boolean P_BlockLinesIterator (int x, int y, boolean(*func)(line_t*) ); 191 boolean P_BlockThingsIterator (int x, int y, boolean(*func)(mobj_t*) ); 192 193 #define PT_ADDLINES 1 194 #define PT_ADDTHINGS 2 195 #define PT_EARLYOUT 4 196 #ifdef GL_HERETIC 197 #define PT_ADDTHINGS2 8 198 #endif 199 200 extern divline_t trace; 201 boolean P_PathTraverse (fixed_t x1, fixed_t y1, fixed_t x2, fixed_t y2, 202 int flags, boolean (*trav) (intercept_t *)); 203 204 void P_UnsetThingPosition (mobj_t *thing); 205 void P_SetThingPosition (mobj_t *thing); 206 207 /* ***** P_MAP ***** */ 208 209 extern boolean floatok; /* if true, move would be ok if */ 210 extern fixed_t tmfloorz, tmceilingz; /* within tmfloorz - tmceilingz */ 211 212 extern line_t *ceilingline; 213 boolean P_TestMobjLocation(mobj_t *mobj); 214 boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y); 215 mobj_t *P_CheckOnmobj(mobj_t *thing); 216 void P_FakeZMovement(mobj_t *mo); 217 boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y); 218 boolean P_TeleportMove(mobj_t *thing, fixed_t x, fixed_t y); 219 void P_SlideMove(mobj_t *mo); 220 boolean P_CheckSight(mobj_t *t1, mobj_t *t2); 221 void P_UseLines(player_t *player); 222 223 boolean P_ChangeSector (sector_t *sector, boolean crunch); 224 225 extern mobj_t *linetarget; /* who got hit (or NULL) */ 226 fixed_t P_AimLineAttack (mobj_t *t1, angle_t angle, fixed_t distance); 227 228 void P_LineAttack (mobj_t *t1, angle_t angle, fixed_t distance, fixed_t slope, int damage); 229 230 void P_RadiusAttack (mobj_t *spot, mobj_t *source, int damage); 231 232 /* ***** P_SETUP ***** */ 233 234 extern byte *rejectmatrix; /* for fast sight rejection */ 235 extern short *blockmaplump; /* offsets in blockmap are from here */ 236 extern short *blockmap; 237 extern int bmapwidth, bmapheight; /* in mapblocks */ 238 extern fixed_t bmaporgx, bmaporgy; /* origin of block map */ 239 extern mobj_t **blocklinks; /* for thing chains */ 240 241 /* ***** P_INTER ***** */ 242 243 extern int maxammo[NUMAMMO]; 244 extern int clipammo[NUMAMMO]; 245 246 void P_SetMessage(player_t *player, char *message, boolean ultmsg); 247 void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher); 248 void P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, 249 int damage); 250 boolean P_GiveAmmo(player_t *player, ammotype_t ammo, int count); 251 boolean P_GiveArtifact(player_t *player, artitype_t arti, mobj_t *mo); 252 boolean P_GiveBody(player_t *player, int num); 253 boolean P_GivePower(player_t *player, powertype_t power); 254 boolean P_ChickenMorphPlayer(player_t *player); 255 256 /* ***** AM_MAP ***** */ 257 258 boolean AM_Responder(event_t *ev); 259 void AM_Ticker(void); 260 void AM_Drawer(void); 261 262 /* ***** SB_BAR ***** */ 263 264 extern int SB_state; 265 extern int ArtifactFlash; 266 void SB_PaletteFlash(void); 267 268 #endif /* __P_LOCAL__ */ 269 270