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