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