/
p_spec.c
1791 lines (1527 loc) · 46.7 KB
/
p_spec.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/**\file
*\section License
* License: GPL
* Online License Link: http://www.gnu.org/licenses/gpl.html
*
*\author Copyright © 2003-2009 Jaakko Keränen <jaakko.keranen@iki.fi>
*\author Copyright © 2005-2009 Daniel Swanson <danij@dengine.net>
*\author Copyright © 1993-1996 by id Software, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301 USA
*/
/**
* p_spec.c: Implements special effects.
*
* Texture animation, height or lighting changes according to adjacent
* sectors, respective utility functions, etc.
*
* Line Tag handling. Line and Sector triggers.
*
* Events are operations triggered by using, crossing, or shooting special
* lines, or by timed thinkers.
*/
// HEADER FILES ------------------------------------------------------------
#include "jheretic.h"
#include "m_argv.h"
#include "dmu_lib.h"
#include "p_mapsetup.h"
#include "p_mapspec.h"
#include "p_player.h"
#include "p_tick.h"
#include "p_ceiling.h"
#include "p_door.h"
#include "p_floor.h"
#include "p_plat.h"
#include "p_switch.h"
#include "d_netsv.h"
// MACROS ------------------------------------------------------------------
#define MAX_AMBIENT_SFX 8 // Per level
// TYPES -------------------------------------------------------------------
typedef enum afxcmd_e {
afxcmd_play, // (sound)
afxcmd_playabsvol, // (sound, volume)
afxcmd_playrelvol, // (sound, volume)
afxcmd_delay, // (ticks)
afxcmd_delayrand, // (andbits)
afxcmd_end // ()
} afxcmd_t;
// Animating textures and planes
// In Doomsday these are handled via DED definitions.
// In BOOM they invented the ANIMATED lump for the same purpose.
// This struct is directly read from the lump.
// So its important we keep it aligned.
#pragma pack(1)
typedef struct animdef_s {
/* Do NOT change these members in any way */
signed char istexture; // if false, it is a flat (instead of bool)
char endname[9];
char startname[9];
int speed;
} animdef_t;
#pragma pack()
// EXTERNAL FUNCTION PROTOTYPES --------------------------------------------
// PUBLIC FUNCTION PROTOTYPES ----------------------------------------------
// PRIVATE FUNCTION PROTOTYPES ---------------------------------------------
static void P_CrossSpecialLine(linedef_t* line, int side, mobj_t* thing);
static void P_ShootSpecialLine(mobj_t* thing, linedef_t* line);
// EXTERNAL DATA DECLARATIONS ----------------------------------------------
// PUBLIC DATA DEFINITIONS -------------------------------------------------
mobj_t LavaInflictor;
int* LevelAmbientSfx[MAX_AMBIENT_SFX];
int* AmbSfxPtr;
int AmbSfxCount;
int AmbSfxTics;
int AmbSfxVolume;
int AmbSndSeqInit[] = { // Startup
afxcmd_end
};
int AmbSndSeq1[] = { // Scream
afxcmd_play, SFX_AMB1,
afxcmd_end
};
int AmbSndSeq2[] = { // Squish
afxcmd_play, SFX_AMB2,
afxcmd_end
};
int AmbSndSeq3[] = { // Drops
afxcmd_play, SFX_AMB3,
afxcmd_delay, 16,
afxcmd_delayrand, 31,
afxcmd_play, SFX_AMB7,
afxcmd_delay, 16,
afxcmd_delayrand, 31,
afxcmd_play, SFX_AMB3,
afxcmd_delay, 16,
afxcmd_delayrand, 31,
afxcmd_play, SFX_AMB7,
afxcmd_delay, 16,
afxcmd_delayrand, 31,
afxcmd_play, SFX_AMB3,
afxcmd_delay, 16,
afxcmd_delayrand, 31,
afxcmd_play, SFX_AMB7,
afxcmd_delay, 16,
afxcmd_delayrand, 31,
afxcmd_end
};
int AmbSndSeq4[] = { // SlowFootSteps
afxcmd_play, SFX_AMB4,
afxcmd_delay, 15,
afxcmd_playrelvol, SFX_AMB11, -3,
afxcmd_delay, 15,
afxcmd_playrelvol, SFX_AMB4, -3,
afxcmd_delay, 15,
afxcmd_playrelvol, SFX_AMB11, -3,
afxcmd_delay, 15,
afxcmd_playrelvol, SFX_AMB4, -3,
afxcmd_delay, 15,
afxcmd_playrelvol, SFX_AMB11, -3,
afxcmd_delay, 15,
afxcmd_playrelvol, SFX_AMB4, -3,
afxcmd_delay, 15,
afxcmd_playrelvol, SFX_AMB11, -3,
afxcmd_end
};
int AmbSndSeq5[] = { // Heartbeat
afxcmd_play, SFX_AMB5,
afxcmd_delay, 35,
afxcmd_play, SFX_AMB5,
afxcmd_delay, 35,
afxcmd_play, SFX_AMB5,
afxcmd_delay, 35,
afxcmd_play, SFX_AMB5,
afxcmd_end
};
int AmbSndSeq6[] = { // Bells
afxcmd_play, SFX_AMB6,
afxcmd_delay, 17,
afxcmd_playrelvol, SFX_AMB6, -8,
afxcmd_delay, 17,
afxcmd_playrelvol, SFX_AMB6, -8,
afxcmd_delay, 17,
afxcmd_playrelvol, SFX_AMB6, -8,
afxcmd_end
};
int AmbSndSeq7[] = { // Growl
afxcmd_play, SFX_BSTSIT,
afxcmd_end
};
int AmbSndSeq8[] = { // Magic
afxcmd_play, SFX_AMB8,
afxcmd_end
};
int AmbSndSeq9[] = { // Laughter
afxcmd_play, SFX_AMB9,
afxcmd_delay, 16,
afxcmd_playrelvol, SFX_AMB9, -4,
afxcmd_delay, 16,
afxcmd_playrelvol, SFX_AMB9, -4,
afxcmd_delay, 16,
afxcmd_playrelvol, SFX_AMB10, -4,
afxcmd_delay, 16,
afxcmd_playrelvol, SFX_AMB10, -4,
afxcmd_delay, 16,
afxcmd_playrelvol, SFX_AMB10, -4,
afxcmd_end
};
int AmbSndSeq10[] = { // FastFootsteps
afxcmd_play, SFX_AMB4,
afxcmd_delay, 8,
afxcmd_playrelvol, SFX_AMB11, -3,
afxcmd_delay, 8,
afxcmd_playrelvol, SFX_AMB4, -3,
afxcmd_delay, 8,
afxcmd_playrelvol, SFX_AMB11, -3,
afxcmd_delay, 8,
afxcmd_playrelvol, SFX_AMB4, -3,
afxcmd_delay, 8,
afxcmd_playrelvol, SFX_AMB11, -3,
afxcmd_delay, 8,
afxcmd_playrelvol, SFX_AMB4, -3,
afxcmd_delay, 8,
afxcmd_playrelvol, SFX_AMB11, -3,
afxcmd_end
};
int* AmbientSfx[] = {
AmbSndSeq1, // Scream
AmbSndSeq2, // Squish
AmbSndSeq3, // Drops
AmbSndSeq4, // SlowFootsteps
AmbSndSeq5, // Heartbeat
AmbSndSeq6, // Bells
AmbSndSeq7, // Growl
AmbSndSeq8, // Magic
AmbSndSeq9, // Laughter
AmbSndSeq10 // FastFootsteps
};
// PRIVATE DATA DEFINITIONS ------------------------------------------------
static animdef_t anims[] = {
{0, "FLTWAWA3", "FLTWAWA1", MACRO_LONG(8)},
{0, "FLTSLUD3", "FLTSLUD1", MACRO_LONG(8)},
{0, "FLTTELE4", "FLTTELE1", MACRO_LONG(6)},
{0, "FLTFLWW3", "FLTFLWW1", MACRO_LONG(9)},
{0, "FLTLAVA4", "FLTLAVA1", MACRO_LONG(8)},
{0, "FLATHUH4", "FLATHUH1", MACRO_LONG(8)},
{1, "LAVAFL3", "LAVAFL1", MACRO_LONG(6)},
{1, "WATRWAL3", "WATRWAL1", MACRO_LONG(4)},
{-1, "\0", "\0"}
};
// CODE --------------------------------------------------------------------
/**
* From PrBoom:
* Load the table of animation definitions, checking for existence of
* the start and end of each frame. If the start doesn't exist the sequence
* is skipped, if the last doesn't exist, BOOM exits.
*
* Wall/Flat animation sequences, defined by name of first and last frame,
* The full animation sequence is given using all lumps between the start
* and end entry, in the order found in the WAD file.
*
* This routine modified to read its data from a predefined lump or
* PWAD lump called ANIMATED rather than a static table in this module to
* allow wad designers to insert or modify animation sequences.
*
* Lump format is an array of byte packed animdef_t structures, terminated
* by a structure with istexture == -1. The lump can be generated from a
* text source file using SWANTBLS.EXE, distributed with the BOOM utils.
* The standard list of switches and animations is contained in the example
* source text file DEFSWANI.DAT also in the BOOM util distribution.
*/
static void loadAnimDefs(animdef_t* animDefs)
{
int i;
// Read structures until -1 is found
for(i = 0; animDefs[i].istexture != -1 ; ++i)
{
int groupNum, ticsPerFrame, numFrames;
material_namespace_t mnamespace =
(animDefs[i].istexture? MN_TEXTURES : MN_FLATS);
switch(mnamespace)
{
case MN_FLATS:
{
lumpnum_t startFrame, endFrame, n;
if((startFrame = W_CheckNumForName(animDefs[i].startname)) == -1 ||
(endFrame = W_CheckNumForName(animDefs[i].endname)) == -1)
continue;
numFrames = endFrame - startFrame + 1;
ticsPerFrame = LONG(animDefs[i].speed);
if(numFrames < 2)
Con_Error("P_InitPicAnims: bad cycle from %s to %s",
animDefs[i].startname, animDefs[i].endname);
if(startFrame && endFrame)
{ // We have a valid animation.
// Create a new animation group for it.
groupNum = R_CreateAnimGroup(AGF_SMOOTH);
/**
* Doomsday's group animation needs to know the texture/flat
* numbers of ALL frames in the animation group so we'll
* have to step through the directory adding frames as we
* go. (DOOM only required the start/end texture/flat
* numbers and would animate all textures/flats inbetween).
*/
VERBOSE(Con_Message("P_InitPicAnims: ADD (\"%s\" > \"%s\" %d)\n",
animDefs[i].startname, animDefs[i].endname,
ticsPerFrame));
// Add all frames from start to end to the group.
if(endFrame > startFrame)
{
for(n = startFrame; n <= endFrame; n++)
{
materialnum_t frame =
P_MaterialCheckNumForName(W_LumpName(n),
MN_FLATS);
if(frame != 0)
R_AddToAnimGroup(groupNum, frame, ticsPerFrame, 0);
}
}
else
{
for(n = endFrame; n >= startFrame; n--)
{
materialnum_t frame =
P_MaterialCheckNumForName(W_LumpName(n),
MN_FLATS);
if(frame != 0)
R_AddToAnimGroup(groupNum, frame, ticsPerFrame, 0);
}
}
}
break;
}
case MN_TEXTURES:
{ // Same as above but for texture groups.
materialnum_t startFrame, endFrame, n;
if((startFrame = P_MaterialCheckNumForName(animDefs[i].startname,
MN_TEXTURES)) == 0 ||
(endFrame = P_MaterialCheckNumForName(animDefs[i].endname,
MN_TEXTURES)) == 0)
continue;
numFrames = endFrame - startFrame + 1;
ticsPerFrame = LONG(animDefs[i].speed);
if(numFrames < 2)
Con_Error("P_InitPicAnims: bad cycle from %s to %s",
animDefs[i].startname, animDefs[i].endname);
if(startFrame && endFrame)
{
groupNum = R_CreateAnimGroup(AGF_SMOOTH);
VERBOSE(Con_Message("P_InitPicAnims: ADD (\"%s\" > \"%s\" %d)\n",
animDefs[i].startname, animDefs[i].endname,
ticsPerFrame));
/**
* \fixme Here an assumption is made that MN_TEXTURES type
* materials are registered in the same order as they are
* defined in the TEXTURE(1...) lump(s).
*/
if(endFrame > startFrame)
{
for(n = startFrame; n <= endFrame; n++)
R_AddToAnimGroup(groupNum, n, ticsPerFrame, 0);
}
else
{
for(n = endFrame; n >= startFrame; n--)
R_AddToAnimGroup(groupNum, n, ticsPerFrame, 0);
}
}
break;
}
default:
Con_Error("loadAnimDefs: Internal Error, invalid namespace %i.",
(int) mnamespace);
}
}
}
void P_InitPicAnims(void)
{
int lump;
// Is there an ANIMATED lump?
if((lump = W_CheckNumForName("ANIMATED")) > 0)
{
animdef_t* animDefs;
/**
* We'll support this BOOM extension by reading the data and then
* registering the new animations into Doomsday using the animation
* groups feature.
*
* Support for this extension should be considered depreciated.
* All new features should be added, accessed via DED.
*/
Con_Message("P_InitPicAnims: \"ANIMATED\" lump found. "
"Reading animations...\n");
animDefs = (animdef_t *)W_CacheLumpNum(lump, PU_STATIC);
loadAnimDefs(animDefs);
Z_Free(animDefs);
}
else
{
Con_Message("P_InitPicAnims: Registering default animations...\n");
loadAnimDefs(anims);
}
VERBOSE(Con_Message("P_InitPicAnims: Done.\n"));
}
boolean P_ActivateLine(linedef_t *ld, mobj_t *mo, int side, int actType)
{
switch(actType)
{
case SPAC_CROSS:
P_CrossSpecialLine(ld, side, mo);
return true;
case SPAC_USE:
return P_UseSpecialLine(mo, ld, side);
case SPAC_IMPACT:
P_ShootSpecialLine(mo, ld);
return true;
default:
Con_Error("P_ActivateLine: Unknown Activation Type %i", actType);
break;
}
return false;
}
/**
* Called every time a thing origin is about to cross a line with
* a non 0 special.
*/
static void P_CrossSpecialLine(linedef_t *line, int side, mobj_t *thing)
{
int ok;
xline_t* xline;
// Extended functionality overrides old.
if(XL_CrossLine(line, side, thing))
return;
xline = P_ToXLine(line);
// Triggers that other things can activate.
if(!thing->player)
{
/* // DJS - All things can trigger specials in Heretic
// Things that should NOT trigger specials...
switch (thing->type)
{
case MT_ROCKET:
case MT_PLASMA:
case MT_BFG:
case MT_TROOPSHOT:
case MT_HEADSHOT:
case MT_BRUISERSHOT:
return;
break;
default:
break;
}
*/
ok = 0;
switch(xline->special)
{
case 39: // TELEPORT TRIGGER
case 97: // TELEPORT RETRIGGER
//case 125: // TELEPORT MONSTERONLY TRIGGER
//case 126: // TELEPORT MONSTERONLY RETRIGGER
case 4: // RAISE DOOR
//case 10: // PLAT DOWN-WAIT-UP-STAY TRIGGER
//case 88: // PLAT DOWN-WAIT-UP-STAY RETRIGGER
ok = 1;
break;
}
/* // DJS - Not implemented in jHeretic
// Anything can trigger this line!
if(P_GetInt(DMU_LINEDEF, linenum, DMU_FLAGS) & ML_ALLTRIGGER)
ok = 1;
*/
if(!ok)
return;
}
// Note: could use some const's here.
switch(xline->special)
{
// TRIGGERS.
// All from here to RETRIGGERS.
case 2:
// Open Door
EV_DoDoor(line, DT_OPEN);
xline->special = 0;
break;
case 3:
// Close Door
EV_DoDoor(line, DT_CLOSE);
xline->special = 0;
break;
case 4:
// Raise Door
EV_DoDoor(line, DT_NORMAL);
xline->special = 0;
break;
case 5:
// Raise Floor
EV_DoFloor(line, FT_RAISEFLOOR);
xline->special = 0;
break;
case 6:
// Fast Ceiling Crush & Raise
EV_DoCeiling(line, CT_CRUSHANDRAISEFAST);
xline->special = 0;
break;
case 8:
// Build Stairs
EV_BuildStairs(line, build8);
xline->special = 0;
break;
case 10:
// PlatDownWaitUp
EV_DoPlat(line, PT_DOWNWAITUPSTAY, 0);
xline->special = 0;
break;
case 12:
// Light Turn On - brightest near
EV_LightTurnOn(line, 0);
xline->special = 0;
break;
case 13:
// Light Turn On 255
EV_LightTurnOn(line, 1);
xline->special = 0;
break;
case 16:
// Close Door 30
EV_DoDoor(line, DT_CLOSE30THENOPEN);
xline->special = 0;
break;
case 17:
// Start Light Strobing
EV_StartLightStrobing(line);
xline->special = 0;
break;
case 19:
// Lower Floor
EV_DoFloor(line, FT_LOWER);
xline->special = 0;
break;
case 22:
// Raise floor to nearest height and change texture
EV_DoPlat(line, PT_RAISETONEARESTANDCHANGE, 0);
xline->special = 0;
break;
case 25:
// Ceiling Crush and Raise
EV_DoCeiling(line, CT_CRUSHANDRAISE);
xline->special = 0;
break;
case 30:
// Raise floor to shortest texture height
// on either side of lines.
EV_DoFloor(line, FT_RAISETOTEXTURE);
xline->special = 0;
break;
case 35:
// Lights Very Dark
EV_LightTurnOn(line, 35.0f/255.0f);
xline->special = 0;
break;
case 36:
// Lower Floor (TURBO)
EV_DoFloor(line, FT_LOWERTURBO);
xline->special = 0;
break;
case 37:
// LowerAndChange
EV_DoFloor(line, FT_LOWERANDCHANGE);
xline->special = 0;
break;
case 38:
// Lower Floor To Lowest
EV_DoFloor(line, FT_LOWERTOLOWEST);
xline->special = 0;
break;
case 39:
// TELEPORT!
EV_Teleport(line, side, thing, true);
xline->special = 0;
break;
case 40:
// RaiseCeilingLowerFloor
EV_DoCeiling(line, CT_RAISETOHIGHEST);
EV_DoFloor(line, FT_LOWERTOLOWEST);
xline->special = 0;
break;
case 44:
// Ceiling Crush
EV_DoCeiling(line, CT_LOWERANDCRUSH);
xline->special = 0;
break;
case 52:
// EXIT!
G_LeaveMap(G_GetNextMap(gameEpisode, gameMap, false), 0, false);
break;
case 53:
// Perpetual Platform Raise
EV_DoPlat(line, PT_PERPETUALRAISE, 0);
xline->special = 0;
break;
case 54:
// Platform Stop
P_PlatDeactivate(xline->tag);
xline->special = 0;
break;
case 56:
// Raise Floor Crush
EV_DoFloor(line, FT_RAISEFLOORCRUSH);
xline->special = 0;
break;
case 57:
// Ceiling Crush Stop
P_CeilingDeactivate(xline->tag);
xline->special = 0;
break;
case 58:
// Raise Floor 24
EV_DoFloor(line, FT_RAISE24);
xline->special = 0;
break;
case 59:
// Raise Floor 24 And Change
EV_DoFloor(line, FT_RAISE24ANDCHANGE);
xline->special = 0;
break;
case 104:
// Turn lights off in sector(tag)
EV_TurnTagLightsOff(line);
xline->special = 0;
break;
/*
// DJS - This stuff isn't in Heretic
case 108:
// Blazing Door Raise (faster than TURBO!)
EV_DoDoor(line, DT_BLAZERAISE);
xline->special = 0;
break;
case 109:
// Blazing Door Open (faster than TURBO!)
EV_DoDoor(line, DT_BLAZEOPEN);
xline->special = 0;
break;
case 100:
// Build Stairs Turbo 16
EV_BuildStairs(line, turbo16);
xline->special = 0;
break;
case 110:
// Blazing Door Close (faster than TURBO!)
EV_DoDoor(line, DT_BLAZECLOSE);
xline->special = 0;
break;
case 119:
// Raise floor to nearest surr. floor
EV_DoFloor(line, FT_RAISEFLOORTONEAREST);
xline->special = 0;
break;
case 121:
// Blazing PlatDownWaitUpStay
EV_DoPlat(line, PT_DOWNWAITUPSTAYBLAZE, 0);
xline->special = 0;
break;
*/
//case 124: // DJS - In Heretic, the secret exit is 105
case 105:
// Secret EXIT
G_LeaveMap(G_GetNextMap(gameEpisode, gameMap, true), 0, true);
break;
// DJS - Heretic has an additional stair build special
// that moves in steps of 16.
case 106:
// Build Stairs
EV_BuildStairs(line, build16);
xline->special = 0;
break;
/* // DJS - more specials that arn't in Heretic
case 125:
// TELEPORT MonsterONLY
if(!thing->player)
{
EV_Teleport(line, side, thing);
xline->special = 0;
}
break;
case 130:
// Raise Floor Turbo
EV_DoFloor(line, FT_RAISEFLOORTURBO);
xline->special = 0;
break;
case 141:
// Silent Ceiling Crush & Raise
EV_DoCeiling(line, CT_SILENTCRUSHANDRAISE);
xline->special = 0;
break;
*/
// RETRIGGERS. All from here till end.
case 72:
// Ceiling Crush
EV_DoCeiling(line, CT_LOWERANDCRUSH);
break;
case 73:
// Ceiling Crush and Raise
EV_DoCeiling(line, CT_CRUSHANDRAISE);
break;
case 74:
// Ceiling Crush Stop
P_CeilingDeactivate(xline->tag);
break;
case 75:
// Close Door
EV_DoDoor(line, DT_CLOSE);
break;
case 76:
// Close Door 30
EV_DoDoor(line, DT_CLOSE30THENOPEN);
break;
case 77:
// Fast Ceiling Crush & Raise
EV_DoCeiling(line, CT_CRUSHANDRAISEFAST);
break;
case 79:
// Lights Very Dark
EV_LightTurnOn(line, 35.0f/255.0f);
break;
case 80:
// Light Turn On - brightest near
EV_LightTurnOn(line, 0);
break;
case 81:
// Light Turn On 255
EV_LightTurnOn(line, 1);
break;
case 82:
// Lower Floor To Lowest
EV_DoFloor(line, FT_LOWERTOLOWEST);
break;
case 83:
// Lower Floor
EV_DoFloor(line, FT_LOWER);
break;
case 84:
// LowerAndChange
EV_DoFloor(line, FT_LOWERANDCHANGE);
break;
case 86:
// Open Door
EV_DoDoor(line, DT_OPEN);
break;
case 87:
// Perpetual Platform Raise
EV_DoPlat(line, PT_PERPETUALRAISE, 0);
break;
case 88:
// PlatDownWaitUp
EV_DoPlat(line, PT_DOWNWAITUPSTAY, 0);
break;
case 89:
// Platform Stop
P_PlatDeactivate(xline->tag);
break;
case 90:
// Raise Door
EV_DoDoor(line, DT_NORMAL);
break;
case 91:
// Raise Floor
EV_DoFloor(line, FT_RAISEFLOOR);
break;
case 92:
// Raise Floor 24
EV_DoFloor(line, FT_RAISE24);
break;
case 93:
// Raise Floor 24 And Change
EV_DoFloor(line, FT_RAISE24ANDCHANGE);
break;
case 94:
// Raise Floor Crush
EV_DoFloor(line, FT_RAISEFLOORCRUSH);
break;
case 95:
// Raise floor to nearest height
// and change texture.
EV_DoPlat(line, PT_RAISETONEARESTANDCHANGE, 0);
break;
case 96:
// Raise floor to shortest texture height
// on either side of lines.
EV_DoFloor(line, FT_RAISETOTEXTURE);
break;
case 97:
// TELEPORT!
EV_Teleport(line, side, thing, true);
break;
case 100:
// DJS - Heretic has one turbo door raise
EV_DoDoor(line, DT_BLAZEOPEN);
break;
/*
// DJS - Yet more specials not in Heretic
case 98:
// Lower Floor (TURBO)
EV_DoFloor(line, FT_LOWERTURBO);
break;
case 105:
// Blazing Door Raise (faster than TURBO!)
EV_DoDoor(line, DT_BLAZERAISE);
break;
case 106:
// Blazing Door Open (faster than TURBO!)
EV_DoDoor(line, DT_BLAZEOPEN);
break;
case 107:
// Blazing Door Close (faster than TURBO!)
EV_DoDoor(line, DT_BLAZECLOSE);
break;
case 120:
// Blazing PlatDownWaitUpStay.
EV_DoPlat(line, PT_DOWNWAITUPSTAYBLAZE, 0);
break;
case 126:
// TELEPORT MonsterONLY.
if(!thing->player)
EV_Teleport(line, side, thing);
break;
case 128:
// Raise To Nearest Floor
EV_DoFloor(line, FT_RAISEFLOORTONEAREST);
break;
case 129:
// Raise Floor Turbo
EV_DoFloor(line, FT_RAISEFLOORTURBO);
break;
*/
}
}
/**
* Called when a thing shoots a special line.
*/
static void P_ShootSpecialLine(mobj_t* thing, linedef_t* line)
{
xline_t* xline = P_ToXLine(line);
// Impacts that other things can activate.
if(!thing->player)
{
switch(xline->special)
{
case 46:
// OPEN DOOR IMPACT
break;
default:
return;
}
}
switch(xline->special)
{
case 24:
// RAISE FLOOR
EV_DoFloor(line, FT_RAISEFLOOR);
P_ToggleSwitch(P_GetPtrp(line, DMU_SIDEDEF0), SFX_NONE, false, 0);
xline->special = 0;
break;
case 46:
// OPEN DOOR
EV_DoDoor(line, DT_OPEN);
P_ToggleSwitch(P_GetPtrp(line, DMU_SIDEDEF0), SFX_NONE, false, BUTTONTIME);
break;
case 47:
// RAISE FLOOR NEAR AND CHANGE
EV_DoPlat(line, PT_RAISETONEARESTANDCHANGE, 0);
P_ToggleSwitch(P_GetPtrp(line, DMU_SIDEDEF0), SFX_NONE, false, 0);
xline->special = 0;
break;
default:
break;
}
}
/**
* Called every tic frame that the player origin is in a special sector.
*/
void P_PlayerInSpecialSector(player_t *player)
{