2004-08-21 01:25:48 +00:00
/*
Copyright ( C ) 1996 - 1997 Id Software , Inc .
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 .
*/
// upper design bounds
# define MAX_MAP_HULLSDQ1 4
# define MAX_MAP_HULLSDH2 8
2017-01-29 13:10:53 +00:00
# define MAX_MAP_HULLSM 8
2004-08-21 01:25:48 +00:00
2013-06-23 02:17:02 +00:00
//#define MAX_MAP_MODELS 256
//#define MAX_MAP_BRUSHES 0x8000
//#define MAX_MAP_ENTITIES 1024
//#define MAX_MAP_ENTSTRING 65536
2017-06-21 01:24:25 +00:00
//FIXME: make sure that any 16bit indexes are bounded properly
//FIXME: ensure that we don't get any count*size overflows
# define SANITY_MAX_MAP_PLANES 65536*64 //sanity
# define SANITY_MAX_MAP_NODES 65536*64 //sanity
//#define SANITY_MAX_MAP_CLIPNODES 65536*64 //sanity
//#define MAX_MAP_LEAFS 1 //pvs buffer size. not sanity.
# define SANITY_MAX_MAP_LEAFS 65536*64 //too many leafs results in massive amounts of ram used for pvs/phs caches.
//#define SANITY_MAX_MAP_VERTS 65536 //sanity
# define SANITY_MAX_MAP_FACES 65536*64 //sanity
2013-12-29 22:48:28 +00:00
//#define MAX_MAP_MARKSURFACES 65536 //sanity
2013-06-23 02:17:02 +00:00
//#define MAX_MAP_TEXINFO 4096 //sanity
2017-06-21 01:24:25 +00:00
//#define MAX_MAP_EDGES 256000
2013-06-23 02:17:02 +00:00
//#define MAX_MAP_SURFEDGES 512000
//#define MAX_MAP_MIPTEX 0x200000
//#define MAX_MAP_LIGHTING 0x100000
//#define MAX_MAP_VISIBILITY 0x200000
2004-08-21 01:25:48 +00:00
2017-08-29 02:29:06 +00:00
# define SANITY_MAX_MAP_BRUSHSIDES ((~0u) / sizeof(q2cbrushside_t))
2014-02-11 17:51:29 +00:00
2004-08-21 01:25:48 +00:00
// key / value pair sizes
# define MAX_KEY 32
# define MAX_VALUE 1024
//=============================================================================
2005-05-08 03:41:24 +00:00
# define BSPVERSIONPREREL 28
2004-08-21 01:25:48 +00:00
# define BSPVERSION 29
//HalfLife support
# define BSPVERSIONHL 30
2012-09-30 05:52:03 +00:00
# define BSPVERSION_LONG1 (('B' << 24) | ('S' << 16) | ('P' << 8) | '2') /*RMQ support (2PSB). 32bits instead of shorts for all but bbox sizes*/
# define BSPVERSION_LONG2 (('B' << 0) | ('S' << 8) | ('P' << 16) | ('2'<<24)) /*BSP2 support. 32bits instead of shorts for everything*/
2004-08-21 01:25:48 +00:00
typedef struct
{
int fileofs , filelen ;
} lump_t ;
# define LUMP_ENTITIES 0
# define LUMP_PLANES 1
# define LUMP_TEXTURES 2
# define LUMP_VERTEXES 3
# define LUMP_VISIBILITY 4
# define LUMP_NODES 5
# define LUMP_TEXINFO 6
# define LUMP_FACES 7
# define LUMP_LIGHTING 8
# define LUMP_CLIPNODES 9
# define LUMP_LEAFS 10
# define LUMP_MARKSURFACES 11
# define LUMP_EDGES 12
# define LUMP_SURFEDGES 13
# define LUMP_MODELS 14
# define HEADER_LUMPS 15
typedef struct
{
float mins [ 3 ] , maxs [ 3 ] ;
float origin [ 3 ] ;
int headnode [ MAX_MAP_HULLSDQ1 ] ;
int visleafs ; // not including the solid leaf 0
int firstface , numfaces ;
} dq1model_t ;
typedef struct
{
float mins [ 3 ] , maxs [ 3 ] ;
float origin [ 3 ] ;
int headnode [ MAX_MAP_HULLSDH2 ] ;
int visleafs ; // not including the solid leaf 0
int firstface , numfaces ;
} dh2model_t ;
typedef struct
{
int version ;
lump_t lumps [ HEADER_LUMPS ] ;
} dheader_t ;
typedef struct
{
int nummiptex ;
int dataofs [ 4 ] ; // [nummiptex]
} dmiptexlump_t ;
# define MIPLEVELS 4
typedef struct miptex_s
{
char name [ 16 ] ;
unsigned width , height ;
unsigned offsets [ MIPLEVELS ] ; // four mip maps stored
} miptex_t ;
typedef struct
{
float point [ 3 ] ;
} dvertex_t ;
// 0-2 are axial planes
# define PLANE_X 0
# define PLANE_Y 1
# define PLANE_Z 2
// 3-5 are non-axial planes snapped to the nearest
# define PLANE_ANYX 3
# define PLANE_ANYY 4
# define PLANE_ANYZ 5
typedef struct
{
float normal [ 3 ] ;
float dist ;
int type ; // PLANE_X - PLANE_ANYZ ?remove? trivial to regenerate
} dplane_t ;
# define Q1CONTENTS_EMPTY -1
# define Q1CONTENTS_SOLID -2
# define Q1CONTENTS_WATER -3
# define Q1CONTENTS_SLIME -4
# define Q1CONTENTS_LAVA -5
# define Q1CONTENTS_SKY -6
2015-03-05 22:14:21 +00:00
# define Q1CONTENTS_STRIPPED -7 /*not known to engine*/
# define Q1CONTENTS_CLIP -8 /*solid to players*/
# define Q1CONTENTS_FLOW_1 -9 /*moves player*/
# define Q1CONTENTS_FLOW_2 -10 /*moves player*/
# define Q1CONTENTS_FLOW_3 -11 /*moves player*/
# define Q1CONTENTS_FLOW_4 -12 /*moves player*/
# define Q1CONTENTS_FLOW_5 -13 /*moves player*/
# define Q1CONTENTS_FLOW_6 -14 /*moves player*/
# define Q1CONTENTS_TRANS -15 /*should be solid I guess*/
# define Q1CONTENTS_LADDER -16 /*player can climb up/down*/
2004-08-21 01:25:48 +00:00
// !!! if this is changed, it must be changed in asm_i386.h too !!!
typedef struct
{
int planenum ;
short children [ 2 ] ; // negative numbers are -(leafs+1), not nodes
short mins [ 3 ] ; // for sphere culling
short maxs [ 3 ] ;
unsigned short firstface ;
unsigned short numfaces ; // counting both sides
2011-10-27 16:16:29 +00:00
} dsnode_t ;
typedef struct
{
int planenum ;
int children [ 2 ] ; // negative numbers are -(leafs+1), not nodes
short mins [ 3 ] ; // for sphere culling
short maxs [ 3 ] ;
unsigned int firstface ;
unsigned int numfaces ; // counting both sides
2012-09-30 05:52:03 +00:00
} dl1node_t ;
typedef struct
{
int planenum ;
int children [ 2 ] ; // negative numbers are -(leafs+1), not nodes
float mins [ 3 ] ; // for sphere culling
float maxs [ 3 ] ;
unsigned int firstface ;
unsigned int numfaces ; // counting both sides
} dl2node_t ;
2004-08-21 01:25:48 +00:00
typedef struct
{
int planenum ;
short children [ 2 ] ; // negative numbers are contents
2011-10-27 16:16:29 +00:00
} dsclipnode_t ;
typedef struct
{
int planenum ;
int children [ 2 ] ; // negative numbers are contents
} dlclipnode_t ;
2004-08-21 01:25:48 +00:00
2011-06-29 18:39:11 +00:00
typedef struct
{
int planenum ;
2011-07-30 14:14:56 +00:00
int children [ 2 ] ; // negative numbers are contents
2011-06-29 18:39:11 +00:00
} mclipnode_t ;
2004-08-21 01:25:48 +00:00
typedef struct texinfo_s
{
float vecs [ 2 ] [ 4 ] ; // [s/t][xyz offset]
int miptex ;
int flags ;
} texinfo_t ;
# define TEX_SPECIAL 1 // sky or slime, no lightmap or 256 subdivision
// note that edge 0 is never used, because negative edge nums are used for
// counterclockwise use of the edge in a face
typedef struct
{
unsigned short v [ 2 ] ; // vertex numbers
2011-10-27 16:16:29 +00:00
} dsedge_t ;
typedef struct
{
2011-12-05 15:23:40 +00:00
unsigned int v [ 2 ] ; // vertex numbers
2011-10-27 16:16:29 +00:00
} dledge_t ;
2004-08-21 01:25:48 +00:00
2017-02-19 00:15:42 +00:00
# ifdef RFBSPS
2013-10-08 14:28:11 +00:00
# define MAXRLIGHTMAPS 4 //max lightmaps mixed by the renderer (rbsp=4, otherwise 1)
# else
# define MAXRLIGHTMAPS 1 //max lightmaps mixed by the renderer (rbsp=4, otherwise 1)
# endif
# define MAXQ1LIGHTMAPS 4
2004-08-21 01:25:48 +00:00
typedef struct
{
short planenum ;
short side ;
int firstedge ; // we must support > 64k edges
short numedges ;
short texinfo ;
// lighting info
2013-10-08 14:28:11 +00:00
qbyte styles [ MAXQ1LIGHTMAPS ] ;
2004-08-21 01:25:48 +00:00
int lightofs ; // start of [numstyles*surfsize] samples
2011-10-27 16:16:29 +00:00
} dsface_t ;
typedef struct
{
int planenum ;
int side ;
int firstedge ; // we must support > 64k edges
int numedges ;
int texinfo ;
// lighting info
2013-10-08 14:28:11 +00:00
qbyte styles [ MAXQ1LIGHTMAPS ] ;
2011-10-27 16:16:29 +00:00
int lightofs ; // start of [numstyles*surfsize] samples
} dlface_t ;
2004-08-21 01:25:48 +00:00
# define AMBIENT_WATER 0
# define AMBIENT_SKY 1
# define AMBIENT_SLIME 2
# define AMBIENT_LAVA 3
# define NUM_AMBIENTS 4 // automatic ambient sounds
// leaf 0 is the generic CONTENTS_SOLID leaf, used for all solid areas
// all other leafs need visibility info
typedef struct
{
int contents ;
int visofs ; // -1 = no visibility info
short mins [ 3 ] ; // for frustum culling
short maxs [ 3 ] ;
unsigned short firstmarksurface ;
unsigned short nummarksurfaces ;
qbyte ambient_level [ NUM_AMBIENTS ] ;
2011-10-27 16:16:29 +00:00
} dsleaf_t ;
typedef struct
{
int contents ;
int visofs ; // -1 = no visibility info
short mins [ 3 ] ; // for frustum culling
short maxs [ 3 ] ;
unsigned int firstmarksurface ;
unsigned int nummarksurfaces ;
qbyte ambient_level [ NUM_AMBIENTS ] ;
2012-09-30 05:52:03 +00:00
} dl1leaf_t ;
typedef struct
{
int contents ;
int visofs ; // -1 = no visibility info
float mins [ 3 ] ; // for frustum culling
float maxs [ 3 ] ;
unsigned int firstmarksurface ;
unsigned int nummarksurfaces ;
qbyte ambient_level [ NUM_AMBIENTS ] ;
} dl2leaf_t ;
2004-08-21 01:25:48 +00:00
//============================================================================
# define MIPLEVELS 4
typedef struct q2miptex_s
{
char name [ 32 ] ;
unsigned width , height ;
unsigned offsets [ MIPLEVELS ] ; // four mip maps stored
char animname [ 32 ] ; // next frame in animation chain
int flags ;
int contents ;
int value ;
} q2miptex_t ;
/*
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
. BSP file format
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
*/
# define IDBSPHEADER (('P'<<24)+('S'<<16)+('B'<<8)+'I')
// little-endian "IBSP"
2015-03-03 00:14:43 +00:00
# define BSPVERSION_Q2 38
# define BSPVERSION_Q2W 69
# define BSPVERSION_Q3 46
# define BSPVERSION_RTCW 47
# define BSPVERSION_RBSP 1 //also fbsp(just bigger internal lightmaps)
2004-08-21 01:25:48 +00:00
// upper design bounds
// leaffaces, leafbrushes, planes, and verts are still bounded by
// 16 bit short limits
2013-08-21 07:14:39 +00:00
# define SANITY_MAX_Q2MAP_MODELS 1024
2014-12-11 16:26:26 +00:00
//#define MAX_Q2MAP_ENTITIES 2048
2017-08-29 02:29:06 +00:00
# define SANITY_MAX_MAP_BRUSHES (~0u / sizeof(*out))
# define SANITY_MAX_MAP_LEAFFACES 262144 //sanity only
2004-08-21 01:25:48 +00:00
# define MAX_Q2MAP_AREAS 256
# define MAX_Q2MAP_AREAPORTALS 1024
2014-12-11 16:26:26 +00:00
//#define MAX_Q2MAP_VERTS MAX_MAP_VERTS
//#define MAX_Q2MAP_FACES MAX_MAP_FACES
# ifdef FTE_TARGET_WEB
# define MAX_Q2MAP_LEAFBRUSHES (32768) //used in an array
# else
2014-04-01 23:43:45 +00:00
# define MAX_Q2MAP_LEAFBRUSHES (65536*2) //used in an array
2014-12-11 16:26:26 +00:00
# endif
2013-06-23 02:17:02 +00:00
//#define MAX_Q2MAP_PORTALS 65536 //unused
//#define MAX_Q2MAP_EDGES 128000 //unused
//#define MAX_Q2MAP_SURFEDGES 256000 //unused
//#define MAX_Q2MAP_LIGHTING 0x200000 //unused
2012-08-04 01:35:52 +00:00
//#define MAX_Q2MAP_VISIBILITY MAX_MAP_VISIBILITY
2004-08-21 01:25:48 +00:00
// key / value pair sizes
# define MAX_KEY 32
# define MAX_VALUE 1024
//=============================================================================
# define Q2LUMP_ENTITIES 0
# define Q2LUMP_PLANES 1
# define Q2LUMP_VERTEXES 2
# define Q2LUMP_VISIBILITY 3
# define Q2LUMP_NODES 4
# define Q2LUMP_TEXINFO 5
# define Q2LUMP_FACES 6
# define Q2LUMP_LIGHTING 7
# define Q2LUMP_LEAFS 8
# define Q2LUMP_LEAFFACES 9
# define Q2LUMP_LEAFBRUSHES 10
# define Q2LUMP_EDGES 11
# define Q2LUMP_SURFEDGES 12
# define Q2LUMP_MODELS 13
# define Q2LUMP_BRUSHES 14
# define Q2LUMP_BRUSHSIDES 15
# define Q2LUMP_POP 16
# define Q2LUMP_AREAS 17
# define Q2LUMP_AREAPORTALS 18
# define Q2HEADER_LUMPS 19
enum Q3LUMP
{
Q3LUMP_ENTITIES = 0 ,
Q3LUMP_SHADERS = 1 ,
Q3LUMP_PLANES = 2 ,
Q3LUMP_NODES = 3 ,
Q3LUMP_LEAFS = 4 ,
Q3LUMP_LEAFSURFACES = 5 ,
Q3LUMP_LEAFBRUSHES = 6 ,
Q3LUMP_MODELS = 7 ,
Q3LUMP_BRUSHES = 8 ,
Q3LUMP_BRUSHSIDES = 9 ,
Q3LUMP_DRAWVERTS = 10 ,
Q3LUMP_DRAWINDEXES = 11 ,
Q3LUMP_FOGS = 12 ,
Q3LUMP_SURFACES = 13 ,
Q3LUMP_LIGHTMAPS = 14 ,
Q3LUMP_LIGHTGRID = 15 ,
Q3LUMP_VISIBILITY = 16 ,
2017-02-19 00:15:42 +00:00
# ifdef RFBSPS
2005-04-21 00:02:01 +00:00
RBSPLUMP_LIGHTINDEXES = 17 ,
2017-02-19 00:15:42 +00:00
# endif
2004-08-21 01:25:48 +00:00
Q3LUMPS_TOTAL
} ;
typedef struct
{
int ident ;
int version ;
2015-03-03 00:14:43 +00:00
lump_t lumps [ 50 ] ;
2004-08-21 01:25:48 +00:00
} q2dheader_t ;
typedef struct
{
float mins [ 3 ] , maxs [ 3 ] ;
float origin [ 3 ] ; // for sounds or lights
int headnode ;
int firstface , numfaces ; // submodels just draw faces
// without walking the bsp tree
} q2dmodel_t ;
typedef struct
{
float mins [ 3 ] ;
float maxs [ 3 ] ;
int firstsurface ;
int num_surfaces ;
int firstbrush ;
int num_brushes ;
} q3dmodel_t ;
// 0-2 are axial planes
# define PLANE_X 0
# define PLANE_Y 1
# define PLANE_Z 2
// 3-5 are non-axial planes snapped to the nearest
# define PLANE_ANYX 3
# define PLANE_ANYY 4
# define PLANE_ANYZ 5
// contents flags are seperate bits
// a given brush can contribute multiple content bits
// multiple brushes can be in a single leaf
2017-11-14 14:37:04 +00:00
# define FTECONTENTS_EMPTY 0x00000000
# define FTECONTENTS_SOLID 0x00000001
//q2window 0x00000002
//q2aux 0x00000004
# define FTECONTENTS_LAVA 0x00000008
# define FTECONTENTS_SLIME 0x00000010
# define FTECONTENTS_WATER 0x00000020
# define FTECONTENTS_FLUID (FTECONTENTS_WATER|FTECONTENTS_SLIME|FTECONTENTS_LAVA|FTECONTENTS_SKY) //sky is a fluid for q1 code.
//q2mist 0x00000040
//q3notteam1 0x00000080
//q3notteam2 0x00000100
//q3nobotclip 0x00000200
// 0x00000400
// 0x00000800
// 0x00001000
// 0x00002000
# define FTECONTENTS_LADDER 0x00004000
//q2areaportal,q3areaportal 0x00008000
# define FTECONTENTS_PLAYERCLIP 0x00010000
# define FTECONTENTS_MONSTERCLIP 0x00020000
//q2current0,q3teleporter 0x00040000
//q2current90,q3jumppad 0x00080000
//q2current180,q3clusterportal 0x00100000
//q2current270,q3donotenter 0x00200000
//q2currentup,q3botclip 0x00400000
//q2currentdown,q3mover 0x00800000
//q2origin,q3origin 0x01000000 //could define, but normally removed by compiler, so why?
# define FTECONTENTS_BODY 0x02000000
# define FTECONTENTS_CORPSE 0x04000000
//q2detail,q3detail 0x08000000 //not very useful to us
//q2translucent,q3structual 0x10000000
//q2ladder,q3translucent 0x20000000
//q3trigger 0x40000000
# define FTECONTENTS_SKY /*q3nodrop*/ 0x80000000
2012-01-17 07:57:46 +00:00
2004-08-21 01:25:48 +00:00
// lower bits are stronger, and will eat weaker brushes completely
2012-07-05 19:42:36 +00:00
# define Q2CONTENTS_SOLID FTECONTENTS_SOLID //0x00000001
# define Q2CONTENTS_WINDOW 0x00000002 // translucent, but not watery
# define Q2CONTENTS_AUX 0x00000004
# define Q2CONTENTS_LAVA FTECONTENTS_LAVA //0x00000008
# define Q2CONTENTS_SLIME FTECONTENTS_SLIME //0x00000010
# define Q2CONTENTS_WATER FTECONTENTS_WATER //0x00000020
# define Q2CONTENTS_MIST 0x00000040
//0x00000080
//0x00000100
//0x00000200
//0x00000400
//0x00000800
//0x00001000
//0x00002000
//FTECONTENTS_LADDER //0x00004000
2004-08-21 01:25:48 +00:00
// remaining contents are non-visible, and don't eat brushes
2012-07-05 19:42:36 +00:00
# define Q2CONTENTS_AREAPORTAL 0x00008000
# define Q2CONTENTS_PLAYERCLIP FTECONTENTS_PLAYERCLIP //0x00010000
# define Q2CONTENTS_MONSTERCLIP FTECONTENTS_MONSTERCLIP //0x00020000
2004-08-21 01:25:48 +00:00
// currents can be added to any other contents, and may be mixed
2012-07-05 19:42:36 +00:00
# define Q2CONTENTS_CURRENT_0 0x00040000
# define Q2CONTENTS_CURRENT_90 0x00080000
# define Q2CONTENTS_CURRENT_180 0x00100000
# define Q2CONTENTS_CURRENT_270 0x00200000
# define Q2CONTENTS_CURRENT_UP 0x00400000
# define Q2CONTENTS_CURRENT_DOWN 0x00800000
# define Q2CONTENTS_ORIGIN 0x01000000 // removed before bsping an entity
# define Q2CONTENTS_MONSTER FTECONTENTS_BODY //0x02000000 // should never be on a brush, only in game
# define Q2CONTENTS_DEADMONSTER FTECONTENTS_CORPSE //0x04000000
# define Q2CONTENTS_DETAIL 0x08000000 // brushes to be added after vis leafs
# define Q2CONTENTS_TRANSLUCENT 0x10000000 // auto set if any surface has trans
# define Q2CONTENTS_LADDER 0x20000000
//0x40000000
2017-01-13 00:39:50 +00:00
//FTECONTENTS_SKY //0x80000000
2010-08-28 17:14:38 +00:00
2012-01-17 07:57:46 +00:00
2016-07-12 00:40:13 +00:00
# define Q3CONTENTS_SOLID FTECONTENTS_SOLID //0x00000001 // should never be on a brush, only in game
//0x00000002
//0x00000004
# define Q3CONTENTS_LAVA FTECONTENTS_LAVA //0x00000008
# define Q3CONTENTS_SLIME FTECONTENTS_SLIME //0x00000010
# define Q3CONTENTS_WATER FTECONTENTS_WATER //0x00000020
//0x00000040
2012-01-17 07:57:46 +00:00
# define Q3CONTENTS_NOTTEAM1 0x00000080
# define Q3CONTENTS_NOTTEAM2 0x00000100
# define Q3CONTENTS_NOBOTCLIP 0x00000200
//0x00000400
//0x00000800
//0x00001000
//0x00002000
2012-07-05 19:42:36 +00:00
//FTECONTENTS_LADDER //0x00004000
2012-01-17 07:57:46 +00:00
# define Q3CONTENTS_AREAPORTAL 0x00008000
2012-07-05 19:42:36 +00:00
# define Q3CONTENTS_PLAYERCLIP FTECONTENTS_PLAYERCLIP //0x00010000
# define Q3CONTENTS_MONSTERCLIP FTECONTENTS_MONSTERCLIP //0x00020000
2012-01-17 07:57:46 +00:00
# define Q3CONTENTS_TELEPORTER 0x00040000
# define Q3CONTENTS_JUMPPAD 0x00080000
# define Q3CONTENTS_CLUSTERPORTAL 0x00100000
# define Q3CONTENTS_DONOTENTER 0x00200000
# define Q3CONTENTS_BOTCLIP 0x00400000
# define Q3CONTENTS_MOVER 0x00800000
# define Q3CONTENTS_ORIGIN Q2CONTENTS_ORIGIN //0x01000000
2017-01-13 00:39:50 +00:00
# define Q3CONTENTS_BODY FTECONTENTS_BODY //0x02000000
2012-07-05 19:42:36 +00:00
# define Q3CONTENTS_CORPSE FTECONTENTS_CORPSE //0x04000000
2012-01-17 07:57:46 +00:00
# define Q3CONTENTS_DETAIL Q2CONTENTS_DETAIL //0x08000000
# define Q3CONTENTS_STRUCTURAL 0x10000000
# define Q3CONTENTS_TRANSLUCENT 0x20000000
# define Q3CONTENTS_TRIGGER 0x40000000
# define Q3CONTENTS_NODROP FTECONTENTS_SKY //0x80000000
2004-08-21 01:25:48 +00:00
2017-08-14 16:38:44 +00:00
//qc compat only. not used internally.
# define DPCONTENTS_SOLID 1 // hit a bmodel, not a bounding box
# define DPCONTENTS_WATER 2
# define DPCONTENTS_SLIME 4
# define DPCONTENTS_LAVA 8
# define DPCONTENTS_SKY 16
# define DPCONTENTS_BODY 32 // hit a bounding box, not a bmodel
# define DPCONTENTS_CORPSE 64 // hit a SOLID_CORPSE entity
# define DPCONTENTS_NODROP 128 // an area where backpacks should not spawn
# define DPCONTENTS_PLAYERCLIP 256 // blocks player movement
# define DPCONTENTS_MONSTERCLIP 512 // blocks monster movement
# define DPCONTENTS_DONOTENTER 1024 // AI hint brush
# define DPCONTENTS_BOTCLIP 2048 // AI hint brush
# define DPCONTENTS_OPAQUE 4096 // only fully opaque brushes get this (may be useful for line of sight checks)
2004-08-21 01:25:48 +00:00
2009-11-04 21:16:50 +00:00
//Texinfo flags - warning: these mix with q3 surface flags
# define TI_LIGHT 0x1 // value will hold the light strength
2004-08-21 01:25:48 +00:00
2009-11-04 21:16:50 +00:00
# define TI_SLICK 0x2 // effects game physics
2004-08-21 01:25:48 +00:00
2009-11-04 21:16:50 +00:00
# define TI_SKY 0x4 // don't draw, but add to skybox
# define TI_WARP 0x8 // turbulent water warp
# define TI_TRANS33 0x10
# define TI_TRANS66 0x20
# define TI_FLOWING 0x40 // scroll towards angle
# define TI_NODRAW 0x80 // don't bother referencing the texture
2004-08-21 01:25:48 +00:00
2009-11-04 21:16:50 +00:00
# define TI_ALPHATEST 0x100
2008-12-23 02:55:20 +00:00
2009-11-04 21:16:50 +00:00
//Surface flags
2006-02-12 04:47:10 +00:00
# define Q3SURF_LADDER 0x8 //wee
2012-01-17 07:57:46 +00:00
// content masks. Allow q2contents_window in here
//#define MASK_ALL (-1)
# define MASK_WORLDSOLID (FTECONTENTS_SOLID|Q2CONTENTS_WINDOW) /*default trace type for something simple that ignores non-bsp stuff*/
# define MASK_POINTSOLID (FTECONTENTS_SOLID|Q2CONTENTS_WINDOW|FTECONTENTS_BODY) /*default trace type for an entity of no size*/
# define MASK_BOXSOLID (FTECONTENTS_SOLID|FTECONTENTS_PLAYERCLIP|Q2CONTENTS_WINDOW|FTECONTENTS_BODY) /*default trace type for an entity that does have size*/
# define MASK_PLAYERSOLID MASK_BOXSOLID
//#define MASK_DEADSOLID (Q2CONTENTS_SOLID|Q2CONTENTS_PLAYERCLIP|Q2CONTENTS_WINDOW)
//#define MASK_MONSTERSOLID (Q2CONTENTS_SOLID|Q2CONTENTS_MONSTERCLIP|Q2CONTENTS_WINDOW|Q2CONTENTS_MONSTER)
# define MASK_WATER (FTECONTENTS_WATER|FTECONTENTS_LAVA|FTECONTENTS_SLIME)
//#define MASK_OPAQUE (Q2CONTENTS_SOLID|Q2CONTENTS_SLIME|Q2CONTENTS_LAVA)
//#define MASK_SHOT (Q2CONTENTS_SOLID|Q2CONTENTS_MONSTER|Q2CONTENTS_WINDOW|Q2CONTENTS_DEADMONSTER)
# define Q2MASK_CURRENT (Q2CONTENTS_CURRENT_0|Q2CONTENTS_CURRENT_90|Q2CONTENTS_CURRENT_180|Q2CONTENTS_CURRENT_270|Q2CONTENTS_CURRENT_UP|Q2CONTENTS_CURRENT_DOWN)
2004-08-21 01:25:48 +00:00
typedef struct
{
int planenum ;
int children [ 2 ] ; // negative numbers are -(leafs+1), not nodes
short mins [ 3 ] ; // for frustom culling
short maxs [ 3 ] ;
unsigned short firstface ;
unsigned short numfaces ; // counting both sides
} q2dnode_t ;
typedef struct
{
int plane ;
int children [ 2 ] ;
int mins [ 3 ] ;
int maxs [ 3 ] ;
} q3dnode_t ;
typedef struct q2texinfo_s
{
float vecs [ 2 ] [ 4 ] ; // [s/t][xyz offset]
int flags ; // miptex flags + overrides
int value ; // light emission, etc
char texture [ 32 ] ; // texture name (textures/ *.wal)
int nexttexinfo ; // for animations, -1 = end of chain
} q2texinfo_t ;
typedef struct
{
int contents ; // OR of all brushes (not needed?)
short cluster ;
short area ;
short mins [ 3 ] ; // for frustum culling
short maxs [ 3 ] ;
unsigned short firstleafface ;
unsigned short numleaffaces ;
unsigned short firstleafbrush ;
unsigned short numleafbrushes ;
} q2dleaf_t ;
typedef struct
{
int cluster ;
int area ;
int mins [ 3 ] ;
int maxs [ 3 ] ;
int firstleafsurface ;
int num_leafsurfaces ;
int firstleafbrush ;
int num_leafbrushes ;
} q3dleaf_t ;
typedef struct
{
unsigned short planenum ; // facing out of the leaf
short texinfo ;
} q2dbrushside_t ;
typedef struct
{
int planenum ;
int texinfo ;
} q3dbrushside_t ;
2005-04-21 00:02:01 +00:00
typedef struct
{
int planenum ;
int texinfo ;
int facenum ;
} rbspbrushside_t ;
2004-08-21 01:25:48 +00:00
typedef struct
{
int firstside ;
int numsides ;
int contents ;
} q2dbrush_t ;
typedef struct
{
int firstside ;
int num_sides ;
int shadernum ;
} q3dbrush_t ;
# define ANGLE_UP -1
# define ANGLE_DOWN -2
// the visibility lump consists of a header with a count, then
// qbyte offsets for the PVS and PHS of each cluster, then the raw
// compressed bit vectors
# define DVIS_PVS 0
# define DVIS_PHS 1
typedef struct
{
int numclusters ;
int bitofs [ 8 ] [ 2 ] ; // bitofs[numclusters][2]
} q2dvis_t ;
typedef struct
{
int numclusters ;
int rowsize ;
unsigned char data [ 1 ] ;
} q3dvis_t ;
// each area has a list of portals that lead into other areas
// when portals are closed, other areas may not be visible or
// hearable even if the vis info says that it should be
typedef struct
{
int portalnum ;
int otherarea ;
} q2dareaportal_t ;
typedef struct
{
int numareaportals ;
int firstareaportal ;
} q2darea_t ;
typedef struct
{
char shadername [ 64 ] ;
int surfflags ;
int contents ;
} dq3shader_t ;
typedef struct
{
float n [ 3 ] ;
float d ;
} Q3PLANE_t ;
struct Q3MODEL
{
float mins [ 3 ] ;
float maxs [ 3 ] ;
int firstsurface ;
int num_surfaces ;
int firstbrush ;
int num_brushes ;
} ;
typedef struct
{
float point [ 3 ] ;
float texcoords [ 2 ] [ 2 ] ;
float normal [ 3 ] ;
unsigned char color [ 4 ] ;
} q3dvertex_t ;
2005-04-21 00:02:01 +00:00
typedef struct
{
float point [ 3 ] ;
float texcoords [ 5 ] [ 2 ] ;
float normal [ 3 ] ;
unsigned char color [ 4 ] [ 4 ] ;
} rbspvertex_t ;
2004-08-21 01:25:48 +00:00
struct Q3FOG
{
char shadername [ 64 ] ;
int brushnum ;
int visibleside ;
} ;
enum q3surfacetype
{
MST_BAD = 0 ,
MST_PLANAR = 1 ,
MST_PATCH = 2 ,
MST_TRIANGLE_SOUP = 3 ,
MST_FLARE = 4
} ;
typedef struct
{
int shadernum ;
int fognum ;
int facetype ;
int firstvertex ;
int num_vertices ;
int firstindex ;
int num_indexes ;
int lightmapnum ;
int lightmap_x ;
int lightmap_y ;
int lightmap_width ;
int lightmap_height ;
float lightmap_origin [ 3 ] ;
float lightmap_vecs [ 2 ] [ 3 ] ;
float normal [ 3 ] ;
int patchwidth ;
int patchheight ;
} q3dface_t ;
2005-04-21 00:02:01 +00:00
typedef struct
{
int shadernum ;
int fognum ;
int facetype ;
int firstvertex ;
int num_vertices ;
int firstindex ;
int num_indexes ;
unsigned char lm_styles [ 4 ] ;
unsigned char vt_styles [ 4 ] ;
int lightmapnum [ 4 ] ;
int lightmap_offs [ 2 ] [ 4 ] ;
int lightmap_width ;
int lightmap_height ;
float lightmap_origin [ 3 ] ;
float lightmap_vecs [ 2 ] [ 3 ] ;
float normal [ 3 ] ;
int patchwidth ;
int patchheight ;
} rbspface_t ;
2010-07-11 02:22:39 +00:00
2012-05-09 15:30:53 +00:00
# define MAX_ENT_LEAFS 32
2010-07-11 02:22:39 +00:00
typedef struct pvscache_s
{
2014-09-17 03:04:08 +00:00
int num_leafs ;
unsigned short leafnums [ MAX_ENT_LEAFS ] ;
2017-02-19 00:15:42 +00:00
# if defined(Q2BSPS) || defined(Q3BSPS) || defined(TERRAIN)
2014-09-17 03:04:08 +00:00
int areanum ; //q2bsp
int areanum2 ; //q2bsp
int headnode ; //q2bsp
2010-07-11 02:22:39 +00:00
# endif
} pvscache_t ;