]> icculus.org git repositories - divverent/darkplaces.git/blob - bspfile.h
fixed forged packet identification to only care about address (not port) and do so...
[divverent/darkplaces.git] / bspfile.h
1 /*
2 Copyright (C) 1996-1997 Id Software, Inc.
3
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU General Public License
6 as published by the Free Software Foundation; either version 2
7 of the License, or (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12
13 See the GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
18
19 */
20
21
22 #define MAX_MAP_HULLS           4
23 #define MAX_MAP_LEAFS           65536   // was 8192
24
25 // key / value pair sizes
26
27 #define MAX_KEY         32
28 #define MAX_VALUE       1024
29
30 //=============================================================================
31
32
33 #define BSPVERSION      29
34 #define TOOLVERSION     2
35
36 typedef struct
37 {
38         int             fileofs, filelen;
39 } lump_t;
40
41 #define LUMP_ENTITIES   0
42 #define LUMP_PLANES             1
43 #define LUMP_TEXTURES   2
44 #define LUMP_VERTEXES   3
45 #define LUMP_VISIBILITY 4
46 #define LUMP_NODES              5
47 #define LUMP_TEXINFO    6
48 #define LUMP_FACES              7
49 #define LUMP_LIGHTING   8
50 #define LUMP_CLIPNODES  9
51 #define LUMP_LEAFS              10
52 #define LUMP_MARKSURFACES 11
53 #define LUMP_EDGES              12
54 #define LUMP_SURFEDGES  13
55 #define LUMP_MODELS             14
56 #define HEADER_LUMPS    15
57
58 typedef struct
59 {
60         float           mins[3], maxs[3];
61         float           origin[3];
62         int                     headnode[MAX_MAP_HULLS];
63         int                     visleafs;               // not including the solid leaf 0
64         int                     firstface, numfaces;
65 } dmodel_t;
66
67 typedef struct
68 {
69         int                     version;
70         lump_t          lumps[HEADER_LUMPS];
71 } dheader_t;
72
73 typedef struct
74 {
75         int                     nummiptex;
76         int                     dataofs[4];             // [nummiptex]
77 } dmiptexlump_t;
78
79 #define MIPLEVELS       4
80 typedef struct miptex_s
81 {
82         char            name[16];
83         unsigned        width, height;
84         unsigned        offsets[MIPLEVELS];             // four mip maps stored
85 } miptex_t;
86
87
88 typedef struct
89 {
90         float   point[3];
91 } dvertex_t;
92
93
94 // 0-2 are axial planes
95 #define PLANE_X                 0
96 #define PLANE_Y                 1
97 #define PLANE_Z                 2
98
99 // 3-5 are non-axial planes snapped to the nearest
100 #define PLANE_ANYX              3
101 #define PLANE_ANYY              4
102 #define PLANE_ANYZ              5
103
104 typedef struct
105 {
106         float   normal[3];
107         float   dist;
108         int             type;           // PLANE_X - PLANE_ANYZ ?remove? trivial to regenerate
109 } dplane_t;
110
111
112
113 #define CONTENTS_EMPTY          -1
114 #define CONTENTS_SOLID          -2
115 #define CONTENTS_WATER          -3
116 #define CONTENTS_SLIME          -4
117 #define CONTENTS_LAVA           -5
118 #define CONTENTS_SKY            -6
119 #define CONTENTS_ORIGIN         -7              // removed at csg time
120 #define CONTENTS_CLIP           -8              // changed to contents_solid
121
122 // LordHavoc: Q2 water
123 /*
124 #define CONTENTS_CURRENT_0              -9
125 #define CONTENTS_CURRENT_90             -10
126 #define CONTENTS_CURRENT_180    -11
127 #define CONTENTS_CURRENT_270    -12
128 #define CONTENTS_CURRENT_UP             -13
129 #define CONTENTS_CURRENT_DOWN   -14
130 */
131
132
133 typedef struct
134 {
135         int                     planenum;
136         short           children[2];    // negative numbers are -(leafs+1), not nodes
137         short           mins[3];                // for sphere culling
138         short           maxs[3];
139         unsigned short  firstface;
140         unsigned short  numfaces;       // counting both sides
141 } dnode_t;
142
143 typedef struct
144 {
145         int                     planenum;
146         short           children[2];    // negative numbers are contents
147 } dclipnode_t;
148
149
150 typedef struct
151 {
152         float           vecs[2][4];             // [s/t][xyz offset]
153         int                     miptex;
154         int                     flags;
155 } texinfo_t;
156 #define TEX_SPECIAL             1               // sky or slime, no lightmap or 256 subdivision
157
158 // note that edge 0 is never used, because negative edge nums are used for
159 // counterclockwise use of the edge in a face
160 typedef struct
161 {
162         unsigned short  v[2];           // vertex numbers
163 } dedge_t;
164
165 #define MAXLIGHTMAPS    4
166 typedef struct
167 {
168         // LordHavoc: changed from short to unsigned short for q2 support
169         unsigned short  planenum;
170         short           side;
171
172         int                     firstedge;              // we must support > 64k edges
173         short           numedges;
174         short           texinfo;
175
176 // lighting info
177         qbyte           styles[MAXLIGHTMAPS];
178         int                     lightofs;               // start of [numstyles*surfsize] samples
179 } dface_t;
180
181
182
183 #define AMBIENT_WATER   0
184 #define AMBIENT_SKY             1
185 #define AMBIENT_SLIME   2
186 #define AMBIENT_LAVA    3
187
188 #define NUM_AMBIENTS                    4               // automatic ambient sounds
189
190 // leaf 0 is the generic CONTENTS_SOLID leaf, used for all solid areas
191 // all other leafs need visibility info
192 typedef struct
193 {
194         int                     contents;
195         int                     visofs;                         // -1 = no visibility info
196
197         short           mins[3];                        // for frustum culling
198         short           maxs[3];
199
200         unsigned short          firstmarksurface;
201         unsigned short          nummarksurfaces;
202
203         qbyte           ambient_level[NUM_AMBIENTS];
204 } dleaf_t;
205