2006-02-24 04:48:15 +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:
|
|
|
|
// Refresh/rendering module, shared data struct definitions.
|
|
|
|
//
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef __R_DEFS_H__
|
|
|
|
#define __R_DEFS_H__
|
|
|
|
|
|
|
|
#include "doomdef.h"
|
2009-08-08 21:30:23 +00:00
|
|
|
#include "templates.h"
|
2011-01-02 18:02:27 +00:00
|
|
|
#include "memarena.h"
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
// Some more or less basic data types
|
|
|
|
// we depend on.
|
|
|
|
#include "m_fixed.h"
|
|
|
|
|
|
|
|
// We rely on the thinker data struct
|
|
|
|
// to handle sound origins in sectors.
|
|
|
|
// SECTORS do store MObjs anyway.
|
|
|
|
#include "actor.h"
|
|
|
|
|
|
|
|
#include "dthinker.h"
|
|
|
|
|
2012-09-16 04:51:28 +00:00
|
|
|
#define MAXWIDTH 5760
|
|
|
|
#define MAXHEIGHT 3600
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
const WORD NO_INDEX = 0xffffu;
|
|
|
|
const DWORD NO_SIDE = 0xffffffffu;
|
|
|
|
|
|
|
|
// Silhouette, needed for clipping Segs (mainly)
|
|
|
|
// and sprites representing things.
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
SIL_NONE,
|
|
|
|
SIL_BOTTOM,
|
|
|
|
SIL_TOP,
|
|
|
|
SIL_BOTH
|
|
|
|
};
|
|
|
|
|
|
|
|
extern size_t MaxDrawSegs;
|
2016-02-16 15:40:53 +00:00
|
|
|
struct FDisplacement;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
|
2016-02-14 12:12:03 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
SKYBOX_ANCHOR = -1,
|
|
|
|
SKYBOX_SKYVIEWPOINT = 0, // a regular skybox
|
|
|
|
SKYBOX_STACKEDSECTORTHING, // stacked sectors with the thing method
|
|
|
|
SKYBOX_PORTAL, // stacked sectors with Sector_SetPortal
|
|
|
|
SKYBOX_LINKEDPORTAL, // linked portal (interactive)
|
|
|
|
SKYBOX_PLANE, // EE-style plane portal (not implemented in SW renderer)
|
|
|
|
SKYBOX_HORIZON, // EE-style horizon portal (not implemented in SW renderer)
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
//
|
|
|
|
// INTERNAL MAP TYPES
|
|
|
|
// used by play and refresh
|
|
|
|
//
|
|
|
|
|
|
|
|
//
|
|
|
|
// Your plain vanilla vertex.
|
|
|
|
// Note: transformed values not buffered locally,
|
|
|
|
// like some DOOM-alikes ("wt", "WebView") did.
|
|
|
|
//
|
2010-12-14 00:56:44 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
VERTEXFLAG_ZCeilingEnabled = 0x01,
|
|
|
|
VERTEXFLAG_ZFloorEnabled = 0x02
|
|
|
|
};
|
|
|
|
struct vertexdata_t
|
|
|
|
{
|
|
|
|
fixed_t zCeiling, zFloor;
|
|
|
|
DWORD flags;
|
|
|
|
};
|
2008-04-12 15:31:18 +00:00
|
|
|
struct vertex_t
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
fixed_t x, y;
|
|
|
|
|
2008-04-12 15:31:18 +00:00
|
|
|
bool operator== (const vertex_t &other)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
return x == other.x && y == other.y;
|
|
|
|
}
|
2010-07-23 05:56:25 +00:00
|
|
|
|
|
|
|
void clear()
|
|
|
|
{
|
|
|
|
x = y = 0;
|
|
|
|
}
|
2006-02-24 04:48:15 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// Forward of LineDefs, for Sectors.
|
2008-03-21 17:35:49 +00:00
|
|
|
struct line_t;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2008-06-01 07:52:33 +00:00
|
|
|
class player_t;
|
2008-04-12 15:31:18 +00:00
|
|
|
class FScanner;
|
2008-04-15 18:05:39 +00:00
|
|
|
class FBitmap;
|
2008-04-16 18:17:20 +00:00
|
|
|
struct FCopyInfo;
|
2008-06-04 17:53:15 +00:00
|
|
|
class DInterpolation;
|
2011-07-06 14:20:54 +00:00
|
|
|
class FArchive;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2009-05-11 21:05:40 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
UDMF_Line,
|
|
|
|
UDMF_Side,
|
|
|
|
UDMF_Sector,
|
|
|
|
UDMF_Thing
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
struct FUDMFKey
|
|
|
|
{
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
UDMF_Int,
|
|
|
|
UDMF_Float,
|
|
|
|
UDMF_String
|
|
|
|
};
|
|
|
|
|
|
|
|
FName Key;
|
|
|
|
int Type;
|
|
|
|
int IntVal;
|
|
|
|
double FloatVal;
|
|
|
|
FString StringVal;
|
|
|
|
|
|
|
|
FUDMFKey()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
FUDMFKey& operator =(int val)
|
|
|
|
{
|
|
|
|
Type = UDMF_Int;
|
|
|
|
IntVal = val;
|
|
|
|
FloatVal = val;
|
|
|
|
StringVal = "";
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
FUDMFKey& operator =(double val)
|
|
|
|
{
|
|
|
|
Type = UDMF_Float;
|
|
|
|
IntVal = int(val);
|
|
|
|
FloatVal = val;
|
|
|
|
StringVal = "";
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
FUDMFKey& operator =(const FString &val)
|
|
|
|
{
|
|
|
|
Type = UDMF_String;
|
2016-02-05 09:40:45 +00:00
|
|
|
IntVal = strtol(val.GetChars(), NULL, 0);
|
|
|
|
FloatVal = strtod(val.GetChars(), NULL);
|
2009-05-11 21:05:40 +00:00
|
|
|
StringVal = val;
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
class FUDMFKeys : public TArray<FUDMFKey>
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
void Sort();
|
|
|
|
FUDMFKey *Find(FName key);
|
|
|
|
};
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
//
|
|
|
|
// The SECTORS record, at runtime.
|
|
|
|
// Stores things/mobjs.
|
|
|
|
//
|
|
|
|
class DSectorEffect;
|
|
|
|
struct sector_t;
|
2009-09-06 18:19:28 +00:00
|
|
|
struct line_t;
|
2007-12-29 10:25:07 +00:00
|
|
|
struct FRemapTable;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
SECSPAC_Enter = 1, // Trigger when player enters
|
|
|
|
SECSPAC_Exit = 2, // Trigger when player exits
|
|
|
|
SECSPAC_HitFloor = 4, // Trigger when player hits floor
|
|
|
|
SECSPAC_HitCeiling = 8, // Trigger when player hits ceiling
|
|
|
|
SECSPAC_Use = 16, // Trigger when player uses
|
|
|
|
SECSPAC_UseWall = 32, // Trigger when player uses a wall
|
|
|
|
SECSPAC_EyesDive = 64, // Trigger when player eyes go below fake floor
|
|
|
|
SECSPAC_EyesSurface = 128, // Trigger when player eyes go above fake floor
|
|
|
|
SECSPAC_EyesBelowC = 256, // Trigger when player eyes go below fake ceiling
|
|
|
|
SECSPAC_EyesAboveC = 512, // Trigger when player eyes go above fake ceiling
|
|
|
|
SECSPAC_HitFakeFloor= 1024, // Trigger when player hits fake floor
|
|
|
|
};
|
|
|
|
|
|
|
|
class ASectorAction : public AActor
|
|
|
|
{
|
2008-08-08 22:52:04 +00:00
|
|
|
DECLARE_CLASS (ASectorAction, AActor)
|
2006-02-24 04:48:15 +00:00
|
|
|
public:
|
2015-09-12 01:47:49 +00:00
|
|
|
ASectorAction (bool activatedByUse = false);
|
2006-02-24 04:48:15 +00:00
|
|
|
void Destroy ();
|
|
|
|
void BeginPlay ();
|
|
|
|
void Activate (AActor *source);
|
|
|
|
void Deactivate (AActor *source);
|
2014-05-13 19:26:51 +00:00
|
|
|
bool TriggerAction(AActor *triggerer, int activationType);
|
2015-09-12 01:47:49 +00:00
|
|
|
bool CanTrigger (AActor *triggerer) const;
|
|
|
|
bool IsActivatedByUse() const;
|
2006-02-24 04:48:15 +00:00
|
|
|
protected:
|
2014-05-13 19:26:51 +00:00
|
|
|
virtual bool DoTriggerAction(AActor *triggerer, int activationType);
|
|
|
|
bool CheckTrigger(AActor *triggerer) const;
|
2015-09-12 01:47:49 +00:00
|
|
|
private:
|
|
|
|
bool ActivatedByUse;
|
2006-02-24 04:48:15 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class ASkyViewpoint;
|
|
|
|
|
|
|
|
struct secplane_t
|
|
|
|
{
|
|
|
|
// the plane is defined as a*x + b*y + c*z + d = 0
|
|
|
|
// ic is 1/c, for faster Z calculations
|
|
|
|
|
|
|
|
fixed_t a, b, c, d, ic;
|
|
|
|
|
2013-04-17 01:32:40 +00:00
|
|
|
// Returns < 0 : behind; == 0 : on; > 0 : in front
|
|
|
|
int PointOnSide (fixed_t x, fixed_t y, fixed_t z) const
|
|
|
|
{
|
|
|
|
return TMulScale16(a,x, b,y, c,z) + d;
|
|
|
|
}
|
|
|
|
|
2011-01-29 11:09:38 +00:00
|
|
|
// Returns the value of z at (0,0) This is used by the 3D floor code which does not handle slopes
|
|
|
|
fixed_t Zat0 () const
|
|
|
|
{
|
2013-04-17 01:32:40 +00:00
|
|
|
return ic < 0 ? d : -d;
|
2011-01-29 11:09:38 +00:00
|
|
|
}
|
|
|
|
|
2016-02-16 15:40:53 +00:00
|
|
|
fixed_t ZatPoint(const fixedvec2 &spot) const
|
|
|
|
{
|
|
|
|
return FixedMul(ic, -d - DMulScale16(a, spot.x, b, spot.y));
|
|
|
|
}
|
|
|
|
|
|
|
|
fixed_t ZatPoint(const fixedvec3 &spot) const
|
|
|
|
{
|
|
|
|
return FixedMul(ic, -d - DMulScale16(a, spot.x, b, spot.y));
|
|
|
|
}
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
// Returns the value of z at (x,y)
|
|
|
|
fixed_t ZatPoint (fixed_t x, fixed_t y) const
|
|
|
|
{
|
|
|
|
return FixedMul (ic, -d - DMulScale16 (a, x, b, y));
|
|
|
|
}
|
|
|
|
|
2008-05-22 05:17:21 +00:00
|
|
|
// Returns the value of z at (x,y) as a double
|
|
|
|
double ZatPoint (double x, double y) const
|
|
|
|
{
|
|
|
|
return (d + a*x + b*y) * ic / (-65536.0 * 65536.0);
|
|
|
|
}
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
// Returns the value of z at vertex v
|
|
|
|
fixed_t ZatPoint (const vertex_t *v) const
|
|
|
|
{
|
|
|
|
return FixedMul (ic, -d - DMulScale16 (a, v->x, b, v->y));
|
|
|
|
}
|
|
|
|
|
2016-01-17 12:48:16 +00:00
|
|
|
fixed_t ZatPoint (const AActor *ac) const
|
|
|
|
{
|
|
|
|
return FixedMul (ic, -d - DMulScale16 (a, ac->X(), b, ac->Y()));
|
|
|
|
}
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
// Returns the value of z at (x,y) if d is equal to dist
|
|
|
|
fixed_t ZatPointDist (fixed_t x, fixed_t y, fixed_t dist) const
|
|
|
|
{
|
|
|
|
return FixedMul (ic, -dist - DMulScale16 (a, x, b, y));
|
|
|
|
}
|
|
|
|
|
|
|
|
// Returns the value of z at vertex v if d is equal to dist
|
|
|
|
fixed_t ZatPointDist (const vertex_t *v, fixed_t dist)
|
|
|
|
{
|
|
|
|
return FixedMul (ic, -dist - DMulScale16 (a, v->x, b, v->y));
|
|
|
|
}
|
|
|
|
|
|
|
|
// Flips the plane's vertical orientiation, so that if it pointed up,
|
|
|
|
// it will point down, and vice versa.
|
|
|
|
void FlipVert ()
|
|
|
|
{
|
|
|
|
a = -a;
|
|
|
|
b = -b;
|
|
|
|
c = -c;
|
|
|
|
d = -d;
|
|
|
|
ic = -ic;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Returns true if 2 planes are the same
|
|
|
|
bool operator== (const secplane_t &other) const
|
|
|
|
{
|
|
|
|
return a == other.a && b == other.b && c == other.c && d == other.d;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Returns true if 2 planes are different
|
|
|
|
bool operator!= (const secplane_t &other) const
|
|
|
|
{
|
|
|
|
return a != other.a || b != other.b || c != other.c || d != other.d;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Moves a plane up/down by hdiff units
|
|
|
|
void ChangeHeight (fixed_t hdiff)
|
|
|
|
{
|
|
|
|
d = d - FixedMul (hdiff, c);
|
|
|
|
}
|
|
|
|
|
2008-03-18 18:18:18 +00:00
|
|
|
// Moves a plane up/down by hdiff units
|
|
|
|
fixed_t GetChangedHeight (fixed_t hdiff)
|
|
|
|
{
|
|
|
|
return d - FixedMul (hdiff, c);
|
|
|
|
}
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
// Returns how much this plane's height would change if d were set to oldd
|
|
|
|
fixed_t HeightDiff (fixed_t oldd) const
|
|
|
|
{
|
|
|
|
return FixedMul (oldd - d, ic);
|
|
|
|
}
|
|
|
|
|
2008-03-18 18:18:18 +00:00
|
|
|
// Returns how much this plane's height would change if d were set to oldd
|
|
|
|
fixed_t HeightDiff (fixed_t oldd, fixed_t newd) const
|
|
|
|
{
|
|
|
|
return FixedMul (oldd - newd, ic);
|
|
|
|
}
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
fixed_t PointToDist (fixed_t x, fixed_t y, fixed_t z) const
|
|
|
|
{
|
|
|
|
return -TMulScale16 (a, x, y, b, z, c);
|
|
|
|
}
|
|
|
|
|
|
|
|
fixed_t PointToDist (const vertex_t *v, fixed_t z) const
|
|
|
|
{
|
|
|
|
return -TMulScale16 (a, v->x, b, v->y, z, c);
|
|
|
|
}
|
2011-07-05 19:50:01 +00:00
|
|
|
|
|
|
|
bool CopyPlaneIfValid (secplane_t *dest, const secplane_t *opp) const;
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
};
|
|
|
|
|
2011-07-06 14:20:54 +00:00
|
|
|
FArchive &operator<< (FArchive &arc, secplane_t &plane);
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2009-01-04 15:00:29 +00:00
|
|
|
#include "p_3dfloors.h"
|
2006-02-24 04:48:15 +00:00
|
|
|
// Ceiling/floor flags
|
|
|
|
enum
|
|
|
|
{
|
2009-09-17 10:40:38 +00:00
|
|
|
PLANEF_ABSLIGHTING = 1, // floor/ceiling light is absolute, not relative
|
2011-02-12 09:53:40 +00:00
|
|
|
PLANEF_BLOCKED = 2, // can not be moved anymore.
|
|
|
|
PLANEF_ADDITIVE = 4, // rendered additive
|
2016-02-05 22:51:28 +00:00
|
|
|
|
|
|
|
// linked portal stuff
|
|
|
|
PLANEF_NORENDER = 8,
|
|
|
|
PLANEF_NOPASS = 16,
|
|
|
|
PLANEF_BLOCKSOUND = 32,
|
|
|
|
PLANEF_DISABLED = 64,
|
|
|
|
PLANEF_OBSTRUCTED = 128, // if the portal plane is beyond the sector's floor or ceiling.
|
2006-02-24 04:48:15 +00:00
|
|
|
};
|
|
|
|
|
2008-05-11 21:16:32 +00:00
|
|
|
// Internal sector flags
|
2006-02-24 04:48:15 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
SECF_FAKEFLOORONLY = 2, // when used as heightsec in R_FakeFlat, only copies floor
|
|
|
|
SECF_CLIPFAKEPLANES = 4, // as a heightsec, clip planes to target sector's planes
|
|
|
|
SECF_NOFAKELIGHT = 8, // heightsec does not change lighting
|
|
|
|
SECF_IGNOREHEIGHTSEC= 16, // heightsec is only for triggering sector actions
|
|
|
|
SECF_UNDERWATER = 32, // sector is underwater
|
|
|
|
SECF_FORCEDUNDERWATER= 64, // sector is forced to be underwater
|
2006-10-20 04:04:04 +00:00
|
|
|
SECF_UNDERWATERMASK = 32+64,
|
|
|
|
SECF_DRAWN = 128, // sector has been drawn at least once
|
2010-08-27 15:20:05 +00:00
|
|
|
SECF_HIDDEN = 256, // Do not draw on textured automap
|
2015-11-25 10:49:34 +00:00
|
|
|
SECF_NOFLOORSKYBOX = 512, // force use of regular sky
|
2016-01-12 20:34:41 +00:00
|
|
|
SECF_NOCEILINGSKYBOX = 1024, // force use of regular sky (do not separate from NOFLOORSKYBOX!!!)
|
2006-02-24 04:48:15 +00:00
|
|
|
};
|
|
|
|
|
2008-05-11 21:16:32 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
SECF_SILENT = 1, // actors in sector make no noise
|
|
|
|
SECF_NOFALLINGDAMAGE= 2, // No falling damage in this sector
|
2008-05-22 19:35:38 +00:00
|
|
|
SECF_FLOORDROP = 4, // all actors standing on this floor will remain on it when it lowers very fast.
|
2008-12-14 19:12:41 +00:00
|
|
|
SECF_NORESPAWN = 8, // players can not respawn in this sector
|
2016-01-06 01:01:59 +00:00
|
|
|
SECF_FRICTION = 16, // sector has friction enabled
|
2016-01-06 01:05:39 +00:00
|
|
|
SECF_PUSH = 32, // pushers enabled
|
2016-01-06 01:16:33 +00:00
|
|
|
SECF_SILENTMOVE = 64, // Sector movement makes mo sound (Eternity got this so this may be useful for an extended cross-port standard.)
|
2016-01-06 11:12:47 +00:00
|
|
|
SECF_DMGTERRAINFX = 128, // spawns terrain splash when inflicting damage
|
|
|
|
SECF_ENDGODMODE = 256, // getting damaged by this sector ends god mode
|
|
|
|
SECF_ENDLEVEL = 512, // ends level when health goes below 10
|
|
|
|
SECF_HAZARD = 1024, // Change to Strife's delayed damage handling.
|
2016-01-06 00:50:45 +00:00
|
|
|
|
|
|
|
SECF_WASSECRET = 1 << 30, // a secret that was discovered
|
|
|
|
SECF_SECRET = 1 << 31, // a secret sector
|
|
|
|
|
2016-01-06 11:12:47 +00:00
|
|
|
SECF_DAMAGEFLAGS = SECF_ENDGODMODE|SECF_ENDLEVEL|SECF_DMGTERRAINFX|SECF_HAZARD,
|
2016-01-06 12:30:28 +00:00
|
|
|
SECF_NOMODIFY = SECF_SECRET|SECF_WASSECRET, // not modifiable by Sector_ChangeFlags
|
|
|
|
SECF_SPECIALFLAGS = SECF_DAMAGEFLAGS|SECF_FRICTION|SECF_PUSH, // these flags originate from 'special and must be transferrable by floor thinkers
|
2008-05-11 21:16:32 +00:00
|
|
|
};
|
|
|
|
|
2008-06-15 18:36:26 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
PL_SKYFLAT = 0x40000000
|
|
|
|
};
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
struct FDynamicColormap;
|
|
|
|
|
|
|
|
|
2008-03-20 21:12:03 +00:00
|
|
|
struct FLinkedSector
|
|
|
|
{
|
|
|
|
sector_t *Sector;
|
|
|
|
int Type;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2009-09-06 18:19:28 +00:00
|
|
|
// this substructure contains a few sector properties that are stored in dynamic arrays
|
|
|
|
// These must not be copied by R_FakeFlat etc. or bad things will happen.
|
2008-03-18 18:18:18 +00:00
|
|
|
struct extsector_t
|
|
|
|
{
|
2008-03-22 12:17:52 +00:00
|
|
|
// Boom sector transfer information
|
|
|
|
struct fakefloor
|
|
|
|
{
|
|
|
|
TArray<sector_t *> Sectors;
|
|
|
|
} FakeFloor;
|
|
|
|
|
2008-03-19 09:53:23 +00:00
|
|
|
// 3DMIDTEX information
|
2008-03-18 18:18:18 +00:00
|
|
|
struct midtex
|
|
|
|
{
|
|
|
|
struct plane
|
|
|
|
{
|
|
|
|
TArray<sector_t *> AttachedSectors; // all sectors containing 3dMidtex lines attached to this sector
|
2008-03-21 17:35:49 +00:00
|
|
|
TArray<line_t *> AttachedLines; // all 3dMidtex lines attached to this sector
|
2008-03-18 18:18:18 +00:00
|
|
|
} Floor, Ceiling;
|
|
|
|
} Midtex;
|
2008-03-19 09:53:23 +00:00
|
|
|
|
2008-03-20 21:12:03 +00:00
|
|
|
// Linked sector information
|
2008-03-19 09:53:23 +00:00
|
|
|
struct linked
|
|
|
|
{
|
2008-03-20 21:12:03 +00:00
|
|
|
struct plane
|
|
|
|
{
|
|
|
|
TArray<FLinkedSector> Sectors;
|
|
|
|
} Floor, Ceiling;
|
2008-03-19 09:53:23 +00:00
|
|
|
} Linked;
|
2009-01-04 15:00:29 +00:00
|
|
|
|
|
|
|
// 3D floors
|
|
|
|
struct xfloor
|
|
|
|
{
|
|
|
|
TDeletingArray<F3DFloor *> ffloors; // 3D floors in this sector
|
|
|
|
TArray<lightlist_t> lightlist; // 3D light list
|
|
|
|
TArray<sector_t*> attached; // 3D floors attached to this sector
|
|
|
|
} XFloor;
|
2008-03-18 18:18:18 +00:00
|
|
|
|
|
|
|
void Serialize(FArchive &arc);
|
|
|
|
};
|
|
|
|
|
2008-06-14 15:26:16 +00:00
|
|
|
struct FTransform
|
|
|
|
{
|
|
|
|
// killough 3/7/98: floor and ceiling texture offsets
|
|
|
|
fixed_t xoffs, yoffs;
|
|
|
|
|
|
|
|
// [RH] floor and ceiling texture scales
|
|
|
|
fixed_t xscale, yscale;
|
|
|
|
|
|
|
|
// [RH] floor and ceiling texture rotation
|
|
|
|
angle_t angle;
|
|
|
|
|
|
|
|
// base values
|
|
|
|
fixed_t base_angle, base_yoffs;
|
|
|
|
};
|
2008-03-18 18:18:18 +00:00
|
|
|
|
2016-01-06 12:30:28 +00:00
|
|
|
struct secspecial_t
|
|
|
|
{
|
|
|
|
FNameNoInit damagetype; // [RH] Means-of-death for applied damage
|
|
|
|
int damageamount; // [RH] Damage to do while standing on floor
|
|
|
|
short special;
|
|
|
|
short damageinterval; // Interval for damage application
|
|
|
|
short leakydamage; // chance of leaking through radiation suit
|
|
|
|
int Flags;
|
|
|
|
|
2016-01-18 00:21:20 +00:00
|
|
|
secspecial_t()
|
|
|
|
{
|
|
|
|
Clear();
|
|
|
|
}
|
|
|
|
|
2016-01-06 12:30:28 +00:00
|
|
|
void Clear()
|
|
|
|
{
|
|
|
|
memset(this, 0, sizeof(*this));
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
FArchive &operator<< (FArchive &arc, secspecial_t &p);
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
struct sector_t
|
|
|
|
{
|
|
|
|
// Member functions
|
2008-03-20 21:12:03 +00:00
|
|
|
bool IsLinked(sector_t *other, bool ceiling) const;
|
2006-02-24 04:48:15 +00:00
|
|
|
fixed_t FindLowestFloorSurrounding (vertex_t **v) const;
|
|
|
|
fixed_t FindHighestFloorSurrounding (vertex_t **v) const;
|
|
|
|
fixed_t FindNextHighestFloor (vertex_t **v) const;
|
|
|
|
fixed_t FindNextLowestFloor (vertex_t **v) const;
|
|
|
|
fixed_t FindLowestCeilingSurrounding (vertex_t **v) const; // jff 2/04/98
|
|
|
|
fixed_t FindHighestCeilingSurrounding (vertex_t **v) const; // jff 2/04/98
|
|
|
|
fixed_t FindNextLowestCeiling (vertex_t **v) const; // jff 2/04/98
|
|
|
|
fixed_t FindNextHighestCeiling (vertex_t **v) const; // jff 2/04/98
|
|
|
|
fixed_t FindShortestTextureAround () const; // jff 2/04/98
|
|
|
|
fixed_t FindShortestUpperAround () const; // jff 2/04/98
|
|
|
|
sector_t *FindModelFloorSector (fixed_t floordestheight) const; // jff 2/04/98
|
|
|
|
sector_t *FindModelCeilingSector (fixed_t floordestheight) const; // jff 2/04/98
|
|
|
|
int FindMinSurroundingLight (int max) const;
|
|
|
|
sector_t *NextSpecialSector (int type, sector_t *prev) const; // [RH]
|
|
|
|
fixed_t FindLowestCeilingPoint (vertex_t **v) const;
|
|
|
|
fixed_t FindHighestFloorPoint (vertex_t **v) const;
|
|
|
|
void AdjustFloorClip () const;
|
2007-10-29 22:15:46 +00:00
|
|
|
void SetColor(int r, int g, int b, int desat);
|
|
|
|
void SetFade(int r, int g, int b);
|
2008-06-15 02:25:09 +00:00
|
|
|
void ClosestPoint(fixed_t x, fixed_t y, fixed_t &ox, fixed_t &oy) const;
|
2011-07-05 19:50:01 +00:00
|
|
|
int GetFloorLight () const;
|
|
|
|
int GetCeilingLight () const;
|
2012-04-27 02:50:23 +00:00
|
|
|
sector_t *GetHeightSec() const;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2008-06-04 17:53:15 +00:00
|
|
|
DInterpolation *SetInterpolation(int position, bool attach);
|
|
|
|
|
2015-11-25 10:49:34 +00:00
|
|
|
ASkyViewpoint *GetSkyBox(int which);
|
2016-02-14 15:26:27 +00:00
|
|
|
void CheckPortalPlane(int plane);
|
2015-11-25 10:49:34 +00:00
|
|
|
|
2008-06-14 15:26:16 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
floor,
|
|
|
|
ceiling
|
|
|
|
};
|
|
|
|
|
|
|
|
struct splane
|
|
|
|
{
|
|
|
|
FTransform xform;
|
2008-08-16 20:19:35 +00:00
|
|
|
int Flags;
|
|
|
|
int Light;
|
2010-11-07 16:17:14 +00:00
|
|
|
fixed_t alpha;
|
2008-08-16 20:19:35 +00:00
|
|
|
FTextureID Texture;
|
|
|
|
fixed_t TexZ;
|
2008-06-14 15:26:16 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
splane planes[2];
|
|
|
|
|
|
|
|
void SetXOffset(int pos, fixed_t o)
|
|
|
|
{
|
|
|
|
planes[pos].xform.xoffs = o;
|
|
|
|
}
|
|
|
|
|
|
|
|
void AddXOffset(int pos, fixed_t o)
|
|
|
|
{
|
|
|
|
planes[pos].xform.xoffs += o;
|
|
|
|
}
|
|
|
|
|
|
|
|
fixed_t GetXOffset(int pos) const
|
|
|
|
{
|
|
|
|
return planes[pos].xform.xoffs;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SetYOffset(int pos, fixed_t o)
|
|
|
|
{
|
|
|
|
planes[pos].xform.yoffs = o;
|
|
|
|
}
|
|
|
|
|
|
|
|
void AddYOffset(int pos, fixed_t o)
|
|
|
|
{
|
|
|
|
planes[pos].xform.yoffs += o;
|
|
|
|
}
|
|
|
|
|
|
|
|
fixed_t GetYOffset(int pos, bool addbase = true) const
|
|
|
|
{
|
|
|
|
if (!addbase)
|
|
|
|
{
|
|
|
|
return planes[pos].xform.yoffs;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return planes[pos].xform.yoffs + planes[pos].xform.base_yoffs;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void SetXScale(int pos, fixed_t o)
|
|
|
|
{
|
|
|
|
planes[pos].xform.xscale = o;
|
|
|
|
}
|
|
|
|
|
|
|
|
fixed_t GetXScale(int pos) const
|
|
|
|
{
|
|
|
|
return planes[pos].xform.xscale;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SetYScale(int pos, fixed_t o)
|
|
|
|
{
|
|
|
|
planes[pos].xform.yscale = o;
|
|
|
|
}
|
|
|
|
|
|
|
|
fixed_t GetYScale(int pos) const
|
|
|
|
{
|
|
|
|
return planes[pos].xform.yscale;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SetAngle(int pos, angle_t o)
|
|
|
|
{
|
|
|
|
planes[pos].xform.angle = o;
|
|
|
|
}
|
|
|
|
|
|
|
|
angle_t GetAngle(int pos, bool addbase = true) const
|
|
|
|
{
|
|
|
|
if (!addbase)
|
|
|
|
{
|
|
|
|
return planes[pos].xform.angle;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return planes[pos].xform.angle + planes[pos].xform.base_angle;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void SetBase(int pos, fixed_t y, angle_t o)
|
|
|
|
{
|
|
|
|
planes[pos].xform.base_yoffs = y;
|
|
|
|
planes[pos].xform.base_angle = o;
|
|
|
|
}
|
|
|
|
|
2010-11-07 16:17:14 +00:00
|
|
|
void SetAlpha(int pos, fixed_t o)
|
|
|
|
{
|
|
|
|
planes[pos].alpha = o;
|
|
|
|
}
|
|
|
|
|
|
|
|
fixed_t GetAlpha(int pos) const
|
|
|
|
{
|
|
|
|
return planes[pos].alpha;
|
|
|
|
}
|
|
|
|
|
2008-08-16 20:19:35 +00:00
|
|
|
int GetFlags(int pos) const
|
|
|
|
{
|
|
|
|
return planes[pos].Flags;
|
|
|
|
}
|
|
|
|
|
|
|
|
void ChangeFlags(int pos, int And, int Or)
|
|
|
|
{
|
|
|
|
planes[pos].Flags &= ~And;
|
|
|
|
planes[pos].Flags |= Or;
|
|
|
|
}
|
|
|
|
|
|
|
|
int GetPlaneLight(int pos) const
|
|
|
|
{
|
|
|
|
return planes[pos].Light;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SetPlaneLight(int pos, int level)
|
|
|
|
{
|
|
|
|
planes[pos].Light = level;
|
|
|
|
}
|
|
|
|
|
|
|
|
FTextureID GetTexture(int pos) const
|
|
|
|
{
|
|
|
|
return planes[pos].Texture;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SetTexture(int pos, FTextureID tex, bool floorclip = true)
|
|
|
|
{
|
|
|
|
FTextureID old = planes[pos].Texture;
|
|
|
|
planes[pos].Texture = tex;
|
|
|
|
if (floorclip && pos == floor && tex != old) AdjustFloorClip();
|
|
|
|
}
|
|
|
|
|
|
|
|
fixed_t GetPlaneTexZ(int pos) const
|
|
|
|
{
|
|
|
|
return planes[pos].TexZ;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SetPlaneTexZ(int pos, fixed_t val)
|
|
|
|
{
|
|
|
|
planes[pos].TexZ = val;
|
|
|
|
}
|
|
|
|
|
|
|
|
void ChangePlaneTexZ(int pos, fixed_t val)
|
|
|
|
{
|
|
|
|
planes[pos].TexZ += val;
|
|
|
|
}
|
2008-06-14 15:26:16 +00:00
|
|
|
|
2011-06-11 23:58:33 +00:00
|
|
|
static inline short ClampLight(int level)
|
|
|
|
{
|
|
|
|
return (short)clamp(level, SHRT_MIN, SHRT_MAX);
|
|
|
|
}
|
|
|
|
|
2009-08-08 20:03:43 +00:00
|
|
|
void ChangeLightLevel(int newval)
|
|
|
|
{
|
2011-06-11 23:58:33 +00:00
|
|
|
lightlevel = ClampLight(lightlevel + newval);
|
2009-08-08 20:03:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void SetLightLevel(int newval)
|
|
|
|
{
|
2011-06-11 23:58:33 +00:00
|
|
|
lightlevel = ClampLight(newval);
|
2009-08-08 20:03:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int GetLightLevel() const
|
|
|
|
{
|
|
|
|
return lightlevel;
|
|
|
|
}
|
|
|
|
|
2009-11-13 21:28:39 +00:00
|
|
|
secplane_t &GetSecPlane(int pos)
|
|
|
|
{
|
|
|
|
return pos == floor? floorplane:ceilingplane;
|
|
|
|
}
|
|
|
|
|
2016-01-06 00:50:45 +00:00
|
|
|
bool isSecret() const
|
|
|
|
{
|
|
|
|
return !!(Flags & SECF_SECRET);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool wasSecret() const
|
|
|
|
{
|
|
|
|
return !!(Flags & SECF_WASSECRET);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ClearSecret()
|
|
|
|
{
|
|
|
|
Flags &= ~SECF_SECRET;
|
|
|
|
}
|
2015-03-31 15:09:19 +00:00
|
|
|
|
2016-01-06 12:30:28 +00:00
|
|
|
void ClearSpecial()
|
|
|
|
{
|
|
|
|
// clears all variables that originate from 'special'. Used for sector type transferring thinkers
|
|
|
|
special = 0;
|
|
|
|
damageamount = 0;
|
|
|
|
damageinterval = 0;
|
|
|
|
damagetype = NAME_None;
|
|
|
|
leakydamage = 0;
|
|
|
|
Flags &= ~SECF_SPECIALFLAGS;
|
|
|
|
}
|
|
|
|
|
2016-02-14 23:53:59 +00:00
|
|
|
bool PortalBlocksView(int plane);
|
|
|
|
bool PortalBlocksMovement(int plane);
|
|
|
|
bool PortalBlocksSound(int plane);
|
2016-02-14 15:26:27 +00:00
|
|
|
|
2016-01-09 11:10:36 +00:00
|
|
|
int GetTerrain(int pos) const;
|
|
|
|
|
2016-01-06 12:30:28 +00:00
|
|
|
void TransferSpecial(sector_t *model);
|
|
|
|
void GetSpecial(secspecial_t *spec);
|
|
|
|
void SetSpecial(const secspecial_t *spec);
|
2009-09-17 10:40:38 +00:00
|
|
|
bool PlaneMoving(int pos);
|
|
|
|
|
2016-02-16 15:40:53 +00:00
|
|
|
// Portal-aware height calculation
|
|
|
|
fixed_t HighestCeilingAt(fixed_t x, fixed_t y, sector_t **resultsec = NULL);
|
|
|
|
fixed_t LowestFloorAt(fixed_t x, fixed_t y, sector_t **resultsec = NULL);
|
|
|
|
|
|
|
|
fixed_t HighestCeilingAt(AActor *a, sector_t **resultsec = NULL)
|
|
|
|
{
|
|
|
|
return HighestCeilingAt(a->X(), a->X(), resultsec);
|
|
|
|
}
|
|
|
|
|
|
|
|
fixed_t LowestFloorAt(AActor *a, sector_t **resultsec = NULL)
|
|
|
|
{
|
|
|
|
return LowestFloorAt(a->X(), a->Y(), resultsec);
|
|
|
|
}
|
|
|
|
|
|
|
|
// ... for ceilings
|
|
|
|
fixed_t CeilingAtPoint(fixed_t x, fixed_t y, int refgroup) const
|
|
|
|
{
|
|
|
|
return PlaneAtPoint(ceilingplane, x, y, refgroup);
|
|
|
|
}
|
|
|
|
fixed_t CeilingAtPoint(AActor *actor) const
|
|
|
|
{
|
|
|
|
return PlaneAtPoint(ceilingplane, actor->X(), actor->Y(), actor->Sector->PortalGroup);
|
|
|
|
}
|
|
|
|
fixed_t CeilingAtPoint(fixed_t x, fixed_t y, sector_t *refsector) const
|
|
|
|
{
|
|
|
|
return PlaneAtPoint(ceilingplane, x, y, refsector->PortalGroup);
|
|
|
|
}
|
|
|
|
|
|
|
|
// ... for floors
|
|
|
|
fixed_t FloorAtPoint(fixed_t x, fixed_t y, int refgroup) const
|
|
|
|
{
|
|
|
|
return PlaneAtPoint(floorplane, x, y, refgroup);
|
|
|
|
}
|
|
|
|
fixed_t FloorAtPoint(AActor *actor) const
|
|
|
|
{
|
|
|
|
return PlaneAtPoint(floorplane, actor->X(), actor->Y(), actor->Sector->PortalGroup);
|
|
|
|
}
|
|
|
|
fixed_t FloorAtPoint(fixed_t x, fixed_t y, sector_t *refsector) const
|
|
|
|
{
|
|
|
|
return PlaneAtPoint(floorplane, x, y, refsector->PortalGroup);
|
|
|
|
}
|
|
|
|
|
|
|
|
// ... for control sectors
|
|
|
|
fixed_t PlaneAtPoint(const secplane_t &plane, AActor *actor) const
|
|
|
|
{
|
|
|
|
return PlaneAtPoint(plane, actor->X(), actor->Y(), actor->Sector->PortalGroup);
|
|
|
|
}
|
|
|
|
fixed_t PlaneAtPoint(const secplane_t &plane, fixed_t x, fixed_t y, sector_t *refsector) const
|
|
|
|
{
|
|
|
|
return PlaneAtPoint(plane, x, y, refsector->PortalGroup);
|
|
|
|
}
|
|
|
|
|
|
|
|
// The worker function for all the above.
|
|
|
|
fixed_t PlaneAtPoint(const secplane_t &plane, fixed_t x, fixed_t y, int refgroup) const;
|
|
|
|
|
|
|
|
FDisplacement &FloorDisplacement();
|
|
|
|
FDisplacement &CeilingDisplacement();
|
2008-06-14 15:26:16 +00:00
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
// Member variables
|
|
|
|
fixed_t CenterFloor () const { return floorplane.ZatPoint (soundorg[0], soundorg[1]); }
|
|
|
|
fixed_t CenterCeiling () const { return ceilingplane.ZatPoint (soundorg[0], soundorg[1]); }
|
|
|
|
|
|
|
|
// [RH] store floor and ceiling planes instead of heights
|
|
|
|
secplane_t floorplane, ceilingplane;
|
|
|
|
|
|
|
|
// [RH] give floor and ceiling even more properties
|
|
|
|
FDynamicColormap *ColorMap; // [RH] Per-sector colormap
|
|
|
|
|
|
|
|
|
2008-03-12 02:56:11 +00:00
|
|
|
TObjPtr<AActor> SoundTarget;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
short special;
|
2011-06-11 23:58:33 +00:00
|
|
|
short lightlevel;
|
|
|
|
short seqType; // this sector's sound sequence
|
|
|
|
|
2006-04-11 08:36:23 +00:00
|
|
|
int sky;
|
2010-08-07 04:32:18 +00:00
|
|
|
FNameNoInit SeqName; // Sound sequence name. Setting seqType non-negative will override this.
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2008-07-01 04:06:56 +00:00
|
|
|
fixed_t soundorg[2]; // origin for any sounds played by the sector
|
2006-02-24 04:48:15 +00:00
|
|
|
int validcount; // if == validcount, already checked
|
|
|
|
AActor* thinglist; // list of mobjs in sector
|
|
|
|
|
|
|
|
// killough 8/28/98: friction is a sector property, not an mobj property.
|
|
|
|
// these fields used to be in AActor, but presented performance problems
|
|
|
|
// when processed as mobj properties. Fix is to make them sector properties.
|
|
|
|
fixed_t friction, movefactor;
|
|
|
|
|
2016-01-09 11:10:36 +00:00
|
|
|
int terrainnum[2];
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
// thinker_t for reversable actions
|
2008-03-12 02:56:11 +00:00
|
|
|
TObjPtr<DSectorEffect> floordata; // jff 2/22/98 make thinkers on
|
|
|
|
TObjPtr<DSectorEffect> ceilingdata; // floors, ceilings, lighting,
|
|
|
|
TObjPtr<DSectorEffect> lightingdata; // independent of one another
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2008-06-04 17:53:15 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
CeilingMove,
|
|
|
|
FloorMove,
|
|
|
|
CeilingScroll,
|
|
|
|
FloorScroll
|
|
|
|
};
|
|
|
|
TObjPtr<DInterpolation> interpolations[4];
|
|
|
|
|
2011-06-11 23:58:33 +00:00
|
|
|
BYTE soundtraversed; // 0 = untraversed, 1,2 = sndlines -1
|
2006-02-24 04:48:15 +00:00
|
|
|
// jff 2/26/98 lockout machinery for stairbuilding
|
|
|
|
SBYTE stairlock; // -2 on first locked -1 after thinker done 0 normally
|
|
|
|
SWORD prevsec; // -1 or number of sector for previous step
|
|
|
|
SWORD nextsec; // -1 or number of next step sector
|
|
|
|
|
|
|
|
short linecount;
|
2008-03-21 17:35:49 +00:00
|
|
|
struct line_t **lines; // [linecount] size
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
// killough 3/7/98: support flat heights drawn at another sector's heights
|
|
|
|
sector_t *heightsec; // other sector, or NULL if no other sector
|
|
|
|
|
|
|
|
DWORD bottommap, midmap, topmap; // killough 4/4/98: dynamic colormaps
|
|
|
|
// [RH] these can also be blend values if
|
|
|
|
// the alpha mask is non-zero
|
|
|
|
|
|
|
|
// list of mobjs that are at least partially in the sector
|
|
|
|
// thinglist is a subset of touching_thinglist
|
2008-06-01 20:43:02 +00:00
|
|
|
struct msecnode_t *touching_thinglist; // phares 3/14/98
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2016-01-05 14:37:59 +00:00
|
|
|
float gravity; // [RH] Sector gravity (1.0 is normal)
|
2016-01-05 15:10:04 +00:00
|
|
|
FNameNoInit damagetype; // [RH] Means-of-death for applied damage
|
2016-01-06 11:56:35 +00:00
|
|
|
int damageamount; // [RH] Damage to do while standing on floor
|
2016-01-05 14:37:59 +00:00
|
|
|
short damageinterval; // Interval for damage application
|
|
|
|
short leakydamage; // chance of leaking through radiation suit
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
WORD ZoneNumber; // [RH] Zone this sector belongs to
|
2008-05-11 21:16:32 +00:00
|
|
|
WORD MoreFlags; // [RH] Internal sector flags
|
|
|
|
DWORD Flags; // Sector flags
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
// [RH] Action specials for sectors. Like Skull Tag, but more
|
|
|
|
// flexible in a Bloody way. SecActTarget forms a list of actors
|
|
|
|
// joined by their tracer fields. When a potential sector action
|
|
|
|
// occurs, SecActTarget's TriggerAction method is called.
|
2008-03-12 02:56:11 +00:00
|
|
|
TObjPtr<ASectorAction> SecActTarget;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
// [RH] The sky box to render for this sector. NULL means use a
|
|
|
|
// regular sky.
|
2016-01-12 20:34:41 +00:00
|
|
|
TObjPtr<ASkyViewpoint> SkyBoxes[2];
|
2016-02-14 15:26:27 +00:00
|
|
|
int PortalGroup;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2009-01-04 15:00:29 +00:00
|
|
|
int sectornum; // for comparing sector copies
|
2008-03-18 18:18:18 +00:00
|
|
|
|
|
|
|
extsector_t * e; // This stores data that requires construction/destruction. Such data must not be copied by R_FakeFlat.
|
2006-02-24 04:48:15 +00:00
|
|
|
};
|
|
|
|
|
2008-06-14 15:26:16 +00:00
|
|
|
FArchive &operator<< (FArchive &arc, sector_t::splane &p);
|
|
|
|
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
struct ReverbContainer;
|
|
|
|
struct zone_t
|
|
|
|
{
|
|
|
|
ReverbContainer *Environment;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// The SideDef.
|
|
|
|
//
|
|
|
|
|
2006-04-12 01:50:09 +00:00
|
|
|
class DBaseDecal;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
2009-06-07 01:14:14 +00:00
|
|
|
WALLF_ABSLIGHTING = 1, // Light is absolute instead of relative
|
|
|
|
WALLF_NOAUTODECALS = 2, // Do not attach impact decals to this wall
|
2008-08-21 08:04:21 +00:00
|
|
|
WALLF_NOFAKECONTRAST = 4, // Don't do fake contrast for this wall in side_t::GetLightLevel
|
|
|
|
WALLF_SMOOTHLIGHTING = 8, // Similar to autocontrast but applies to all angles.
|
2009-06-07 01:14:14 +00:00
|
|
|
WALLF_CLIP_MIDTEX = 16, // Like the line counterpart, but only for this side.
|
|
|
|
WALLF_WRAP_MIDTEX = 32, // Like the line counterpart, but only for this side.
|
2009-10-30 07:03:26 +00:00
|
|
|
WALLF_POLYOBJ = 64, // This wall belongs to a polyobject.
|
2012-11-03 02:02:42 +00:00
|
|
|
WALLF_LIGHT_FOG = 128, // This wall's Light is used even in fog.
|
2006-02-24 04:48:15 +00:00
|
|
|
};
|
|
|
|
|
2008-03-21 17:35:49 +00:00
|
|
|
struct side_t
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2008-03-21 17:35:49 +00:00
|
|
|
enum ETexpart
|
|
|
|
{
|
|
|
|
top=0,
|
|
|
|
mid=1,
|
|
|
|
bottom=2
|
|
|
|
};
|
|
|
|
struct part
|
|
|
|
{
|
|
|
|
fixed_t xoffset;
|
|
|
|
fixed_t yoffset;
|
2009-06-07 01:14:14 +00:00
|
|
|
fixed_t xscale;
|
|
|
|
fixed_t yscale;
|
2008-06-15 18:36:26 +00:00
|
|
|
FTextureID texture;
|
2008-06-04 17:53:15 +00:00
|
|
|
TObjPtr<DInterpolation> interpolation;
|
2008-03-21 17:35:49 +00:00
|
|
|
//int Light;
|
|
|
|
};
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
sector_t* sector; // Sector the SideDef is facing.
|
2006-04-12 01:50:09 +00:00
|
|
|
DBaseDecal* AttachedDecals; // [RH] Decals bound to the wall
|
2008-03-21 17:35:49 +00:00
|
|
|
part textures[3];
|
2009-09-06 18:19:28 +00:00
|
|
|
line_t *linedef;
|
|
|
|
//DWORD linenum;
|
2006-02-24 04:48:15 +00:00
|
|
|
DWORD LeftSide, RightSide; // [RH] Group walls into loops
|
|
|
|
WORD TexelLength;
|
2008-05-23 07:54:09 +00:00
|
|
|
SWORD Light;
|
2006-02-24 04:48:15 +00:00
|
|
|
BYTE Flags;
|
2009-05-11 21:05:40 +00:00
|
|
|
int Index; // needed to access custom UDMF fields which are stored in loading order.
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2012-04-01 02:31:57 +00:00
|
|
|
int GetLightLevel (bool foggy, int baselight, bool noabsolute=false, int *pfakecontrast_usedbygzdoom=NULL) const;
|
2008-03-21 17:35:49 +00:00
|
|
|
|
2008-06-14 15:26:16 +00:00
|
|
|
void SetLight(SWORD l)
|
|
|
|
{
|
|
|
|
Light = l;
|
|
|
|
}
|
|
|
|
|
2008-06-15 18:36:26 +00:00
|
|
|
FTextureID GetTexture(int which) const
|
2008-03-21 17:35:49 +00:00
|
|
|
{
|
|
|
|
return textures[which].texture;
|
|
|
|
}
|
2008-06-15 18:36:26 +00:00
|
|
|
void SetTexture(int which, FTextureID tex)
|
2008-03-21 17:35:49 +00:00
|
|
|
{
|
|
|
|
textures[which].texture = tex;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SetTextureXOffset(int which, fixed_t offset)
|
|
|
|
{
|
|
|
|
textures[which].xoffset = offset;
|
|
|
|
}
|
|
|
|
void SetTextureXOffset(fixed_t offset)
|
|
|
|
{
|
|
|
|
textures[top].xoffset =
|
|
|
|
textures[mid].xoffset =
|
|
|
|
textures[bottom].xoffset = offset;
|
|
|
|
}
|
|
|
|
fixed_t GetTextureXOffset(int which) const
|
|
|
|
{
|
|
|
|
return textures[which].xoffset;
|
|
|
|
}
|
|
|
|
void AddTextureXOffset(int which, fixed_t delta)
|
|
|
|
{
|
|
|
|
textures[which].xoffset += delta;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SetTextureYOffset(int which, fixed_t offset)
|
|
|
|
{
|
|
|
|
textures[which].yoffset = offset;
|
|
|
|
}
|
|
|
|
void SetTextureYOffset(fixed_t offset)
|
|
|
|
{
|
|
|
|
textures[top].yoffset =
|
|
|
|
textures[mid].yoffset =
|
|
|
|
textures[bottom].yoffset = offset;
|
|
|
|
}
|
|
|
|
fixed_t GetTextureYOffset(int which) const
|
|
|
|
{
|
|
|
|
return textures[which].yoffset;
|
|
|
|
}
|
|
|
|
void AddTextureYOffset(int which, fixed_t delta)
|
|
|
|
{
|
|
|
|
textures[which].yoffset += delta;
|
|
|
|
}
|
|
|
|
|
2009-06-07 01:14:14 +00:00
|
|
|
void SetTextureXScale(int which, fixed_t scale)
|
|
|
|
{
|
2012-08-23 01:34:19 +00:00
|
|
|
textures[which].xscale = scale == 0 ? FRACUNIT : scale;
|
2009-06-07 01:14:14 +00:00
|
|
|
}
|
|
|
|
void SetTextureXScale(fixed_t scale)
|
|
|
|
{
|
2012-08-23 01:34:19 +00:00
|
|
|
textures[top].xscale = textures[mid].xscale = textures[bottom].xscale = scale == 0 ? FRACUNIT : scale;
|
2009-06-07 01:14:14 +00:00
|
|
|
}
|
|
|
|
fixed_t GetTextureXScale(int which) const
|
|
|
|
{
|
|
|
|
return textures[which].xscale;
|
|
|
|
}
|
2009-06-08 23:49:27 +00:00
|
|
|
void MultiplyTextureXScale(int which, fixed_t delta)
|
|
|
|
{
|
|
|
|
textures[which].xscale = FixedMul(textures[which].xscale, delta);
|
|
|
|
}
|
|
|
|
|
2009-06-07 01:14:14 +00:00
|
|
|
|
|
|
|
void SetTextureYScale(int which, fixed_t scale)
|
|
|
|
{
|
2012-08-23 01:40:00 +00:00
|
|
|
textures[which].yscale = scale == 0 ? FRACUNIT : scale;
|
2009-06-07 01:14:14 +00:00
|
|
|
}
|
|
|
|
void SetTextureYScale(fixed_t scale)
|
|
|
|
{
|
2012-08-23 01:40:00 +00:00
|
|
|
textures[top].yscale = textures[mid].yscale = textures[bottom].yscale = scale == 0 ? FRACUNIT : scale;
|
2009-06-07 01:14:14 +00:00
|
|
|
}
|
|
|
|
fixed_t GetTextureYScale(int which) const
|
|
|
|
{
|
|
|
|
return textures[which].yscale;
|
|
|
|
}
|
2009-06-08 23:49:27 +00:00
|
|
|
void MultiplyTextureYScale(int which, fixed_t delta)
|
|
|
|
{
|
|
|
|
textures[which].yscale = FixedMul(textures[which].yscale, delta);
|
|
|
|
}
|
2009-06-07 01:14:14 +00:00
|
|
|
|
2008-06-04 17:53:15 +00:00
|
|
|
DInterpolation *SetInterpolation(int position);
|
|
|
|
void StopInterpolation(int position);
|
2010-07-23 05:56:25 +00:00
|
|
|
|
|
|
|
vertex_t *V1() const;
|
|
|
|
vertex_t *V2() const;
|
2006-02-24 04:48:15 +00:00
|
|
|
};
|
|
|
|
|
2008-03-21 17:35:49 +00:00
|
|
|
FArchive &operator<< (FArchive &arc, side_t::part &p);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2008-03-21 17:35:49 +00:00
|
|
|
struct line_t
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
vertex_t *v1, *v2; // vertices, from v1 to v2
|
|
|
|
fixed_t dx, dy; // precalculated v2 - v1 for side checking
|
|
|
|
DWORD flags;
|
2008-05-02 10:55:48 +00:00
|
|
|
DWORD activation; // activation type
|
|
|
|
int special;
|
2009-10-30 03:29:15 +00:00
|
|
|
fixed_t Alpha; // <--- translucency (0=invisibile, FRACUNIT=opaque)
|
2006-04-16 13:29:50 +00:00
|
|
|
int args[5]; // <--- hexen-style arguments (expanded to ZDoom's full width)
|
2009-09-06 20:45:56 +00:00
|
|
|
side_t *sidedef[2];
|
2006-02-24 04:48:15 +00:00
|
|
|
fixed_t bbox[4]; // bounding box, for the extent of the LineDef.
|
2012-01-22 00:14:02 +00:00
|
|
|
sector_t *frontsector, *backsector;
|
|
|
|
int validcount; // if == validcount, already checked
|
2012-11-09 23:13:50 +00:00
|
|
|
int locknumber; // [Dusk] lock number for special
|
2016-02-05 22:15:56 +00:00
|
|
|
unsigned portalindex;
|
2016-02-05 15:14:45 +00:00
|
|
|
|
|
|
|
// returns true if the portal is crossable by actors
|
2016-02-05 22:15:56 +00:00
|
|
|
bool isLinePortal() const;
|
2016-02-05 15:14:45 +00:00
|
|
|
// returns true if the portal needs to be handled by the renderer
|
2016-02-05 22:15:56 +00:00
|
|
|
bool isVisualPortal() const;
|
|
|
|
line_t *getPortalDestination() const;
|
|
|
|
int getPortalAlignment() const;
|
2012-01-22 00:14:02 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// phares 3/14/98
|
2006-02-24 04:48:15 +00:00
|
|
|
//
|
|
|
|
// Sector list node showing all sectors an object appears in.
|
|
|
|
//
|
|
|
|
// There are two threads that flow through these nodes. The first thread
|
|
|
|
// starts at touching_thinglist in a sector_t and flows through the m_snext
|
|
|
|
// links to find all mobjs that are entirely or partially in the sector.
|
|
|
|
// The second thread starts at touching_sectorlist in a AActor and flows
|
|
|
|
// through the m_tnext links to find all sectors a thing touches. This is
|
|
|
|
// useful when applying friction or push effects to sectors. These effects
|
|
|
|
// can be done as thinkers that act upon all objects touching their sectors.
|
|
|
|
// As an mobj moves through the world, these nodes are created and
|
|
|
|
// destroyed, with the links changed appropriately.
|
|
|
|
//
|
|
|
|
// For the links, NULL means top or end of list.
|
|
|
|
|
2008-06-01 20:43:02 +00:00
|
|
|
struct msecnode_t
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
sector_t *m_sector; // a sector containing this object
|
|
|
|
AActor *m_thing; // this object
|
2008-06-01 20:43:02 +00:00
|
|
|
struct msecnode_t *m_tprev; // prev msecnode_t for this thing
|
|
|
|
struct msecnode_t *m_tnext; // next msecnode_t for this thing
|
|
|
|
struct msecnode_t *m_sprev; // prev msecnode_t for this sector
|
|
|
|
struct msecnode_t *m_snext; // next msecnode_t for this sector
|
2006-09-14 00:02:31 +00:00
|
|
|
bool visited; // killough 4/4/98, 4/7/98: used in search algorithms
|
2008-06-01 20:43:02 +00:00
|
|
|
};
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2010-07-23 05:56:25 +00:00
|
|
|
struct FPolyNode;
|
2010-08-01 02:41:56 +00:00
|
|
|
struct FMiniBSP;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
//
|
|
|
|
// The LineSeg.
|
|
|
|
//
|
2008-06-01 20:43:02 +00:00
|
|
|
struct seg_t
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
vertex_t* v1;
|
|
|
|
vertex_t* v2;
|
|
|
|
|
|
|
|
side_t* sidedef;
|
|
|
|
line_t* linedef;
|
|
|
|
|
|
|
|
// Sector references. Could be retrieved from linedef, too.
|
|
|
|
sector_t* frontsector;
|
|
|
|
sector_t* backsector; // NULL for one-sided lines
|
2010-08-27 15:20:05 +00:00
|
|
|
};
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2010-08-27 15:20:05 +00:00
|
|
|
struct glsegextra_t
|
|
|
|
{
|
|
|
|
DWORD PartnerSeg;
|
|
|
|
subsector_t *Subsector;
|
2006-02-24 04:48:15 +00:00
|
|
|
};
|
|
|
|
|
2010-08-01 02:41:56 +00:00
|
|
|
//
|
|
|
|
// A SubSector.
|
|
|
|
// References a Sector.
|
|
|
|
// Basically, this is a list of LineSegs indicating the visible walls that
|
|
|
|
// define (all or some) sides of a convex BSP leaf.
|
|
|
|
//
|
2010-08-27 15:20:05 +00:00
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
SSECF_DEGENERATE = 1,
|
|
|
|
SSECF_DRAWN = 2,
|
2010-08-28 16:51:41 +00:00
|
|
|
SSECF_POLYORG = 4,
|
2010-08-27 15:20:05 +00:00
|
|
|
};
|
|
|
|
|
2010-08-01 02:41:56 +00:00
|
|
|
struct subsector_t
|
|
|
|
{
|
|
|
|
sector_t *sector;
|
|
|
|
FPolyNode *polys;
|
|
|
|
FMiniBSP *BSP;
|
|
|
|
seg_t *firstline;
|
2010-08-27 15:20:05 +00:00
|
|
|
sector_t *render_sector;
|
2010-08-01 02:41:56 +00:00
|
|
|
DWORD numlines;
|
2010-08-27 15:20:05 +00:00
|
|
|
int flags;
|
2011-07-05 19:50:01 +00:00
|
|
|
|
|
|
|
void BuildPolyBSP();
|
2010-08-01 02:41:56 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2010-07-23 05:56:25 +00:00
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
//
|
|
|
|
// BSP node.
|
|
|
|
//
|
2008-06-01 20:43:02 +00:00
|
|
|
struct node_t
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
// Partition line.
|
|
|
|
fixed_t x;
|
|
|
|
fixed_t y;
|
|
|
|
fixed_t dx;
|
|
|
|
fixed_t dy;
|
|
|
|
fixed_t bbox[2][4]; // Bounding box for each child.
|
2010-07-23 05:56:25 +00:00
|
|
|
float len;
|
2006-02-24 04:48:15 +00:00
|
|
|
union
|
|
|
|
{
|
|
|
|
void *children[2]; // If bit 0 is set, it's a subsector.
|
|
|
|
int intchildren[2]; // Used by nodebuilder.
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2010-08-01 02:41:56 +00:00
|
|
|
// An entire BSP tree.
|
|
|
|
|
|
|
|
struct FMiniBSP
|
|
|
|
{
|
|
|
|
bool bDirty;
|
|
|
|
|
|
|
|
TArray<node_t> Nodes;
|
|
|
|
TArray<seg_t> Segs;
|
|
|
|
TArray<subsector_t> Subsectors;
|
|
|
|
TArray<vertex_t> Verts;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
//
|
|
|
|
// OTHER TYPES
|
|
|
|
//
|
|
|
|
|
2006-09-14 00:02:31 +00:00
|
|
|
typedef BYTE lighttable_t; // This could be wider for >8 bit display.
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2011-07-06 13:00:51 +00:00
|
|
|
// This encapsulates the fields of vissprite_t that can be altered by AlterWeaponSprite
|
|
|
|
struct visstyle_t
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
lighttable_t *colormap;
|
|
|
|
fixed_t alpha;
|
- Updated lempar.c to v1.31.
- Added .txt files to the list of types (wad, zip, and pk3) that can be
loaded without listing them after -file.
- Fonts that are created by the ACS setfont command to wrap a texture now
support animated textures.
- FON2 fonts can now use their full palette for CR_UNTRANSLATED when drawn
with the hardware 2D path instead of being restricted to the game palette.
- Fixed: Toggling vid_vsync would reset the displayed fullscreen gamma to 1
on a Radeon 9000.
- Added back the off-by-one palette handling, but in a much more limited
scope than before. The skipped entry is assumed to always be at 248, and
it is assumed that all Shader Model 1.4 cards suffer from this. That's
because all SM1.4 cards are based on variants of the ATI R200 core, and the
RV250 in a Radeon 9000 craps up like this. I see no reason to assume that
other flavors of the R200 are any different. (Interesting note: With the
Radeon 9000, D3DTADDRESS_CLAMP is an invalid address mode when using the
debug Direct3D 9 runtime, but it works perfectly fine with the retail
Direct3D 9 runtime.) (Insight: The R200 probably uses bytes for all its
math inside pixel shaders. That would explain perfectly why I can't use
constants greater than 1 with PS1.4 and why it can't do an exact mapping to
every entry in the color palette.
- Fixed: The software shaded drawer did not work for 2D, because its selected
"color"map was replaced with the identitymap before being used.
- Fixed: I cannot use Printf to output messages before the framebuffer was
completely setup, meaning that Shader Model 1.4 cards could not change
resolution.
- I have decided to let remap palettes specify variable alpha values for
their colors. D3DFB no longer forces them to 255.
- Updated re2c to version 0.12.3.
- Fixed: A_Wander used threshold as a timer, when it should have used
reactiontime.
- Fixed: A_CustomRailgun would not fire at all for actors without a target
when the aim parameter was disabled.
- Made the warp command work in multiplayer, again courtesy of Karate Chris.
- Fixed: Trying to spawn a bot while not in a game made for a crashing time.
(Patch courtesy of Karate Chris.)
- Removed some floating point math from hu_scores.cpp that somebody's GCC
gave warnings for (not mine, though).
- Fixed: The SBarInfo drawbar command crashed if the sprite image was
unavailable.
- Fixed: FString::operator=(const char *) did not release its old buffer when
being assigned to the null string.
- The scanner no longer has an upper limit on the length of strings it
accepts, though short strings will be faster than long ones.
- Moved all the text scanning functions into a class. Mainly, this means that
multiple script scanner states can be stored without being forced to do so
recursively. I think I might be taking advantage of that in the near
future. Possibly. Maybe.
- Removed some potential buffer overflows from the decal parser.
- Applied Blzut3's SBARINFO update #9:
* Fixed: When using even length values in drawnumber it would cap to a 98
value instead of a 99 as intended.
* The SBarInfo parser can now accept negatives for coordinates. This
doesn't allow much right now, but later I plan to add better fullscreen
hud support in which the negatives will be more useful. This also cleans
up the source a bit since all calls for (x, y) coordinates are with the
function getCoordinates().
- Added support for stencilling actors.
- Added support for non-black colors specified with DTA_ColorOverlay to the
software renderer.
- Fixed: The inverse, gold, red, and green fixed colormaps each allocated
space for 32 different colormaps, even though each only used the first one.
- Added two new blending flags to make reverse subtract blending more useful:
STYLEF_InvertSource and STYLEF_InvertOverlay. These invert the color that
gets blended with the background, since that seems like a good idea for
reverse subtraction. They also work with the other two blending operations.
- Added subtract and reverse subtract blending operations to the renderer.
Since the ERenderStyle enumeration was getting rather unwieldy, I converted
it into a new FRenderStyle structure that lets each parameter of the
blending equation be set separately. This simplified the set up for the
blend quite a bit, and it means a number of new combinations are available
by setting the parameters properly.
SVN r710 (trunk)
2008-01-25 23:57:44 +00:00
|
|
|
FRenderStyle RenderStyle;
|
2006-02-24 04:48:15 +00:00
|
|
|
};
|
|
|
|
|
2011-01-02 18:02:27 +00:00
|
|
|
|
2016-02-15 01:14:34 +00:00
|
|
|
//----------------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// The playsim can use different nodes than the renderer so this is
|
|
|
|
// not the same as R_PointInSubsector
|
|
|
|
//
|
|
|
|
//----------------------------------------------------------------------------------
|
|
|
|
subsector_t *P_PointInSubsector(fixed_t x, fixed_t y);
|
|
|
|
inline sector_t *P_PointInSector(fixed_t x, fixed_t y)
|
|
|
|
{
|
|
|
|
return P_PointInSubsector(x, y)->sector;
|
|
|
|
}
|
|
|
|
|
2016-02-16 15:40:53 +00:00
|
|
|
#define _ZatPoint ZatPoint // so that it still compiles during the transition
|
2016-02-15 01:14:34 +00:00
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
#endif
|