| 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_maputl.h" |
| 38 |
#include "p_spec.h" |
| 39 |
#include "g_game.h" |
| 40 |
#include "s_sound.h" |
| 41 |
#include "sounds.h" |
| 42 |
#include "lprintf.h" |
| 43 |
#include "e6y.h"//e6y |
| 44 |
|
| 45 |
#include "dsda.h" |
| 46 |
#include "dsda/map_format.h" |
| 47 |
|
| 48 |
//================================================================== |
| 49 |
// |
| 50 |
// CHANGE THE TEXTURE OF A WALL SWITCH TO ITS OPPOSITE |
| 51 |
// |
| 52 |
//================================================================== |
| 53 |
const switchlist_t heretic_alphSwitchList[] = { |
| 54 |
{ "SW1OFF", "SW1ON", 1 }, |
| 55 |
{ "SW2OFF", "SW2ON", 1 }, |
| 56 |
{ "", "", 0 } |
| 57 |
}; |
| 58 |
|
| 59 |
const switchlist_t hexen_alphSwitchList[] = { |
| 60 |
{"SW_1_UP", "SW_1_DN", hexen_sfx_switch1}, |
| 61 |
{"SW_2_UP", "SW_2_DN", hexen_sfx_switch1}, |
| 62 |
{"VALVE1", "VALVE2", hexen_sfx_valve_turn}, |
| 63 |
{"SW51_OFF", "SW51_ON", hexen_sfx_switch2}, |
| 64 |
{"SW52_OFF", "SW52_ON", hexen_sfx_switch2}, |
| 65 |
{"SW53_UP", "SW53_DN", hexen_sfx_rope_pull}, |
| 66 |
{"PUZZLE5", "PUZZLE9", hexen_sfx_switch1}, |
| 67 |
{"PUZZLE6", "PUZZLE10", hexen_sfx_switch1}, |
| 68 |
{"PUZZLE7", "PUZZLE11", hexen_sfx_switch1}, |
| 69 |
{"PUZZLE8", "PUZZLE12", hexen_sfx_switch1}, |
| 70 |
{"\0", "\0", 0} |
| 71 |
}; |
| 72 |
|
| 73 |
// killough 2/8/98: Remove switch limit |
| 74 |
|
| 75 |
static int *switchlist; // killough |
| 76 |
static int max_numswitches; // killough |
| 77 |
static int numswitches; // killough |
| 78 |
|
| 79 |
button_t buttonlist[MAXBUTTONS]; |
| 80 |
|
| 81 |
const switchlist_t *alphSwitchList; //jff 3/23/98 pointer to switch table |
| 82 |
|
| 83 |
// |
| 84 |
// P_InitSwitchList() |
| 85 |
// |
| 86 |
// Only called at game initialization in order to list the set of switches |
| 87 |
// and buttons known to the engine. This enables their texture to change |
| 88 |
// when activated, and in the case of buttons, change back after a timeout. |
| 89 |
// |
| 90 |
// This routine modified to read its data from a predefined lump or |
| 91 |
// PWAD lump called SWITCHES rather than a static table in this module to |
| 92 |
// allow wad designers to insert or modify switches. |
| 93 |
// |
| 94 |
// Lump format is an array of byte packed switchlist_t structures, terminated |
| 95 |
// by a structure with episode == -0. The lump can be generated from a |
| 96 |
// text source file using SWANTBLS.EXE, distributed with the BOOM utils. |
| 97 |
// The standard list of switches and animations is contained in the example |
| 98 |
// source text file DEFSWANI.DAT also in the BOOM util distribution. |
| 99 |
// |
| 100 |
// Rewritten by Lee Killough to remove limit 2/8/98 |
| 101 |
// |
| 102 |
void P_InitSwitchList(void) |
| 103 |
{ |
| 104 |
int lump = -1; |
| 105 |
int i, index = 0; |
| 106 |
int episode = (gamemode == registered || gamemode==retail) ? |
| 107 |
2 : gamemode == commercial ? 3 : 1; |
| 108 |
|
| 109 |
// MAP_FORMAT_TODO: switch list? |
| 110 |
if (heretic) |
| 111 |
{ |
| 112 |
alphSwitchList = heretic_alphSwitchList; |
| 113 |
} |
| 114 |
else if (hexen) |
| 115 |
{ |
| 116 |
alphSwitchList = hexen_alphSwitchList; |
| 117 |
} |
| 118 |
else |
| 119 |
{ |
| 120 |
lump = W_GetNumForName("SWITCHES"); // cph - new wad lump handling |
| 121 |
|
| 122 |
//jff 3/23/98 read the switch table from a predefined lump |
| 123 |
alphSwitchList = (const switchlist_t *)W_LumpByNum(lump); |
| 124 |
} |
| 125 |
|
| 126 |
for (i=0;;i++) |
| 127 |
{ |
| 128 |
if (index+1 >= max_numswitches) |
| 129 |
switchlist = Z_Realloc(switchlist, sizeof *switchlist * |
| 130 |
(max_numswitches = max_numswitches ? max_numswitches*2 : 8)); |
| 131 |
|
| 132 |
// hexen overrides the episode field with a sound index |
| 133 |
if (hexen || LittleShort(alphSwitchList[i].episode) <= episode) //jff 5/11/98 endianess |
| 134 |
{ |
| 135 |
int texture1, texture2; |
| 136 |
|
| 137 |
if (!LittleShort(alphSwitchList[i].episode)) |
| 138 |
break; |
| 139 |
|
| 140 |
// Ignore switches referencing unknown texture names, instead of exiting. |
| 141 |
// Warn if either one is missing, but only add if both are valid. |
| 142 |
texture1 = R_CheckTextureNumForName(alphSwitchList[i].name1); |
| 143 |
if (texture1 == -1) |
| 144 |
lprintf(LO_WARN, "P_InitSwitchList: unknown texture %s\n", |
| 145 |
alphSwitchList[i].name1); |
| 146 |
|
| 147 |
texture2 = R_CheckTextureNumForName(alphSwitchList[i].name2); |
| 148 |
if (texture2 == -1) |
| 149 |
lprintf(LO_WARN, "P_InitSwitchList: unknown texture %s\n", |
| 150 |
alphSwitchList[i].name2); |
| 151 |
|
| 152 |
if (texture1 != -1 && texture2 != -1) { |
| 153 |
switchlist[index++] = texture1; |
| 154 |
switchlist[index++] = texture2; |
| 155 |
} |
| 156 |
} |
| 157 |
} |
| 158 |
|
| 159 |
numswitches = index / 2; |
| 160 |
switchlist[index] = -1; |
| 161 |
} |
| 162 |
|
| 163 |
// |
| 164 |
// P_StartButton() |
| 165 |
// |
| 166 |
// Start a button (retriggerable switch) counting down till it turns off. |
| 167 |
// |
| 168 |
// Passed the linedef the button is on, which texture on the sidedef contains |
| 169 |
// the button, the texture number of the button, and the time the button is |
| 170 |
// to remain active in gametics. |
| 171 |
// No return. |
| 172 |
// |
| 173 |
void P_StartButton |
| 174 |
( line_t* line, |
| 175 |
bwhere_e w, |
| 176 |
int texture, |
| 177 |
int time ) |
| 178 |
{ |
| 179 |
int i; |
| 180 |
|
| 181 |
if (!raven) |
| 182 |
// See if button is already pressed |
| 183 |
for (i = 0;i < MAXBUTTONS;i++) |
| 184 |
if (buttonlist[i].btimer && buttonlist[i].line == line) |
| 185 |
return; |
| 186 |
|
| 187 |
for (i = 0;i < MAXBUTTONS;i++) |
| 188 |
if (!buttonlist[i].btimer) // use first unused element of list |
| 189 |
{ |
| 190 |
buttonlist[i].line = line; |
| 191 |
buttonlist[i].where = w; |
| 192 |
buttonlist[i].btexture = texture; |
| 193 |
buttonlist[i].btimer = time; |
| 194 |
/* use sound origin of line itself - no need to compatibility-wrap |
| 195 |
* as the popout code gets it wrong whatever its value */ |
| 196 |
buttonlist[i].soundorg = &line->soundorg; |
| 197 |
return; |
| 198 |
} |
| 199 |
|
| 200 |
I_Error("P_StartButton: no button slots left!"); |
| 201 |
} |
| 202 |
|
| 203 |
// |
| 204 |
// P_ChangeSwitchTexture() |
| 205 |
// |
| 206 |
// Function that changes switch wall texture on activation. |
| 207 |
// |
| 208 |
// Passed the line which the switch is on, and whether its retriggerable. |
| 209 |
// If not retriggerable, this function clears the line special to insure that |
| 210 |
// |
| 211 |
// No return |
| 212 |
// |
| 213 |
void P_ChangeSwitchTexture |
| 214 |
( line_t* line, |
| 215 |
int useAgain ) |
| 216 |
{ |
| 217 |
/* Rearranged a bit to avoid too much code duplication */ |
| 218 |
degenmobj_t *soundorg; |
| 219 |
int i, sound; |
| 220 |
short *texture, *ttop, *tmid, *tbot; |
| 221 |
bwhere_e position; |
| 222 |
|
| 223 |
ttop = &sides[line->sidenum[0]].toptexture; |
| 224 |
tmid = &sides[line->sidenum[0]].midtexture; |
| 225 |
tbot = &sides[line->sidenum[0]].bottomtexture; |
| 226 |
|
| 227 |
/* don't zero line->special until after exit switch test */ |
| 228 |
if (!hexen && !useAgain) |
| 229 |
line->special = 0; |
| 230 |
|
| 231 |
/* search for a texture to change */ |
| 232 |
texture = NULL; position = 0; |
| 233 |
for (i = 0; i < numswitches * 2; i++) { /* this could be more efficient... */ |
| 234 |
if (switchlist[i] == *ttop) { |
| 235 |
texture = ttop; position = top; break; |
| 236 |
} else if (switchlist[i] == *tmid) { |
| 237 |
texture = tmid; position = middle; break; |
| 238 |
} else if (switchlist[i] == *tbot) { |
| 239 |
texture = tbot; position = bottom; break; |
| 240 |
} |
| 241 |
} |
| 242 |
if (texture == NULL) |
| 243 |
return; /* no switch texture was found to change */ |
| 244 |
*texture = switchlist[i^1]; |
| 245 |
|
| 246 |
if (hexen) |
| 247 |
{ |
| 248 |
// hexen has sound id in episode field |
| 249 |
sound = alphSwitchList[i / 2].episode; |
| 250 |
soundorg = &line->frontsector->soundorg; |
| 251 |
} |
| 252 |
else |
| 253 |
{ |
| 254 |
sound = g_sfx_swtchn; |
| 255 |
/* use the sound origin of the linedef (its midpoint) |
| 256 |
* unless in a compatibility mode */ |
| 257 |
soundorg = &line->soundorg; |
| 258 |
if (comp[comp_sound] || compatibility_level < prboom_6_compatibility) { |
| 259 |
/* usually NULL, unless there is another button already pressed in, |
| 260 |
* in which case it's the sound origin of that button press... */ |
| 261 |
soundorg = buttonlist->soundorg; |
| 262 |
} |
| 263 |
} |
| 264 |
|
| 265 |
S_StartLineSound(line, soundorg, sound); |
| 266 |
|
| 267 |
if (useAgain) |
| 268 |
P_StartButton(line, position, switchlist[i], BUTTONTIME); |
| 269 |
} |
| 270 |
|
| 271 |
static dboolean P_IsSwitchTexture(short texture) |
| 272 |
{ |
| 273 |
int i; |
| 274 |
|
| 275 |
for (i = 0; i < numswitches * 2; ++i) |
| 276 |
if (switchlist[i] == texture) |
| 277 |
return true; |
| 278 |
|
| 279 |
return false; |
| 280 |
} |
| 281 |
|
| 282 |
dboolean P_CheckSwitchRange(line_t *line, mobj_t *mo, int sideno) |
| 283 |
{ |
| 284 |
side_t *side; |
| 285 |
sector_t *front; |
| 286 |
dboolean can_hit_top, can_hit_bottom; |
| 287 |
dboolean found_switch; |
| 288 |
|
| 289 |
// Is it possible to use a side that doesn't exist? |
| 290 |
if (line->sidenum[sideno] == NO_INDEX) |
| 291 |
{ |
| 292 |
return true; |
| 293 |
} |
| 294 |
|
| 295 |
side = &sides[line->sidenum[sideno]]; |
| 296 |
front = side->sector; |
| 297 |
|
| 298 |
if (mo->z + mo->height <= front->floorheight || mo->z >= front->ceilingheight) |
| 299 |
{ |
| 300 |
return false; |
| 301 |
} |
| 302 |
|
| 303 |
// one-sided |
| 304 |
if (line->sidenum[1] == NO_INDEX) |
| 305 |
{ |
| 306 |
return true; |
| 307 |
} |
| 308 |
|
| 309 |
P_LineOpening(line, NULL); |
| 310 |
|
| 311 |
// acts like one-sided |
| 312 |
if (line_opening.range <= 0) |
| 313 |
{ |
| 314 |
return true; |
| 315 |
} |
| 316 |
|
| 317 |
can_hit_top = (front->ceilingheight > line_opening.top) && |
| 318 |
(mo->z + mo->height > line_opening.top && mo->z < front->ceilingheight); |
| 319 |
|
| 320 |
can_hit_bottom = (front->floorheight < line_opening.bottom) && |
| 321 |
(mo->z + mo->height > front->floorheight && mo->z < line_opening.bottom); |
| 322 |
|
| 323 |
found_switch = false; |
| 324 |
|
| 325 |
if (side->toptexture && P_IsSwitchTexture(side->toptexture)) |
| 326 |
{ |
| 327 |
found_switch = true; |
| 328 |
|
| 329 |
if (can_hit_top) |
| 330 |
{ |
| 331 |
return true; |
| 332 |
} |
| 333 |
} |
| 334 |
|
| 335 |
if (side->bottomtexture && P_IsSwitchTexture(side->bottomtexture)) |
| 336 |
{ |
| 337 |
found_switch = true; |
| 338 |
|
| 339 |
if (can_hit_bottom) |
| 340 |
{ |
| 341 |
return true; |
| 342 |
} |
| 343 |
} |
| 344 |
|
| 345 |
if (side->midtexture && P_IsSwitchTexture(side->midtexture)) |
| 346 |
{ |
| 347 |
fixed_t top, bottom; |
| 348 |
|
| 349 |
found_switch = true; |
| 350 |
|
| 351 |
if (P_GetMidTexturePosition(line, sideno, &top, &bottom)) |
| 352 |
{ |
| 353 |
if (front->ceilingheight > bottom && front->floorheight < top) |
| 354 |
{ |
| 355 |
if (mo->z + mo->height > bottom && mo->z < top) |
| 356 |
{ |
| 357 |
return true; |
| 358 |
} |
| 359 |
} |
| 360 |
} |
| 361 |
} |
| 362 |
|
| 363 |
return !found_switch && (can_hit_top || can_hit_bottom); |
| 364 |
} |
| 365 |
|
| 366 |
// |
| 367 |
// GetPairForSwitchTexture |
| 368 |
// |
| 369 |
int GetPairForSwitchTexture(side_t *side) |
| 370 |
{ |
| 371 |
int i; |
| 372 |
short *texture, *ttop, *tmid, *tbot; |
| 373 |
|
| 374 |
ttop = &side->toptexture; |
| 375 |
tmid = &side->midtexture; |
| 376 |
tbot = &side->bottomtexture; |
| 377 |
|
| 378 |
/* search for a texture to change */ |
| 379 |
texture = NULL; |
| 380 |
for (i = 0;i < numswitches*2;i++) { |
| 381 |
if (switchlist[i] == *ttop) { |
| 382 |
texture = ttop; break; |
| 383 |
} else if (switchlist[i] == *tmid) { |
| 384 |
texture = tmid; break; |
| 385 |
} else if (switchlist[i] == *tbot) { |
| 386 |
texture = tbot; break; |
| 387 |
} |
| 388 |
} |
| 389 |
|
| 390 |
if (texture == NULL) |
| 391 |
return -1; |
| 392 |
|
| 393 |
return switchlist[i^1]; |
| 394 |
} |
| 395 |
|
| 396 |
// |
| 397 |
// P_UseSpecialLine |
| 398 |
// |
| 399 |
// |
| 400 |
// Called when a thing uses (pushes) a special line. |
| 401 |
// Only the front sides of lines are usable. |
| 402 |
// Dispatches to the appropriate linedef function handler. |
| 403 |
// |
| 404 |
// Passed the thing using the line, the line being used, and the side used |
| 405 |
// Returns true if a thinker was created |
| 406 |
// |
| 407 |
dboolean |
| 408 |
P_UseSpecialLine |
| 409 |
( mobj_t* thing, |
| 410 |
line_t* line, |
| 411 |
int side, |
| 412 |
dboolean bossaction) |
| 413 |
{ |
| 414 |
dsda_WatchLineActivation(line, thing); |
| 415 |
|
| 416 |
if (map_format.hexen) |
| 417 |
{ |
| 418 |
if (side) |
| 419 |
{ |
| 420 |
if (line->activation & SPAC_USEBACK) |
| 421 |
{ |
| 422 |
return P_ActivateLine(line, thing, side, SPAC_USEBACK); |
| 423 |
} |
| 424 |
|
| 425 |
return false; |
| 426 |
} |
| 427 |
|
| 428 |
return P_ActivateLine(line, thing, side, SPAC_USE); |
| 429 |
} |
| 430 |
|
| 431 |
// e6y |
| 432 |
// b.m. side test was broken in boom201 |
| 433 |
if ((demoplayback ? (demover != 201) : (compatibility_level != boom_201_compatibility))) |
| 434 |
if (side) //jff 6/1/98 fix inadvertent deletion of side test |
| 435 |
return false; |
| 436 |
|
| 437 |
if (heretic) return Heretic_P_UseSpecialLine(thing, line, side, bossaction); |
| 438 |
|
| 439 |
//jff 02/04/98 add check here for generalized floor/ceil mover |
| 440 |
if (!demo_compatibility) |
| 441 |
{ |
| 442 |
// pointer to line function is NULL by default, set non-null if |
| 443 |
// line special is push or switch generalized linedef type |
| 444 |
int (*linefunc)(line_t *line)=NULL; |
| 445 |
|
| 446 |
// check each range of generalized linedefs |
| 447 |
if ((unsigned)line->special >= GenEnd) |
| 448 |
{ |
| 449 |
// Out of range for GenFloors |
| 450 |
} |
| 451 |
else if ((unsigned)line->special >= GenFloorBase) |
| 452 |
{ |
| 453 |
if (!thing->player && !bossaction) |
| 454 |
if ((line->special & FloorChange) || !(line->special & FloorModel)) |
| 455 |
return false; // FloorModel is "Allow Monsters" if FloorChange is 0 |
| 456 |
if (!line->tag && ((line->special&6)!=6)) //jff 2/27/98 all non-manual |
| 457 |
return false; // generalized types require tag |
| 458 |
linefunc = EV_DoGenFloor; |
| 459 |
} |
| 460 |
else if ((unsigned)line->special >= GenCeilingBase) |
| 461 |
{ |
| 462 |
if (!thing->player && !bossaction) |
| 463 |
if ((line->special & CeilingChange) || !(line->special & CeilingModel)) |
| 464 |
return false; // CeilingModel is "Allow Monsters" if CeilingChange is 0 |
| 465 |
if (!line->tag && ((line->special&6)!=6)) //jff 2/27/98 all non-manual |
| 466 |
return false; // generalized types require tag |
| 467 |
linefunc = EV_DoGenCeiling; |
| 468 |
} |
| 469 |
else if ((unsigned)line->special >= GenDoorBase) |
| 470 |
{ |
| 471 |
if (!thing->player && !bossaction) |
| 472 |
{ |
| 473 |
if (!(line->special & DoorMonster)) |
| 474 |
return false; // monsters disallowed from this door |
| 475 |
if (line->flags & ML_SECRET) // they can't open secret doors either |
| 476 |
return false; |
| 477 |
} |
| 478 |
if (!line->tag && ((line->special&6)!=6)) //jff 3/2/98 all non-manual |
| 479 |
return false; // generalized types require tag |
| 480 |
linefunc = EV_DoGenDoor; |
| 481 |
} |
| 482 |
else if ((unsigned)line->special >= GenLockedBase) |
| 483 |
{ |
| 484 |
if (!thing->player || bossaction) |
| 485 |
return false; // monsters disallowed from unlocking doors |
| 486 |
if (!P_CanUnlockGenDoor(line,thing->player)) |
| 487 |
return false; |
| 488 |
if (!line->tag && ((line->special&6)!=6)) //jff 2/27/98 all non-manual |
| 489 |
return false; // generalized types require tag |
| 490 |
|
| 491 |
linefunc = EV_DoGenLockedDoor; |
| 492 |
} |
| 493 |
else if ((unsigned)line->special >= GenLiftBase) |
| 494 |
{ |
| 495 |
if (!thing->player && !bossaction) |
| 496 |
if (!(line->special & LiftMonster)) |
| 497 |
return false; // monsters disallowed |
| 498 |
if (!line->tag && ((line->special&6)!=6)) //jff 2/27/98 all non-manual |
| 499 |
return false; // generalized types require tag |
| 500 |
linefunc = EV_DoGenLift; |
| 501 |
} |
| 502 |
else if ((unsigned)line->special >= GenStairsBase) |
| 503 |
{ |
| 504 |
if (!thing->player && !bossaction) |
| 505 |
if (!(line->special & StairMonster)) |
| 506 |
return false; // monsters disallowed |
| 507 |
if (!line->tag && ((line->special&6)!=6)) //jff 2/27/98 all non-manual |
| 508 |
return false; // generalized types require tag |
| 509 |
linefunc = EV_DoGenStairs; |
| 510 |
} |
| 511 |
else if ((unsigned)line->special >= GenCrusherBase) |
| 512 |
{ |
| 513 |
if (!thing->player && !bossaction) |
| 514 |
if (!(line->special & CrusherMonster)) |
| 515 |
return false; // monsters disallowed |
| 516 |
if (!line->tag && ((line->special&6)!=6)) //jff 2/27/98 all non-manual |
| 517 |
return false; // generalized types require tag |
| 518 |
linefunc = EV_DoGenCrusher; |
| 519 |
} |
| 520 |
|
| 521 |
if (linefunc) |
| 522 |
switch((line->special & TriggerType) >> TriggerTypeShift) |
| 523 |
{ |
| 524 |
case PushOnce: |
| 525 |
if (!side) |
| 526 |
if (linefunc(line)) |
| 527 |
line->special = 0; |
| 528 |
return true; |
| 529 |
case PushMany: |
| 530 |
if (!side) |
| 531 |
linefunc(line); |
| 532 |
return true; |
| 533 |
case SwitchOnce: |
| 534 |
if (linefunc(line)) |
| 535 |
P_ChangeSwitchTexture(line,0); |
| 536 |
return true; |
| 537 |
case SwitchMany: |
| 538 |
if (linefunc(line)) |
| 539 |
P_ChangeSwitchTexture(line,1); |
| 540 |
return true; |
| 541 |
default: // if not a switch/push type, do nothing here |
| 542 |
return false; |
| 543 |
} |
| 544 |
} |
| 545 |
|
| 546 |
// Switches that other things can activate. |
| 547 |
if (!thing->player && !bossaction) |
| 548 |
{ |
| 549 |
// never open secret doors |
| 550 |
if (line->flags & ML_SECRET) |
| 551 |
return false; |
| 552 |
|
| 553 |
switch(line->special) |
| 554 |
{ |
| 555 |
case 1: // MANUAL DOOR RAISE |
| 556 |
case 32: // MANUAL BLUE |
| 557 |
case 33: // MANUAL RED |
| 558 |
case 34: // MANUAL YELLOW |
| 559 |
//jff 3/5/98 add ability to use teleporters for monsters |
| 560 |
case 195: // switch teleporters |
| 561 |
case 174: |
| 562 |
case 210: // silent switch teleporters |
| 563 |
case 209: |
| 564 |
break; |
| 565 |
|
| 566 |
default: |
| 567 |
return false; |
| 568 |
break; |
| 569 |
} |
| 570 |
} |
| 571 |
|
| 572 |
if (bossaction) |
| 573 |
{ |
| 574 |
switch(line->special) |
| 575 |
{ |
| 576 |
// 0-tag specials, locked switches and teleporters need to be blocked for boss actions. |
| 577 |
case 1: // MANUAL DOOR RAISE |
| 578 |
case 32: // MANUAL BLUE |
| 579 |
case 33: // MANUAL RED |
| 580 |
case 34: // MANUAL YELLOW |
| 581 |
case 117: // Blazing door raise |
| 582 |
case 118: // Blazing door open |
| 583 |
case 133: // BlzOpenDoor BLUE |
| 584 |
case 135: // BlzOpenDoor RED |
| 585 |
case 137: // BlzOpenDoor YEL |
| 586 |
|
| 587 |
case 99: // BlzOpenDoor BLUE |
| 588 |
case 134: // BlzOpenDoor RED |
| 589 |
case 136: // BlzOpenDoor YELLOW |
| 590 |
|
| 591 |
//jff 3/5/98 add ability to use teleporters for monsters |
| 592 |
case 195: // switch teleporters |
| 593 |
case 174: |
| 594 |
case 210: // silent switch teleporters |
| 595 |
case 209: |
| 596 |
return false; |
| 597 |
break; |
| 598 |
} |
| 599 |
} |
| 600 |
|
| 601 |
if (!P_CheckTag(line)) //jff 2/27/98 disallow zero tag on some types |
| 602 |
return false; |
| 603 |
|
| 604 |
// Dispatch to handler according to linedef type |
| 605 |
switch (line->special) |
| 606 |
{ |
| 607 |
// Manual doors, push type with no tag |
| 608 |
case 1: // Vertical Door |
| 609 |
case 26: // Blue Door/Locked |
| 610 |
case 27: // Yellow Door /Locked |
| 611 |
case 28: // Red Door /Locked |
| 612 |
|
| 613 |
case 31: // Manual door open |
| 614 |
case 32: // Blue locked door open |
| 615 |
case 33: // Red locked door open |
| 616 |
case 34: // Yellow locked door open |
| 617 |
|
| 618 |
case 117: // Blazing door raise |
| 619 |
case 118: // Blazing door open |
| 620 |
EV_VerticalDoor (line, thing); |
| 621 |
return true; |
| 622 |
|
| 623 |
// Switches (non-retriggerable) |
| 624 |
case 7: |
| 625 |
// Build Stairs |
| 626 |
if (EV_BuildStairs(line,build8)) |
| 627 |
P_ChangeSwitchTexture(line,0); |
| 628 |
return true; |
| 629 |
|
| 630 |
case 9: |
| 631 |
// Change Donut |
| 632 |
if (EV_DoDonut(line)) |
| 633 |
P_ChangeSwitchTexture(line,0); |
| 634 |
return true; |
| 635 |
|
| 636 |
case 11: |
| 637 |
/* Exit level |
| 638 |
* killough 10/98: prevent zombies from exiting levels |
| 639 |
*/ |
| 640 |
if (!bossaction && thing->player && thing->player->health <= 0 && !comp[comp_zombie]) |
| 641 |
{ |
| 642 |
S_StartMobjSound(thing, sfx_noway); |
| 643 |
return false; |
| 644 |
} |
| 645 |
|
| 646 |
P_ChangeSwitchTexture(line,0); |
| 647 |
G_ExitLevel(0); |
| 648 |
return true; |
| 649 |
|
| 650 |
case 14: |
| 651 |
// Raise Floor 32 and change texture |
| 652 |
if (EV_DoPlat(line,raiseAndChange,32)) |
| 653 |
P_ChangeSwitchTexture(line,0); |
| 654 |
return true; |
| 655 |
|
| 656 |
case 15: |
| 657 |
// Raise Floor 24 and change texture |
| 658 |
if (EV_DoPlat(line,raiseAndChange,24)) |
| 659 |
P_ChangeSwitchTexture(line,0); |
| 660 |
return true; |
| 661 |
|
| 662 |
case 18: |
| 663 |
// Raise Floor to next highest floor |
| 664 |
if (EV_DoFloor(line, raiseFloorToNearest)) |
| 665 |
P_ChangeSwitchTexture(line,0); |
| 666 |
return true; |
| 667 |
|
| 668 |
case 20: |
| 669 |
// Raise Plat next highest floor and change texture |
| 670 |
if (EV_DoPlat(line,raiseToNearestAndChange,0)) |
| 671 |
P_ChangeSwitchTexture(line,0); |
| 672 |
return true; |
| 673 |
|
| 674 |
case 21: |
| 675 |
// PlatDownWaitUpStay |
| 676 |
if (EV_DoPlat(line,downWaitUpStay,0)) |
| 677 |
P_ChangeSwitchTexture(line,0); |
| 678 |
return true; |
| 679 |
|
| 680 |
case 23: |
| 681 |
// Lower Floor to Lowest |
| 682 |
if (EV_DoFloor(line,lowerFloorToLowest)) |
| 683 |
P_ChangeSwitchTexture(line,0); |
| 684 |
return true; |
| 685 |
|
| 686 |
case 29: |
| 687 |
// Raise Door |
| 688 |
if (EV_DoDoor(line,normal)) |
| 689 |
P_ChangeSwitchTexture(line,0); |
| 690 |
return true; |
| 691 |
|
| 692 |
case 41: |
| 693 |
// Lower Ceiling to Floor |
| 694 |
if (EV_DoCeiling(line,lowerToFloor)) |
| 695 |
P_ChangeSwitchTexture(line,0); |
| 696 |
return true; |
| 697 |
|
| 698 |
case 71: |
| 699 |
// Turbo Lower Floor |
| 700 |
if (EV_DoFloor(line,turboLower)) |
| 701 |
P_ChangeSwitchTexture(line,0); |
| 702 |
return true; |
| 703 |
|
| 704 |
case 49: |
| 705 |
// Ceiling Crush And Raise |
| 706 |
if (EV_DoCeiling(line,crushAndRaise)) |
| 707 |
P_ChangeSwitchTexture(line,0); |
| 708 |
return true; |
| 709 |
|
| 710 |
case 50: |
| 711 |
// Close Door |
| 712 |
if (EV_DoDoor(line,closeDoor)) |
| 713 |
P_ChangeSwitchTexture(line,0); |
| 714 |
return true; |
| 715 |
|
| 716 |
case 51: |
| 717 |
/* Secret EXIT |
| 718 |
* killough 10/98: prevent zombies from exiting levels |
| 719 |
*/ |
| 720 |
if (!bossaction && thing->player && thing->player->health <= 0 && !comp[comp_zombie]) |
| 721 |
{ |
| 722 |
S_StartMobjSound(thing, sfx_noway); |
| 723 |
return false; |
| 724 |
} |
| 725 |
|
| 726 |
P_ChangeSwitchTexture(line,0); |
| 727 |
G_SecretExitLevel(0); |
| 728 |
return true; |
| 729 |
|
| 730 |
case 55: |
| 731 |
// Raise Floor Crush |
| 732 |
if (EV_DoFloor(line,raiseFloorCrush)) |
| 733 |
P_ChangeSwitchTexture(line,0); |
| 734 |
return true; |
| 735 |
|
| 736 |
case 101: |
| 737 |
// Raise Floor |
| 738 |
if (EV_DoFloor(line,raiseFloor)) |
| 739 |
P_ChangeSwitchTexture(line,0); |
| 740 |
return true; |
| 741 |
|
| 742 |
case 102: |
| 743 |
// Lower Floor to Surrounding floor height |
| 744 |
if (EV_DoFloor(line,lowerFloor)) |
| 745 |
P_ChangeSwitchTexture(line,0); |
| 746 |
return true; |
| 747 |
|
| 748 |
case 103: |
| 749 |
// Open Door |
| 750 |
if (EV_DoDoor(line,openDoor)) |
| 751 |
P_ChangeSwitchTexture(line,0); |
| 752 |
return true; |
| 753 |
|
| 754 |
case 111: |
| 755 |
// Blazing Door Raise (faster than TURBO!) |
| 756 |
if (EV_DoDoor (line,blazeRaise)) |
| 757 |
P_ChangeSwitchTexture(line,0); |
| 758 |
return true; |
| 759 |
|
| 760 |
case 112: |
| 761 |
// Blazing Door Open (faster than TURBO!) |
| 762 |
if (EV_DoDoor (line,blazeOpen)) |
| 763 |
P_ChangeSwitchTexture(line,0); |
| 764 |
return true; |
| 765 |
|
| 766 |
case 113: |
| 767 |
// Blazing Door Close (faster than TURBO!) |
| 768 |
if (EV_DoDoor (line,blazeClose)) |
| 769 |
P_ChangeSwitchTexture(line,0); |
| 770 |
return true; |
| 771 |
|
| 772 |
case 122: |
| 773 |
// Blazing PlatDownWaitUpStay |
| 774 |
if (EV_DoPlat(line,blazeDWUS,0)) |
| 775 |
P_ChangeSwitchTexture(line,0); |
| 776 |
return true; |
| 777 |
|
| 778 |
case 127: |
| 779 |
// Build Stairs Turbo 16 |
| 780 |
if (EV_BuildStairs(line,turbo16)) |
| 781 |
P_ChangeSwitchTexture(line,0); |
| 782 |
return true; |
| 783 |
|
| 784 |
case 131: |
| 785 |
// Raise Floor Turbo |
| 786 |
if (EV_DoFloor(line,raiseFloorTurbo)) |
| 787 |
P_ChangeSwitchTexture(line,0); |
| 788 |
return true; |
| 789 |
|
| 790 |
case 133: |
| 791 |
// BlzOpenDoor BLUE |
| 792 |
case 135: |
| 793 |
// BlzOpenDoor RED |
| 794 |
case 137: |
| 795 |
// BlzOpenDoor YELLOW |
| 796 |
if (EV_DoLockedDoor (line,blazeOpen,thing)) |
| 797 |
P_ChangeSwitchTexture(line,0); |
| 798 |
return true; |
| 799 |
|
| 800 |
case 140: |
| 801 |
// Raise Floor 512 |
| 802 |
if (EV_DoFloor(line,raiseFloor512)) |
| 803 |
P_ChangeSwitchTexture(line,0); |
| 804 |
return true; |
| 805 |
|
| 806 |
// killough 1/31/98: factored out compatibility check; |
| 807 |
// added inner switch, relaxed check to demo_compatibility |
| 808 |
|
| 809 |
default: |
| 810 |
if (!demo_compatibility) |
| 811 |
switch (line->special) |
| 812 |
{ |
| 813 |
//jff 1/29/98 added linedef types to fill all functions out so that |
| 814 |
// all possess SR, S1, WR, W1 types |
| 815 |
|
| 816 |
case 158: |
| 817 |
// Raise Floor to shortest lower texture |
| 818 |
// 158 S1 EV_DoFloor(raiseToTexture), CSW(0) |
| 819 |
if (EV_DoFloor(line,raiseToTexture)) |
| 820 |
P_ChangeSwitchTexture(line,0); |
| 821 |
return true; |
| 822 |
|
| 823 |
case 159: |
| 824 |
// Raise Floor to shortest lower texture |
| 825 |
// 159 S1 EV_DoFloor(lowerAndChange) |
| 826 |
if (EV_DoFloor(line,lowerAndChange)) |
| 827 |
P_ChangeSwitchTexture(line,0); |
| 828 |
return true; |
| 829 |
|
| 830 |
case 160: |
| 831 |
// Raise Floor 24 and change |
| 832 |
// 160 S1 EV_DoFloor(raiseFloor24AndChange) |
| 833 |
if (EV_DoFloor(line,raiseFloor24AndChange)) |
| 834 |
P_ChangeSwitchTexture(line,0); |
| 835 |
return true; |
| 836 |
|
| 837 |
case 161: |
| 838 |
// Raise Floor 24 |
| 839 |
// 161 S1 EV_DoFloor(raiseFloor24) |
| 840 |
if (EV_DoFloor(line,raiseFloor24)) |
| 841 |
P_ChangeSwitchTexture(line,0); |
| 842 |
return true; |
| 843 |
|
| 844 |
case 162: |
| 845 |
// Moving floor min n to max n |
| 846 |
// 162 S1 EV_DoPlat(perpetualRaise,0) |
| 847 |
if (EV_DoPlat(line,perpetualRaise,0)) |
| 848 |
P_ChangeSwitchTexture(line,0); |
| 849 |
return true; |
| 850 |
|
| 851 |
case 163: |
| 852 |
// Stop Moving floor |
| 853 |
// 163 S1 EV_DoPlat(perpetualRaise,0) |
| 854 |
EV_StopPlat(line); |
| 855 |
P_ChangeSwitchTexture(line,0); |
| 856 |
return true; |
| 857 |
|
| 858 |
case 164: |
| 859 |
// Start fast crusher |
| 860 |
// 164 S1 EV_DoCeiling(fastCrushAndRaise) |
| 861 |
if (EV_DoCeiling(line,fastCrushAndRaise)) |
| 862 |
P_ChangeSwitchTexture(line,0); |
| 863 |
return true; |
| 864 |
|
| 865 |
case 165: |
| 866 |
// Start slow silent crusher |
| 867 |
// 165 S1 EV_DoCeiling(silentCrushAndRaise) |
| 868 |
if (EV_DoCeiling(line,silentCrushAndRaise)) |
| 869 |
P_ChangeSwitchTexture(line,0); |
| 870 |
return true; |
| 871 |
|
| 872 |
case 166: |
| 873 |
// Raise ceiling, Lower floor |
| 874 |
// 166 S1 EV_DoCeiling(raiseToHighest), EV_DoFloor(lowerFloortoLowest) |
| 875 |
if (EV_DoCeiling(line, raiseToHighest) || |
| 876 |
EV_DoFloor(line, lowerFloorToLowest)) |
| 877 |
P_ChangeSwitchTexture(line,0); |
| 878 |
return true; |
| 879 |
|
| 880 |
case 167: |
| 881 |
// Lower floor and Crush |
| 882 |
// 167 S1 EV_DoCeiling(lowerAndCrush) |
| 883 |
if (EV_DoCeiling(line, lowerAndCrush)) |
| 884 |
P_ChangeSwitchTexture(line,0); |
| 885 |
return true; |
| 886 |
|
| 887 |
case 168: |
| 888 |
// Stop crusher |
| 889 |
// 168 S1 EV_CeilingCrushStop() |
| 890 |
if (EV_CeilingCrushStop(line)) |
| 891 |
P_ChangeSwitchTexture(line,0); |
| 892 |
return true; |
| 893 |
|
| 894 |
case 169: |
| 895 |
// Lights to brightest neighbor sector |
| 896 |
// 169 S1 EV_LightTurnOn(0) |
| 897 |
EV_LightTurnOn(line,0); |
| 898 |
P_ChangeSwitchTexture(line,0); |
| 899 |
return true; |
| 900 |
|
| 901 |
case 170: |
| 902 |
// Lights to near dark |
| 903 |
// 170 S1 EV_LightTurnOn(35) |
| 904 |
EV_LightTurnOn(line,35); |
| 905 |
P_ChangeSwitchTexture(line,0); |
| 906 |
return true; |
| 907 |
|
| 908 |
case 171: |
| 909 |
// Lights on full |
| 910 |
// 171 S1 EV_LightTurnOn(255) |
| 911 |
EV_LightTurnOn(line,255); |
| 912 |
P_ChangeSwitchTexture(line,0); |
| 913 |
return true; |
| 914 |
|
| 915 |
case 172: |
| 916 |
// Start Lights Strobing |
| 917 |
// 172 S1 EV_StartLightStrobing() |
| 918 |
EV_StartLightStrobing(line); |
| 919 |
P_ChangeSwitchTexture(line,0); |
| 920 |
return true; |
| 921 |
|
| 922 |
case 173: |
| 923 |
// Lights to Dimmest Near |
| 924 |
// 173 S1 EV_TurnTagLightsOff() |
| 925 |
EV_TurnTagLightsOff(line); |
| 926 |
P_ChangeSwitchTexture(line,0); |
| 927 |
return true; |
| 928 |
|
| 929 |
case 174: |
| 930 |
// Teleport |
| 931 |
// 174 S1 Teleport(side,thing) |
| 932 |
if (map_format.ev_teleport(0, line->tag,line,side,thing,TELF_VANILLA)) |
| 933 |
P_ChangeSwitchTexture(line,0); |
| 934 |
return true; |
| 935 |
|
| 936 |
case 175: |
| 937 |
// Close Door, Open in 30 secs |
| 938 |
// 175 S1 EV_DoDoor(close30ThenOpen) |
| 939 |
if (EV_DoDoor(line,close30ThenOpen)) |
| 940 |
P_ChangeSwitchTexture(line,0); |
| 941 |
return true; |
| 942 |
|
| 943 |
case 189: //jff 3/15/98 create texture change no motion type |
| 944 |
// Texture Change Only (Trigger) |
| 945 |
// 189 S1 Change Texture/Type Only |
| 946 |
if (EV_DoChange(line,trigChangeOnly,line->tag)) |
| 947 |
P_ChangeSwitchTexture(line,0); |
| 948 |
return true; |
| 949 |
|
| 950 |
case 203: |
| 951 |
// Lower ceiling to lowest surrounding ceiling |
| 952 |
// 203 S1 EV_DoCeiling(lowerToLowest) |
| 953 |
if (EV_DoCeiling(line,lowerToLowest)) |
| 954 |
P_ChangeSwitchTexture(line,0); |
| 955 |
return true; |
| 956 |
|
| 957 |
case 204: |
| 958 |
// Lower ceiling to highest surrounding floor |
| 959 |
// 204 S1 EV_DoCeiling(lowerToMaxFloor) |
| 960 |
if (EV_DoCeiling(line,lowerToMaxFloor)) |
| 961 |
P_ChangeSwitchTexture(line,0); |
| 962 |
return true; |
| 963 |
|
| 964 |
case 209: |
| 965 |
// killough 1/31/98: silent teleporter |
| 966 |
//jff 209 S1 SilentTeleport |
| 967 |
if (map_format.ev_teleport(0, line->tag, line, side, thing, TELF_SILENT)) |
| 968 |
P_ChangeSwitchTexture(line,0); |
| 969 |
return true; |
| 970 |
|
| 971 |
case 241: //jff 3/15/98 create texture change no motion type |
| 972 |
// Texture Change Only (Numeric) |
| 973 |
// 241 S1 Change Texture/Type Only |
| 974 |
if (EV_DoChange(line,numChangeOnly,line->tag)) |
| 975 |
P_ChangeSwitchTexture(line,0); |
| 976 |
return true; |
| 977 |
|
| 978 |
case 221: |
| 979 |
// Lower floor to next lowest floor |
| 980 |
// 221 S1 Lower Floor To Nearest Floor |
| 981 |
if (EV_DoFloor(line,lowerFloorToNearest)) |
| 982 |
P_ChangeSwitchTexture(line,0); |
| 983 |
return true; |
| 984 |
|
| 985 |
case 229: |
| 986 |
// Raise elevator next floor |
| 987 |
// 229 S1 Raise Elevator next floor |
| 988 |
if (EV_DoElevator(line,elevateUp)) |
| 989 |
P_ChangeSwitchTexture(line,0); |
| 990 |
return true; |
| 991 |
|
| 992 |
case 233: |
| 993 |
// Lower elevator next floor |
| 994 |
// 233 S1 Lower Elevator next floor |
| 995 |
if (EV_DoElevator(line,elevateDown)) |
| 996 |
P_ChangeSwitchTexture(line,0); |
| 997 |
return true; |
| 998 |
|
| 999 |
case 237: |
| 1000 |
// Elevator to current floor |
| 1001 |
// 237 S1 Elevator to current floor |
| 1002 |
if (EV_DoElevator(line,elevateCurrent)) |
| 1003 |
P_ChangeSwitchTexture(line,0); |
| 1004 |
return true; |
| 1005 |
|
| 1006 |
|
| 1007 |
// jff 1/29/98 end of added S1 linedef types |
| 1008 |
|
| 1009 |
//jff 1/29/98 added linedef types to fill all functions out so that |
| 1010 |
// all possess SR, S1, WR, W1 types |
| 1011 |
|
| 1012 |
case 78: //jff 3/15/98 create texture change no motion type |
| 1013 |
// Texture Change Only (Numeric) |
| 1014 |
// 78 SR Change Texture/Type Only |
| 1015 |
if (EV_DoChange(line,numChangeOnly,line->tag)) |
| 1016 |
P_ChangeSwitchTexture(line,1); |
| 1017 |
return true; |
| 1018 |
|
| 1019 |
case 176: |
| 1020 |
// Raise Floor to shortest lower texture |
| 1021 |
// 176 SR EV_DoFloor(raiseToTexture), CSW(1) |
| 1022 |
if (EV_DoFloor(line,raiseToTexture)) |
| 1023 |
P_ChangeSwitchTexture(line,1); |
| 1024 |
return true; |
| 1025 |
|
| 1026 |
case 177: |
| 1027 |
// Raise Floor to shortest lower texture |
| 1028 |
// 177 SR EV_DoFloor(lowerAndChange) |
| 1029 |
if (EV_DoFloor(line,lowerAndChange)) |
| 1030 |
P_ChangeSwitchTexture(line,1); |
| 1031 |
return true; |
| 1032 |
|
| 1033 |
case 178: |
| 1034 |
// Raise Floor 512 |
| 1035 |
// 178 SR EV_DoFloor(raiseFloor512) |
| 1036 |
if (EV_DoFloor(line,raiseFloor512)) |
| 1037 |
P_ChangeSwitchTexture(line,1); |
| 1038 |
return true; |
| 1039 |
|
| 1040 |
case 179: |
| 1041 |
// Raise Floor 24 and change |
| 1042 |
// 179 SR EV_DoFloor(raiseFloor24AndChange) |
| 1043 |
if (EV_DoFloor(line,raiseFloor24AndChange)) |
| 1044 |
P_ChangeSwitchTexture(line,1); |
| 1045 |
return true; |
| 1046 |
|
| 1047 |
case 180: |
| 1048 |
// Raise Floor 24 |
| 1049 |
// 180 SR EV_DoFloor(raiseFloor24) |
| 1050 |
if (EV_DoFloor(line,raiseFloor24)) |
| 1051 |
P_ChangeSwitchTexture(line,1); |
| 1052 |
return true; |
| 1053 |
|
| 1054 |
case 181: |
| 1055 |
// Moving floor min n to max n |
| 1056 |
// 181 SR EV_DoPlat(perpetualRaise,0) |
| 1057 |
|
| 1058 |
EV_DoPlat(line,perpetualRaise,0); |
| 1059 |
P_ChangeSwitchTexture(line,1); |
| 1060 |
return true; |
| 1061 |
|
| 1062 |
case 182: |
| 1063 |
// Stop Moving floor |
| 1064 |
// 182 SR EV_DoPlat(perpetualRaise,0) |
| 1065 |
EV_StopPlat(line); |
| 1066 |
P_ChangeSwitchTexture(line,1); |
| 1067 |
return true; |
| 1068 |
|
| 1069 |
case 183: |
| 1070 |
// Start fast crusher |
| 1071 |
// 183 SR EV_DoCeiling(fastCrushAndRaise) |
| 1072 |
if (EV_DoCeiling(line,fastCrushAndRaise)) |
| 1073 |
P_ChangeSwitchTexture(line,1); |
| 1074 |
return true; |
| 1075 |
|
| 1076 |
case 184: |
| 1077 |
// Start slow crusher |
| 1078 |
// 184 SR EV_DoCeiling(crushAndRaise) |
| 1079 |
if (EV_DoCeiling(line,crushAndRaise)) |
| 1080 |
P_ChangeSwitchTexture(line,1); |
| 1081 |
return true; |
| 1082 |
|
| 1083 |
case 185: |
| 1084 |
// Start slow silent crusher |
| 1085 |
// 185 SR EV_DoCeiling(silentCrushAndRaise) |
| 1086 |
if (EV_DoCeiling(line,silentCrushAndRaise)) |
| 1087 |
P_ChangeSwitchTexture(line,1); |
| 1088 |
return true; |
| 1089 |
|
| 1090 |
case 186: |
| 1091 |
// Raise ceiling, Lower floor |
| 1092 |
// 186 SR EV_DoCeiling(raiseToHighest), EV_DoFloor(lowerFloortoLowest) |
| 1093 |
if (EV_DoCeiling(line, raiseToHighest) || |
| 1094 |
EV_DoFloor(line, lowerFloorToLowest)) |
| 1095 |
P_ChangeSwitchTexture(line,1); |
| 1096 |
return true; |
| 1097 |
|
| 1098 |
case 187: |
| 1099 |
// Lower floor and Crush |
| 1100 |
// 187 SR EV_DoCeiling(lowerAndCrush) |
| 1101 |
if (EV_DoCeiling(line, lowerAndCrush)) |
| 1102 |
P_ChangeSwitchTexture(line,1); |
| 1103 |
return true; |
| 1104 |
|
| 1105 |
case 188: |
| 1106 |
// Stop crusher |
| 1107 |
// 188 SR EV_CeilingCrushStop() |
| 1108 |
if (EV_CeilingCrushStop(line)) |
| 1109 |
P_ChangeSwitchTexture(line,1); |
| 1110 |
return true; |
| 1111 |
|
| 1112 |
case 190: //jff 3/15/98 create texture change no motion type |
| 1113 |
// Texture Change Only (Trigger) |
| 1114 |
// 190 SR Change Texture/Type Only |
| 1115 |
if (EV_DoChange(line,trigChangeOnly,line->tag)) |
| 1116 |
P_ChangeSwitchTexture(line,1); |
| 1117 |
return true; |
| 1118 |
|
| 1119 |
case 191: |
| 1120 |
// Lower Pillar, Raise Donut |
| 1121 |
// 191 SR EV_DoDonut() |
| 1122 |
if (EV_DoDonut(line)) |
| 1123 |
P_ChangeSwitchTexture(line,1); |
| 1124 |
return true; |
| 1125 |
|
| 1126 |
case 192: |
| 1127 |
// Lights to brightest neighbor sector |
| 1128 |
// 192 SR EV_LightTurnOn(0) |
| 1129 |
EV_LightTurnOn(line,0); |
| 1130 |
P_ChangeSwitchTexture(line,1); |
| 1131 |
return true; |
| 1132 |
|
| 1133 |
case 193: |
| 1134 |
// Start Lights Strobing |
| 1135 |
// 193 SR EV_StartLightStrobing() |
| 1136 |
EV_StartLightStrobing(line); |
| 1137 |
P_ChangeSwitchTexture(line,1); |
| 1138 |
return true; |
| 1139 |
|
| 1140 |
case 194: |
| 1141 |
// Lights to Dimmest Near |
| 1142 |
// 194 SR EV_TurnTagLightsOff() |
| 1143 |
EV_TurnTagLightsOff(line); |
| 1144 |
P_ChangeSwitchTexture(line,1); |
| 1145 |
return true; |
| 1146 |
|
| 1147 |
case 195: |
| 1148 |
// Teleport |
| 1149 |
// 195 SR Teleport(side,thing) |
| 1150 |
if (map_format.ev_teleport(0, line->tag,line,side,thing,TELF_VANILLA)) |
| 1151 |
P_ChangeSwitchTexture(line,1); |
| 1152 |
return true; |
| 1153 |
|
| 1154 |
case 196: |
| 1155 |
// Close Door, Open in 30 secs |
| 1156 |
// 196 SR EV_DoDoor(close30ThenOpen) |
| 1157 |
if (EV_DoDoor(line,close30ThenOpen)) |
| 1158 |
P_ChangeSwitchTexture(line,1); |
| 1159 |
return true; |
| 1160 |
|
| 1161 |
case 205: |
| 1162 |
// Lower ceiling to lowest surrounding ceiling |
| 1163 |
// 205 SR EV_DoCeiling(lowerToLowest) |
| 1164 |
if (EV_DoCeiling(line,lowerToLowest)) |
| 1165 |
P_ChangeSwitchTexture(line,1); |
| 1166 |
return true; |
| 1167 |
|
| 1168 |
case 206: |
| 1169 |
// Lower ceiling to highest surrounding floor |
| 1170 |
// 206 SR EV_DoCeiling(lowerToMaxFloor) |
| 1171 |
if (EV_DoCeiling(line,lowerToMaxFloor)) |
| 1172 |
P_ChangeSwitchTexture(line,1); |
| 1173 |
return true; |
| 1174 |
|
| 1175 |
case 210: |
| 1176 |
// killough 1/31/98: silent teleporter |
| 1177 |
//jff 210 SR SilentTeleport |
| 1178 |
if (map_format.ev_teleport(0, line->tag, line, side, thing, TELF_SILENT)) |
| 1179 |
P_ChangeSwitchTexture(line,1); |
| 1180 |
return true; |
| 1181 |
|
| 1182 |
case 211: //jff 3/14/98 create instant toggle floor type |
| 1183 |
// Toggle Floor Between C and F Instantly |
| 1184 |
// 211 SR Toggle Floor Instant |
| 1185 |
if (EV_DoPlat(line,toggleUpDn,0)) |
| 1186 |
P_ChangeSwitchTexture(line,1); |
| 1187 |
return true; |
| 1188 |
|
| 1189 |
case 222: |
| 1190 |
// Lower floor to next lowest floor |
| 1191 |
// 222 SR Lower Floor To Nearest Floor |
| 1192 |
if (EV_DoFloor(line,lowerFloorToNearest)) |
| 1193 |
P_ChangeSwitchTexture(line,1); |
| 1194 |
return true; |
| 1195 |
|
| 1196 |
case 230: |
| 1197 |
// Raise elevator next floor |
| 1198 |
// 230 SR Raise Elevator next floor |
| 1199 |
if (EV_DoElevator(line,elevateUp)) |
| 1200 |
P_ChangeSwitchTexture(line,1); |
| 1201 |
return true; |
| 1202 |
|
| 1203 |
case 234: |
| 1204 |
// Lower elevator next floor |
| 1205 |
// 234 SR Lower Elevator next floor |
| 1206 |
if (EV_DoElevator(line,elevateDown)) |
| 1207 |
P_ChangeSwitchTexture(line,1); |
| 1208 |
return true; |
| 1209 |
|
| 1210 |
case 238: |
| 1211 |
// Elevator to current floor |
| 1212 |
// 238 SR Elevator to current floor |
| 1213 |
if (EV_DoElevator(line,elevateCurrent)) |
| 1214 |
P_ChangeSwitchTexture(line,1); |
| 1215 |
return true; |
| 1216 |
|
| 1217 |
case 258: |
| 1218 |
// Build stairs, step 8 |
| 1219 |
// 258 SR EV_BuildStairs(build8) |
| 1220 |
if (EV_BuildStairs(line,build8)) |
| 1221 |
P_ChangeSwitchTexture(line,1); |
| 1222 |
return true; |
| 1223 |
|
| 1224 |
case 259: |
| 1225 |
// Build stairs, step 16 |
| 1226 |
// 259 SR EV_BuildStairs(turbo16) |
| 1227 |
if (EV_BuildStairs(line,turbo16)) |
| 1228 |
P_ChangeSwitchTexture(line,1); |
| 1229 |
return true; |
| 1230 |
|
| 1231 |
// 1/29/98 jff end of added SR linedef types |
| 1232 |
|
| 1233 |
} |
| 1234 |
break; |
| 1235 |
|
| 1236 |
// Buttons (retriggerable switches) |
| 1237 |
case 42: |
| 1238 |
// Close Door |
| 1239 |
if (EV_DoDoor(line,closeDoor)) |
| 1240 |
P_ChangeSwitchTexture(line,1); |
| 1241 |
return true; |
| 1242 |
|
| 1243 |
case 43: |
| 1244 |
// Lower Ceiling to Floor |
| 1245 |
if (EV_DoCeiling(line,lowerToFloor)) |
| 1246 |
P_ChangeSwitchTexture(line,1); |
| 1247 |
return true; |
| 1248 |
|
| 1249 |
case 45: |
| 1250 |
// Lower Floor to Surrounding floor height |
| 1251 |
if (EV_DoFloor(line,lowerFloor)) |
| 1252 |
P_ChangeSwitchTexture(line,1); |
| 1253 |
return true; |
| 1254 |
|
| 1255 |
case 60: |
| 1256 |
// Lower Floor to Lowest |
| 1257 |
if (EV_DoFloor(line,lowerFloorToLowest)) |
| 1258 |
P_ChangeSwitchTexture(line,1); |
| 1259 |
return true; |
| 1260 |
|
| 1261 |
case 61: |
| 1262 |
// Open Door |
| 1263 |
if (EV_DoDoor(line,openDoor)) |
| 1264 |
P_ChangeSwitchTexture(line,1); |
| 1265 |
return true; |
| 1266 |
|
| 1267 |
case 62: |
| 1268 |
// PlatDownWaitUpStay |
| 1269 |
if (EV_DoPlat(line,downWaitUpStay,1)) |
| 1270 |
P_ChangeSwitchTexture(line,1); |
| 1271 |
return true; |
| 1272 |
|
| 1273 |
case 63: |
| 1274 |
// Raise Door |
| 1275 |
if (EV_DoDoor(line,normal)) |
| 1276 |
P_ChangeSwitchTexture(line,1); |
| 1277 |
return true; |
| 1278 |
|
| 1279 |
case 64: |
| 1280 |
// Raise Floor to ceiling |
| 1281 |
if (EV_DoFloor(line,raiseFloor)) |
| 1282 |
P_ChangeSwitchTexture(line,1); |
| 1283 |
return true; |
| 1284 |
|
| 1285 |
case 66: |
| 1286 |
// Raise Floor 24 and change texture |
| 1287 |
if (EV_DoPlat(line,raiseAndChange,24)) |
| 1288 |
P_ChangeSwitchTexture(line,1); |
| 1289 |
return true; |
| 1290 |
|
| 1291 |
case 67: |
| 1292 |
// Raise Floor 32 and change texture |
| 1293 |
if (EV_DoPlat(line,raiseAndChange,32)) |
| 1294 |
P_ChangeSwitchTexture(line,1); |
| 1295 |
return true; |
| 1296 |
|
| 1297 |
case 65: |
| 1298 |
// Raise Floor Crush |
| 1299 |
if (EV_DoFloor(line,raiseFloorCrush)) |
| 1300 |
P_ChangeSwitchTexture(line,1); |
| 1301 |
return true; |
| 1302 |
|
| 1303 |
case 68: |
| 1304 |
// Raise Plat to next highest floor and change texture |
| 1305 |
if (EV_DoPlat(line,raiseToNearestAndChange,0)) |
| 1306 |
P_ChangeSwitchTexture(line,1); |
| 1307 |
return true; |
| 1308 |
|
| 1309 |
case 69: |
| 1310 |
// Raise Floor to next highest floor |
| 1311 |
if (EV_DoFloor(line, raiseFloorToNearest)) |
| 1312 |
P_ChangeSwitchTexture(line,1); |
| 1313 |
return true; |
| 1314 |
|
| 1315 |
case 70: |
| 1316 |
// Turbo Lower Floor |
| 1317 |
if (EV_DoFloor(line,turboLower)) |
| 1318 |
P_ChangeSwitchTexture(line,1); |
| 1319 |
return true; |
| 1320 |
|
| 1321 |
case 114: |
| 1322 |
// Blazing Door Raise (faster than TURBO!) |
| 1323 |
if (EV_DoDoor (line,blazeRaise)) |
| 1324 |
P_ChangeSwitchTexture(line,1); |
| 1325 |
return true; |
| 1326 |
|
| 1327 |
case 115: |
| 1328 |
// Blazing Door Open (faster than TURBO!) |
| 1329 |
if (EV_DoDoor (line,blazeOpen)) |
| 1330 |
P_ChangeSwitchTexture(line,1); |
| 1331 |
return true; |
| 1332 |
|
| 1333 |
case 116: |
| 1334 |
// Blazing Door Close (faster than TURBO!) |
| 1335 |
if (EV_DoDoor (line,blazeClose)) |
| 1336 |
P_ChangeSwitchTexture(line,1); |
| 1337 |
return true; |
| 1338 |
|
| 1339 |
case 123: |
| 1340 |
// Blazing PlatDownWaitUpStay |
| 1341 |
if (EV_DoPlat(line,blazeDWUS,0)) |
| 1342 |
P_ChangeSwitchTexture(line,1); |
| 1343 |
return true; |
| 1344 |
|
| 1345 |
case 132: |
| 1346 |
// Raise Floor Turbo |
| 1347 |
if (EV_DoFloor(line,raiseFloorTurbo)) |
| 1348 |
P_ChangeSwitchTexture(line,1); |
| 1349 |
return true; |
| 1350 |
|
| 1351 |
case 99: |
| 1352 |
// BlzOpenDoor BLUE |
| 1353 |
case 134: |
| 1354 |
// BlzOpenDoor RED |
| 1355 |
case 136: |
| 1356 |
// BlzOpenDoor YELLOW |
| 1357 |
if (EV_DoLockedDoor (line,blazeOpen,thing)) |
| 1358 |
P_ChangeSwitchTexture(line,1); |
| 1359 |
return true; |
| 1360 |
|
| 1361 |
case 138: |
| 1362 |
// Light Turn On |
| 1363 |
EV_LightTurnOn(line,255); |
| 1364 |
P_ChangeSwitchTexture(line,1); |
| 1365 |
return true; |
| 1366 |
|
| 1367 |
case 139: |
| 1368 |
// Light Turn Off |
| 1369 |
EV_LightTurnOn(line,35); |
| 1370 |
P_ChangeSwitchTexture(line,1); |
| 1371 |
return true; |
| 1372 |
} |
| 1373 |
return !bossaction; |
| 1374 |
} |
| 1375 |
|
| 1376 |
// heretic |
| 1377 |
|
| 1378 |
dboolean Heretic_P_UseSpecialLine(mobj_t * thing, line_t * line, int side, dboolean bossaction) |
| 1379 |
{ |
| 1380 |
// This condition never reached in heretic |
| 1381 |
if (side || bossaction) return false; |
| 1382 |
|
| 1383 |
// |
| 1384 |
// Switches that other things can activate |
| 1385 |
// |
| 1386 |
if (!thing->player) |
| 1387 |
{ |
| 1388 |
if (line->flags & ML_SECRET) |
| 1389 |
return false; // never open secret doors |
| 1390 |
switch (line->special) |
| 1391 |
{ |
| 1392 |
case 1: // MANUAL DOOR RAISE |
| 1393 |
case 32: // MANUAL BLUE |
| 1394 |
case 33: // MANUAL RED |
| 1395 |
case 34: // MANUAL YELLOW |
| 1396 |
break; |
| 1397 |
default: |
| 1398 |
return false; |
| 1399 |
} |
| 1400 |
} |
| 1401 |
|
| 1402 |
// |
| 1403 |
// do something |
| 1404 |
// |
| 1405 |
switch (line->special) |
| 1406 |
{ |
| 1407 |
//=============================================== |
| 1408 |
// MANUALS |
| 1409 |
//=============================================== |
| 1410 |
case 1: // Vertical Door |
| 1411 |
case 26: // Blue Door/Locked |
| 1412 |
case 27: // Yellow Door /Locked |
| 1413 |
case 28: // Red Door /Locked |
| 1414 |
|
| 1415 |
case 31: // Manual door open |
| 1416 |
case 32: // Blue locked door open |
| 1417 |
case 33: // Red locked door open |
| 1418 |
case 34: // Yellow locked door open |
| 1419 |
EV_VerticalDoor(line, thing); |
| 1420 |
break; |
| 1421 |
//=============================================== |
| 1422 |
// SWITCHES |
| 1423 |
//=============================================== |
| 1424 |
case 7: // Switch_Build_Stairs (8 pixel steps) |
| 1425 |
if (EV_BuildStairs(line, heretic_build8)) |
| 1426 |
{ |
| 1427 |
P_ChangeSwitchTexture(line, 0); |
| 1428 |
} |
| 1429 |
break; |
| 1430 |
case 107: // Switch_Build_Stairs_16 (16 pixel steps) |
| 1431 |
if (EV_BuildStairs(line, heretic_turbo16)) |
| 1432 |
{ |
| 1433 |
P_ChangeSwitchTexture(line, 0); |
| 1434 |
} |
| 1435 |
break; |
| 1436 |
case 9: // Change Donut |
| 1437 |
if (EV_DoDonut(line)) |
| 1438 |
P_ChangeSwitchTexture(line, 0); |
| 1439 |
break; |
| 1440 |
case 11: // Exit level |
| 1441 |
G_ExitLevel(0); |
| 1442 |
P_ChangeSwitchTexture(line, 0); |
| 1443 |
break; |
| 1444 |
case 14: // Raise Floor 32 and change texture |
| 1445 |
if (EV_DoPlat(line, raiseAndChange, 32)) |
| 1446 |
P_ChangeSwitchTexture(line, 0); |
| 1447 |
break; |
| 1448 |
case 15: // Raise Floor 24 and change texture |
| 1449 |
if (EV_DoPlat(line, raiseAndChange, 24)) |
| 1450 |
P_ChangeSwitchTexture(line, 0); |
| 1451 |
break; |
| 1452 |
case 18: // Raise Floor to next highest floor |
| 1453 |
if (EV_DoFloor(line, raiseFloorToNearest)) |
| 1454 |
P_ChangeSwitchTexture(line, 0); |
| 1455 |
break; |
| 1456 |
case 20: // Raise Plat next highest floor and change texture |
| 1457 |
if (EV_DoPlat(line, raiseToNearestAndChange, 0)) |
| 1458 |
P_ChangeSwitchTexture(line, 0); |
| 1459 |
break; |
| 1460 |
case 21: // PlatDownWaitUpStay |
| 1461 |
if (EV_DoPlat(line, downWaitUpStay, 0)) |
| 1462 |
P_ChangeSwitchTexture(line, 0); |
| 1463 |
break; |
| 1464 |
case 23: // Lower Floor to Lowest |
| 1465 |
if (EV_DoFloor(line, lowerFloorToLowest)) |
| 1466 |
P_ChangeSwitchTexture(line, 0); |
| 1467 |
break; |
| 1468 |
case 29: // Raise Door |
| 1469 |
if (EV_DoDoor(line, vld_normal)) |
| 1470 |
P_ChangeSwitchTexture(line, 0); |
| 1471 |
break; |
| 1472 |
case 41: // Lower Ceiling to Floor |
| 1473 |
if (EV_DoCeiling(line, lowerToFloor)) |
| 1474 |
P_ChangeSwitchTexture(line, 0); |
| 1475 |
break; |
| 1476 |
case 71: // Turbo Lower Floor |
| 1477 |
if (EV_DoFloor(line, turboLower)) |
| 1478 |
P_ChangeSwitchTexture(line, 0); |
| 1479 |
break; |
| 1480 |
case 49: // Lower Ceiling And Crush |
| 1481 |
if (EV_DoCeiling(line, lowerAndCrush)) |
| 1482 |
P_ChangeSwitchTexture(line, 0); |
| 1483 |
break; |
| 1484 |
case 50: // Close Door |
| 1485 |
if (EV_DoDoor(line, vld_close)) |
| 1486 |
P_ChangeSwitchTexture(line, 0); |
| 1487 |
break; |
| 1488 |
case 51: // Secret EXIT |
| 1489 |
G_SecretExitLevel(0); |
| 1490 |
P_ChangeSwitchTexture(line, 0); |
| 1491 |
break; |
| 1492 |
case 55: // Raise Floor Crush |
| 1493 |
if (EV_DoFloor(line, raiseFloorCrush)) |
| 1494 |
P_ChangeSwitchTexture(line, 0); |
| 1495 |
break; |
| 1496 |
case 101: // Raise Floor |
| 1497 |
if (EV_DoFloor(line, raiseFloor)) |
| 1498 |
P_ChangeSwitchTexture(line, 0); |
| 1499 |
break; |
| 1500 |
case 102: // Lower Floor to Surrounding floor height |
| 1501 |
if (EV_DoFloor(line, lowerFloor)) |
| 1502 |
P_ChangeSwitchTexture(line, 0); |
| 1503 |
break; |
| 1504 |
case 103: // Open Door |
| 1505 |
if (EV_DoDoor(line, vld_open)) |
| 1506 |
P_ChangeSwitchTexture(line, 0); |
| 1507 |
break; |
| 1508 |
//=============================================== |
| 1509 |
// BUTTONS |
| 1510 |
//=============================================== |
| 1511 |
case 42: // Close Door |
| 1512 |
if (EV_DoDoor(line, vld_close)) |
| 1513 |
P_ChangeSwitchTexture(line, 1); |
| 1514 |
break; |
| 1515 |
case 43: // Lower Ceiling to Floor |
| 1516 |
if (EV_DoCeiling(line, lowerToFloor)) |
| 1517 |
P_ChangeSwitchTexture(line, 1); |
| 1518 |
break; |
| 1519 |
case 45: // Lower Floor to Surrounding floor height |
| 1520 |
if (EV_DoFloor(line, lowerFloor)) |
| 1521 |
P_ChangeSwitchTexture(line, 1); |
| 1522 |
break; |
| 1523 |
case 60: // Lower Floor to Lowest |
| 1524 |
if (EV_DoFloor(line, lowerFloorToLowest)) |
| 1525 |
P_ChangeSwitchTexture(line, 1); |
| 1526 |
break; |
| 1527 |
case 61: // Open Door |
| 1528 |
if (EV_DoDoor(line, vld_open)) |
| 1529 |
P_ChangeSwitchTexture(line, 1); |
| 1530 |
break; |
| 1531 |
case 62: // PlatDownWaitUpStay |
| 1532 |
if (EV_DoPlat(line, downWaitUpStay, 1)) |
| 1533 |
P_ChangeSwitchTexture(line, 1); |
| 1534 |
break; |
| 1535 |
case 63: // Raise Door |
| 1536 |
if (EV_DoDoor(line, vld_normal)) |
| 1537 |
P_ChangeSwitchTexture(line, 1); |
| 1538 |
break; |
| 1539 |
case 64: // Raise Floor to ceiling |
| 1540 |
if (EV_DoFloor(line, raiseFloor)) |
| 1541 |
P_ChangeSwitchTexture(line, 1); |
| 1542 |
break; |
| 1543 |
case 66: // Raise Floor 24 and change texture |
| 1544 |
if (EV_DoPlat(line, raiseAndChange, 24)) |
| 1545 |
P_ChangeSwitchTexture(line, 1); |
| 1546 |
break; |
| 1547 |
case 67: // Raise Floor 32 and change texture |
| 1548 |
if (EV_DoPlat(line, raiseAndChange, 32)) |
| 1549 |
P_ChangeSwitchTexture(line, 1); |
| 1550 |
break; |
| 1551 |
case 65: // Raise Floor Crush |
| 1552 |
if (EV_DoFloor(line, raiseFloorCrush)) |
| 1553 |
P_ChangeSwitchTexture(line, 1); |
| 1554 |
break; |
| 1555 |
case 68: // Raise Plat to next highest floor and change texture |
| 1556 |
if (EV_DoPlat(line, raiseToNearestAndChange, 0)) |
| 1557 |
P_ChangeSwitchTexture(line, 1); |
| 1558 |
break; |
| 1559 |
case 69: // Raise Floor to next highest floor |
| 1560 |
if (EV_DoFloor(line, raiseFloorToNearest)) |
| 1561 |
P_ChangeSwitchTexture(line, 1); |
| 1562 |
break; |
| 1563 |
case 70: // Turbo Lower Floor |
| 1564 |
if (EV_DoFloor(line, turboLower)) |
| 1565 |
P_ChangeSwitchTexture(line, 1); |
| 1566 |
break; |
| 1567 |
} |
| 1568 |
|
| 1569 |
return true; |
| 1570 |
} |