]> icculus.org git repositories - theoddone33/hheretic.git/blob - include/p_spec.h
Initial revision
[theoddone33/hheretic.git] / include / p_spec.h
1
2 // P_spec.h
3
4 /*
5 ===============================================================================
6
7                                                         P_SPEC
8
9 ===============================================================================
10 */
11
12 //
13 //      Animating textures and planes
14 //
15 typedef struct
16 {
17         boolean istexture;
18         int             picnum;
19         int             basepic;
20         int             numpics;
21         int             speed;
22 } anim_t;
23
24 //
25 //      source animation definition
26 //
27 typedef struct
28 {
29         boolean istexture;              // if false, it's a flat
30         char    endname[9];
31         char    startname[9];
32         int             speed;
33 } animdef_t;
34
35 #define MAXANIMS                32
36
37 extern  anim_t  anims[MAXANIMS], *lastanim;
38 extern int *TerrainTypes;
39
40 //
41 //      Animating line specials
42 //
43 #define MAXLINEANIMS            64
44 extern  short   numlinespecials;
45 extern  line_t  *linespeciallist[MAXLINEANIMS];
46
47 //      Define values for map objects
48 #define MO_TELEPORTMAN          14
49
50 // at game start
51 void P_InitPicAnims(void);
52 void P_InitTerrainTypes(void);
53 void P_InitLava(void);
54
55 // at map load
56 void P_SpawnSpecials(void);
57 void P_InitAmbientSound(void);
58 void P_AddAmbientSfx(int sequence);
59
60 // every tic
61 void P_UpdateSpecials(void);
62 void P_AmbientSound(void);
63
64 // when needed
65 boolean P_UseSpecialLine ( mobj_t *thing, line_t *line);
66 void    P_ShootSpecialLine ( mobj_t *thing, line_t *line);
67 void    P_CrossSpecialLine (int linenum, int side, mobj_t *thing);
68
69 void    P_PlayerInSpecialSector (player_t *player);
70
71 int             twoSided(int sector,int line);
72 sector_t *getSector(int currentSector,int line,int side);
73 side_t  *getSide(int currentSector,int line, int side);
74 fixed_t P_FindLowestFloorSurrounding(sector_t *sec);
75 fixed_t P_FindHighestFloorSurrounding(sector_t *sec);
76 fixed_t P_FindNextHighestFloor(sector_t *sec,int currentheight);
77 fixed_t P_FindLowestCeilingSurrounding(sector_t *sec);
78 fixed_t P_FindHighestCeilingSurrounding(sector_t *sec);
79 int             P_FindSectorFromLineTag(line_t  *line,int start);
80 int             P_FindMinSurroundingLight(sector_t *sector,int max);
81 sector_t *getNextSector(line_t *line,sector_t *sec);
82
83 //
84 //      SPECIAL
85 //
86 int EV_DoDonut(line_t *line);
87
88 /*
89 ===============================================================================
90
91                                                         P_LIGHTS
92
93 ===============================================================================
94 */
95 typedef struct
96 {
97         thinker_t       thinker;
98         sector_t        *sector;
99         int                     count;
100         int                     maxlight;
101         int                     minlight;
102         int                     maxtime;
103         int                     mintime;
104 } lightflash_t;
105
106 typedef struct
107 {
108         thinker_t       thinker;
109         sector_t        *sector;
110         int                     count;
111         int                     minlight;
112         int                     maxlight;
113         int                     darktime;
114         int                     brighttime;
115 } strobe_t;
116
117 typedef struct
118 {
119         thinker_t       thinker;
120         sector_t        *sector;
121         int                     minlight;
122         int                     maxlight;
123         int                     direction;
124 } glow_t;
125
126 #define GLOWSPEED               8
127 #define STROBEBRIGHT    5
128 #define FASTDARK                15
129 #define SLOWDARK                35
130
131 void    T_LightFlash (lightflash_t *flash);
132 void    P_SpawnLightFlash (sector_t *sector);
133 void    T_StrobeFlash (strobe_t *flash);
134 void    P_SpawnStrobeFlash (sector_t *sector, int fastOrSlow, int inSync);
135 void    EV_StartLightStrobing(line_t *line);
136 void    EV_TurnTagLightsOff(line_t      *line);
137 void    EV_LightTurnOn(line_t *line, int bright);
138 void    T_Glow(glow_t *g);
139 void    P_SpawnGlowingLight(sector_t *sector);
140
141 /*
142 ===============================================================================
143
144                                                         P_SWITCH
145
146 ===============================================================================
147 */
148 typedef struct
149 {
150         char    name1[9];
151         char    name2[9];
152         short   episode;
153 } switchlist_t;
154
155 typedef enum
156 {
157         top,
158         middle,
159         bottom
160 } bwhere_e;
161
162 typedef struct
163 {
164         line_t          *line;
165         bwhere_e        where;
166         int                     btexture;
167         int                     btimer;
168         mobj_t          *soundorg;
169 } button_t;
170
171 #define MAXSWITCHES     50              // max # of wall switches in a level
172 #define MAXBUTTONS      16              // 4 players, 4 buttons each at once, max.
173 #define BUTTONTIME      35              // 1 second
174
175 extern  button_t        buttonlist[MAXBUTTONS]; 
176
177 void    P_ChangeSwitchTexture(line_t *line,int useAgain);
178 void    P_InitSwitchList(void);
179
180 /*
181 ===============================================================================
182
183                                                         P_PLATS
184
185 ===============================================================================
186 */
187 typedef enum
188 {
189         up,
190         down,
191         waiting,
192         in_stasis
193 } plat_e;
194
195 typedef enum
196 {
197         perpetualRaise,
198         downWaitUpStay,
199         raiseAndChange,
200         raiseToNearestAndChange
201 } plattype_e;
202
203 typedef struct
204 {
205         thinker_t       thinker;
206         sector_t        *sector;
207         fixed_t         speed;
208         fixed_t         low;
209         fixed_t         high;
210         int                     wait;
211         int                     count;
212         plat_e          status;
213         plat_e          oldstatus;
214         boolean         crush;
215         int                     tag;
216         plattype_e      type;
217 } plat_t;
218
219 #define PLATWAIT        3
220 #define PLATSPEED       FRACUNIT
221 #define MAXPLATS        30
222
223 extern  plat_t  *activeplats[MAXPLATS];
224
225 void    T_PlatRaise(plat_t      *plat);
226 int             EV_DoPlat(line_t *line,plattype_e type,int amount);
227 void    P_AddActivePlat(plat_t *plat);
228 void    P_RemoveActivePlat(plat_t *plat);
229 void    EV_StopPlat(line_t *line);
230 void    P_ActivateInStasis(int tag);
231
232 /*
233 ===============================================================================
234
235                                                         P_DOORS
236
237 ===============================================================================
238 */
239 typedef enum
240 {
241         normal,
242         close30ThenOpen,
243         close,
244         open,
245         raiseIn5Mins
246 } vldoor_e;
247
248 typedef struct
249 {
250         thinker_t       thinker;
251         vldoor_e        type;
252         sector_t        *sector;
253         fixed_t         topheight;
254         fixed_t         speed;
255         int                     direction;              // 1 = up, 0 = waiting at top, -1 = down
256         int                     topwait;                // tics to wait at the top
257                                                                 // (keep in case a door going down is reset)
258         int                     topcountdown;   // when it reaches 0, start going down
259 } vldoor_t;
260         
261 #define VDOORSPEED      FRACUNIT*2
262 #define VDOORWAIT               150
263
264 void    EV_VerticalDoor (line_t *line, mobj_t *thing);
265 int             EV_DoDoor (line_t *line, vldoor_e type, fixed_t speed);
266 void    T_VerticalDoor (vldoor_t *door);
267 void    P_SpawnDoorCloseIn30 (sector_t *sec);
268 void    P_SpawnDoorRaiseIn5Mins (sector_t *sec, int secnum);
269
270 /*
271 ===============================================================================
272
273                                                         P_CEILNG
274
275 ===============================================================================
276 */
277 typedef enum
278 {
279         lowerToFloor,
280         raiseToHighest,
281         lowerAndCrush,
282         crushAndRaise,
283         fastCrushAndRaise
284 } ceiling_e;
285
286 typedef struct
287 {
288         thinker_t       thinker;
289         ceiling_e       type;
290         sector_t        *sector;
291         fixed_t         bottomheight, topheight;
292         fixed_t         speed;
293         boolean         crush;
294         int                     direction;              // 1 = up, 0 = waiting, -1 = down
295         int                     tag;                    // ID
296         int                     olddirection;
297 } ceiling_t;
298
299 #define CEILSPEED               FRACUNIT
300 #define CEILWAIT                150
301 #define MAXCEILINGS             30
302
303 extern  ceiling_t       *activeceilings[MAXCEILINGS];
304
305 int             EV_DoCeiling (line_t *line, ceiling_e  type);
306 void    T_MoveCeiling (ceiling_t *ceiling);
307 void    P_AddActiveCeiling(ceiling_t *c);
308 void    P_RemoveActiveCeiling(ceiling_t *c);
309 int             EV_CeilingCrushStop(line_t      *line);
310 void    P_ActivateInStasisCeiling(line_t *line);
311
312 /*
313 ===============================================================================
314
315                                                         P_FLOOR
316
317 ===============================================================================
318 */
319 typedef enum
320 {
321         lowerFloor,                     // lower floor to highest surrounding floor
322         lowerFloorToLowest,     // lower floor to lowest surrounding floor
323         turboLower,                     // lower floor to highest surrounding floor VERY FAST
324         raiseFloor,                     // raise floor to lowest surrounding CEILING
325         raiseFloorToNearest,    // raise floor to next highest surrounding floor
326         raiseToTexture,         // raise floor to shortest height texture around it
327         lowerAndChange,         // lower floor to lowest surrounding floor and change
328                                                 // floorpic
329         raiseFloor24,
330         raiseFloor24AndChange,
331         raiseFloorCrush,
332         donutRaise,
333         raiseBuildStep          // One step of a staircase
334 } floor_e;
335
336 typedef struct
337 {
338         thinker_t       thinker;
339         floor_e         type;
340         boolean         crush;
341         sector_t        *sector;
342         int                     direction;
343         int                     newspecial;
344         short           texture;
345         fixed_t         floordestheight;
346         fixed_t         speed;
347 } floormove_t;
348
349 #define FLOORSPEED      FRACUNIT
350
351 typedef enum
352 {
353         ok,
354         crushed,
355         pastdest
356 } result_e;
357
358 result_e        T_MovePlane(sector_t *sector,fixed_t speed,
359                         fixed_t dest,boolean crush,int floorOrCeiling,int direction);
360
361 int             EV_BuildStairs(line_t *line, fixed_t stepDelta);
362 int             EV_DoFloor(line_t *line,floor_e floortype);
363 void    T_MoveFloor(floormove_t *floor);
364
365 /*
366 ===============================================================================
367
368                                                         P_TELEPT
369
370 ===============================================================================
371 */
372
373 boolean P_Teleport(mobj_t *thing, fixed_t x, fixed_t y, angle_t angle);
374 boolean EV_Teleport(line_t *line, int side, mobj_t *thing);