gzdoom/code/P_spec.h

722 lines
14 KiB
C
Raw Normal View History

1998-04-07 00:00:00 +00:00
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id:$
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// DESCRIPTION: none
// Implements special effects:
// Texture animation, height or lighting changes
// according to adjacent sectors, respective
// utility functions, etc.
//
//-----------------------------------------------------------------------------
#ifndef __P_SPEC__
#define __P_SPEC__
1998-07-26 00:00:00 +00:00
//jff 2/23/98 identify the special classes that can share sectors
typedef enum
{
floor_special,
ceiling_special,
lighting_special,
} special_e;
// killough 3/7/98: Add generalized scroll effects
typedef struct {
thinker_t thinker; // Thinker structure for scrolling
fixed_t dx, dy; // (dx,dy) scroll speeds
int affectee; // Number of affected sidedef, sector, tag, or whatever
int control; // Control sector (-1 if none) used to control scrolling
fixed_t last_height; // Last known height of control sector
fixed_t vdx, vdy; // Accumulated velocity if accelerative
int accel; // Whether it's accelerative
enum
{
sc_side,
sc_floor,
sc_ceiling,
sc_carry,
sc_carry_ceiling, // killough 4/11/98: carry objects hanging on ceilings
} type; // Type of scroll effect
} scroll_t;
1998-12-22 00:00:00 +00:00
// phares 3/20/98: added new model of Pushers for push/pull effects
typedef struct {
thinker_t thinker; // Thinker structure for Pusher
enum
{
p_push,
p_pull,
p_wind,
p_current,
} type;
mobj_t* source; // Point source if point pusher
int x_mag; // X Strength
int y_mag; // Y Strength
int magnitude; // Vector strength for point pusher
int radius; // Effective radius for point pusher
int x; // X of point source if point pusher
int y; // Y of point source if point pusher
int affectee; // Number of affected sector
} pusher_t;
// [RH] Types of keys used by locked doors and scripts
typedef enum
{
NoKey,
RCard,
BCard,
YCard,
RSkull,
BSkull,
YSkull,
AnyKey = 100,
AllKeys = 101,
CardIsSkull = 128
} keytype_t;
BOOL P_CheckKeys (player_t *p, keytype_t lock, BOOL remote);
1998-07-26 00:00:00 +00:00
1998-07-14 00:00:00 +00:00
// Define values for map objects
1998-04-07 00:00:00 +00:00
#define MO_TELEPORTMAN 14
1998-07-14 00:00:00 +00:00
// [RH] If a deathmatch game, checks to see if noexit is enabled.
// If so, it kills the player and returns false. Otherwise,
// it returns true, and the player is allowed to live.
BOOL CheckIfExitIsGood (mobj_t *self);
1998-04-07 00:00:00 +00:00
// at game start
void P_InitPicAnims (void);
// at map load
void P_SpawnSpecials (void);
// every tic
void P_UpdateSpecials (void);
// when needed
1999-02-17 00:00:00 +00:00
BOOL P_ActivateLine (line_t *ld, mobj_t *mo, int side, int activationType);
1998-07-14 00:00:00 +00:00
void P_PlayerInSpecialSector (player_t *player);
int twoSided (int sector, int line);
sector_t *getSector (int currentSector, int line, int side);
side_t *getSide (int currentSector, int line, int side);
fixed_t P_FindLowestFloorSurrounding (sector_t *sec);
fixed_t P_FindHighestFloorSurrounding (sector_t *sec);
fixed_t P_FindNextHighestFloor (sector_t *sec, int currentheight);
1998-07-26 00:00:00 +00:00
fixed_t P_FindNextLowestFloor (sector_t* sec, int currentheight);
1998-07-14 00:00:00 +00:00
1998-12-22 00:00:00 +00:00
fixed_t P_FindLowestCeilingSurrounding (sector_t *sec); // jff 2/04/98
fixed_t P_FindHighestCeilingSurrounding (sector_t *sec); // jff 2/04/98
fixed_t P_FindNextLowestCeiling (sector_t *sec, int currentheight); // jff 2/04/98
fixed_t P_FindNextHighestCeiling (sector_t *sec, int currentheight); // jff 2/04/98
1998-07-14 00:00:00 +00:00
1998-12-22 00:00:00 +00:00
fixed_t P_FindShortestTextureAround (int secnum); // jff 2/04/98
fixed_t P_FindShortestUpperAround (int secnum); // jff 2/04/98
sector_t* P_FindModelFloorSector (fixed_t floordestheight, int secnum); //jff 02/04/98
sector_t* P_FindModelCeilingSector (fixed_t ceildestheight, int secnum); //jff 02/04/98
int P_FindSectorFromTag (int tag, int start);
int P_FindLineFromID (int id, int start);
1998-07-14 00:00:00 +00:00
int P_FindMinSurroundingLight (sector_t *sector, int max);
sector_t *getNextSector (line_t *line, sector_t *sec);
1998-12-22 00:00:00 +00:00
sector_t *P_NextSpecialSector (sector_t *sec, int type, sector_t *back2); // [RH]
1998-04-07 00:00:00 +00:00
1998-07-26 00:00:00 +00:00
void T_Scroll (scroll_t *); // killough 3/7/98: scroll effect thinker
1998-12-22 00:00:00 +00:00
void T_Pusher (pusher_t *); // phares 3/20/98: Push thinker
1998-07-26 00:00:00 +00:00
1998-04-07 00:00:00 +00:00
//
// SPECIAL
//
1998-12-22 00:00:00 +00:00
int EV_DoDonut (int tag, fixed_t pillarspeed, fixed_t slimespeed);
1998-04-07 00:00:00 +00:00
//
// P_LIGHTS
//
typedef struct
{
thinker_t thinker;
sector_t* sector;
int count;
int maxlight;
int minlight;
} fireflicker_t;
typedef struct
{
thinker_t thinker;
sector_t* sector;
int count;
int maxlight;
int minlight;
int maxtime;
int mintime;
} lightflash_t;
typedef struct
{
thinker_t thinker;
sector_t* sector;
int count;
int minlight;
int maxlight;
int darktime;
int brighttime;
} strobe_t;
typedef struct
{
thinker_t thinker;
sector_t* sector;
int minlight;
int maxlight;
int direction;
} glow_t;
1998-12-22 00:00:00 +00:00
// [RH] Glow from Light_Glow and Light_Fade specials
typedef struct
{
thinker_t thinker;
sector_t *sector;
int start;
int end;
int maxtics;
int tics;
BOOL oneshot;
} glow2_t;
// [RH] Phased light thinker
typedef struct
{
thinker_t thinker;
sector_t *sector;
byte baselevel;
byte phase;
} phased_t;
#define GLOWSPEED 8
#define STROBEBRIGHT 5
#define FASTDARK 15
1998-07-14 00:00:00 +00:00
#define SLOWDARK TICRATE
1998-04-07 00:00:00 +00:00
1998-07-14 00:00:00 +00:00
void T_FireFlicker (fireflicker_t *flick);
void P_SpawnFireFlicker (sector_t *sector);
void T_LightFlash (lightflash_t *flash);
1998-12-22 00:00:00 +00:00
void P_SpawnLightFlash (sector_t *sector, int min, int max);
1998-07-14 00:00:00 +00:00
void T_StrobeFlash (strobe_t *flash);
1998-04-07 00:00:00 +00:00
1998-12-22 00:00:00 +00:00
void P_SpawnStrobeFlash (sector_t *sector, int upper, int lower,
int utics, int ltics, int inSync);
1998-04-07 00:00:00 +00:00
1999-02-17 00:00:00 +00:00
void T_Flicker (fireflicker_t *flick);
void EV_StartLightFlickering (int tag, int upper, int lower);
1998-12-22 00:00:00 +00:00
void EV_StartLightStrobing (int tag, int upper, int lower,
int utics, int ltics);
void EV_TurnTagLightsOff (int tag);
void EV_LightTurnOn (int tag, int bright);
void EV_LightChange (int tag, int value);
1998-04-07 00:00:00 +00:00
1998-07-14 00:00:00 +00:00
void T_Glow (glow_t *g);
void P_SpawnGlowingLight (sector_t *sector);
1998-04-07 00:00:00 +00:00
1998-12-22 00:00:00 +00:00
void T_Glow2 (glow2_t *g);
void EV_StartLightGlowing (int tag, int upper, int lower, int tics);
void EV_StartLightFading (int tag, int value, int tics);
1998-04-07 00:00:00 +00:00
1998-12-22 00:00:00 +00:00
void T_PhasedLight (phased_t *l);
void P_SpawnLightSequence (sector_t *sector);
void P_SpawnLightPhased (sector_t *sector);
1998-04-07 00:00:00 +00:00
//
// P_SWITCH
//
typedef struct
{
char name1[9];
char name2[9];
short episode;
} switchlist_t;
typedef enum
{
top,
middle,
bottom
} bwhere_e;
1998-12-22 00:00:00 +00:00
typedef struct button_s
1998-04-07 00:00:00 +00:00
{
1998-12-22 00:00:00 +00:00
struct button_s *next; // [RH] make buttons a singly-linked list
1998-04-07 00:00:00 +00:00
line_t* line;
bwhere_e where;
int btexture;
int btimer;
1999-02-17 00:00:00 +00:00
fixed_t x, y; // [RH] Location of switch sound, independent of any mobjs
1998-04-07 00:00:00 +00:00
} button_t;
// 1 second, in ticks.
1998-07-14 00:00:00 +00:00
#define BUTTONTIME TICRATE
1998-04-07 00:00:00 +00:00
1998-12-22 00:00:00 +00:00
extern button_t *buttonlist;
1998-04-07 00:00:00 +00:00
1998-07-14 00:00:00 +00:00
void P_ChangeSwitchTexture (line_t *line, int useAgain);
1998-04-07 00:00:00 +00:00
1998-07-14 00:00:00 +00:00
void P_InitSwitchList(void);
1998-04-07 00:00:00 +00:00
//
// P_PLATS
//
typedef enum
{
up,
down,
waiting,
in_stasis
} plat_e;
typedef enum
{
1998-12-22 00:00:00 +00:00
// [RH] Changed these
platPerpetualRaise,
platDownWaitUpStay,
platUpWaitDownStay,
platDownByValue,
platUpByValue,
platUpByValueStay,
platRaiseAndStay,
platToggle,
platDownToNearestFloor,
platDownToLowestCeiling
1998-04-07 00:00:00 +00:00
} plattype_e;
1998-12-22 00:00:00 +00:00
typedef struct plat_s
1998-04-07 00:00:00 +00:00
{
thinker_t thinker;
1998-12-22 00:00:00 +00:00
// [RH] Added next and prev links
struct plat_s *next, *prev;
1998-04-07 00:00:00 +00:00
sector_t* sector;
fixed_t speed;
fixed_t low;
fixed_t high;
int wait;
int count;
plat_e status;
plat_e oldstatus;
1998-07-26 00:00:00 +00:00
BOOL crush;
1998-04-07 00:00:00 +00:00
int tag;
plattype_e type;
} plat_t;
1998-12-22 00:00:00 +00:00
extern plat_t *activeplats;
1998-04-07 00:00:00 +00:00
1998-07-14 00:00:00 +00:00
void T_PlatRaise(plat_t *plat);
1998-04-07 00:00:00 +00:00
1998-12-22 00:00:00 +00:00
BOOL EV_DoPlat (int tag, line_t *line, plattype_e type, int height,
int speed, int delay, int lip, int change);
1998-04-07 00:00:00 +00:00
1998-07-14 00:00:00 +00:00
void P_AddActivePlat (plat_t *plat);
void P_RemoveActivePlat (plat_t *plat);
1998-12-22 00:00:00 +00:00
void EV_StopPlat (int tag);
1998-07-14 00:00:00 +00:00
void P_ActivateInStasis (int tag);
1998-04-07 00:00:00 +00:00
//
1998-12-22 00:00:00 +00:00
// [RH]
// P_PILLAR
1998-04-07 00:00:00 +00:00
//
typedef enum
{
1998-12-22 00:00:00 +00:00
pillarBuild,
pillarOpen
1998-04-07 00:00:00 +00:00
1998-12-22 00:00:00 +00:00
} pillar_e;
typedef struct
{
thinker_t thinker;
sector_t *sector;
pillar_e type;
fixed_t floorspeed;
fixed_t ceilingspeed;
fixed_t floortarget;
fixed_t ceilingtarget;
int crush;
1998-04-07 00:00:00 +00:00
1998-12-22 00:00:00 +00:00
} pillar_t;
BOOL EV_DoPillar (pillar_e type, int tag, fixed_t speed, fixed_t height,
fixed_t height2, int crush);
void T_Pillar (pillar_t *pillar);
//
// P_DOORS
//
typedef enum
{
// [RH] Changed for new specials
doorClose,
doorOpen,
doorRaise,
doorRaiseIn5Mins,
doorCloseWaitOpen,
1998-04-07 00:00:00 +00:00
1998-12-22 00:00:00 +00:00
} vldoor_e;
1998-04-07 00:00:00 +00:00
typedef struct
{
thinker_t thinker;
vldoor_e type;
sector_t* sector;
fixed_t topheight;
fixed_t speed;
// 1 = up, 0 = waiting at top, -1 = down
1998-07-14 00:00:00 +00:00
int direction;
1998-04-07 00:00:00 +00:00
// tics to wait at the top
1998-07-14 00:00:00 +00:00
int topwait;
1998-04-07 00:00:00 +00:00
// (keep in case a door going down is reset)
// when it reaches 0, start going down
1998-07-14 00:00:00 +00:00
int topcountdown;
1998-04-07 00:00:00 +00:00
} vldoor_t;
1998-12-22 00:00:00 +00:00
BOOL EV_DoDoor (vldoor_e type, line_t *line, mobj_t *thing,
int tag, int speed, int delay, keytype_t lock);
1998-04-07 00:00:00 +00:00
1998-07-14 00:00:00 +00:00
void T_VerticalDoor (vldoor_t *door);
void P_SpawnDoorCloseIn30 (sector_t *sec);
1998-04-07 00:00:00 +00:00
1998-12-22 00:00:00 +00:00
void P_SpawnDoorRaiseIn5Mins (sector_t *sec);
1998-04-07 00:00:00 +00:00
//
1998-12-22 00:00:00 +00:00
// P_CEILNG
1998-04-07 00:00:00 +00:00
//
1998-12-22 00:00:00 +00:00
// [RH] Changed these
1998-04-07 00:00:00 +00:00
typedef enum
{
1998-12-22 00:00:00 +00:00
ceilLowerByValue,
ceilRaiseByValue,
ceilMoveToValue,
ceilLowerToHighestFloor,
ceilLowerInstant,
ceilRaiseInstant,
ceilCrushAndRaise,
ceilLowerAndCrush,
ceilCrushRaiseAndStay,
ceilRaiseToNearest,
ceilLowerToLowest,
ceilLowerToFloor,
// The following are only used by Generic_Ceiling
ceilRaiseToHighest,
ceilLowerToHighest,
ceilRaiseToLowest,
ceilLowerToNearest,
ceilRaiseToHighestFloor,
ceilRaiseToFloor,
ceilRaiseByTexture,
ceilLowerByTexture,
genCeilingChg0,
genCeilingChgT,
genCeilingChg
1998-04-07 00:00:00 +00:00
1998-12-22 00:00:00 +00:00
} ceiling_e;
1998-04-07 00:00:00 +00:00
1998-12-22 00:00:00 +00:00
typedef struct ceiling_s
1998-04-07 00:00:00 +00:00
{
thinker_t thinker;
1998-12-22 00:00:00 +00:00
// [RH] Added next and prev links
struct ceiling_s *next, *prev;
1998-04-07 00:00:00 +00:00
ceiling_e type;
sector_t* sector;
fixed_t bottomheight;
fixed_t topheight;
fixed_t speed;
1998-12-22 00:00:00 +00:00
fixed_t speed1; // [RH] dnspeed of crushers
fixed_t speed2; // [RH] upspeed of crushers
int crush;
1999-02-17 00:00:00 +00:00
int silent;
int direction; // 1 = up, 0 = waiting, -1 = down
1998-04-07 00:00:00 +00:00
1998-12-22 00:00:00 +00:00
// [RH] Need these for BOOM-ish transfering ceilings
int texture;
int newspecial;
1998-04-07 00:00:00 +00:00
// ID
1998-07-14 00:00:00 +00:00
int tag;
1998-04-07 00:00:00 +00:00
int olddirection;
} ceiling_t;
1998-12-22 00:00:00 +00:00
extern ceiling_t *activeceilings;
1998-04-07 00:00:00 +00:00
1998-12-22 00:00:00 +00:00
BOOL EV_DoCeiling (ceiling_e type, line_t *line,
int tag, fixed_t speed, fixed_t speed2, fixed_t height,
int crush, int silent, int change);
1998-04-07 00:00:00 +00:00
1998-07-14 00:00:00 +00:00
void T_MoveCeiling (ceiling_t *ceiling);
1998-12-22 00:00:00 +00:00
void P_AddActiveCeiling (ceiling_t *c);
void P_RemoveActiveCeiling (ceiling_t *c);
BOOL EV_CeilingCrushStop (int tag);
void P_ActivateInStasisCeiling(int tag);
1998-04-07 00:00:00 +00:00
//
// P_FLOOR
//
1998-12-22 00:00:00 +00:00
// [RH] Changed these enums
1998-04-07 00:00:00 +00:00
typedef enum
{
1998-12-22 00:00:00 +00:00
floorLowerToLowest,
floorLowerToNearest,
floorLowerToHighest,
floorLowerByValue,
floorRaiseByValue,
floorRaiseToHighest,
floorRaiseToNearest,
floorRaiseAndCrush,
floorCrushStop,
floorLowerInstant,
floorRaiseInstant,
floorMoveToValue,
floorRaiseToLowestCeiling,
floorRaiseByTexture,
floorLowerAndChange,
floorRaiseAndChange,
floorRaiseToLowest,
floorRaiseToCeiling,
floorLowerToLowestCeiling,
floorLowerByTexture,
floorLowerToCeiling,
1998-04-07 00:00:00 +00:00
donutRaise,
1998-12-22 00:00:00 +00:00
buildStair,
waitStair,
resetStair,
// Not to be used as parameters to EV_DoFloor()
genFloorChg0,
genFloorChgT,
genFloorChg
1998-04-07 00:00:00 +00:00
} floor_e;
1998-12-22 00:00:00 +00:00
//jff 3/15/98 pure texture/type change for better generalized support
typedef enum
{
trigChangeOnly,
numChangeOnly,
} change_e;
// [RH] Changed to use Hexen-ish specials
1998-04-07 00:00:00 +00:00
typedef enum
{
1998-12-22 00:00:00 +00:00
buildUp,
buildDown
1998-04-07 00:00:00 +00:00
} stair_e;
1998-07-26 00:00:00 +00:00
typedef enum
{
elevateUp,
elevateDown,
elevateCurrent,
1998-12-22 00:00:00 +00:00
// [RH] For FloorAndCeiling_Raise/Lower
elevateRaise,
elevateLower
1998-07-26 00:00:00 +00:00
} elevator_e;
1998-04-07 00:00:00 +00:00
typedef struct
{
thinker_t thinker;
floor_e type;
1998-12-22 00:00:00 +00:00
int crush;
1998-04-07 00:00:00 +00:00
sector_t* sector;
int direction;
1998-12-22 00:00:00 +00:00
short newspecial;
1998-04-07 00:00:00 +00:00
short texture;
fixed_t floordestheight;
fixed_t speed;
1998-12-22 00:00:00 +00:00
// [RH] New parameters use to reset and delayed stairs
int resetcount;
int orgheight;
int delay;
int pausetime;
int steptime;
int persteptime;
1998-04-07 00:00:00 +00:00
} floormove_t;
1998-07-26 00:00:00 +00:00
typedef struct
{
1998-12-22 00:00:00 +00:00
thinker_t thinker;
elevator_e type;
sector_t* sector;
int direction;
fixed_t floordestheight;
fixed_t ceilingdestheight;
fixed_t speed;
1998-07-26 00:00:00 +00:00
} elevator_t;
1998-04-07 00:00:00 +00:00
1999-02-17 00:00:00 +00:00
typedef struct
{
thinker_t thinker;
sector_t *sector;
fixed_t originalHeight;
fixed_t accumulator;
fixed_t accDelta;
fixed_t targetScale;
fixed_t scale;
fixed_t scaleDelta;
int ticker;
int state;
} floorWaggle_t;
1998-04-07 00:00:00 +00:00
typedef enum
{
ok,
crushed,
pastdest
} result_e;
1998-07-14 00:00:00 +00:00
result_e T_MovePlane (sector_t *sector, fixed_t speed, fixed_t dest,
1998-12-22 00:00:00 +00:00
int crush, int floorOrCeiling, int direction);
1998-04-07 00:00:00 +00:00
1998-12-22 00:00:00 +00:00
BOOL EV_DoElevator (line_t *line, ceiling_e type, fixed_t speed, fixed_t height, int tag);
1998-07-26 00:00:00 +00:00
1998-12-22 00:00:00 +00:00
BOOL EV_BuildStairs (int tag, stair_e type, line_t *line,
fixed_t stairsize, fixed_t speed, int delay, int reset, int igntxt,
int usespecials);
1998-04-07 00:00:00 +00:00
1998-12-22 00:00:00 +00:00
BOOL EV_DoFloor (floor_e floortype, line_t *line, int tag,
fixed_t speed, fixed_t height, int crush, int change);
BOOL EV_FloorCrushStop (int tag);
BOOL EV_DoChange (line_t *line, change_e changetype, int tag);
1999-02-17 00:00:00 +00:00
BOOL EV_StartFloorWaggle(int tag, int height, int speed, int offset,
int timer);
1998-04-07 00:00:00 +00:00
1999-02-17 00:00:00 +00:00
void T_FloorWaggle (floorWaggle_t *w);
1998-07-14 00:00:00 +00:00
void T_MoveFloor (floormove_t *floor);
1998-07-26 00:00:00 +00:00
void T_MoveElevator (elevator_t *elevator);
1998-04-07 00:00:00 +00:00
//
// P_TELEPT
//
1998-12-22 00:00:00 +00:00
BOOL EV_Teleport (int tid, int side, mobj_t *thing);
BOOL EV_SilentTeleport (int tid, line_t *line, int side, mobj_t *thing);
BOOL EV_SilentLineTeleport (line_t *line, int side, mobj_t *thing, int id,
BOOL reverse);
1998-04-07 00:00:00 +00:00
1998-07-26 00:00:00 +00:00
int P_SectorActive (special_e t, sector_t *s); // [RH] from BOOM
1998-12-22 00:00:00 +00:00
//
// [RH] ACS (see also p_acs.h)
//
void P_ClearScripts (void);
BOOL P_StartScript (mobj_t *who, line_t *where, int script, char *map, int lineSide,
int arg0, int arg1, int arg2, int always);
void P_SuspendScript (int script, char *map);
void P_TerminateScript (int script, char *map);
void P_StartOpenScripts (void);
void P_DoDeferedScripts (void);
//
// [RH] p_quake.c
//
typedef struct quake_s {
struct quake_s *next;
mobj_t *quakespot;
fixed_t tremorbox[4];
fixed_t damagebox[4];
int intensity;
int countdown;
} quake_t;
extern quake_t *ActiveQuakes;
void P_RunQuakes (void);
BOOL P_StartQuake (int tid, int intensity, int duration, int damrad, int tremrad);
1998-04-07 00:00:00 +00:00
#endif