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