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
207 typedef unsigned triggertype_e
;
209 // define names for the Speed field of the general linedefs
218 typedef unsigned motionspeed_e
;
220 // define names for the Target field of the general floor
233 typedef unsigned floortarget_e
;
235 // define names for the Changer Type field of the general floor
244 typedef unsigned floorchange_e
;
246 // define names for the Change Model field of the general floor
253 typedef unsigned floormodel_t
;
255 // define names for the Target field of the general ceiling
268 typedef unsigned ceilingtarget_e
;
270 // define names for the Changer Type field of the general ceiling
279 typedef unsigned ceilingchange_e
;
281 // define names for the Change Model field of the general ceiling
288 typedef unsigned ceilingmodel_t
;
290 // define names for the Target field of the general lift
299 typedef unsigned lifttarget_e
;
301 // define names for the door Kind field of the general ceiling
310 typedef unsigned intdoorkind_e
;
312 // define names for the locked door Kind field of the general ceiling
325 typedef unsigned keykind_e
;
327 //////////////////////////////////////////////////////////////////
329 // enums for classes of linedef triggers
331 //////////////////////////////////////////////////////////////////
333 //jff 2/23/98 identify the special classes that can share sectors
341 typedef unsigned special_e
;
343 //jff 3/15/98 pure texture/type change for better generalized support
349 typedef unsigned change_e
;
360 typedef unsigned plat_e
;
367 raiseToNearestAndChange
,
369 genLift
, //jff added to support generalized Plat types
371 toggleUpDn
, //jff 3/14/98 added to support instant toggle type
374 typedef unsigned plattype_e
;
389 //jff 02/05/98 add generalize door types
399 typedef unsigned vldoor_e
;
414 //jff 02/04/98 add types for generalized ceiling mover
420 //jff 02/05/98 add types for generalized ceiling mover
425 typedef unsigned ceiling_e
;
431 // lower floor to highest surrounding floor
434 // lower floor to lowest surrounding floor
437 // lower floor to highest surrounding floor VERY FAST
440 // raise floor to lowest surrounding CEILING
443 // raise floor to next highest surrounding floor
446 //jff 02/03/98 lower floor to next lowest neighbor
449 //jff 02/03/98 lower floor 24 absolute
452 //jff 02/03/98 lower floor 32 absolute
455 // raise floor to shortest height texture around it
458 // lower floor to lowest surrounding floor
459 // and change floorpic
464 //jff 02/03/98 raise floor 32 absolute
467 raiseFloor24AndChange
,
470 // raise to next highest floor, turbo-speed
475 //jff 02/04/98 add types for generalized floor mover
481 //new types for stair builders
485 typedef unsigned floor_e
;
489 build8
, // slowly build by 8
490 turbo16
// quickly build by 16
493 typedef unsigned stair_e
;
501 typedef unsigned elevator_e
;
503 //////////////////////////////////////////////////////////////////
507 //////////////////////////////////////////////////////////////////
517 typedef unsigned bwhere_e
;
519 // crush check returns
526 typedef unsigned result_e
;
528 //////////////////////////////////////////////////////////////////
530 // linedef and sector special data types
532 //////////////////////////////////////////////////////////////////
536 // switch animation structure type
538 #if defined(__MWERKS__)
539 #pragma options align=packed
547 } PACKEDATTR switchlist_t
; //jff 3/23/98 pack to read from memory
549 #if defined(__MWERKS__)
550 #pragma options align=reset
626 struct platlist
*list
; // killough
629 // New limit-free plat structure -- killough
631 typedef struct platlist
{
633 struct platlist
*next
,**prev
;
646 // 1 = up, 0 = waiting at top, -1 = down
649 // tics to wait at the top
651 // (keep in case a door going down is reset)
652 // when it reaches 0, start going down
655 //jff 1/31/98 keep track of line door is triggered by
658 /* killough 10/98: sector tag for gradual lighting effects */
669 fixed_t bottomheight
;
675 //jff 02/04/98 add these to support ceiling changers
677 int oldspecial
; //jff 3/14/98 add to fix bug in change transfers
680 // 1 = up, 0 = waiting, -1 = down
686 struct ceilinglist
*list
; // jff 2/22/98 copied from killough's plats
689 typedef struct ceilinglist
{
691 struct ceilinglist
*next
,**prev
;
704 int oldspecial
; //jff 3/14/98 add to fix bug in change transfers
706 fixed_t floordestheight
;
717 fixed_t floordestheight
;
718 fixed_t ceilingdestheight
;
724 // killough 3/7/98: Add generalized scroll effects
731 sc_carry_ceiling
, // killough 4/11/98: carry objects hanging on ceilings
735 thinker_t thinker
; // Thinker structure for scrolling
736 fixed_t dx
, dy
; // (dx,dy) scroll speeds
737 int affectee
; // Number of affected sidedef, sector, tag, or whatever
738 int control
; // Control sector (-1 if none) used to control scrolling
739 fixed_t last_height
; // Last known height of control sector
740 fixed_t vdx
, vdy
; // Accumulated velocity if accelerative
741 int accel
; // Whether it's accelerative
742 unsigned type
; // Type of scroll effect
745 // phares 3/12/98: added new model of friction for ice/sludge effects
748 thinker_t thinker
; // Thinker structure for friction
749 int friction
; // friction value (E800 = normal)
750 int movefactor
; // inertia factor when adding to momentum
751 int affectee
; // Number of affected sector
754 // phares 3/20/98: added new model of Pushers for push/pull effects
765 thinker_t thinker
; // Thinker structure for Pusher
767 mobj_t
* source
; // Point source if point pusher
768 int x_mag
; // X Strength
769 int y_mag
; // Y Strength
770 int magnitude
; // Vector strength for point pusher
771 int radius
; // Effective radius for point pusher
772 int x
; // X of point source if point pusher
773 int y
; // Y of point source if point pusher
774 int affectee
; // Number of affected sector
777 //////////////////////////////////////////////////////////////////
779 // external data declarations
781 //////////////////////////////////////////////////////////////////
784 // End-level timer (-TIMER option)
786 extern boolean levelTimer
;
787 extern int levelTimeCount
;
789 // list of retriggerable buttons active
790 extern button_t buttonlist
[MAXBUTTONS
];
792 extern platlist_t
*activeplats
; // killough 2/14/98
794 extern ceilinglist_t
*activeceilings
; // jff 2/22/98
796 ////////////////////////////////////////////////////////////////
798 // Linedef and sector special utility function prototypes
800 ////////////////////////////////////////////////////////////////
816 fixed_t P_FindLowestFloorSurrounding
819 fixed_t P_FindHighestFloorSurrounding
822 fixed_t P_FindNextHighestFloor
826 fixed_t P_FindNextLowestFloor
830 fixed_t P_FindLowestCeilingSurrounding
831 ( sector_t
* sec
); // jff 2/04/98
833 fixed_t P_FindHighestCeilingSurrounding
834 ( sector_t
* sec
); // jff 2/04/98
836 fixed_t P_FindNextLowestCeiling
838 int currentheight
); // jff 2/04/98
840 fixed_t P_FindNextHighestCeiling
842 int currentheight
); // jff 2/04/98
844 fixed_t P_FindShortestTextureAround
845 ( int secnum
); // jff 2/04/98
847 fixed_t P_FindShortestUpperAround
848 ( int secnum
); // jff 2/04/98
850 sector_t
* P_FindModelFloorSector
851 ( fixed_t floordestheight
,
852 int secnum
); //jff 02/04/98
854 sector_t
* P_FindModelCeilingSector
855 ( fixed_t ceildestheight
,
856 int secnum
); //jff 02/04/98
858 int P_FindSectorFromLineTag
859 ( const line_t
*line
,
860 int start
); // killough 4/17/98
862 int P_FindLineFromLineTag
863 ( const line_t
*line
,
864 int start
); // killough 4/17/98
866 int P_FindMinSurroundingLight
870 sector_t
* getNextSector
875 (line_t
*line
); // jff 2/27/98
877 boolean P_CanUnlockGenDoor
881 boolean P_SectorActive
891 void P_ChangeSwitchTexture
895 ////////////////////////////////////////////////////////////////
897 // Linedef and sector special action function prototypes
899 ////////////////////////////////////////////////////////////////
904 ( lightflash_t
* flash
);
909 // jff 8/8/98 add missing thinker for flicker
911 ( fireflicker_t
* flick
);
929 ( ceiling_t
* ceiling
);
942 ( floormove_t
* floor
);
945 ( elevator_t
* elevator
);
950 ( scroll_t
* ); // killough 3/7/98: scroll effect thinker
953 ( friction_t
* ); // phares 3/12/98: friction thinker
956 ( pusher_t
* ); // phares 3/20/98: Push thinker
958 ////////////////////////////////////////////////////////////////
960 // Linedef and sector special handler prototypes
962 ////////////////////////////////////////////////////////////////
971 // killough 2/14/98: Add silent teleporter
972 int EV_SilentTeleport
977 // killough 1/31/98: Add silent line teleporter
978 int EV_SilentLineTeleport
1005 int EV_CeilingCrushStop
1025 int EV_StartLightStrobing
1028 int EV_TurnTagLightsOff
1035 int EV_LightTurnOnPartway(line_t
* line
, fixed_t level
); // killough 10/10/98
1041 change_e changetype
);
1076 int EV_DoGenLockedDoor
1079 ////////////////////////////////////////////////////////////////
1081 // Linedef and sector special thinker spawning
1083 ////////////////////////////////////////////////////////////////
1089 void P_InitSwitchList
1093 void P_SpawnSpecials
1097 void P_UpdateSpecials
1101 boolean P_UseSpecialLine
1106 void P_ShootSpecialLine
1110 void P_CrossSpecialLine(line_t
*line
, int side
, mobj_t
*thing
);
1112 void P_PlayerInSpecialSector
1113 ( player_t
* player
);
1117 void P_SpawnFireFlicker
1118 ( sector_t
* sector
);
1120 void P_SpawnLightFlash
1121 ( sector_t
* sector
);
1123 void P_SpawnStrobeFlash
1128 void P_SpawnGlowingLight
1129 ( sector_t
* sector
);
1133 void P_AddActivePlat
1136 void P_RemoveActivePlat
1139 void P_RemoveAllActivePlats
1140 ( void ); // killough
1142 void P_ActivateInStasis
1147 void P_SpawnDoorCloseIn30
1150 void P_SpawnDoorRaiseIn5Mins
1156 void P_RemoveActiveCeiling
1157 ( ceiling_t
* ceiling
); //jff 2/22/98
1159 void P_RemoveAllActiveCeilings
1160 ( void ); //jff 2/22/98
1162 void P_AddActiveCeiling
1165 void P_RemoveActiveCeiling
1168 int P_ActivateInStasisCeiling
1171 mobj_t
* P_GetPushThing(int); // phares 3/23/98