mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2024-12-18 08:01:36 +00:00
322 lines
6 KiB
C
322 lines
6 KiB
C
|
// Emacs style mode select -*- C++ -*-
|
||
|
//-----------------------------------------------------------------------------
|
||
|
//
|
||
|
// Copyright(C) 1993-1996 Id Software, Inc.
|
||
|
// Copyright(C) 2005 Simon Howard
|
||
|
//
|
||
|
// This program is free software; you can redistribute it and/or
|
||
|
// modify it under the terms of the GNU General Public License
|
||
|
// as published by the Free Software Foundation; either version 2
|
||
|
// of the License, or (at your option) any later version.
|
||
|
//
|
||
|
// This program is distributed in the hope that it will be useful,
|
||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
|
// GNU General Public License for more details.
|
||
|
//
|
||
|
// You should have received a copy of the GNU General Public License
|
||
|
// along with this program; if not, write to the Free Software
|
||
|
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||
|
// 02111-1307, USA.
|
||
|
//
|
||
|
// DESCRIPTION:
|
||
|
// Refresh/rendering module, shared data struct definitions.
|
||
|
//
|
||
|
//-----------------------------------------------------------------------------
|
||
|
|
||
|
#ifndef __R_DEFS__
|
||
|
#define __R_DEFS__
|
||
|
|
||
|
|
||
|
// Silhouette, needed for clipping Segs (mainly)
|
||
|
// and sprites representing things.
|
||
|
#define SIL_NONE 0
|
||
|
#define SIL_BOTTOM 1
|
||
|
#define SIL_TOP 2
|
||
|
#define SIL_BOTH 3
|
||
|
|
||
|
// #define MAXDRAWSEGS 256
|
||
|
#define MAXDRAWSEGS 1024 // andrewj: increased for Visplane Explorer
|
||
|
|
||
|
|
||
|
#define skyflatnum 2
|
||
|
|
||
|
|
||
|
//
|
||
|
// 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.
|
||
|
//
|
||
|
typedef struct
|
||
|
{
|
||
|
fixed_t x;
|
||
|
fixed_t y;
|
||
|
|
||
|
} vertex_t;
|
||
|
|
||
|
|
||
|
// Forward of LineDefs, for Sectors.
|
||
|
struct line_s;
|
||
|
|
||
|
|
||
|
//
|
||
|
// The SECTORS record, at runtime.
|
||
|
// Stores things/mobjs.
|
||
|
//
|
||
|
typedef struct
|
||
|
{
|
||
|
fixed_t floorheight;
|
||
|
fixed_t ceilingheight;
|
||
|
|
||
|
short floorpic;
|
||
|
short ceilingpic;
|
||
|
short lightlevel;
|
||
|
short special;
|
||
|
short tag;
|
||
|
|
||
|
// 0 = untraversed, 1,2 = sndlines -1
|
||
|
int soundtraversed;
|
||
|
|
||
|
/// // thing that made a sound (or null)
|
||
|
/// mobj_t* soundtarget;
|
||
|
|
||
|
/// // mapblock bounding box for height changes
|
||
|
/// int blockbox[4];
|
||
|
|
||
|
// origin for any sounds played by the sector
|
||
|
/// degenmobj_t soundorg;
|
||
|
|
||
|
// if == validcount, already checked
|
||
|
int validcount;
|
||
|
|
||
|
/// // list of mobjs in sector
|
||
|
/// mobj_t* thinglist;
|
||
|
|
||
|
// thinker_t for reversable actions
|
||
|
void* specialdata;
|
||
|
|
||
|
int linecount;
|
||
|
struct line_s** lines; // [linecount] size
|
||
|
|
||
|
} sector_t;
|
||
|
|
||
|
|
||
|
|
||
|
//
|
||
|
// The SideDef.
|
||
|
//
|
||
|
|
||
|
typedef struct
|
||
|
{
|
||
|
// add this to the calculated texture column
|
||
|
fixed_t textureoffset;
|
||
|
|
||
|
// add this to the calculated texture top
|
||
|
fixed_t rowoffset;
|
||
|
|
||
|
// Texture indices.
|
||
|
// We do not maintain names here.
|
||
|
short toptexture;
|
||
|
short bottomtexture;
|
||
|
short midtexture;
|
||
|
|
||
|
// Sector the SideDef is facing.
|
||
|
sector_t* sector;
|
||
|
|
||
|
} side_t;
|
||
|
|
||
|
|
||
|
|
||
|
//
|
||
|
// Move clipping aid for LineDefs.
|
||
|
//
|
||
|
typedef enum
|
||
|
{
|
||
|
ST_HORIZONTAL,
|
||
|
ST_VERTICAL,
|
||
|
ST_POSITIVE,
|
||
|
ST_NEGATIVE
|
||
|
|
||
|
} slopetype_t;
|
||
|
|
||
|
|
||
|
|
||
|
typedef struct line_s
|
||
|
{
|
||
|
// Vertices, from v1 to v2.
|
||
|
vertex_t* v1;
|
||
|
vertex_t* v2;
|
||
|
|
||
|
// Precalculated v2 - v1 for side checking.
|
||
|
fixed_t dx;
|
||
|
fixed_t dy;
|
||
|
|
||
|
// Animation related.
|
||
|
short flags;
|
||
|
short special;
|
||
|
short tag;
|
||
|
|
||
|
// Visual appearance: SideDefs.
|
||
|
// sidenum[1] will be -1 if one sided
|
||
|
short sidenum[2];
|
||
|
|
||
|
// Neat. Another bounding box, for the extent
|
||
|
// of the LineDef.
|
||
|
fixed_t bbox[4];
|
||
|
|
||
|
// To aid move clipping.
|
||
|
slopetype_t slopetype;
|
||
|
|
||
|
// Front and back sector.
|
||
|
// Note: redundant? Can be retrieved from SideDefs.
|
||
|
sector_t* frontsector;
|
||
|
sector_t* backsector;
|
||
|
|
||
|
// if == validcount, already checked
|
||
|
int validcount;
|
||
|
|
||
|
// thinker_t for reversable actions
|
||
|
void* specialdata;
|
||
|
} line_t;
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
//
|
||
|
// 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.
|
||
|
//
|
||
|
typedef struct subsector_s
|
||
|
{
|
||
|
sector_t* sector;
|
||
|
|
||
|
short numlines;
|
||
|
short firstline;
|
||
|
|
||
|
} subsector_t;
|
||
|
|
||
|
|
||
|
|
||
|
//
|
||
|
// The LineSeg.
|
||
|
//
|
||
|
typedef struct
|
||
|
{
|
||
|
vertex_t* v1;
|
||
|
vertex_t* v2;
|
||
|
|
||
|
fixed_t offset;
|
||
|
|
||
|
angle_t angle;
|
||
|
|
||
|
side_t* sidedef;
|
||
|
line_t* linedef;
|
||
|
|
||
|
// Sector references.
|
||
|
// Could be retrieved from linedef, too.
|
||
|
// backsector is NULL for one sided lines
|
||
|
sector_t* frontsector;
|
||
|
sector_t* backsector;
|
||
|
|
||
|
} seg_t;
|
||
|
|
||
|
|
||
|
|
||
|
//
|
||
|
// BSP node.
|
||
|
//
|
||
|
typedef struct
|
||
|
{
|
||
|
// Partition line.
|
||
|
fixed_t x;
|
||
|
fixed_t y;
|
||
|
fixed_t dx;
|
||
|
fixed_t dy;
|
||
|
|
||
|
// Bounding box for each child.
|
||
|
fixed_t bbox[2][4];
|
||
|
|
||
|
// If NF_SUBSECTOR its a subsector.
|
||
|
unsigned short children[2];
|
||
|
|
||
|
} node_t;
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
//
|
||
|
// OTHER TYPES
|
||
|
//
|
||
|
|
||
|
|
||
|
|
||
|
//
|
||
|
// ?
|
||
|
//
|
||
|
typedef struct drawseg_s
|
||
|
{
|
||
|
seg_t* curline;
|
||
|
int x1;
|
||
|
int x2;
|
||
|
|
||
|
fixed_t scale1;
|
||
|
fixed_t scale2;
|
||
|
fixed_t scalestep;
|
||
|
|
||
|
// 0=none, 1=bottom, 2=top, 3=both
|
||
|
int silhouette;
|
||
|
|
||
|
// do not clip sprites above this
|
||
|
fixed_t bsilheight;
|
||
|
|
||
|
// do not clip sprites below this
|
||
|
fixed_t tsilheight;
|
||
|
|
||
|
// Pointers to lists for sprite clipping,
|
||
|
// all three adjusted so [x1] is first value.
|
||
|
short* sprtopclip;
|
||
|
short* sprbottomclip;
|
||
|
short* maskedtexturecol;
|
||
|
|
||
|
} drawseg_t;
|
||
|
|
||
|
|
||
|
|
||
|
//
|
||
|
// Now what is a visplane, anyway?
|
||
|
//
|
||
|
typedef struct
|
||
|
{
|
||
|
fixed_t height;
|
||
|
int picnum;
|
||
|
int lightlevel;
|
||
|
int minx;
|
||
|
int maxx;
|
||
|
|
||
|
// leave pads for [minx-1]/[maxx+1]
|
||
|
|
||
|
byte pad1;
|
||
|
// Here lies the rub for all
|
||
|
// dynamic resize/change of resolution.
|
||
|
byte top[SCREENWIDTH];
|
||
|
byte pad2;
|
||
|
byte pad3;
|
||
|
// See above.
|
||
|
byte bottom[SCREENWIDTH];
|
||
|
byte pad4;
|
||
|
|
||
|
} visplane_t;
|
||
|
|
||
|
|
||
|
#endif
|