6 #define Q2BSPMAGIC ('I' + 'B' * 256 + 'S' * 65536 + 'P' * 16777216)
7 #define Q2BSPVERSION 38
9 // leaffaces, leafbrushes, planes, and verts are still bounded by
10 // 16 bit short limits
12 //=============================================================================
14 #define Q2LUMP_ENTITIES 0
15 #define Q2LUMP_PLANES 1
16 #define Q2LUMP_VERTEXES 2
17 #define Q2LUMP_VISIBILITY 3
18 #define Q2LUMP_NODES 4
19 #define Q2LUMP_TEXINFO 5
20 #define Q2LUMP_FACES 6
21 #define Q2LUMP_LIGHTING 7
22 #define Q2LUMP_LEAFS 8
23 #define Q2LUMP_LEAFFACES 9
24 #define Q2LUMP_LEAFBRUSHES 10
25 #define Q2LUMP_EDGES 11
26 #define Q2LUMP_SURFEDGES 12
27 #define Q2LUMP_MODELS 13
28 #define Q2LUMP_BRUSHES 14
29 #define Q2LUMP_BRUSHSIDES 15
31 #define Q2LUMP_AREAS 17
32 #define Q2LUMP_AREAPORTALS 18
33 #define Q2HEADER_LUMPS 19
35 typedef struct q2dheader_s
39 lump_t lumps[Q2HEADER_LUMPS];
42 typedef struct q2dmodel_s
44 float mins[3], maxs[3];
45 float origin[3]; // for sounds or lights
47 int firstface, numfaces; // submodels just draw faces
48 // without walking the bsp tree
51 // planes (x&~1) and (x&~1)+1 are always opposites
53 // contents flags are seperate bits
54 // a given brush can contribute multiple content bits
55 // multiple brushes can be in a single leaf
57 // these definitions also need to be in q_shared.h!
59 // lower bits are stronger, and will eat weaker brushes completely
60 #define Q2CONTENTS_SOLID 1 // an eye is never valid in a solid
61 #define Q2CONTENTS_WINDOW 2 // translucent, but not watery
62 #define Q2CONTENTS_AUX 4
63 #define Q2CONTENTS_LAVA 8
64 #define Q2CONTENTS_SLIME 16
65 #define Q2CONTENTS_WATER 32
66 #define Q2CONTENTS_MIST 64
67 #define Q2LAST_VISIBLE_CONTENTS 64
69 // remaining contents are non-visible, and don't eat brushes
71 #define Q2CONTENTS_AREAPORTAL 0x8000
73 #define Q2CONTENTS_PLAYERCLIP 0x10000
74 #define Q2CONTENTS_MONSTERCLIP 0x20000
76 // currents can be added to any other contents, and may be mixed
77 #define Q2CONTENTS_CURRENT_0 0x40000
78 #define Q2CONTENTS_CURRENT_90 0x80000
79 #define Q2CONTENTS_CURRENT_180 0x100000
80 #define Q2CONTENTS_CURRENT_270 0x200000
81 #define Q2CONTENTS_CURRENT_UP 0x400000
82 #define Q2CONTENTS_CURRENT_DOWN 0x800000
84 #define Q2CONTENTS_ORIGIN 0x1000000 // removed before bsping an entity
86 #define Q2CONTENTS_MONSTER 0x2000000 // should never be on a brush, only in game
87 #define Q2CONTENTS_DEADMONSTER 0x4000000
88 #define Q2CONTENTS_DETAIL 0x8000000 // brushes to be added after vis leafs
89 #define Q2CONTENTS_TRANSLUCENT 0x10000000 // auto set if any surface has trans
90 #define Q2CONTENTS_LADDER 0x20000000
94 #define Q2SURF_LIGHT 0x1 // value will hold the light strength
96 #define Q2SURF_SLICK 0x2 // effects game physics
98 #define Q2SURF_SKY 0x4 // don't draw, but add to skybox
99 #define Q2SURF_WARP 0x8 // turbulent water warp
100 #define Q2SURF_TRANS33 0x10
101 #define Q2SURF_TRANS66 0x20
102 #define Q2SURF_FLOWING 0x40 // scroll towards angle
103 #define Q2SURF_NODRAW 0x80 // don't bother referencing the texture
105 #define Q2SURF_HINT 0x100 // make a primary bsp splitter
106 #define Q2SURF_SKIP 0x200 // completely ignore, allowing non-closed brushes
108 #define Q2SURF_ALPHATEST 0x02000000 // alpha test masking of color 255 in wal textures (supported by modded engines)
112 typedef struct q2dnode_s
115 int children[2]; // negative numbers are -(leafs+1), not nodes
116 short mins[3]; // for frustom culling
118 unsigned short firstface;
119 unsigned short numfaces; // counting both sides
122 typedef struct q2texinfo_s
124 float vecs[2][4]; // [s/t][xyz offset]
125 int flags; // miptex flags + overrides
126 int value; // light emission, etc
127 char texture[32]; // texture name (textures/something.wal)
128 int nexttexinfo; // for animations, -1 = end of chain
131 typedef struct q2dleaf_s
133 int contents; // OR of all brushes (not needed?)
138 short mins[3]; // for frustum culling
141 unsigned short firstleafface;
142 unsigned short numleaffaces;
144 unsigned short firstleafbrush;
145 unsigned short numleafbrushes;
148 typedef struct q2dbrushside_s
150 unsigned short planenum; // facing out of the leaf
154 typedef struct q2dbrush_s
162 // the visibility lump consists of a header with a count, then
163 // byte offsets for the PVS and PHS of each cluster, then the raw
164 // compressed bit vectors
167 typedef struct q2dvis_s
170 int bitofs[8][2]; // bitofs[numclusters][2]
173 // each area has a list of portals that lead into other areas
174 // when portals are closed, other areas may not be visible or
175 // hearable even if the vis info says that it should be
176 typedef struct q2dareaportal_s
182 typedef struct q2darea_s