2 Copyright (C) 1999-2007 id Software, Inc. and contributors.
3 For a list of contributors, see the accompanying CONTRIBUTORS file.
5 This file is part of GtkRadiant.
7 GtkRadiant is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 GtkRadiant is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with GtkRadiant; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24 // qfiles.h: quake file formats
25 // This file must be identical in the quake and utils directories
29 ========================================================================
31 .MD2 triangle model file format
33 ========================================================================
36 #define IDALIASHEADER (('2'<<24)+('P'<<16)+('D'<<8)+'I')
37 #define ALIAS_VERSION 8
39 #define MAX_TRIANGLES 4096
40 #define MAX_VERTS 2048
41 #define MAX_FRAMES 512
42 #define MAX_MD2SKINS 32
43 #define MAX_SKINNAME 64
59 byte v[3]; // scaled byte to fit in frame mins/maxs
60 byte lightnormalindex;
65 float scale[3]; // multiply byte verts by this
66 float translate[3]; // then add this
67 char name[16]; // frame name from grabbing
68 dtrivertx_t verts[1]; // variable sized
73 // a positive integer starts a tristrip command, followed by that many
75 // a negative integer starts a trifan command, followed by -x vertexes
76 // a zero indicates the end of the command list.
77 // a vertex consists of a floating point s, a floating point t,
78 // and an integer vertex index.
88 int framesize; // byte size of each frame
92 int num_st; // greater than num_xyz for seams
94 int num_glcmds; // dwords in strip/fan command list
97 int ofs_skins; // each skin is a MAX_SKINNAME string
98 int ofs_st; // byte offset from start for stverts
99 int ofs_tris; // offset for dtriangles
100 int ofs_frames; // offset for first frame
102 int ofs_end; // end of file
106 #define MD3_IDENT (('3'<<24)+('P'<<16)+('D'<<8)+'I')
107 #define MAX_QPATH 64 // max length of a quake game pathname
108 #define MD3_XYZ_SCALE (1.0/64)
114 char name[MAX_QPATH]; // model name
124 int ofsFrames; // offset for first frame
125 int ofsTags; // numFrames * numTags
126 int ofsSurfaces; // first surface, others follow
128 int ofsEnd; // end of file
134 char name[MAX_QPATH]; // polyset name
137 int numFrames; // all surfaces in a model should have the same
139 int numShaders; // all surfaces in a model should have the same
145 int ofsShaders; // offset from start of md3Surface_t
146 int ofsSt; // texture coords are common for all frames
147 int ofsXyzNormals; // numVerts * numFrames
149 int ofsEnd; // next surface follows
154 char name[MAX_QPATH];
155 int shaderIndex; // for in-game use
186 ========================================================================
188 .SP2 sprite file format
190 ========================================================================
193 #define IDSPRITEHEADER (('2'<<24)+('S'<<16)+('D'<<8)+'I')
194 // little-endian "IDS2"
195 #define SPRITE_VERSION 2
200 int origin_x, origin_y; // raster coordinates inside pic
201 char name[MAX_SKINNAME]; // name of pcx file
208 dsprframe_t frames[1]; // variable sized
212 ==============================================================================
214 .WAL texture file format
216 ==============================================================================
223 typedef struct miptex_s
226 unsigned width, height;
227 unsigned offsets[MIPLEVELS]; // four mip maps stored
228 char animname[32]; // next frame in animation chain
237 ==============================================================================
241 ==============================================================================
244 #define IDBSPHEADER (('P'<<24)+('S'<<16)+('B'<<8)+'I')
245 // little-endian "IBSP"
247 #define BSPVERSION 36
250 // upper design bounds
251 // leaffaces, leafbrushes, planes, and verts are still bounded by
252 // 16 bit short limits
253 #define MAX_MAP_MODELS 1024
254 #define MAX_MAP_BRUSHES 8192
255 #define MAX_MAP_ENTITIES 2048
256 #define MAX_MAP_ENTSTRING 0x20000
257 #define MAX_MAP_TEXINFO 8192
259 #define MAX_MAP_PLANES 65536
260 #define MAX_MAP_NODES 65536
261 #define MAX_MAP_BRUSHSIDES 65536
262 #define MAX_MAP_LEAFS 65536
263 #define MAX_MAP_VERTS 65536
264 #define MAX_MAP_FACES 65536
265 #define MAX_MAP_LEAFFACES 65536
266 #define MAX_MAP_LEAFBRUSHES 65536
267 #define MAX_MAP_PORTALS 65536
268 #define MAX_MAP_EDGES 128000
269 #define MAX_MAP_SURFEDGES 256000
270 #define MAX_MAP_LIGHTING 0x200000
271 #define MAX_MAP_VISIBILITY 0x100000
273 // we are using g_MaxBrushSize now, cleanme
274 /* #define MAX_BRUSH_SIZE 8192 */
276 // key / value pair sizes
279 #define MAX_VALUE 1024
281 //=============================================================================
285 int fileofs, filelen;
288 #define LUMP_ENTITIES 0
289 #define LUMP_PLANES 1
290 #define LUMP_VERTEXES 2
291 #define LUMP_VISIBILITY 3
293 #define LUMP_TEXINFO 5
295 #define LUMP_LIGHTING 7
297 #define LUMP_LEAFFACES 9
298 #define LUMP_LEAFBRUSHES 10
299 #define LUMP_EDGES 11
300 #define LUMP_SURFEDGES 12
301 #define LUMP_MODELS 13
302 #define LUMP_BRUSHES 14
303 #define LUMP_BRUSHSIDES 15
306 #define HEADER_LUMPS 17
312 lump_t lumps[HEADER_LUMPS];
317 float mins[3], maxs[3];
318 float origin[3]; // for sounds or lights
320 int firstface, numfaces; // submodels just draw faces
321 // without walking the bsp tree
331 // 0-2 are axial planes
336 // 3-5 are non-axial planes snapped to the nearest
341 // planes (x&~1) and (x&~1)+1 are allways opposites
347 int type; // PLANE_X - PLANE_ANYZ ?remove? trivial to regenerate
351 // contents flags are seperate bits
352 // a given brush can contribute multiple content bits
353 // multiple brushes can be in a single leaf
355 // lower bits are stronger, and will eat weaker brushes completely
356 #define CONTENTS_SOLID 1 // an eye is never valid in a solid
357 #define CONTENTS_WINDOW 2 // translucent, but not watery
358 #define CONTENTS_AUX 4
359 #define CONTENTS_LAVA 8
360 #define CONTENTS_SLIME 16
361 #define CONTENTS_WATER 32
362 #define CONTENTS_MIST 64
363 #define LAST_VISIBLE_CONTENTS 64
365 // remaining contents are non-visible, and don't eat brushes
366 #define CONTENTS_PLAYERCLIP 0x10000
367 #define CONTENTS_MONSTERCLIP 0x20000
369 // currents can be added to any other contents, and may be mixed
370 #define CONTENTS_CURRENT_0 0x40000
371 #define CONTENTS_CURRENT_90 0x80000
372 #define CONTENTS_CURRENT_180 0x100000
373 #define CONTENTS_CURRENT_270 0x200000
374 #define CONTENTS_CURRENT_UP 0x400000
375 #define CONTENTS_CURRENT_DOWN 0x800000
377 #define CONTENTS_ORIGIN 0x1000000 // removed before bsping an entity
379 #define CONTENTS_MONSTER 0x2000000 // should never be on a brush, only in game
380 #define CONTENTS_DEADMONSTER 0x4000000 // corpse
381 #define CONTENTS_DETAIL 0x8000000 // brushes to be added after vis leafs
382 #define CONTENTS_TRANSLUCENT 0x10000000 // auto set if any surface has trans
383 #define CONTENTS_LADDER 0x20000000 // ladder
384 #define CONTENTS_NEGATIVE_CURVE 0x40000000 // reverse inside / outside
386 #define CONTENTS_KEEP (CONTENTS_DETAIL | CONTENTS_NEGATIVE_CURVE)
392 int children[2]; // negative numbers are -(leafs+1), not nodes
393 short mins[3]; // for frustom culling
395 unsigned short firstface;
396 unsigned short numfaces; // counting both sides
400 typedef struct texinfo_s
402 float vecs[2][4]; // [s/t][xyz offset]
403 int flags; // miptex flags + overrides
404 int value; // light emission, etc
405 char texture[32]; // texture name (textures/*.wal)
406 int nexttexinfo; // for animations, -1 = end of chain
410 #define SURF_LIGHT 0x1 // value will hold the light strength
412 #define SURF_SLICK 0x2 // effects game physics
414 #define SURF_SKY 0x4 // don't draw, but add to skybox
415 #define SURF_WARP 0x8 // turbulent water warp
416 #define SURF_TRANS33 0x10
417 #define SURF_TRANS66 0x20
418 #define SURF_FLOWING 0x40 // scroll towards angle
419 #define SURF_NODRAW 0x80 // don't bother referencing the texture
421 #define SURF_PATCH 0x20000000
422 #define SURF_CURVE_FAKE 0x40000000
423 #define SURF_CURVE 0x80000000
424 #define SURF_KEEP (SURF_CURVE | SURF_CURVE_FAKE | SURF_PATCH)
426 // note that edge 0 is never used, because negative edge nums are used for
427 // counterclockwise use of the edge in a face
430 unsigned short v[2]; // vertex numbers
433 #define MAXLIGHTMAPS 4
436 unsigned short planenum;
439 int firstedge; // we must support > 64k edges
444 byte styles[MAXLIGHTMAPS];
445 int lightofs; // start of [numstyles*surfsize] samples
450 int contents; // OR of all brushes (not needed?)
452 int pvsofs; // -1 = no info
453 int phsofs; // -1 = no info
455 short mins[3]; // for frustum culling
458 unsigned short firstleafface;
459 unsigned short numleaffaces;
461 unsigned short firstleafbrush;
462 unsigned short numleafbrushes;
467 unsigned short planenum; // facing out of the leaf
479 #define ANGLE_DOWN -2