aboutsummaryrefslogtreecommitdiff
path: root/src/p_switch.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/p_switch.c')
-rw-r--r--src/p_switch.c1150
1 files changed, 1150 insertions, 0 deletions
diff --git a/src/p_switch.c b/src/p_switch.c
new file mode 100644
index 0000000..7dfb2f9
--- /dev/null
+++ b/src/p_switch.c
@@ -0,0 +1,1150 @@
1/* Emacs style mode select -*- C++ -*-
2 *-----------------------------------------------------------------------------
3 *
4 *
5 * PrBoom: a Doom port merged with LxDoom and LSDLDoom
6 * based on BOOM, a modified and improved DOOM engine
7 * Copyright (C) 1999 by
8 * id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
9 * Copyright (C) 1999-2000 by
10 * Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
11 * Copyright 2005, 2006 by
12 * Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
13 *
14 * This program is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU General Public License
16 * as published by the Free Software Foundation; either version 2
17 * of the License, or (at your option) any later version.
18 *
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, write to the Free Software
26 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
27 * 02111-1307, USA.
28 *
29 * DESCRIPTION:
30 * Switches, buttons. Two-state animation. Exits.
31 *
32 *-----------------------------------------------------------------------------*/
33
34#include "doomstat.h"
35#include "w_wad.h"
36#include "r_main.h"
37#include "p_spec.h"
38#include "g_game.h"
39#include "s_sound.h"
40#include "sounds.h"
41#include "lprintf.h"
42
43// killough 2/8/98: Remove switch limit
44
45static int *switchlist; // killough
46static int max_numswitches; // killough
47static int numswitches; // killough
48
49button_t buttonlist[MAXBUTTONS];
50
51//
52// P_InitSwitchList()
53//
54// Only called at game initialization in order to list the set of switches
55// and buttons known to the engine. This enables their texture to change
56// when activated, and in the case of buttons, change back after a timeout.
57//
58// This routine modified to read its data from a predefined lump or
59// PWAD lump called SWITCHES rather than a static table in this module to
60// allow wad designers to insert or modify switches.
61//
62// Lump format is an array of byte packed switchlist_t structures, terminated
63// by a structure with episode == -0. The lump can be generated from a
64// text source file using SWANTBLS.EXE, distributed with the BOOM utils.
65// The standard list of switches and animations is contained in the example
66// source text file DEFSWANI.DAT also in the BOOM util distribution.
67//
68// Rewritten by Lee Killough to remove limit 2/8/98
69//
70void P_InitSwitchList(void)
71{
72 int i, index = 0;
73 int episode = (gamemode == registered || gamemode==retail) ?
74 2 : gamemode == commercial ? 3 : 1;
75 const switchlist_t *alphSwitchList; //jff 3/23/98 pointer to switch table
76 int lump = W_GetNumForName("SWITCHES"); // cph - new wad lump handling
77
78 //jff 3/23/98 read the switch table from a predefined lump
79 alphSwitchList = (const switchlist_t *)W_CacheLumpNum(lump);
80
81 for (i=0;;i++)
82 {
83 if (index+1 >= max_numswitches)
84 switchlist = realloc(switchlist, sizeof *switchlist *
85 (max_numswitches = max_numswitches ? max_numswitches*2 : 8));
86 if (SHORT(alphSwitchList[i].episode) <= episode) //jff 5/11/98 endianess
87 {
88 int texture1, texture2;
89
90 if (!SHORT(alphSwitchList[i].episode))
91 break;
92
93 // Ignore switches referencing unknown texture names, instead of exiting.
94 // Warn if either one is missing, but only add if both are valid.
95 texture1 = R_CheckTextureNumForName(alphSwitchList[i].name1);
96 if (texture1 == -1)
97 lprintf(LO_WARN, "P_InitSwitchList: unknown texture %s\n",
98 alphSwitchList[i].name1);
99 texture2 = R_CheckTextureNumForName(alphSwitchList[i].name2);
100 if (texture2 == -1)
101 lprintf(LO_WARN, "P_InitSwitchList: unknown texture %s\n",
102 alphSwitchList[i].name2);
103 if (texture1 != -1 && texture2 != -1) {
104 switchlist[index++] = texture1;
105 switchlist[index++] = texture2;
106 }
107 }
108 }
109
110 numswitches = index/2;
111 switchlist[index] = -1;
112 W_UnlockLumpNum(lump);
113}
114
115//
116// P_StartButton()
117//
118// Start a button (retriggerable switch) counting down till it turns off.
119//
120// Passed the linedef the button is on, which texture on the sidedef contains
121// the button, the texture number of the button, and the time the button is
122// to remain active in gametics.
123// No return.
124//
125static void P_StartButton
126( line_t* line,
127 bwhere_e w,
128 int texture,
129 int time )
130{
131 int i;
132
133 // See if button is already pressed
134 for (i = 0;i < MAXBUTTONS;i++)
135 if (buttonlist[i].btimer && buttonlist[i].line == line)
136 return;
137
138 for (i = 0;i < MAXBUTTONS;i++)
139 if (!buttonlist[i].btimer) // use first unused element of list
140 {
141 buttonlist[i].line = line;
142 buttonlist[i].where = w;
143 buttonlist[i].btexture = texture;
144 buttonlist[i].btimer = time;
145 /* use sound origin of line itself - no need to compatibility-wrap
146 * as the popout code gets it wrong whatever its value */
147 buttonlist[i].soundorg = (mobj_t *)&line->soundorg;
148 return;
149 }
150
151 I_Error("P_StartButton: no button slots left!");
152}
153
154//
155// P_ChangeSwitchTexture()
156//
157// Function that changes switch wall texture on activation.
158//
159// Passed the line which the switch is on, and whether its retriggerable.
160// If not retriggerable, this function clears the line special to insure that
161//
162// No return
163//
164void P_ChangeSwitchTexture
165( line_t* line,
166 int useAgain )
167{
168 /* Rearranged a bit to avoid too much code duplication */
169 mobj_t *soundorg;
170 int i, sound;
171 short *texture, *ttop, *tmid, *tbot;
172 bwhere_e position;
173
174 ttop = &sides[line->sidenum[0]].toptexture;
175 tmid = &sides[line->sidenum[0]].midtexture;
176 tbot = &sides[line->sidenum[0]].bottomtexture;
177
178 sound = sfx_swtchn;
179 /* use the sound origin of the linedef (its midpoint)
180 * unless in a compatibility mode */
181 soundorg = (mobj_t *)&line->soundorg;
182 if (comp[comp_sound] || compatibility_level < prboom_6_compatibility) {
183 /* usually NULL, unless there is another button already pressed in,
184 * in which case it's the sound origin of that button press... */
185 soundorg = buttonlist->soundorg;
186 } else {
187 // EXIT SWITCH?
188 /* don't do this unless you're in a compatibility mode */
189 // proff - this works as advertised, but I don't like the sound
190 // if (line->special == 11 || line->special == 51) // exit or secret exit
191 // sound = sfx_swtchx;
192 }
193
194 /* don't zero line->special until after exit switch test */
195 if (!useAgain)
196 line->special = 0;
197
198 /* search for a texture to change */
199 texture = NULL; position = 0;
200 for (i = 0;i < numswitches*2;i++) { /* this could be more efficient... */
201 if (switchlist[i] == *ttop) {
202 texture = ttop; position = top; break;
203 } else if (switchlist[i] == *tmid) {
204 texture = tmid; position = middle; break;
205 } else if (switchlist[i] == *tbot) {
206 texture = tbot; position = bottom; break;
207 }
208 }
209 if (texture == NULL)
210 return; /* no switch texture was found to change */
211 *texture = switchlist[i^1];
212
213 S_StartSound(soundorg, sound);
214
215 if (useAgain)
216 P_StartButton(line, position, switchlist[i], BUTTONTIME);
217}
218
219
220//
221// P_UseSpecialLine
222//
223//
224// Called when a thing uses (pushes) a special line.
225// Only the front sides of lines are usable.
226// Dispatches to the appropriate linedef function handler.
227//
228// Passed the thing using the line, the line being used, and the side used
229// Returns true if a thinker was created
230//
231boolean
232P_UseSpecialLine
233( mobj_t* thing,
234 line_t* line,
235 int side )
236{
237
238 // e6y
239 // b.m. side test was broken in boom201
240 if ((demoplayback ? (demover != 201) : (compatibility_level != boom_201_compatibility)))
241 if (side) //jff 6/1/98 fix inadvertent deletion of side test
242 return false;
243
244 //jff 02/04/98 add check here for generalized floor/ceil mover
245 if (!demo_compatibility)
246 {
247 // pointer to line function is NULL by default, set non-null if
248 // line special is push or switch generalized linedef type
249 int (*linefunc)(line_t *line)=NULL;
250
251 // check each range of generalized linedefs
252 if ((unsigned)line->special >= GenEnd)
253 {
254 // Out of range for GenFloors
255 }
256 else if ((unsigned)line->special >= GenFloorBase)
257 {
258 if (!thing->player)
259 if ((line->special & FloorChange) || !(line->special & FloorModel))
260 return false; // FloorModel is "Allow Monsters" if FloorChange is 0
261 if (!line->tag && ((line->special&6)!=6)) //jff 2/27/98 all non-manual
262 return false; // generalized types require tag
263 linefunc = EV_DoGenFloor;
264 }
265 else if ((unsigned)line->special >= GenCeilingBase)
266 {
267 if (!thing->player)
268 if ((line->special & CeilingChange) || !(line->special & CeilingModel))
269 return false; // CeilingModel is "Allow Monsters" if CeilingChange is 0
270 if (!line->tag && ((line->special&6)!=6)) //jff 2/27/98 all non-manual
271 return false; // generalized types require tag
272 linefunc = EV_DoGenCeiling;
273 }
274 else if ((unsigned)line->special >= GenDoorBase)
275 {
276 if (!thing->player)
277 {
278 if (!(line->special & DoorMonster))
279 return false; // monsters disallowed from this door
280 if (line->flags & ML_SECRET) // they can't open secret doors either
281 return false;
282 }
283 if (!line->tag && ((line->special&6)!=6)) //jff 3/2/98 all non-manual
284 return false; // generalized types require tag
285 linefunc = EV_DoGenDoor;
286 }
287 else if ((unsigned)line->special >= GenLockedBase)
288 {
289 if (!thing->player)
290 return false; // monsters disallowed from unlocking doors
291 if (!P_CanUnlockGenDoor(line,thing->player))
292 return false;
293 if (!line->tag && ((line->special&6)!=6)) //jff 2/27/98 all non-manual
294 return false; // generalized types require tag
295
296 linefunc = EV_DoGenLockedDoor;
297 }
298 else if ((unsigned)line->special >= GenLiftBase)
299 {
300 if (!thing->player)
301 if (!(line->special & LiftMonster))
302 return false; // monsters disallowed
303 if (!line->tag && ((line->special&6)!=6)) //jff 2/27/98 all non-manual
304 return false; // generalized types require tag
305 linefunc = EV_DoGenLift;
306 }
307 else if ((unsigned)line->special >= GenStairsBase)
308 {
309 if (!thing->player)
310 if (!(line->special & StairMonster))
311 return false; // monsters disallowed
312 if (!line->tag && ((line->special&6)!=6)) //jff 2/27/98 all non-manual
313 return false; // generalized types require tag
314 linefunc = EV_DoGenStairs;
315 }
316 else if ((unsigned)line->special >= GenCrusherBase)
317 {
318 if (!thing->player)
319 if (!(line->special & CrusherMonster))
320 return false; // monsters disallowed
321 if (!line->tag && ((line->special&6)!=6)) //jff 2/27/98 all non-manual
322 return false; // generalized types require tag
323 linefunc = EV_DoGenCrusher;
324 }
325
326 if (linefunc)
327 switch((line->special & TriggerType) >> TriggerTypeShift)
328 {
329 case PushOnce:
330 if (!side)
331 if (linefunc(line))
332 line->special = 0;
333 return true;
334 case PushMany:
335 if (!side)
336 linefunc(line);
337 return true;
338 case SwitchOnce:
339 if (linefunc(line))
340 P_ChangeSwitchTexture(line,0);
341 return true;
342 case SwitchMany:
343 if (linefunc(line))
344 P_ChangeSwitchTexture(line,1);
345 return true;
346 default: // if not a switch/push type, do nothing here
347 return false;
348 }
349 }
350
351 // Switches that other things can activate.
352 if (!thing->player)
353 {
354 // never open secret doors
355 if (line->flags & ML_SECRET)
356 return false;
357
358 switch(line->special)
359 {
360 case 1: // MANUAL DOOR RAISE
361 case 32: // MANUAL BLUE
362 case 33: // MANUAL RED
363 case 34: // MANUAL YELLOW
364 //jff 3/5/98 add ability to use teleporters for monsters
365 case 195: // switch teleporters
366 case 174:
367 case 210: // silent switch teleporters
368 case 209:
369 break;
370
371 default:
372 return false;
373 break;
374 }
375 }
376
377 if (!P_CheckTag(line)) //jff 2/27/98 disallow zero tag on some types
378 return false;
379
380 // Dispatch to handler according to linedef type
381 switch (line->special)
382 {
383 // Manual doors, push type with no tag
384 case 1: // Vertical Door
385 case 26: // Blue Door/Locked
386 case 27: // Yellow Door /Locked
387 case 28: // Red Door /Locked
388
389 case 31: // Manual door open
390 case 32: // Blue locked door open
391 case 33: // Red locked door open
392 case 34: // Yellow locked door open
393
394 case 117: // Blazing door raise
395 case 118: // Blazing door open
396 EV_VerticalDoor (line, thing);
397 break;
398
399 // Switches (non-retriggerable)
400 case 7:
401 // Build Stairs
402 if (EV_BuildStairs(line,build8))
403 P_ChangeSwitchTexture(line,0);
404 break;
405
406 case 9:
407 // Change Donut
408 if (EV_DoDonut(line))
409 P_ChangeSwitchTexture(line,0);
410 break;
411
412 case 11:
413 /* Exit level
414 * killough 10/98: prevent zombies from exiting levels
415 */
416 if (thing->player && thing->player->health <= 0 && !comp[comp_zombie])
417 {
418 S_StartSound(thing, sfx_noway);
419 return false;
420 }
421
422 P_ChangeSwitchTexture(line,0);
423 G_ExitLevel ();
424 break;
425
426 case 14:
427 // Raise Floor 32 and change texture
428 if (EV_DoPlat(line,raiseAndChange,32))
429 P_ChangeSwitchTexture(line,0);
430 break;
431
432 case 15:
433 // Raise Floor 24 and change texture
434 if (EV_DoPlat(line,raiseAndChange,24))
435 P_ChangeSwitchTexture(line,0);
436 break;
437
438 case 18:
439 // Raise Floor to next highest floor
440 if (EV_DoFloor(line, raiseFloorToNearest))
441 P_ChangeSwitchTexture(line,0);
442 break;
443
444 case 20:
445 // Raise Plat next highest floor and change texture
446 if (EV_DoPlat(line,raiseToNearestAndChange,0))
447 P_ChangeSwitchTexture(line,0);
448 break;
449
450 case 21:
451 // PlatDownWaitUpStay
452 if (EV_DoPlat(line,downWaitUpStay,0))
453 P_ChangeSwitchTexture(line,0);
454 break;
455
456 case 23:
457 // Lower Floor to Lowest
458 if (EV_DoFloor(line,lowerFloorToLowest))
459 P_ChangeSwitchTexture(line,0);
460 break;
461
462 case 29:
463 // Raise Door
464 if (EV_DoDoor(line,normal))
465 P_ChangeSwitchTexture(line,0);
466 break;
467
468 case 41:
469 // Lower Ceiling to Floor
470 if (EV_DoCeiling(line,lowerToFloor))
471 P_ChangeSwitchTexture(line,0);
472 break;
473
474 case 71:
475 // Turbo Lower Floor
476 if (EV_DoFloor(line,turboLower))
477 P_ChangeSwitchTexture(line,0);
478 break;
479
480 case 49:
481 // Ceiling Crush And Raise
482 if (EV_DoCeiling(line,crushAndRaise))
483 P_ChangeSwitchTexture(line,0);
484 break;
485
486 case 50:
487 // Close Door
488 if (EV_DoDoor(line,close))
489 P_ChangeSwitchTexture(line,0);
490 break;
491
492 case 51:
493 /* Secret EXIT
494 * killough 10/98: prevent zombies from exiting levels
495 */
496 if (thing->player && thing->player->health <= 0 && !comp[comp_zombie])
497 {
498 S_StartSound(thing, sfx_noway);
499 return false;
500 }
501
502 P_ChangeSwitchTexture(line,0);
503 G_SecretExitLevel ();
504 break;
505
506 case 55:
507 // Raise Floor Crush
508 if (EV_DoFloor(line,raiseFloorCrush))
509 P_ChangeSwitchTexture(line,0);
510 break;
511
512 case 101:
513 // Raise Floor
514 if (EV_DoFloor(line,raiseFloor))
515 P_ChangeSwitchTexture(line,0);
516 break;
517
518 case 102:
519 // Lower Floor to Surrounding floor height
520 if (EV_DoFloor(line,lowerFloor))
521 P_ChangeSwitchTexture(line,0);
522 break;
523
524 case 103:
525 // Open Door
526 if (EV_DoDoor(line,open))
527 P_ChangeSwitchTexture(line,0);
528 break;
529
530 case 111:
531 // Blazing Door Raise (faster than TURBO!)
532 if (EV_DoDoor (line,blazeRaise))
533 P_ChangeSwitchTexture(line,0);
534 break;
535
536 case 112:
537 // Blazing Door Open (faster than TURBO!)
538 if (EV_DoDoor (line,blazeOpen))
539 P_ChangeSwitchTexture(line,0);
540 break;
541
542 case 113:
543 // Blazing Door Close (faster than TURBO!)
544 if (EV_DoDoor (line,blazeClose))
545 P_ChangeSwitchTexture(line,0);
546 break;
547
548 case 122:
549 // Blazing PlatDownWaitUpStay
550 if (EV_DoPlat(line,blazeDWUS,0))
551 P_ChangeSwitchTexture(line,0);
552 break;
553
554 case 127:
555 // Build Stairs Turbo 16
556 if (EV_BuildStairs(line,turbo16))
557 P_ChangeSwitchTexture(line,0);
558 break;
559
560 case 131:
561 // Raise Floor Turbo
562 if (EV_DoFloor(line,raiseFloorTurbo))
563 P_ChangeSwitchTexture(line,0);
564 break;
565
566 case 133:
567 // BlzOpenDoor BLUE
568 case 135:
569 // BlzOpenDoor RED
570 case 137:
571 // BlzOpenDoor YELLOW
572 if (EV_DoLockedDoor (line,blazeOpen,thing))
573 P_ChangeSwitchTexture(line,0);
574 break;
575
576 case 140:
577 // Raise Floor 512
578 if (EV_DoFloor(line,raiseFloor512))
579 P_ChangeSwitchTexture(line,0);
580 break;
581
582 // killough 1/31/98: factored out compatibility check;
583 // added inner switch, relaxed check to demo_compatibility
584
585 default:
586 if (!demo_compatibility)
587 switch (line->special)
588 {
589 //jff 1/29/98 added linedef types to fill all functions out so that
590 // all possess SR, S1, WR, W1 types
591
592 case 158:
593 // Raise Floor to shortest lower texture
594 // 158 S1 EV_DoFloor(raiseToTexture), CSW(0)
595 if (EV_DoFloor(line,raiseToTexture))
596 P_ChangeSwitchTexture(line,0);
597 break;
598
599 case 159:
600 // Raise Floor to shortest lower texture
601 // 159 S1 EV_DoFloor(lowerAndChange)
602 if (EV_DoFloor(line,lowerAndChange))
603 P_ChangeSwitchTexture(line,0);
604 break;
605
606 case 160:
607 // Raise Floor 24 and change
608 // 160 S1 EV_DoFloor(raiseFloor24AndChange)
609 if (EV_DoFloor(line,raiseFloor24AndChange))
610 P_ChangeSwitchTexture(line,0);
611 break;
612
613 case 161:
614 // Raise Floor 24
615 // 161 S1 EV_DoFloor(raiseFloor24)
616 if (EV_DoFloor(line,raiseFloor24))
617 P_ChangeSwitchTexture(line,0);
618 break;
619
620 case 162:
621 // Moving floor min n to max n
622 // 162 S1 EV_DoPlat(perpetualRaise,0)
623 if (EV_DoPlat(line,perpetualRaise,0))
624 P_ChangeSwitchTexture(line,0);
625 break;
626
627 case 163:
628 // Stop Moving floor
629 // 163 S1 EV_DoPlat(perpetualRaise,0)
630 EV_StopPlat(line);
631 P_ChangeSwitchTexture(line,0);
632 break;
633
634 case 164:
635 // Start fast crusher
636 // 164 S1 EV_DoCeiling(fastCrushAndRaise)
637 if (EV_DoCeiling(line,fastCrushAndRaise))
638 P_ChangeSwitchTexture(line,0);
639 break;
640
641 case 165:
642 // Start slow silent crusher
643 // 165 S1 EV_DoCeiling(silentCrushAndRaise)
644 if (EV_DoCeiling(line,silentCrushAndRaise))
645 P_ChangeSwitchTexture(line,0);
646 break;
647
648 case 166:
649 // Raise ceiling, Lower floor
650 // 166 S1 EV_DoCeiling(raiseToHighest), EV_DoFloor(lowerFloortoLowest)
651 if (EV_DoCeiling(line, raiseToHighest) ||
652 EV_DoFloor(line, lowerFloorToLowest))
653 P_ChangeSwitchTexture(line,0);
654 break;
655
656 case 167:
657 // Lower floor and Crush
658 // 167 S1 EV_DoCeiling(lowerAndCrush)
659 if (EV_DoCeiling(line, lowerAndCrush))
660 P_ChangeSwitchTexture(line,0);
661 break;
662
663 case 168:
664 // Stop crusher
665 // 168 S1 EV_CeilingCrushStop()
666 if (EV_CeilingCrushStop(line))
667 P_ChangeSwitchTexture(line,0);
668 break;
669
670 case 169:
671 // Lights to brightest neighbor sector
672 // 169 S1 EV_LightTurnOn(0)
673 EV_LightTurnOn(line,0);
674 P_ChangeSwitchTexture(line,0);
675 break;
676
677 case 170:
678 // Lights to near dark
679 // 170 S1 EV_LightTurnOn(35)
680 EV_LightTurnOn(line,35);
681 P_ChangeSwitchTexture(line,0);
682 break;
683
684 case 171:
685 // Lights on full
686 // 171 S1 EV_LightTurnOn(255)
687 EV_LightTurnOn(line,255);
688 P_ChangeSwitchTexture(line,0);
689 break;
690
691 case 172:
692 // Start Lights Strobing
693 // 172 S1 EV_StartLightStrobing()
694 EV_StartLightStrobing(line);
695 P_ChangeSwitchTexture(line,0);
696 break;
697
698 case 173:
699 // Lights to Dimmest Near
700 // 173 S1 EV_TurnTagLightsOff()
701 EV_TurnTagLightsOff(line);
702 P_ChangeSwitchTexture(line,0);
703 break;
704
705 case 174:
706 // Teleport
707 // 174 S1 EV_Teleport(side,thing)
708 if (EV_Teleport(line,side,thing))
709 P_ChangeSwitchTexture(line,0);
710 break;
711
712 case 175:
713 // Close Door, Open in 30 secs
714 // 175 S1 EV_DoDoor(close30ThenOpen)
715 if (EV_DoDoor(line,close30ThenOpen))
716 P_ChangeSwitchTexture(line,0);
717 break;
718
719 case 189: //jff 3/15/98 create texture change no motion type
720 // Texture Change Only (Trigger)
721 // 189 S1 Change Texture/Type Only
722 if (EV_DoChange(line,trigChangeOnly))
723 P_ChangeSwitchTexture(line,0);
724 break;
725
726 case 203:
727 // Lower ceiling to lowest surrounding ceiling
728 // 203 S1 EV_DoCeiling(lowerToLowest)
729 if (EV_DoCeiling(line,lowerToLowest))
730 P_ChangeSwitchTexture(line,0);
731 break;
732
733 case 204:
734 // Lower ceiling to highest surrounding floor
735 // 204 S1 EV_DoCeiling(lowerToMaxFloor)
736 if (EV_DoCeiling(line,lowerToMaxFloor))
737 P_ChangeSwitchTexture(line,0);
738 break;
739
740 case 209:
741 // killough 1/31/98: silent teleporter
742 //jff 209 S1 SilentTeleport
743 if (EV_SilentTeleport(line, side, thing))
744 P_ChangeSwitchTexture(line,0);
745 break;
746
747 case 241: //jff 3/15/98 create texture change no motion type
748 // Texture Change Only (Numeric)
749 // 241 S1 Change Texture/Type Only
750 if (EV_DoChange(line,numChangeOnly))
751 P_ChangeSwitchTexture(line,0);
752 break;
753
754 case 221:
755 // Lower floor to next lowest floor
756 // 221 S1 Lower Floor To Nearest Floor
757 if (EV_DoFloor(line,lowerFloorToNearest))
758 P_ChangeSwitchTexture(line,0);
759 break;
760
761 case 229:
762 // Raise elevator next floor
763 // 229 S1 Raise Elevator next floor
764 if (EV_DoElevator(line,elevateUp))
765 P_ChangeSwitchTexture(line,0);
766 break;
767
768 case 233:
769 // Lower elevator next floor
770 // 233 S1 Lower Elevator next floor
771 if (EV_DoElevator(line,elevateDown))
772 P_ChangeSwitchTexture(line,0);
773 break;
774
775 case 237:
776 // Elevator to current floor
777 // 237 S1 Elevator to current floor
778 if (EV_DoElevator(line,elevateCurrent))
779 P_ChangeSwitchTexture(line,0);
780 break;
781
782
783 // jff 1/29/98 end of added S1 linedef types
784
785 //jff 1/29/98 added linedef types to fill all functions out so that
786 // all possess SR, S1, WR, W1 types
787
788 case 78: //jff 3/15/98 create texture change no motion type
789 // Texture Change Only (Numeric)
790 // 78 SR Change Texture/Type Only
791 if (EV_DoChange(line,numChangeOnly))
792 P_ChangeSwitchTexture(line,1);
793 break;
794
795 case 176:
796 // Raise Floor to shortest lower texture
797 // 176 SR EV_DoFloor(raiseToTexture), CSW(1)
798 if (EV_DoFloor(line,raiseToTexture))
799 P_ChangeSwitchTexture(line,1);
800 break;
801
802 case 177:
803 // Raise Floor to shortest lower texture
804 // 177 SR EV_DoFloor(lowerAndChange)
805 if (EV_DoFloor(line,lowerAndChange))
806 P_ChangeSwitchTexture(line,1);
807 break;
808
809 case 178:
810 // Raise Floor 512
811 // 178 SR EV_DoFloor(raiseFloor512)
812 if (EV_DoFloor(line,raiseFloor512))
813 P_ChangeSwitchTexture(line,1);
814 break;
815
816 case 179:
817 // Raise Floor 24 and change
818 // 179 SR EV_DoFloor(raiseFloor24AndChange)
819 if (EV_DoFloor(line,raiseFloor24AndChange))
820 P_ChangeSwitchTexture(line,1);
821 break;
822
823 case 180:
824 // Raise Floor 24
825 // 180 SR EV_DoFloor(raiseFloor24)
826 if (EV_DoFloor(line,raiseFloor24))
827 P_ChangeSwitchTexture(line,1);
828 break;
829
830 case 181:
831 // Moving floor min n to max n
832 // 181 SR EV_DoPlat(perpetualRaise,0)
833
834 EV_DoPlat(line,perpetualRaise,0);
835 P_ChangeSwitchTexture(line,1);
836 break;
837
838 case 182:
839 // Stop Moving floor
840 // 182 SR EV_DoPlat(perpetualRaise,0)
841 EV_StopPlat(line);
842 P_ChangeSwitchTexture(line,1);
843 break;
844
845 case 183:
846 // Start fast crusher
847 // 183 SR EV_DoCeiling(fastCrushAndRaise)
848 if (EV_DoCeiling(line,fastCrushAndRaise))
849 P_ChangeSwitchTexture(line,1);
850 break;
851
852 case 184:
853 // Start slow crusher
854 // 184 SR EV_DoCeiling(crushAndRaise)
855 if (EV_DoCeiling(line,crushAndRaise))
856 P_ChangeSwitchTexture(line,1);
857 break;
858
859 case 185:
860 // Start slow silent crusher
861 // 185 SR EV_DoCeiling(silentCrushAndRaise)
862 if (EV_DoCeiling(line,silentCrushAndRaise))
863 P_ChangeSwitchTexture(line,1);
864 break;
865
866 case 186:
867 // Raise ceiling, Lower floor
868 // 186 SR EV_DoCeiling(raiseToHighest), EV_DoFloor(lowerFloortoLowest)
869 if (EV_DoCeiling(line, raiseToHighest) ||
870 EV_DoFloor(line, lowerFloorToLowest))
871 P_ChangeSwitchTexture(line,1);
872 break;
873
874 case 187:
875 // Lower floor and Crush
876 // 187 SR EV_DoCeiling(lowerAndCrush)
877 if (EV_DoCeiling(line, lowerAndCrush))
878 P_ChangeSwitchTexture(line,1);
879 break;
880
881 case 188:
882 // Stop crusher
883 // 188 SR EV_CeilingCrushStop()
884 if (EV_CeilingCrushStop(line))
885 P_ChangeSwitchTexture(line,1);
886 break;
887
888 case 190: //jff 3/15/98 create texture change no motion type
889 // Texture Change Only (Trigger)
890 // 190 SR Change Texture/Type Only
891 if (EV_DoChange(line,trigChangeOnly))
892 P_ChangeSwitchTexture(line,1);
893 break;
894
895 case 191:
896 // Lower Pillar, Raise Donut
897 // 191 SR EV_DoDonut()
898 if (EV_DoDonut(line))
899 P_ChangeSwitchTexture(line,1);
900 break;
901
902 case 192:
903 // Lights to brightest neighbor sector
904 // 192 SR EV_LightTurnOn(0)
905 EV_LightTurnOn(line,0);
906 P_ChangeSwitchTexture(line,1);
907 break;
908
909 case 193:
910 // Start Lights Strobing
911 // 193 SR EV_StartLightStrobing()
912 EV_StartLightStrobing(line);
913 P_ChangeSwitchTexture(line,1);
914 break;
915
916 case 194:
917 // Lights to Dimmest Near
918 // 194 SR EV_TurnTagLightsOff()
919 EV_TurnTagLightsOff(line);
920 P_ChangeSwitchTexture(line,1);
921 break;
922
923 case 195:
924 // Teleport
925 // 195 SR EV_Teleport(side,thing)
926 if (EV_Teleport(line,side,thing))
927 P_ChangeSwitchTexture(line,1);
928 break;
929
930 case 196:
931 // Close Door, Open in 30 secs
932 // 196 SR EV_DoDoor(close30ThenOpen)
933 if (EV_DoDoor(line,close30ThenOpen))
934 P_ChangeSwitchTexture(line,1);
935 break;
936
937 case 205:
938 // Lower ceiling to lowest surrounding ceiling
939 // 205 SR EV_DoCeiling(lowerToLowest)
940 if (EV_DoCeiling(line,lowerToLowest))
941 P_ChangeSwitchTexture(line,1);
942 break;
943
944 case 206:
945 // Lower ceiling to highest surrounding floor
946 // 206 SR EV_DoCeiling(lowerToMaxFloor)
947 if (EV_DoCeiling(line,lowerToMaxFloor))
948 P_ChangeSwitchTexture(line,1);
949 break;
950
951 case 210:
952 // killough 1/31/98: silent teleporter
953 //jff 210 SR SilentTeleport
954 if (EV_SilentTeleport(line, side, thing))
955 P_ChangeSwitchTexture(line,1);
956 break;
957
958 case 211: //jff 3/14/98 create instant toggle floor type
959 // Toggle Floor Between C and F Instantly
960 // 211 SR Toggle Floor Instant
961 if (EV_DoPlat(line,toggleUpDn,0))
962 P_ChangeSwitchTexture(line,1);
963 break;
964
965 case 222:
966 // Lower floor to next lowest floor
967 // 222 SR Lower Floor To Nearest Floor
968 if (EV_DoFloor(line,lowerFloorToNearest))
969 P_ChangeSwitchTexture(line,1);
970 break;
971
972 case 230:
973 // Raise elevator next floor
974 // 230 SR Raise Elevator next floor
975 if (EV_DoElevator(line,elevateUp))
976 P_ChangeSwitchTexture(line,1);
977 break;
978
979 case 234:
980 // Lower elevator next floor
981 // 234 SR Lower Elevator next floor
982 if (EV_DoElevator(line,elevateDown))
983 P_ChangeSwitchTexture(line,1);
984 break;
985
986 case 238:
987 // Elevator to current floor
988 // 238 SR Elevator to current floor
989 if (EV_DoElevator(line,elevateCurrent))
990 P_ChangeSwitchTexture(line,1);
991 break;
992
993 case 258:
994 // Build stairs, step 8
995 // 258 SR EV_BuildStairs(build8)
996 if (EV_BuildStairs(line,build8))
997 P_ChangeSwitchTexture(line,1);
998 break;
999
1000 case 259:
1001 // Build stairs, step 16
1002 // 259 SR EV_BuildStairs(turbo16)
1003 if (EV_BuildStairs(line,turbo16))
1004 P_ChangeSwitchTexture(line,1);
1005 break;
1006
1007 // 1/29/98 jff end of added SR linedef types
1008
1009 }
1010 break;
1011
1012 // Buttons (retriggerable switches)
1013 case 42:
1014 // Close Door
1015 if (EV_DoDoor(line,close))
1016 P_ChangeSwitchTexture(line,1);
1017 break;
1018
1019 case 43:
1020 // Lower Ceiling to Floor
1021 if (EV_DoCeiling(line,lowerToFloor))
1022 P_ChangeSwitchTexture(line,1);
1023 break;
1024
1025 case 45:
1026 // Lower Floor to Surrounding floor height
1027 if (EV_DoFloor(line,lowerFloor))
1028 P_ChangeSwitchTexture(line,1);
1029 break;
1030
1031 case 60:
1032 // Lower Floor to Lowest
1033 if (EV_DoFloor(line,lowerFloorToLowest))
1034 P_ChangeSwitchTexture(line,1);
1035 break;
1036
1037 case 61:
1038 // Open Door
1039 if (EV_DoDoor(line,open))
1040 P_ChangeSwitchTexture(line,1);
1041 break;
1042
1043 case 62:
1044 // PlatDownWaitUpStay
1045 if (EV_DoPlat(line,downWaitUpStay,1))
1046 P_ChangeSwitchTexture(line,1);
1047 break;
1048
1049 case 63:
1050 // Raise Door
1051 if (EV_DoDoor(line,normal))
1052 P_ChangeSwitchTexture(line,1);
1053 break;
1054
1055 case 64:
1056 // Raise Floor to ceiling
1057 if (EV_DoFloor(line,raiseFloor))
1058 P_ChangeSwitchTexture(line,1);
1059 break;
1060
1061 case 66:
1062 // Raise Floor 24 and change texture
1063 if (EV_DoPlat(line,raiseAndChange,24))
1064 P_ChangeSwitchTexture(line,1);
1065 break;
1066
1067 case 67:
1068 // Raise Floor 32 and change texture
1069 if (EV_DoPlat(line,raiseAndChange,32))
1070 P_ChangeSwitchTexture(line,1);
1071 break;
1072
1073 case 65:
1074 // Raise Floor Crush
1075 if (EV_DoFloor(line,raiseFloorCrush))
1076 P_ChangeSwitchTexture(line,1);
1077 break;
1078
1079 case 68:
1080 // Raise Plat to next highest floor and change texture
1081 if (EV_DoPlat(line,raiseToNearestAndChange,0))
1082 P_ChangeSwitchTexture(line,1);
1083 break;
1084
1085 case 69:
1086 // Raise Floor to next highest floor
1087 if (EV_DoFloor(line, raiseFloorToNearest))
1088 P_ChangeSwitchTexture(line,1);
1089 break;
1090
1091 case 70:
1092 // Turbo Lower Floor
1093 if (EV_DoFloor(line,turboLower))
1094 P_ChangeSwitchTexture(line,1);
1095 break;
1096
1097 case 114:
1098 // Blazing Door Raise (faster than TURBO!)
1099 if (EV_DoDoor (line,blazeRaise))
1100 P_ChangeSwitchTexture(line,1);
1101 break;
1102
1103 case 115:
1104 // Blazing Door Open (faster than TURBO!)
1105 if (EV_DoDoor (line,blazeOpen))
1106 P_ChangeSwitchTexture(line,1);
1107 break;
1108
1109 case 116:
1110 // Blazing Door Close (faster than TURBO!)
1111 if (EV_DoDoor (line,blazeClose))
1112 P_ChangeSwitchTexture(line,1);
1113 break;
1114
1115 case 123:
1116 // Blazing PlatDownWaitUpStay
1117 if (EV_DoPlat(line,blazeDWUS,0))
1118 P_ChangeSwitchTexture(line,1);
1119 break;
1120
1121 case 132:
1122 // Raise Floor Turbo
1123 if (EV_DoFloor(line,raiseFloorTurbo))
1124 P_ChangeSwitchTexture(line,1);
1125 break;
1126
1127 case 99:
1128 // BlzOpenDoor BLUE
1129 case 134:
1130 // BlzOpenDoor RED
1131 case 136:
1132 // BlzOpenDoor YELLOW
1133 if (EV_DoLockedDoor (line,blazeOpen,thing))
1134 P_ChangeSwitchTexture(line,1);
1135 break;
1136
1137 case 138:
1138 // Light Turn On
1139 EV_LightTurnOn(line,255);
1140 P_ChangeSwitchTexture(line,1);
1141 break;
1142
1143 case 139:
1144 // Light Turn Off
1145 EV_LightTurnOn(line,35);
1146 P_ChangeSwitchTexture(line,1);
1147 break;
1148 }
1149 return true;
1150}