1 /* Emacs style mode select -*- C++ -*-
2 *-----------------------------------------------------------------------------
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
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
27 * DESCRIPTION: definitions, declarations and prototypes for specials
29 *-----------------------------------------------------------------------------*/
37 // Define values for map objects
38 #define MO_TELEPORTMAN 14
42 #define ELEVATORSPEED (FRACUNIT*4)
43 #define FLOORSPEED FRACUNIT
47 #define CEILSPEED FRACUNIT
52 #define VDOORSPEED (FRACUNIT*2)
58 #define PLATSPEED FRACUNIT
62 // 4 players, 4 buttons each at once, max.
63 // killough 2/14/98: redefine in terms of MAXPLAYERS
64 #define MAXBUTTONS (MAXPLAYERS*4)
66 // 1 second, in ticks.
67 #define BUTTONTIME TICRATE
72 #define STROBEBRIGHT 5
76 //jff 3/14/98 add bits and shifts for generalized sector types
78 #define DAMAGE_MASK 0x60
79 #define DAMAGE_SHIFT 5
80 #define SECRET_MASK 0x80
81 #define SECRET_SHIFT 7
82 #define FRICTION_MASK 0x100
83 #define FRICTION_SHIFT 8
84 #define PUSH_MASK 0x200
87 //jff 02/04/98 Define masks, shifts, for fields in
88 // generalized linedef types
91 #define GenFloorBase 0x6000
92 #define GenCeilingBase 0x4000
93 #define GenDoorBase 0x3c00
94 #define GenLockedBase 0x3800
95 #define GenLiftBase 0x3400
96 #define GenStairsBase 0x3000
97 #define GenCrusherBase 0x2F80
99 #define TriggerType 0x0007
100 #define TriggerTypeShift 0
102 // define masks and shifts for the floor type fields
104 #define FloorCrush 0x1000
105 #define FloorChange 0x0c00
106 #define FloorTarget 0x0380
107 #define FloorDirection 0x0040
108 #define FloorModel 0x0020
109 #define FloorSpeed 0x0018
111 #define FloorCrushShift 12
112 #define FloorChangeShift 10
113 #define FloorTargetShift 7
114 #define FloorDirectionShift 6
115 #define FloorModelShift 5
116 #define FloorSpeedShift 3
118 // define masks and shifts for the ceiling type fields
120 #define CeilingCrush 0x1000
121 #define CeilingChange 0x0c00
122 #define CeilingTarget 0x0380
123 #define CeilingDirection 0x0040
124 #define CeilingModel 0x0020
125 #define CeilingSpeed 0x0018
127 #define CeilingCrushShift 12
128 #define CeilingChangeShift 10
129 #define CeilingTargetShift 7
130 #define CeilingDirectionShift 6
131 #define CeilingModelShift 5
132 #define CeilingSpeedShift 3
134 // define masks and shifts for the lift type fields
136 #define LiftTarget 0x0300
137 #define LiftDelay 0x00c0
138 #define LiftMonster 0x0020
139 #define LiftSpeed 0x0018
141 #define LiftTargetShift 8
142 #define LiftDelayShift 6
143 #define LiftMonsterShift 5
144 #define LiftSpeedShift 3
146 // define masks and shifts for the stairs type fields
148 #define StairIgnore 0x0200
149 #define StairDirection 0x0100
150 #define StairStep 0x00c0
151 #define StairMonster 0x0020
152 #define StairSpeed 0x0018
154 #define StairIgnoreShift 9
155 #define StairDirectionShift 8
156 #define StairStepShift 6
157 #define StairMonsterShift 5
158 #define StairSpeedShift 3
160 // define masks and shifts for the crusher type fields
162 #define CrusherSilent 0x0040
163 #define CrusherMonster 0x0020
164 #define CrusherSpeed 0x0018
166 #define CrusherSilentShift 6
167 #define CrusherMonsterShift 5
168 #define CrusherSpeedShift 3
170 // define masks and shifts for the door type fields
172 #define DoorDelay 0x0300
173 #define DoorMonster 0x0080
174 #define DoorKind 0x0060
175 #define DoorSpeed 0x0018
177 #define DoorDelayShift 8
178 #define DoorMonsterShift 7
179 #define DoorKindShift 5
180 #define DoorSpeedShift 3
182 // define masks and shifts for the locked door type fields
184 #define LockedNKeys 0x0200
185 #define LockedKey 0x01c0
186 #define LockedKind 0x0020
187 #define LockedSpeed 0x0018
189 #define LockedNKeysShift 9
190 #define LockedKeyShift 6
191 #define LockedKindShift 5
192 #define LockedSpeedShift 3
194 // define names for the TriggerType field of the general linedefs
208 // define names for the Speed field of the general linedefs
218 // define names for the Target field of the general floor
232 // define names for the Changer Type field of the general floor
242 // define names for the Change Model field of the general floor
250 // define names for the Target field of the general ceiling
264 // define names for the Changer Type field of the general ceiling
274 // define names for the Change Model field of the general ceiling
282 // define names for the Target field of the general lift
292 // define names for the door Kind field of the general ceiling
302 // define names for the locked door Kind field of the general ceiling
316 //////////////////////////////////////////////////////////////////
318 // enums for classes of linedef triggers
320 //////////////////////////////////////////////////////////////////
322 //jff 2/23/98 identify the special classes that can share sectors
331 //jff 3/15/98 pure texture/type change for better generalized support
353 raiseToNearestAndChange
,
355 genLift
, //jff added to support generalized Plat types
357 toggleUpDn
, //jff 3/14/98 added to support instant toggle type
374 //jff 02/05/98 add generalize door types
398 //jff 02/04/98 add types for generalized ceiling mover
404 //jff 02/05/98 add types for generalized ceiling mover
414 // lower floor to highest surrounding floor
417 // lower floor to lowest surrounding floor
420 // lower floor to highest surrounding floor VERY FAST
423 // raise floor to lowest surrounding CEILING
426 // raise floor to next highest surrounding floor
429 //jff 02/03/98 lower floor to next lowest neighbor
432 //jff 02/03/98 lower floor 24 absolute
435 //jff 02/03/98 lower floor 32 absolute
438 // raise floor to shortest height texture around it
441 // lower floor to lowest surrounding floor
442 // and change floorpic
447 //jff 02/03/98 raise floor 32 absolute
450 raiseFloor24AndChange
,
453 // raise to next highest floor, turbo-speed
458 //jff 02/04/98 add types for generalized floor mover
464 //new types for stair builders
471 build8
, // slowly build by 8
472 turbo16
// quickly build by 16
483 //////////////////////////////////////////////////////////////////
487 //////////////////////////////////////////////////////////////////
498 // crush check returns
506 //////////////////////////////////////////////////////////////////
508 // linedef and sector special data types
510 //////////////////////////////////////////////////////////////////
514 // switch animation structure type
516 #if defined(__MWERKS__)
517 #pragma options align=packed
525 } PACKEDATTR switchlist_t
; //jff 3/23/98 pack to read from memory
527 #if defined(__MWERKS__)
528 #pragma options align=reset
604 struct platlist
*list
; // killough
607 // New limit-free plat structure -- killough
609 typedef struct platlist
{
611 struct platlist
*next
,**prev
;
624 // 1 = up, 0 = waiting at top, -1 = down
627 // tics to wait at the top
629 // (keep in case a door going down is reset)
630 // when it reaches 0, start going down
633 //jff 1/31/98 keep track of line door is triggered by
636 /* killough 10/98: sector tag for gradual lighting effects */
647 fixed_t bottomheight
;
653 //jff 02/04/98 add these to support ceiling changers
655 int oldspecial
; //jff 3/14/98 add to fix bug in change transfers
658 // 1 = up, 0 = waiting, -1 = down
664 struct ceilinglist
*list
; // jff 2/22/98 copied from killough's plats
667 typedef struct ceilinglist
{
669 struct ceilinglist
*next
,**prev
;
682 int oldspecial
; //jff 3/14/98 add to fix bug in change transfers
684 fixed_t floordestheight
;
695 fixed_t floordestheight
;
696 fixed_t ceilingdestheight
;
702 // killough 3/7/98: Add generalized scroll effects
705 thinker_t thinker
; // Thinker structure for scrolling
706 fixed_t dx
, dy
; // (dx,dy) scroll speeds
707 int affectee
; // Number of affected sidedef, sector, tag, or whatever
708 int control
; // Control sector (-1 if none) used to control scrolling
709 fixed_t last_height
; // Last known height of control sector
710 fixed_t vdx
, vdy
; // Accumulated velocity if accelerative
711 int accel
; // Whether it's accelerative
718 sc_carry_ceiling
, // killough 4/11/98: carry objects hanging on ceilings
719 } type
; // Type of scroll effect
722 // phares 3/12/98: added new model of friction for ice/sludge effects
725 thinker_t thinker
; // Thinker structure for friction
726 int friction
; // friction value (E800 = normal)
727 int movefactor
; // inertia factor when adding to momentum
728 int affectee
; // Number of affected sector
731 // phares 3/20/98: added new model of Pushers for push/pull effects
734 thinker_t thinker
; // Thinker structure for Pusher
742 mobj_t
* source
; // Point source if point pusher
743 int x_mag
; // X Strength
744 int y_mag
; // Y Strength
745 int magnitude
; // Vector strength for point pusher
746 int radius
; // Effective radius for point pusher
747 int x
; // X of point source if point pusher
748 int y
; // Y of point source if point pusher
749 int affectee
; // Number of affected sector
752 //////////////////////////////////////////////////////////////////
754 // external data declarations
756 //////////////////////////////////////////////////////////////////
759 // End-level timer (-TIMER option)
761 extern boolean levelTimer
;
762 extern int levelTimeCount
;
764 // list of retriggerable buttons active
765 extern button_t buttonlist
[MAXBUTTONS
];
767 extern platlist_t
*activeplats
; // killough 2/14/98
769 extern ceilinglist_t
*activeceilings
; // jff 2/22/98
771 ////////////////////////////////////////////////////////////////
773 // Linedef and sector special utility function prototypes
775 ////////////////////////////////////////////////////////////////
791 fixed_t P_FindLowestFloorSurrounding
794 fixed_t P_FindHighestFloorSurrounding
797 fixed_t P_FindNextHighestFloor
801 fixed_t P_FindNextLowestFloor
805 fixed_t P_FindLowestCeilingSurrounding
806 ( sector_t
* sec
); // jff 2/04/98
808 fixed_t P_FindHighestCeilingSurrounding
809 ( sector_t
* sec
); // jff 2/04/98
811 fixed_t P_FindNextLowestCeiling
813 int currentheight
); // jff 2/04/98
815 fixed_t P_FindNextHighestCeiling
817 int currentheight
); // jff 2/04/98
819 fixed_t P_FindShortestTextureAround
820 ( int secnum
); // jff 2/04/98
822 fixed_t P_FindShortestUpperAround
823 ( int secnum
); // jff 2/04/98
825 sector_t
* P_FindModelFloorSector
826 ( fixed_t floordestheight
,
827 int secnum
); //jff 02/04/98
829 sector_t
* P_FindModelCeilingSector
830 ( fixed_t ceildestheight
,
831 int secnum
); //jff 02/04/98
833 int P_FindSectorFromLineTag
834 ( const line_t
*line
,
835 int start
); // killough 4/17/98
837 int P_FindLineFromLineTag
838 ( const line_t
*line
,
839 int start
); // killough 4/17/98
841 int P_FindMinSurroundingLight
845 sector_t
* getNextSector
850 (line_t
*line
); // jff 2/27/98
852 boolean P_CanUnlockGenDoor
856 boolean P_SectorActive
866 void P_ChangeSwitchTexture
870 ////////////////////////////////////////////////////////////////
872 // Linedef and sector special action function prototypes
874 ////////////////////////////////////////////////////////////////
879 ( lightflash_t
* flash
);
884 // jff 8/8/98 add missing thinker for flicker
886 ( fireflicker_t
* flick
);
904 ( ceiling_t
* ceiling
);
917 ( floormove_t
* floor
);
920 ( elevator_t
* elevator
);
925 ( scroll_t
* ); // killough 3/7/98: scroll effect thinker
928 ( friction_t
* ); // phares 3/12/98: friction thinker
931 ( pusher_t
* ); // phares 3/20/98: Push thinker
933 ////////////////////////////////////////////////////////////////
935 // Linedef and sector special handler prototypes
937 ////////////////////////////////////////////////////////////////
946 // killough 2/14/98: Add silent teleporter
947 int EV_SilentTeleport
952 // killough 1/31/98: Add silent line teleporter
953 int EV_SilentLineTeleport
980 int EV_CeilingCrushStop
1000 int EV_StartLightStrobing
1003 int EV_TurnTagLightsOff
1010 int EV_LightTurnOnPartway(line_t
* line
, fixed_t level
); // killough 10/10/98
1016 change_e changetype
);
1051 int EV_DoGenLockedDoor
1054 ////////////////////////////////////////////////////////////////
1056 // Linedef and sector special thinker spawning
1058 ////////////////////////////////////////////////////////////////
1064 void P_InitSwitchList
1068 void P_SpawnSpecials
1072 void P_UpdateSpecials
1076 boolean P_UseSpecialLine
1081 void P_ShootSpecialLine
1085 void P_CrossSpecialLine(line_t
*line
, int side
, mobj_t
*thing
);
1087 void P_PlayerInSpecialSector
1088 ( player_t
* player
);
1092 void P_SpawnFireFlicker
1093 ( sector_t
* sector
);
1095 void P_SpawnLightFlash
1096 ( sector_t
* sector
);
1098 void P_SpawnStrobeFlash
1103 void P_SpawnGlowingLight
1104 ( sector_t
* sector
);
1108 void P_AddActivePlat
1111 void P_RemoveActivePlat
1114 void P_RemoveAllActivePlats
1115 ( void ); // killough
1117 void P_ActivateInStasis
1122 void P_SpawnDoorCloseIn30
1125 void P_SpawnDoorRaiseIn5Mins
1131 void P_RemoveActiveCeiling
1132 ( ceiling_t
* ceiling
); //jff 2/22/98
1134 void P_RemoveAllActiveCeilings
1135 ( void ); //jff 2/22/98
1137 void P_AddActiveCeiling
1140 void P_RemoveActiveCeiling
1143 int P_ActivateInStasisCeiling
1146 mobj_t
* P_GetPushThing(int); // phares 3/23/98