1 // Emacs style mode select -*- C++ -*- 2 //----------------------------------------------------------------------------- 3 // 4 // $Id: p_spec.h 1420 2019-01-29 08:03:08Z wesleyjohnson $ 5 // 6 // Copyright (C) 1993-1996 by id Software, Inc. 7 // Portions Copyright (C) 1998-2012 by DooM Legacy Team. 8 // 9 // This program is free software; you can redistribute it and/or 10 // modify it under the terms of the GNU General Public License 11 // as published by the Free Software Foundation; either version 2 12 // of the License, or (at your option) any later version. 13 // 14 // This program 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 // 20 // $Log: p_spec.h,v $ 21 // Revision 1.16 2003/07/23 17:26:36 darkwolf95 22 // SetLineTexture function for Fraggle Script 23 // 24 // Revision 1.15 2003/06/11 03:02:12 ssntails 25 // Vertical wind currents and friction capability on 3d floors 26 // 27 // Revision 1.14 2002/06/30 13:57:30 ssntails 28 // Added vertical water currents. 29 // 30 // Revision 1.13 2002/06/14 02:43:43 ssntails 31 // Instant-lower and instant-raise capability for sectors added. 32 // 33 // Revision 1.12 2001/03/21 18:24:38 stroggonmeth 34 // Misc changes and fixes. Code cleanup 35 // 36 // Revision 1.11 2001/02/24 13:35:20 bpereira 37 // Revision 1.10 2001/01/25 22:15:44 bpereira 38 // added heretic support 39 // 40 // Revision 1.9 2000/11/11 13:59:46 bpereira 41 // 42 // Revision 1.8 2000/11/02 17:50:08 stroggonmeth 43 // Big 3Dfloors & FraggleScript commit!! 44 // 45 // Revision 1.7 2000/10/21 08:43:30 bpereira 46 // Revision 1.6 2000/04/16 18:38:07 bpereira 47 // 48 // Revision 1.5 2000/04/07 18:48:56 hurdler 49 // AnyKey doesn't seem to compile under Linux, now renamed to AnyKey_ 50 // 51 // Revision 1.4 2000/04/06 20:54:28 hurdler 52 // Mostly remove warnings under windows 53 // 54 // Revision 1.3 2000/04/04 00:32:47 stroggonmeth 55 // Initial Boom compatability plus few misc changes all around. 56 // 57 // Revision 1.2 2000/02/27 00:42:10 hurdler 58 // Revision 1.1.1.1 2000/02/22 20:32:32 hurdler 59 // Initial import into CVS (v1.29 pr3) 60 // 61 // 62 // DESCRIPTION: 63 // Implements special effects: 64 // Texture animation, height or lighting changes 65 // according to adjacent sectors, respective 66 // utility functions, etc. 67 // 68 //----------------------------------------------------------------------------- 69 70 #ifndef P_SPEC_H 71 #define P_SPEC_H 72 73 #include "doomtype.h" 74 #include "p_mobj.h" 75 // mobj_t 76 #include "r_defs.h" 77 // line_t, sector_t 78 #include "d_player.h" 79 // player_t 80 81 // Define values for map objects 82 #define MO_TELEPORTMAN 14 83 84 #define SAVE_VERSION_144 85 86 87 extern consvar_t cv_zerotags; 88 89 // at game start 90 void P_Release_PicAnims(void); 91 void P_Init_PicAnims (void); 92 93 // at map load (sectors) 94 void P_Setup_LevelFlatAnims (void); 95 96 // at map load 97 void P_SpawnSpecials (void); 98 99 // Called to update fogwater special flags after changing config 100 void P_Config_FW_Specials (void); 101 102 // every tic 103 void P_UpdateSpecials (void); 104 105 // when needed 106 boolean P_UseSpecialLine ( mobj_t* thing, line_t* line, int side ); 107 108 void P_ShootSpecialLine ( mobj_t* thing, line_t* line ); 109 110 void P_CrossSpecialLine ( line_t* line, int side, mobj_t* thing ); 111 112 void P_PlayerInSpecialSector (player_t* player); 113 114 int twoSided ( int sector, int line ); 115 116 sector_t* getSector ( int currentSector, int line, int side ); 117 118 side_t* getSide ( int currentSector, int line, int side ); 119 120 fixed_t P_FindLowestFloorSurrounding(sector_t* sec); 121 fixed_t P_FindHighestFloorSurrounding(sector_t* sec); 122 123 fixed_t P_FindNextHighestFloor ( sector_t* sec, int currentheight ); 124 125 //SoM: 3/6/2000 126 fixed_t P_FindNextLowestFloor ( sector_t* sec, int currentheight ); 127 128 fixed_t P_FindLowestCeilingSurrounding(sector_t* sec); 129 fixed_t P_FindHighestCeilingSurrounding(sector_t* sec); 130 131 int P_FindSectorFromLineTag ( line_t* line, int start ); 132 133 int P_FindSectorFromTag ( uint16_t tag, int start ); 134 135 //DarkWolf95:July 23, 2003: Needed for SF_SetLineTexture 136 int P_FindLineFromTag(uint16_t tag, int start); 137 138 int P_FindLineFromLineTag(const line_t *line, int start); //SoM: 3/16/2000 139 140 lightlev_t P_FindMinSurroundingLight ( sector_t* sector, lightlev_t max ); 141 142 sector_t* getNextSector ( line_t* line, sector_t* sec ); 143 144 //SoM: 3/6/2000 145 sector_t* P_FindModelFloorSector ( fixed_t floordestheight, int secnum ); 146 147 //SoM: 3/15/2000 148 fixed_t P_FindNextHighestCeiling(sector_t *sec, int currentheight); 149 fixed_t P_FindNextLowestCeiling(sector_t *sec, int currentheight); 150 fixed_t P_FindShortestUpperAround(int secnum); 151 fixed_t P_FindShortestTextureAround(int secnum); 152 sector_t* P_FindModelCeilingSector(fixed_t ceildestheight,int secnum); 153 boolean P_CanUnlockGenDoor( line_t* line, player_t* player); 154 int P_CheckTag(line_t *line); 155 156 // 157 // SPECIAL 158 // 159 int EV_DoDonut(line_t* line); 160 161 162 #ifdef SAVE_VERSION_144 163 164 // [smite] NOTE: For the code in p_saveg.c to work, all the sector effects 165 // must have a thinker and a sector_t* as their first data fields. 166 167 // 168 // P_LIGHTS 169 // 170 typedef struct 171 { 172 thinker_t thinker; // must be first for ptr conversion 173 sector_t* sector; // saved 174 // State to be saved in save game (p_saveg.c) 175 // Savegame saves fields (count ... ) 176 int count; 177 int minlight, maxlight; 178 179 } fireflicker_144_t; 180 181 182 183 typedef struct 184 { 185 thinker_t thinker; // must be first for ptr conversion 186 sector_t* sector; 187 // State to be saved in save game (p_saveg.c) 188 // Savegame saves fields (count ... ) 189 int count; 190 int minlight, maxlight; 191 int maxtime; 192 int mintime; 193 194 } lightflash_144_t; 195 196 197 198 typedef struct 199 { 200 thinker_t thinker; // must be first for ptr conversion 201 sector_t* sector; // saved 202 // State to be saved in save game (p_saveg.c) 203 // Savegame saves fields (count ... ) 204 int count; 205 int minlight, maxlight; 206 int darktime; 207 int brighttime; 208 209 } strobe_144_t; 210 211 212 213 214 typedef struct 215 { 216 thinker_t thinker; // must be first for ptr conversion 217 sector_t* sector; // saved 218 // State to be saved in save game (p_saveg.c) 219 // Savegame saves fields (minlight ... ) 220 int minlight, maxlight; 221 int direction; // 1 = up, -1 = down 222 223 } glow_144_t; 224 225 //SoM: thinker struct for fading lights. ToDo: Add effects for light 226 // transition 227 typedef struct 228 { 229 thinker_t thinker; // must be first for ptr conversion 230 sector_t *sector; // saved 231 // State to be saved in save game (p_saveg.c) 232 // Savegame saves fields (destlevel ... ) 233 int destlevel; 234 int speed; 235 236 } lightfader_144_t; 237 238 #endif 239 240 241 // [smite] NOTE: For the code in p_saveg.c to work, all the sector effects 242 // must have a thinker and a sector_t* as their first data fields. 243 244 // 245 // P_LIGHTS 246 // 247 typedef struct 248 { 249 thinker_t thinker; // must be first for ptr conversion 250 sector_t* sector; // saved 251 // State to be saved in save game (p_saveg.c) 252 // Savegame saves fields (minlight ... ) 253 lightlev_t minlight, maxlight; 254 int32_t count; 255 256 } fireflicker_t; 257 258 259 260 typedef struct 261 { 262 thinker_t thinker; // must be first for ptr conversion 263 sector_t* sector; 264 // State to be saved in save game (p_saveg.c) 265 // Savegame saves fields (minlight ... ) 266 lightlev_t minlight, maxlight; 267 int32_t mintime, maxtime; 268 int32_t count; 269 270 } lightflash_t; 271 272 273 274 typedef struct 275 { 276 thinker_t thinker; // must be first for ptr conversion 277 sector_t* sector; // saved 278 // State to be saved in save game (p_saveg.c) 279 // Savegame saves fields (minlight ... ) 280 lightlev_t minlight, maxlight; 281 int32_t darktime; 282 int32_t brighttime; 283 int32_t count; 284 285 } strobe_t; 286 287 288 289 290 typedef struct 291 { 292 thinker_t thinker; // must be first for ptr conversion 293 sector_t* sector; // saved 294 // State to be saved in save game (p_saveg.c) 295 // Savegame saves fields (minlight ... ) 296 lightlev_t minlight, maxlight; 297 int8_t direction; // 1 = up, -1 = down 298 299 } glow_t; 300 301 //SoM: thinker struct for fading lights. ToDo: Add effects for light 302 // transition 303 typedef struct 304 { 305 thinker_t thinker; // must be first for ptr conversion 306 sector_t *sector; // saved 307 // State to be saved in save game (p_saveg.c) 308 // Savegame saves fields (destlight ... ) 309 lightlev_t destlight; 310 lightlev_t speed; 311 312 } lightfader_t; 313 314 315 316 #define GLOWSPEED 8 317 #define STROBEBRIGHT 5 318 #define FASTDARK 15 319 #define SLOWDARK 35 320 321 void T_FireFlicker (fireflicker_t* flick); 322 void P_SpawnFireFlicker (sector_t* sector); 323 void T_LightFlash (lightflash_t* flash); 324 void P_SpawnLightFlash (sector_t* sector); 325 void T_StrobeFlash (strobe_t* flash); 326 327 void P_SpawnStrobeFlash ( sector_t* sector, int fastOrSlow, int inSync ); 328 329 int EV_StartLightStrobing(line_t* line); 330 int EV_TurnTagLightsOff(line_t* line); 331 332 int EV_LightTurnOn ( line_t* line, lightlev_t bright ); 333 int EV_LightTurnOnPartway(line_t *line, fixed_t level); 334 335 void T_Glow(glow_t* g); 336 void P_SpawnGlowingLight(sector_t* sector); 337 338 339 void P_FadeLight(uint16_t tag, lightlev_t destvalue, lightlev_t speed); 340 void T_LightFade(lightfader_t * lf); 341 342 343 344 // 345 // P_SWITCH 346 // 347 #pragma pack(1) //Hurdler: 04/04/2000: I think pragma is more portable 348 typedef struct 349 { 350 char name1[9]; 351 char name2[9]; 352 short episode; 353 } switchlist_t; 354 //} __attribute__ ((packed)) switchlist_t; //SoM: 3/22/2000: Packed to read from memory. 355 #pragma pack() 356 357 358 // internal 359 typedef enum 360 { 361 B_top_texture, 362 B_middle_texture, 363 B_bottom_texture 364 } bwhere_e; 365 366 367 typedef struct 368 { 369 line_t * line; 370 xyz_t * soundorg; 371 bwhere_e where; 372 int btexture; 373 int btimer; 374 } button_t; 375 376 377 378 // max # of wall switches in a level 379 #define MAXSWITCHES 50 380 381 // 4 players, 4 buttons each at once, max. 382 // added 19-1-98 16->MAXPLAYERS*4 383 #define MAXBUTTONS (MAXPLAYERS*4) //16 384 385 // 1 second, in ticks. 386 #define BUTTONTIME 35 387 388 extern button_t buttonlist[MAXBUTTONS]; 389 390 void P_ChangeSwitchTexture ( line_t* line, int useAgain ); 391 392 void P_Init_SwitchList(void); 393 394 // SoM: 3/4/2000: Misc Boom stuff for thinkers that can share sectors, and some other stuff 395 396 // internal 397 typedef enum 398 { 399 S_floor_special, 400 S_ceiling_special, 401 S_lighting_special, 402 } sector_special_e; 403 404 405 //SoM: 3/6/2000 406 boolean P_SectorActive ( sector_special_e spt, sector_t* sec ); 407 408 // internal 409 typedef enum 410 { 411 CH_MODEL_trig_only, 412 CH_MODEL_num_only, 413 } change_e; 414 415 416 // 417 // P_PLATS 418 // internal, savegame 419 typedef enum 420 { 421 PLATS_up, 422 PLATS_down, 423 PLATS_waiting, 424 PLATS_in_stasis 425 } platstat_e; 426 427 428 // internal, savegame 429 typedef enum 430 { 431 PLATT_perpetualRaise, 432 PLATT_downWaitUpStay, 433 PLATT_raiseAndChange, 434 PLATT_raiseToNearestAndChange, 435 PLATT_blazeDWUS, 436 //SoM:3/4/2000: Added boom stuffs 437 PLATT_genLift, //General stuff 438 PLATT_genPerpetual, 439 PLATT_toggleUpDn, //Instant toggle of stuff. 440 } plattype_e; 441 442 443 444 445 typedef struct 446 { 447 thinker_t thinker; // must be first for ptr conversion 448 sector_t* sector; // saved 449 struct platlist *list; //SoM: 3/6/2000: Boom's improved code without limits. 450 // list is not saved, generated by linking plats 451 // State to be saved in save game (p_saveg.c) 452 // Savegame saves fields (type ... ) 453 plattype_e type; 454 fixed_t speed; 455 fixed_t low, high; // floor heights 456 boolean crush; // enables crushing damage 457 uint16_t tag; 458 int wait; 459 int count; 460 platstat_e status, oldstatus; // up, down, in_statis etc. 461 } plat_t; 462 463 #ifdef SAVE_VERSION_144 464 typedef struct 465 { 466 // State to be saved in save game (p_saveg.c) 467 // Savegame saves fields (type ... ) 468 plattype_e type; 469 fixed_t speed; 470 fixed_t low, high; // floor heights 471 boolean crush; // enables crushing damage 472 int tag; 473 int wait; 474 int count; 475 platstat_e status, oldstatus; // up, down, in_statis etc. 476 } plat_144_t; 477 #endif 478 479 //SoM: 3/6/2000: Boom's improved code without limits. 480 typedef struct platlist { 481 plat_t *plat; 482 struct platlist *next,**prev; 483 } platlist_t; 484 485 void P_Remove_AllActivePlats(void); //SoM: 3/9/2000 486 487 #define PLATWAIT 3 488 #define PLATSPEED (FRACUNIT/NEWTICRATERATIO) 489 #define MAXPLATS 30 490 491 492 extern platlist_t *activeplats; 493 494 void T_PlatRaise(plat_t* plat); 495 496 int EV_DoPlat ( line_t* line, plattype_e type, int amount ); 497 498 void P_AddActivePlat(plat_t* plat); 499 void P_RemoveActivePlat(plat_t* plat); 500 int EV_StopPlat(line_t* line); 501 void P_ActivateInStasis(uint16_t tag); 502 503 504 // 505 // P_DOORS 506 // internal, savegame 507 typedef enum 508 { 509 VD_normalDoor, 510 VD_close30ThenOpen, 511 VD_doorclose, 512 VD_dooropen, 513 VD_raiseIn5Mins, 514 VD_blazeRaise, 515 VD_blazeOpen, 516 VD_blazeClose, 517 518 //SoM: 3/4/2000: General door types... 519 VD_genRaise, 520 VD_genBlazeRaise, 521 VD_genOpen, 522 VD_genBlazeOpen, 523 VD_genClose, 524 VD_genBlazeClose, 525 VD_genCdO, 526 VD_genBlazeCdO, 527 } vldoor_e; 528 529 530 531 typedef struct 532 { 533 thinker_t thinker; // must be first for ptr conversion 534 sector_t* sector; // saved 535 //SoM: 3/6/2000: the line that triggered the door. 536 line_t * line; // saved 537 // State to be saved in save game (p_saveg.c) 538 // Savegame saves fields (type ... ) 539 vldoor_e type; 540 fixed_t topheight; 541 fixed_t speed; 542 543 // 1 = up, 0 = waiting at top, -1 = down 544 int direction; 545 546 // tics to wait at the top 547 int topwait; 548 // (keep in case a door going down is reset) 549 // when it reaches 0, start going down 550 int topcountdown; 551 552 // killough 10/98: sector tag for gradual lighting effects. 553 uint16_t lighttag; 554 } vldoor_t; 555 556 557 #ifdef SAVE_VERSION_144 558 typedef struct 559 { 560 // State to be saved in save game (p_saveg.c) 561 // Savegame saves fields (type ... ) 562 vldoor_e type; 563 fixed_t topheight; 564 fixed_t speed; 565 int direction; 566 int topwait; 567 int topcountdown; 568 } vldoor_144_t; 569 #endif 570 571 572 573 #define VDOORSPEED (FRACUNIT*2/NEWTICRATERATIO) 574 #define VDOORWAIT 150 575 576 //SoM: 3/6/2000: boom support 577 int EV_VerticalDoor ( line_t* line, mobj_t* thing ); 578 579 int EV_DoDoor ( line_t* line, vldoor_e type, fixed_t speed); 580 581 void EV_OpenDoor(int sectag, int speed, int wait_time); 582 void EV_CloseDoor(int sectag, int speed); 583 584 int EV_DoLockedDoor ( line_t* line, vldoor_e type, mobj_t* thing, 585 fixed_t speed ); 586 587 void T_VerticalDoor (vldoor_t* door); 588 void P_SpawnDoorCloseIn30 (sector_t* sec); 589 590 void P_SpawnDoorRaiseIn5Mins ( sector_t* sec, int secnum ); 591 592 593 594 #if 0 // UNUSED 595 // 596 // Sliding doors... 597 // 598 typedef enum 599 { 600 SDS_opening, 601 SDS_waiting, 602 SDS_closing 603 } sdstat_e; 604 605 606 607 typedef enum 608 { 609 SDT_openOnly, 610 SDT_closeOnly, 611 SDT_openAndClose 612 } sdtype_e; 613 614 615 616 // Savegame does not have slidedoor_t saving code yet !! 617 typedef struct 618 { 619 thinker_t thinker; // must be first for ptr conversion 620 line_t* line; // saved 621 // State to be saved in save game (p_saveg.c) 622 // Savegame saves fields (type ... ) 623 sdtype_e type; 624 int frame; 625 int whichDoorIndex; 626 int timer; 627 sector_t* frontsector; 628 sector_t* backsector; 629 sdstat_e status; 630 631 } slidedoor_t; 632 633 634 635 typedef struct 636 { 637 char frontFrame1[9]; 638 char frontFrame2[9]; 639 char frontFrame3[9]; 640 char frontFrame4[9]; 641 char backFrame1[9]; 642 char backFrame2[9]; 643 char backFrame3[9]; 644 char backFrame4[9]; 645 646 } slidename_t; 647 648 649 650 typedef struct 651 { 652 int frontFrames[4]; 653 int backFrames[4]; 654 655 } slideframe_t; 656 657 658 659 // how many frames of animation 660 #define SNUMFRAMES 4 661 662 #define SDOORWAIT (35*3) 663 #define SWAITTICS 4 664 665 // how many diff. types of anims 666 #define MAXSLIDEDOORS 5 667 668 void P_Init_SlidingDoorFrames(void); 669 670 void EV_SlidingDoor ( line_t* line, mobj_t* thing ); 671 672 #endif // Sliding doors 673 674 675 676 // 677 // P_CEILNG 678 // internal, savegame 679 typedef enum 680 { 681 CT_lowerToFloor, 682 CT_raiseToHighest, 683 //SoM:3/4/2000: Extra boom stuffs that tricked me... 684 CT_lowerToLowest, 685 CT_lowerToMaxFloor, 686 687 CT_lowerAndCrush, 688 CT_crushAndRaise, 689 CT_fastCrushAndRaise, 690 CT_silentCrushAndRaise, 691 CT_instantRaise, // Insantly raises SSNTails 06-13-2002 692 693 //SoM:3/4/2000 694 //jff 02/04/98 add types for generalized ceiling mover 695 CT_genCeiling, 696 CT_genCeilingChg, 697 CT_genCeilingChg0, 698 CT_genCeilingChgT, 699 700 //jff 02/05/98 add types for generalized ceiling mover 701 CT_genCrusher, 702 CT_genSilentCrusher, 703 } ceiling_e; 704 705 706 707 typedef struct 708 { 709 thinker_t thinker; // must be first for ptr conversion 710 sector_t* sector; // saved 711 // SoM: 3/6/2000: by jff: copied from killough's plats 712 struct ceilinglist* list; 713 // list is not saved, generated by linking ceilings 714 715 // State to be saved in save game (p_saveg.c) 716 // Savegame saves fields (type ... ) 717 ceiling_e type; 718 fixed_t bottomheight; 719 fixed_t topheight; 720 fixed_t speed, oldspeed; //SoM: 3/6/2000 721 boolean crush; 722 // 1 = up, 0 = waiting, -1 = down 723 int direction, olddirection; 724 725 // ID 726 int tag; 727 728 //SoM: 3/6/2000: Support ceiling changers 729 short new_sec_special, old_sec_special; // 0 or sector->special 730 short new_ceilingpic; // change ceiling flat when done 731 // Boom and Heretic: called texture 732 } ceiling_t; 733 734 //SoM: 3/6/2000: Boom's improved ceiling list. 735 typedef struct ceilinglist { 736 ceiling_t *ceiling; 737 struct ceilinglist *next, **prev; 738 } ceilinglist_t; 739 740 741 void P_Remove_AllActiveCeilings(void); //SoM: 3/9/2000 742 743 744 #define CEILSPEED (FRACUNIT/NEWTICRATERATIO) 745 #define CEILWAIT 150 746 #define MAXCEILINGS 30 747 748 extern ceilinglist_t *activeceilings; //SoM: 3/6/2000: New improved boom code. 749 750 int EV_DoCeiling ( line_t* line, ceiling_e type ); 751 752 void T_MoveCeiling (ceiling_t* ceiling); 753 void P_AddActiveCeiling(ceiling_t* ceiling); 754 void P_RemoveActiveCeiling(ceiling_t* ceiling); 755 int EV_CeilingCrushStop(line_t* line); 756 int P_ActivateInStasisCeiling(line_t* line); 757 758 759 // 760 // P_FLOOR 761 // internal, savegame 762 typedef enum 763 { 764 // lower floor to highest surrounding floor 765 FT_lowerFloor, 766 767 // lower floor to lowest surrounding floor 768 FT_lowerFloorToLowest, 769 770 // lower floor to highest surrounding floor VERY FAST 771 FT_turboLower, 772 773 // raise floor to lowest surrounding CEILING 774 FT_raiseFloor, 775 776 // raise floor to next highest surrounding floor 777 FT_raiseFloorToNearest, 778 779 // lower floor to lowest surrounding floor 780 FT_lowerFloorToNearest, 781 782 // lower floor 24 783 FT_lowerFloor24, 784 785 // lower floor 32 786 FT_lowerFloor32Turbo, 787 788 // raise floor to shortest height texture around it 789 FT_raiseToTexture, 790 791 // lower floor to lowest surrounding floor 792 // and change floorpic 793 FT_lowerAndChange, 794 795 FT_raiseFloor24, 796 797 //raise floor 32 798 FT_raiseFloor32Turbo, 799 800 FT_raiseFloor24AndChange, 801 FT_raiseFloorCrush, 802 803 // raise to next highest floor, turbo-speed 804 FT_raiseFloorTurbo, 805 FT_donutRaise, 806 FT_raiseFloor512, 807 FT_instantLower, // Instantly lowers SSNTails 06-13-2002 808 809 //SoM: 3/4/2000 Boom copy YEAH YEAH 810 FT_genFloor, 811 FT_genFloorChg, 812 FT_genFloorChg0, 813 FT_genFloorChgT, 814 815 //new types for stair builders 816 FT_buildStair, 817 FT_genBuildStair, 818 819 } floor_e; 820 821 //SoM:3/4/2000: Anothe boom code copy. 822 // internal, savegame 823 typedef enum 824 { 825 ET_elevateUp, 826 ET_elevateDown, 827 ET_elevateCurrent, 828 } elevator_e; 829 830 831 // internal, savegame 832 typedef enum 833 { 834 ST_build8, // slowly build by 8 835 ST_turbo16 // quickly build by 16 836 } stair_e; 837 838 839 840 typedef struct 841 { 842 thinker_t thinker; // must be first for ptr conversion 843 sector_t* sector; // saved 844 // State to be saved in save game (p_saveg.c) 845 // Savegame saves fields (type ... ) 846 floor_e type; 847 boolean crush; 848 fixed_t floordestheight; 849 fixed_t speed; 850 int direction; // 1 = up, 0 = waiting, -1 = down 851 //SoM: 3/6/2000 852 short new_sec_special, old_sec_special; // from sector special 853 short new_floorpic; // change floor when done 854 // Heretic: called texture 855 short new_floortype; // Boom did not have texture sounds. 856 } floormove_t; 857 858 859 typedef struct //SoM: 3/6/2000: Elevator struct. 860 { 861 thinker_t thinker; // must be first for ptr conversion 862 sector_t* sector; // saved 863 // State to be saved in save game (p_saveg.c) 864 // Savegame saves fields (type ... ) 865 elevator_e type; 866 int direction; // 1 = up, 0 = waiting, -1 = down 867 fixed_t floordestheight; 868 fixed_t ceilingdestheight; 869 fixed_t speed; 870 } elevator_t; 871 872 873 #define ELEVATORSPEED (FRACUNIT*4/NEWTICRATERATIO) //SoM: 3/6/2000 874 #define FLOORSPEED (FRACUNIT/NEWTICRATERATIO) 875 876 typedef enum 877 { 878 MP_ok, 879 MP_crushed, 880 MP_pastdest 881 } result_e; 882 883 result_e T_MovePlane ( sector_t* sector, 884 fixed_t speed, 885 fixed_t dest, 886 boolean crush, 887 int floorOrCeiling, 888 int direction ); 889 890 int EV_BuildStairs ( line_t* line, stair_e type ); 891 892 int EV_DoFloor ( line_t* line, floor_e floortype ); 893 894 int EV_DoChange ( line_t* line, change_e changetype ); //SoM: 3/16/2000 895 896 int EV_DoElevator ( line_t* line, elevator_e elevtype ); //SoM: 3/16/2000 897 898 void T_MoveFloor( floormove_t* floor); 899 900 //SoM: New thinker functions. 901 void T_MoveElevator(elevator_t* elevator); 902 903 // 904 // P_TELEPT 905 // 906 int EV_Teleport ( line_t* line, int side, mobj_t* thing ); 907 908 //SoM: 3/15/2000: Boom silent teleport functions 909 int EV_SilentTeleport(line_t *line, int side, mobj_t *thing); 910 int EV_SilentLineTeleport(line_t *line, int side, mobj_t *thing, boolean reverse); 911 int EV_PortalTeleport(line_t* line, mobj_t* thing, int side); 912 913 914 915 916 /* SoM: 3/4/2000: This is a large section of copied code. Sorry if this offends people, but 917 I really don't want to read, understand and rewrite all the changes to the source and entire 918 team made! Anyway, this is for the generalized linedef types. */ 919 920 //jff 3/14/98 add bits and shifts for generalized sector types 921 922 #define DAMAGE_MASK 0x60 923 #define DAMAGE_SHIFT 5 924 #define SECRET_MASK 0x80 925 #define SECRET_SHIFT 7 926 #define FRICTION_MASK 0x100 927 #define FRICTION_SHIFT 8 928 #define PUSH_MASK 0x200 929 #define PUSH_SHIFT 9 930 931 //jff 02/04/98 Define masks, shifts, for fields in 932 // generalized linedef types 933 934 #define GenFloorBase 0x6000 935 #define GenCeilingBase 0x4000 936 #define GenDoorBase 0x3c00 937 #define GenLockedBase 0x3800 938 #define GenLiftBase 0x3400 939 #define GenStairsBase 0x3000 940 #define GenCrusherBase 0x2F80 941 942 #define TriggerType 0x0007 943 #define TriggerTypeShift 0 944 945 // define masks and shifts for the floor type fields 946 947 #define FloorCrush 0x1000 948 #define FloorChange 0x0c00 949 #define FloorTarget 0x0380 950 #define FloorDirection 0x0040 951 #define FloorModel 0x0020 952 #define FloorSpeed 0x0018 953 954 #define FloorCrushShift 12 955 #define FloorChangeShift 10 956 #define FloorTargetShift 7 957 #define FloorDirectionShift 6 958 #define FloorModelShift 5 959 #define FloorSpeedShift 3 960 961 // define masks and shifts for the ceiling type fields 962 963 #define CeilingCrush 0x1000 964 #define CeilingChange 0x0c00 965 #define CeilingTarget 0x0380 966 #define CeilingDirection 0x0040 967 #define CeilingModel 0x0020 968 #define CeilingSpeed 0x0018 969 970 #define CeilingCrushShift 12 971 #define CeilingChangeShift 10 972 #define CeilingTargetShift 7 973 #define CeilingDirectionShift 6 974 #define CeilingModelShift 5 975 #define CeilingSpeedShift 3 976 977 // define masks and shifts for the lift type fields 978 979 #define LiftTarget 0x0300 980 #define LiftDelay 0x00c0 981 #define LiftMonster 0x0020 982 #define LiftSpeed 0x0018 983 984 #define LiftTargetShift 8 985 #define LiftDelayShift 6 986 #define LiftMonsterShift 5 987 #define LiftSpeedShift 3 988 989 // define masks and shifts for the stairs type fields 990 991 #define StairIgnore 0x0200 992 #define StairDirection 0x0100 993 #define StairStep 0x00c0 994 #define StairMonster 0x0020 995 #define StairSpeed 0x0018 996 997 #define StairIgnoreShift 9 998 #define StairDirectionShift 8 999 #define StairStepShift 6 1000 #define StairMonsterShift 5 1001 #define StairSpeedShift 3 1002 1003 // define masks and shifts for the crusher type fields 1004 1005 #define CrusherSilent 0x0040 1006 #define CrusherMonster 0x0020 1007 #define CrusherSpeed 0x0018 1008 1009 #define CrusherSilentShift 6 1010 #define CrusherMonsterShift 5 1011 #define CrusherSpeedShift 3 1012 1013 // define masks and shifts for the door type fields 1014 1015 #define DoorDelay 0x0300 1016 #define DoorMonster 0x0080 1017 #define DoorKind 0x0060 1018 #define DoorSpeed 0x0018 1019 1020 #define DoorDelayShift 8 1021 #define DoorMonsterShift 7 1022 #define DoorKindShift 5 1023 #define DoorSpeedShift 3 1024 1025 // define masks and shifts for the locked door type fields 1026 1027 #define LockedNKeys 0x0200 1028 #define LockedKey 0x01c0 1029 #define LockedKind 0x0020 1030 #define LockedSpeed 0x0018 1031 1032 #define LockedNKeysShift 9 1033 #define LockedKeyShift 6 1034 #define LockedKindShift 5 1035 #define LockedSpeedShift 3 1036 1037 1038 //SoM: 3/9/2000: p_genlin 1039 1040 int EV_DoGenFloor ( line_t* line ); 1041 int EV_DoGenCeiling ( line_t* line ); 1042 int EV_DoGenLift ( line_t* line ); 1043 int EV_DoGenStairs ( line_t* line ); 1044 int EV_DoGenCrusher ( line_t* line ); 1045 int EV_DoGenDoor ( line_t* line ); 1046 int EV_DoGenLockedDoor ( line_t* line ); 1047 1048 // define names for the TriggerType field of the general linedefs 1049 // Boom defined 1050 typedef enum 1051 { 1052 TRIG_WalkOnce, 1053 TRIG_WalkMany, 1054 TRIG_SwitchOnce, 1055 TRIG_SwitchMany, 1056 TRIG_GunOnce, 1057 TRIG_GunMany, 1058 TRIG_PushOnce, 1059 TRIG_PushMany, 1060 } triggertype_e; 1061 1062 // define names for the Speed field of the general linedefs 1063 // Boom defined 1064 typedef enum 1065 { 1066 SPEED_Slow, 1067 SPEED_Normal, 1068 SPEED_Fast, 1069 SPEED_Turbo, 1070 } motionspeed_e; 1071 1072 // define names for the Target field of the general floor 1073 // Boom defined 1074 typedef enum 1075 { 1076 FTAR_FtoHnF, 1077 FTAR_FtoLnF, 1078 FTAR_FtoNnF, 1079 FTAR_FtoLnC, 1080 FTAR_FtoC, 1081 FTAR_FbyST, 1082 FTAR_Fby24, 1083 FTAR_Fby32, 1084 } floortarget_e; 1085 1086 // define names for the Changer Type field of the general floor 1087 // Boom defined 1088 typedef enum 1089 { 1090 FCH_FNoChg, 1091 FCH_FChgZero, 1092 FCH_FChgTxt, 1093 FCH_FChgTyp, 1094 } floorchange_e; 1095 1096 // define names for the Change Model field of the general floor 1097 // define names for the Change Model field of the general ceiling 1098 // Boom defined 1099 typedef enum 1100 { 1101 MODEL_Trigger, 1102 MODEL_Numeric, 1103 } floorceil_model_t; 1104 1105 // define names for the Target field of the general ceiling 1106 // Boom defined 1107 typedef enum 1108 { 1109 CTAR_CtoHnC, 1110 CTAR_CtoLnC, 1111 CTAR_CtoNnC, 1112 CTAR_CtoHnF, 1113 CTAR_CtoF, 1114 CTAR_CbyST, 1115 CTAR_Cby24, 1116 CTAR_Cby32, 1117 } ceilingtarget_e; 1118 1119 // define names for the Changer Type field of the general ceiling 1120 // Boom defined 1121 typedef enum 1122 { 1123 CCH_CNoChg, 1124 CCH_CChgZero, 1125 CCH_CChgTxt, 1126 CCH_CChgTyp, 1127 } ceilingchange_e; 1128 1129 // define names for the Target field of the general lift 1130 // Boom defined 1131 typedef enum 1132 { 1133 LTAR_F2LnF, 1134 LTAR_F2NnF, 1135 LTAR_F2LnC, 1136 LTAR_LnF2HnF, 1137 } lifttarget_e; 1138 1139 // define names for the door Kind field of the general ceiling 1140 // Boom defined 1141 typedef enum 1142 { 1143 DT_OdCDoor, 1144 DT_ODoor, 1145 DT_CdODoor, 1146 DT_CDoor, 1147 } doorkind_e; 1148 1149 // define names for the locked door Kind field of the general ceiling 1150 // Boom defined 1151 typedef enum 1152 { 1153 DKY_anykey, 1154 DKY_R_card, 1155 DKY_B_card, 1156 DKY_Y_card, 1157 DKY_R_skull, 1158 DKY_B_skull, 1159 DKY_Y_skull, 1160 DKY_allkeys, 1161 } keykind_e; 1162 1163 /* SoM: End generalized linedef code */ 1164 1165 // Boom defined 1166 typedef enum 1167 { 1168 SCROLL_side, 1169 SCROLL_floor, 1170 SCROLL_ceiling, 1171 SCROLL_carry, 1172 SCROLL_carry_ceiling, 1173 } scrolltype_e; 1174 1175 //SoM: 3/8/2000: Add generalized scroller code 1176 typedef struct { 1177 // Thinker structure for scrolling 1178 thinker_t thinker; // must be first for ptr conversion 1179 // State to be saved in save game (p_saveg.c) 1180 // Savegame saves fields (type ... ) 1181 scrolltype_e type; 1182 int affectee; // Number of affected sidedef, sector, tag, or whatever 1183 int control; // Control sector (-1 if none) used to control scrolling 1184 int accel; // Whether it's accelerative 1185 fixed_t dx, dy; // (dx,dy) scroll speeds 1186 fixed_t last_height; // Last known height of control sector 1187 fixed_t vdx, vdy; // Accumulated velocity if accelerative 1188 } scroll_t; 1189 1190 void T_Scroll(scroll_t *s); 1191 1192 1193 //SoM: 3/8/2000: added new model of friction for ice/sludge effects 1194 1195 typedef struct { 1196 // Thinker structure for friction 1197 thinker_t thinker; // must be first for ptr conversion 1198 // State to be saved in save game (p_saveg.c) 1199 // Savegame saves fields (affectee ... ) 1200 int affectee; // Number of affected sector 1201 int friction; // friction value (E800 = normal) 1202 int movefactor; // inertia factor when adding to momentum 1203 } friction_t; 1204 1205 //SoM: Friction defines. 1206 // original values 1207 #define ORIG_FRICTION 0xE800 1208 #define ORIG_FRICTION_FACTOR 2048 1209 // Heretic 1210 #define FRICTION_NORM 0xe800 1211 #define FRICTION_LOW 0xf900 1212 #define FRICTION_FLY 0xeb00 1213 1214 //SoM: 3/9/2000: Otherwise, the compiler whines! 1215 void T_Friction(friction_t *f); 1216 1217 // Update sector fields after a change of special type. 1218 void P_Update_Special_Sector( sector_t * sec, short new_special ); 1219 1220 //SoM: 3/8/2000: Model for Pushers for push/pull effects 1221 1222 // Boom defined 1223 typedef enum 1224 { 1225 PP_push, 1226 PP_pull, // [WDJ] not used, uses p_push for push and pull 1227 PP_wind, 1228 PP_current, 1229 PP_upcurrent, // SSNTails 06-10-2002 1230 PP_downcurrent, // SSNTails 06-10-2002 1231 PP_upwind, // SSNTails 06-10-2003 WOAH! EXACTLY ONE YEAR LATER! FREAKY! 1232 PP_downwind, // SSNTails 06-10-2003 1233 } pushpull_type_e; 1234 1235 typedef struct { 1236 // Thinker structure for Pusher 1237 thinker_t thinker; // must be first for ptr conversion 1238 mobj_t* source; // Point source if point pusher 1239 // not saved, derived from affectee 1240 // State to be saved in save game (p_saveg.c) 1241 // Savegame saves fields (type ... ) 1242 pushpull_type_e type; 1243 int affectee; // Number of affected sector 1244 int x_mag, y_mag; // X Strength 1245 int magnitude; // Vector strength for point pusher 1246 int radius; // Effective radius for point pusher 1247 fixed_t x_src, y_src; // X,Y of point source if point pusher 1248 } pusher_t; 1249 1250 //SoM: 3/9/2000: Prototype functions for pushers 1251 boolean PIT_PushThing(mobj_t* thing); 1252 void T_Pusher(pusher_t *p); 1253 mobj_t* P_GetPushThing(int s); 1254 1255 1256 //SoM: 3/16/2000 1257 void P_CalcHeight (player_t* player); 1258 1259 1260 // heretic stuff 1261 void P_Init_Lava(void); 1262 void P_AmbientSound(void); 1263 void P_AddAmbientSfx(int sequence); 1264 void P_Init_AmbientSound(void); 1265 1266 #endif 1267