XenevaOS
Loading...
Searching...
No Matches
p_spec.h
Go to the documentation of this file.
1//
2// Copyright(C) 1993-1996 Id Software, Inc.
3// Copyright(C) 2005-2014 Simon Howard
4//
5// This program is free software; you can redistribute it and/or
6// modify it under the terms of the GNU General Public License
7// as published by the Free Software Foundation; either version 2
8// of the License, or (at your option) any later version.
9//
10// This program is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU General Public License for more details.
14//
15// DESCRIPTION: none
16// Implements special effects:
17// Texture animation, height or lighting changes
18// according to adjacent sectors, respective
19// utility functions, etc.
20//
21
22
23#ifndef __P_SPEC__
24#define __P_SPEC__
25
26
27//
28// End-level timer (-TIMER option)
29//
30extern boolean levelTimer;
31extern int levelTimeCount;
32
33
34// Define values for map objects
35#define MO_TELEPORTMAN 14
36
37
38// at game start
39void P_InitPicAnims (void);
40
41// at map load
42void P_SpawnSpecials (void);
43
44// every tic
45void P_UpdateSpecials (void);
46
47// when needed
48boolean
50( mobj_t* thing,
51 line_t* line,
52 int side );
53
54void
56( mobj_t* thing,
57 line_t* line );
58
59void
61( int linenum,
62 int side,
63 mobj_t* thing );
64
66
67int
69( int sector,
70 int line );
71
74( int currentSector,
75 int line,
76 int side );
77
78side_t*
80( int currentSector,
81 int line,
82 int side );
83
86
89( sector_t* sec,
90 int currentheight );
91
94
95int
97( line_t* line,
98 int start );
99
100int
102( sector_t* sector,
103 int max );
104
107( line_t* line,
108 sector_t* sec );
109
110
111//
112// SPECIAL
113//
114int EV_DoDonut(line_t* line);
115
116
117
118//
119// P_LIGHTS
120//
130
131
132
144
145
146
158
159
160
161
171
172
173#define GLOWSPEED 8
174#define STROBEBRIGHT 5
175#define FASTDARK 15
176#define SLOWDARK 35
177
178void P_SpawnFireFlicker (sector_t* sector);
179void T_LightFlash (lightflash_t* flash);
180void P_SpawnLightFlash (sector_t* sector);
181void T_StrobeFlash (strobe_t* flash);
182
183void
185( sector_t* sector,
186 int fastOrSlow,
187 int inSync );
188
189void EV_StartLightStrobing(line_t* line);
190void EV_TurnTagLightsOff(line_t* line);
191
192void
194( line_t* line,
195 int bright );
196
197void T_Glow(glow_t* g);
198void P_SpawnGlowingLight(sector_t* sector);
199
200
201
202
203//
204// P_SWITCH
205//
206typedef struct
207{
208 char name1[9];
209 char name2[9];
210 short episode;
211
213
214
215typedef enum
216{
219 bottom
220
222
223
233
234
235
236
237 // max # of wall switches in a level
238#define MAXSWITCHES 50
239
240 // 4 players, 4 buttons each at once, max.
241#define MAXBUTTONS 16
242
243 // 1 second, in ticks.
244#define BUTTONTIME 35
245
247
248void
250( line_t* line,
251 int useAgain );
252
253void P_InitSwitchList(void);
254
255
256//
257// P_PLATS
258//
259typedef enum
260{
265
267
268
269
279
280
281
298
299
300
301#define PLATWAIT 3
302#define PLATSPEED FRACUNIT
303#define MAXPLATS 30
304
305
307
308void T_PlatRaise(plat_t* plat);
309
310int
312( line_t* line,
313 plattype_e type,
314 int amount );
315
316void P_AddActivePlat(plat_t* plat);
317void P_RemoveActivePlat(plat_t* plat);
318void EV_StopPlat(line_t* line);
319void P_ActivateInStasis(int tag);
320
321
322//
323// P_DOORS
324//
337
338
339
340typedef struct
341{
347
348 // 1 = up, 0 = waiting at top, -1 = down
350
351 // tics to wait at the top
353 // (keep in case a door going down is reset)
354 // when it reaches 0, start going down
356
357} vldoor_t;
358
359
360
361#define VDOORSPEED FRACUNIT*2
362#define VDOORWAIT 150
363
364void
366( line_t* line,
367 mobj_t* thing );
368
369int
371( line_t* line,
372 vldoor_e type );
373
374int
376( line_t* line,
377 vldoor_e type,
378 mobj_t* thing );
379
380void T_VerticalDoor (vldoor_t* door);
382
383void
385( sector_t* sec,
386 int secnum );
387
388
389
390#if 0 // UNUSED
391//
392// Sliding doors...
393//
394typedef enum
395{
396 sd_opening,
397 sd_waiting,
398 sd_closing
399
400} sd_e;
401
402
403
404typedef enum
405{
406 sdt_openOnly,
407 sdt_closeOnly,
408 sdt_openAndClose
409
410} sdt_e;
411
412
413
414
415typedef struct
416{
417 thinker_t thinker;
418 sdt_e type;
419 line_t* line;
420 int frame;
421 int whichDoorIndex;
422 int timer;
425 sd_e status;
426
427} slidedoor_t;
428
429
430
431typedef struct
432{
433 char frontFrame1[9];
434 char frontFrame2[9];
435 char frontFrame3[9];
436 char frontFrame4[9];
437 char backFrame1[9];
438 char backFrame2[9];
439 char backFrame3[9];
440 char backFrame4[9];
441
442} slidename_t;
443
444
445
446typedef struct
447{
448 int frontFrames[4];
449 int backFrames[4];
450
451} slideframe_t;
452
453
454
455// how many frames of animation
456#define SNUMFRAMES 4
457
458#define SDOORWAIT 35*3
459#define SWAITTICS 4
460
461// how many diff. types of anims
462#define MAXSLIDEDOORS 5
463
464void P_InitSlidingDoorFrames(void);
465
466void
467EV_SlidingDoor
468( line_t* line,
469 mobj_t* thing );
470#endif
471
472
473
474//
475// P_CEILNG
476//
487
488
489
490typedef struct
491{
498 boolean crush;
499
500 // 1 = up, 0 = waiting, -1 = down
502
503 // ID
504 int tag;
506
507} ceiling_t;
508
509
510
511
512
513#define CEILSPEED FRACUNIT
514#define CEILWAIT 150
515#define MAXCEILINGS 30
516
518
519int
521( line_t* line,
522 ceiling_e type );
523
524void T_MoveCeiling (ceiling_t* ceiling);
527int EV_CeilingCrushStop(line_t* line);
529
530
531//
532// P_FLOOR
533//
534typedef enum
535{
536 // lower floor to highest surrounding floor
538
539 // lower floor to lowest surrounding floor
541
542 // lower floor to highest surrounding floor VERY FAST
544
545 // raise floor to lowest surrounding CEILING
547
548 // raise floor to next highest surrounding floor
550
551 // raise floor to shortest height texture around it
553
554 // lower floor to lowest surrounding floor
555 // and change floorpic
557
561
562 // raise to next highest floor, turbo-speed
566
568
569
570
571
572typedef enum
573{
574 build8, // slowly build by 8
575 turbo16 // quickly build by 16
576
578
579
580
594
595
596
597#define FLOORSPEED FRACUNIT
598
599typedef enum
600{
604
606
609( sector_t* sector,
610 fixed_t speed,
611 fixed_t dest,
612 boolean crush,
613 int floorOrCeiling,
614 int direction );
615
616int
618( line_t* line,
619 stair_e type );
620
621int
623( line_t* line,
624 floor_e floortype );
625
626void T_MoveFloor( floormove_t* floor);
627
628//
629// P_TELEPT
630//
631int
633( line_t* line,
634 int side,
635 mobj_t* thing );
636
637#endif
int fixed_t
Definition m_fixed.h:32
#define max(a, b)
Definition minmax.h:28
#define MAXBUTTONS
Definition p_spec.h:241
void EV_StartLightStrobing(line_t *line)
Definition p_lights.c:208
int P_FindMinSurroundingLight(sector_t *sector, int max)
Definition p_spec.c:465
boolean levelTimer
Definition p_spec.c:1090
fixed_t P_FindLowestCeilingSurrounding(sector_t *sec)
Definition p_spec.c:392
void T_PlatRaise(plat_t *plat)
Definition p_plats.c:45
sector_t * getNextSector(line_t *line, sector_t *sec)
Definition p_spec.c:251
int EV_BuildStairs(line_t *line, stair_e type)
Definition p_floor.c:445
void P_ActivateInStasis(int tag)
Definition p_plats.c:248
int EV_DoCeiling(line_t *line, ceiling_e type)
Definition p_ceilng.c:162
void P_SpawnLightFlash(sector_t *sector)
Definition p_lights.c:117
void P_SpawnSpecials(void)
Definition p_spec.c:1374
void T_Glow(glow_t *g)
Definition p_lights.c:307
void P_RemoveActivePlat(plat_t *plat)
Definition p_plats.c:291
stair_e
Definition p_spec.h:573
@ build8
Definition p_spec.h:574
@ turbo16
Definition p_spec.h:575
void P_PlayerInSpecialSector(player_t *player)
Definition p_spec.c:1019
void P_SpawnDoorCloseIn30(sector_t *sec)
Definition p_doors.c:519
vldoor_e
Definition p_spec.h:326
@ vld_open
Definition p_spec.h:330
@ vld_blazeClose
Definition p_spec.h:334
@ vld_normal
Definition p_spec.h:327
@ vld_raiseIn5Mins
Definition p_spec.h:331
@ vld_close30ThenOpen
Definition p_spec.h:328
@ vld_blazeRaise
Definition p_spec.h:332
@ vld_blazeOpen
Definition p_spec.h:333
@ vld_close
Definition p_spec.h:329
void P_AddActivePlat(plat_t *plat)
Definition p_plats.c:278
void T_LightFlash(lightflash_t *flash)
Definition p_lights.c:91
fixed_t P_FindHighestFloorSurrounding(sector_t *sec)
Definition p_spec.c:296
void P_ChangeSwitchTexture(line_t *line, int useAgain)
Definition p_switch.c:196
bwhere_e
Definition p_spec.h:216
@ top
Definition p_spec.h:217
@ bottom
Definition p_spec.h:219
@ middle
Definition p_spec.h:218
void T_VerticalDoor(vldoor_t *door)
Definition p_doors.c:57
floor_e
Definition p_spec.h:535
@ lowerFloor
Definition p_spec.h:537
@ turboLower
Definition p_spec.h:543
@ lowerFloorToLowest
Definition p_spec.h:540
@ raiseToTexture
Definition p_spec.h:552
@ donutRaise
Definition p_spec.h:564
@ raiseFloorCrush
Definition p_spec.h:560
@ raiseFloorToNearest
Definition p_spec.h:549
@ lowerAndChange
Definition p_spec.h:556
@ raiseFloorTurbo
Definition p_spec.h:563
@ raiseFloor24AndChange
Definition p_spec.h:559
@ raiseFloor512
Definition p_spec.h:565
@ raiseFloor
Definition p_spec.h:546
@ raiseFloor24
Definition p_spec.h:558
int EV_DoPlat(line_t *line, plattype_e type, int amount)
Definition p_plats.c:130
void P_SpawnFireFlicker(sector_t *sector)
Definition p_lights.c:61
void P_InitPicAnims(void)
Definition p_spec.c:143
void P_ShootSpecialLine(mobj_t *thing, line_t *line)
Definition p_spec.c:970
int EV_Teleport(line_t *line, int side, mobj_t *thing)
Definition p_telept.c:43
void T_MoveCeiling(ceiling_t *ceiling)
Definition p_ceilng.c:45
fixed_t P_FindNextHighestFloor(sector_t *sec, int currentheight)
Definition p_spec.c:331
fixed_t P_FindLowestFloorSurrounding(sector_t *sec)
Definition p_spec.c:269
int levelTimeCount
Definition p_spec.c:1091
side_t * getSide(int currentSector, int line, int side)
Definition p_spec.c:204
void EV_TurnTagLightsOff(line_t *line)
Definition p_lights.c:229
void P_InitSwitchList(void)
Definition p_switch.c:101
int EV_DoDoor(line_t *line, vldoor_e type)
Definition p_doors.c:253
#define MAXPLATS
Definition p_spec.h:303
void P_SpawnStrobeFlash(sector_t *sector, int fastOrSlow, int inSync)
Definition p_lights.c:175
void EV_VerticalDoor(line_t *line, mobj_t *thing)
Definition p_doors.c:338
void EV_LightTurnOn(line_t *line, int bright)
Definition p_lights.c:265
#define MAXCEILINGS
Definition p_spec.h:515
button_t buttonlist[MAXBUTTONS]
Definition p_switch.c:95
void P_UpdateSpecials(void)
Definition p_spec.c:1093
boolean P_UseSpecialLine(mobj_t *thing, line_t *line, int side)
Definition p_switch.c:271
int EV_DoFloor(line_t *line, floor_e floortype)
Definition p_floor.c:252
int twoSided(int sector, int line)
Definition p_spec.c:235
plattype_e
Definition p_spec.h:271
@ raiseAndChange
Definition p_spec.h:274
@ blazeDWUS
Definition p_spec.h:276
@ perpetualRaise
Definition p_spec.h:272
@ downWaitUpStay
Definition p_spec.h:273
@ raiseToNearestAndChange
Definition p_spec.h:275
void P_SpawnGlowingLight(sector_t *sector)
Definition p_lights.c:334
plat_t * activeplats[MAXPLATS]
Definition p_plats.c:38
result_e
Definition p_spec.h:600
@ pastdest
Definition p_spec.h:603
@ ok
Definition p_spec.h:601
@ crushed
Definition p_spec.h:602
ceiling_t * activeceilings[MAXCEILINGS]
Definition p_ceilng.c:38
void P_ActivateInStasisCeiling(line_t *line)
Definition p_ceilng.c:280
sector_t * getSector(int currentSector, int line, int side)
Definition p_spec.c:220
void T_StrobeFlash(strobe_t *flash)
Definition p_lights.c:148
int EV_CeilingCrushStop(line_t *line)
Definition p_ceilng.c:303
result_e T_MovePlane(sector_t *sector, fixed_t speed, fixed_t dest, boolean crush, int floorOrCeiling, int direction)
Definition p_floor.c:43
void P_CrossSpecialLine(int linenum, int side, mobj_t *thing)
Definition p_spec.c:503
plat_e
Definition p_spec.h:260
@ down
Definition p_spec.h:262
@ waiting
Definition p_spec.h:263
@ in_stasis
Definition p_spec.h:264
@ up
Definition p_spec.h:261
void P_RemoveActiveCeiling(ceiling_t *c)
Definition p_ceilng.c:259
fixed_t P_FindHighestCeilingSurrounding(sector_t *sec)
Definition p_spec.c:417
void P_SpawnDoorRaiseIn5Mins(sector_t *sec, int secnum)
Definition p_doors.c:543
ceiling_e
Definition p_spec.h:478
@ lowerToFloor
Definition p_spec.h:479
@ fastCrushAndRaise
Definition p_spec.h:483
@ raiseToHighest
Definition p_spec.h:480
@ crushAndRaise
Definition p_spec.h:482
@ silentCrushAndRaise
Definition p_spec.h:484
@ lowerAndCrush
Definition p_spec.h:481
int EV_DoDonut(line_t *line)
Definition p_spec.c:1257
void T_MoveFloor(floormove_t *floor)
Definition p_floor.c:202
int P_FindSectorFromLineTag(line_t *line, int start)
Definition p_spec.c:445
void P_AddActiveCeiling(ceiling_t *c)
Definition p_ceilng.c:240
int EV_DoLockedDoor(line_t *line, vldoor_e type, mobj_t *thing)
Definition p_doors.c:196
void EV_StopPlat(line_t *line)
Definition p_plats.c:263
sector_t * backsector
Definition r_bsp.c:44
sector_t * frontsector
Definition r_bsp.c:43
Definition p_spec.h:225
bwhere_e where
Definition p_spec.h:227
int btimer
Definition p_spec.h:229
degenmobj_t * soundorg
Definition p_spec.h:230
int btexture
Definition p_spec.h:228
line_t * line
Definition p_spec.h:226
Definition p_spec.h:491
fixed_t topheight
Definition p_spec.h:496
int tag
Definition p_spec.h:504
int direction
Definition p_spec.h:501
sector_t * sector
Definition p_spec.h:494
fixed_t speed
Definition p_spec.h:497
boolean crush
Definition p_spec.h:498
thinker_t thinker
Definition p_spec.h:492
fixed_t bottomheight
Definition p_spec.h:495
ceiling_e type
Definition p_spec.h:493
int olddirection
Definition p_spec.h:505
Definition r_defs.h:85
Definition p_spec.h:122
thinker_t thinker
Definition p_spec.h:123
int minlight
Definition p_spec.h:127
int count
Definition p_spec.h:125
int maxlight
Definition p_spec.h:126
sector_t * sector
Definition p_spec.h:124
Definition p_spec.h:582
int direction
Definition p_spec.h:587
boolean crush
Definition p_spec.h:585
floor_e type
Definition p_spec.h:584
short texture
Definition p_spec.h:589
fixed_t speed
Definition p_spec.h:591
fixed_t floordestheight
Definition p_spec.h:590
sector_t * sector
Definition p_spec.h:586
thinker_t thinker
Definition p_spec.h:583
int newspecial
Definition p_spec.h:588
Definition p_spec.h:163
int maxlight
Definition p_spec.h:167
int direction
Definition p_spec.h:168
thinker_t thinker
Definition p_spec.h:164
sector_t * sector
Definition p_spec.h:165
int minlight
Definition p_spec.h:166
Definition p_spec.h:134
int mintime
Definition p_spec.h:141
thinker_t thinker
Definition p_spec.h:135
int maxlight
Definition p_spec.h:138
int maxtime
Definition p_spec.h:140
int count
Definition p_spec.h:137
int minlight
Definition p_spec.h:139
sector_t * sector
Definition p_spec.h:136
Definition r_defs.h:176
Definition p_mobj.h:202
Definition p_spec.h:283
int wait
Definition p_spec.h:289
fixed_t low
Definition p_spec.h:287
plat_e status
Definition p_spec.h:291
sector_t * sector
Definition p_spec.h:285
int count
Definition p_spec.h:290
thinker_t thinker
Definition p_spec.h:284
fixed_t high
Definition p_spec.h:288
plat_e oldstatus
Definition p_spec.h:292
boolean crush
Definition p_spec.h:293
int tag
Definition p_spec.h:294
plattype_e type
Definition p_spec.h:295
fixed_t speed
Definition p_spec.h:286
Definition d_player.h:79
Definition r_defs.h:98
Definition r_defs.h:141
Definition p_spec.h:148
int minlight
Definition p_spec.h:152
int darktime
Definition p_spec.h:154
int maxlight
Definition p_spec.h:153
sector_t * sector
Definition p_spec.h:150
int brighttime
Definition p_spec.h:155
int count
Definition p_spec.h:151
thinker_t thinker
Definition p_spec.h:149
Definition p_spec.h:207
short episode
Definition p_spec.h:210
Definition d_think.h:59
Definition p_spec.h:341
fixed_t speed
Definition p_spec.h:346
int direction
Definition p_spec.h:349
fixed_t topheight
Definition p_spec.h:345
int topwait
Definition p_spec.h:352
vldoor_e type
Definition p_spec.h:343
int topcountdown
Definition p_spec.h:355
sector_t * sector
Definition p_spec.h:344
thinker_t thinker
Definition p_spec.h:342