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