00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036 #define IDALIASHEADER (('2'<<24)+('P'<<16)+('D'<<8)+'I')
00037 #define ALIAS_VERSION 8
00038
00039 #define MAX_TRIANGLES 4096
00040 #define MAX_VERTS 2048
00041 #define MAX_FRAMES 512
00042 #define MAX_MD2SKINS 32
00043 #define MAX_SKINNAME 64
00044
00045 typedef struct
00046 {
00047 short s;
00048 short t;
00049 } dstvert_t;
00050
00051 typedef struct
00052 {
00053 short index_xyz[3];
00054 short index_st[3];
00055 } dtriangle_t;
00056
00057 typedef struct
00058 {
00059 byte v[3];
00060 byte lightnormalindex;
00061 } dtrivertx_t;
00062
00063 typedef struct
00064 {
00065 float scale[3];
00066 float translate[3];
00067 char name[16];
00068 dtrivertx_t verts[1];
00069 } daliasframe_t;
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081 typedef struct
00082 {
00083 int ident;
00084 int version;
00085
00086 int skinwidth;
00087 int skinheight;
00088 int framesize;
00089
00090 int num_skins;
00091 int num_xyz;
00092 int num_st;
00093 int num_tris;
00094 int num_glcmds;
00095 int num_frames;
00096
00097 int ofs_skins;
00098 int ofs_st;
00099 int ofs_tris;
00100 int ofs_frames;
00101 int ofs_glcmds;
00102 int ofs_end;
00103
00104 } dmdl_t;
00105
00106 #define MD3_IDENT (('3'<<24)+('P'<<16)+('D'<<8)+'I')
00107 #define MAX_QPATH 64 // max length of a quake game pathname
00108 #define MD3_XYZ_SCALE (1.0/64)
00109
00110 typedef struct {
00111 int ident;
00112 int version;
00113
00114 char name[MAX_QPATH];
00115
00116 int flags;
00117
00118 int numFrames;
00119 int numTags;
00120 int numSurfaces;
00121
00122 int numSkins;
00123
00124 int ofsFrames;
00125 int ofsTags;
00126 int ofsSurfaces;
00127
00128 int ofsEnd;
00129 } md3Header_t;
00130
00131 typedef struct {
00132 int ident;
00133
00134 char name[MAX_QPATH];
00135
00136 int flags;
00137 int numFrames;
00138
00139 int numShaders;
00140 int numVerts;
00141
00142 int numTriangles;
00143 int ofsTriangles;
00144
00145 int ofsShaders;
00146 int ofsSt;
00147 int ofsXyzNormals;
00148
00149 int ofsEnd;
00150
00151 } md3Surface_t;
00152
00153 typedef struct {
00154 char name[MAX_QPATH];
00155 int shaderIndex;
00156 } md3Shader_t;
00157
00158 typedef struct {
00159 int indexes[3];
00160 } md3Triangle_t;
00161
00162 typedef struct {
00163 float st[2];
00164 } md3St_t;
00165
00166 typedef struct {
00167 short xyz[3];
00168 short normal;
00169 } md3XyzNormal_t;
00170
00171
00172 typedef struct
00173 {
00174 float st[2];
00175 int nVertIndex;
00176 } glst_t;
00177
00178 typedef struct
00179 {
00180 int nCount;
00181 int ObjectIndex;
00182 glst_t GlSt;
00183 } gl_t;
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193 #define IDSPRITEHEADER (('2'<<24)+('S'<<16)+('D'<<8)+'I')
00194
00195 #define SPRITE_VERSION 2
00196
00197 typedef struct
00198 {
00199 int width, height;
00200 int origin_x, origin_y;
00201 char name[MAX_SKINNAME];
00202 } dsprframe_t;
00203
00204 typedef struct {
00205 int ident;
00206 int version;
00207 int numframes;
00208 dsprframe_t frames[1];
00209 } dsprite_t;
00210
00211
00212
00213
00214
00215
00216
00217
00218
00219
00220 #define MIPLEVELS 4
00221 typedef struct miptex_s
00222 {
00223 char name[32];
00224 unsigned width, height;
00225 unsigned offsets[MIPLEVELS];
00226 char animname[32];
00227 int flags;
00228 int contents;
00229 int value;
00230 } miptex_t;
00231
00232
00233
00234
00235
00236
00237
00238
00239
00240
00241
00242 #define IDBSPHEADER (('P'<<24)+('S'<<16)+('B'<<8)+'I')
00243
00244
00245 #define BSPVERSION 36
00246
00247
00248
00249
00250
00251 #define MAX_MAP_MODELS 1024
00252 #define MAX_MAP_BRUSHES 8192
00253 #define MAX_MAP_ENTITIES 2048
00254 #define MAX_MAP_ENTSTRING 0x20000
00255 #define MAX_MAP_TEXINFO 8192
00256
00257 #define MAX_MAP_PLANES 65536
00258 #define MAX_MAP_NODES 65536
00259 #define MAX_MAP_BRUSHSIDES 65536
00260 #define MAX_MAP_LEAFS 65536
00261 #define MAX_MAP_VERTS 65536
00262 #define MAX_MAP_FACES 65536
00263 #define MAX_MAP_LEAFFACES 65536
00264 #define MAX_MAP_LEAFBRUSHES 65536
00265 #define MAX_MAP_PORTALS 65536
00266 #define MAX_MAP_EDGES 128000
00267 #define MAX_MAP_SURFEDGES 256000
00268 #define MAX_MAP_LIGHTING 0x200000
00269 #define MAX_MAP_VISIBILITY 0x100000
00270
00271 #define MAX_WORLD_COORD ( 128*1024 )
00272 #define MIN_WORLD_COORD ( -128*1024 )
00273 #define WORLD_SIZE ( MAX_WORLD_COORD - MIN_WORLD_COORD )
00274
00275 #define MAX_BRUSH_SIZE ( WORLD_SIZE )
00276
00277
00278
00279 #define MAX_KEY 32
00280 #define MAX_VALUE 1024
00281
00282
00283
00284 typedef struct
00285 {
00286 int fileofs, filelen;
00287 } lump_t;
00288
00289 #define LUMP_ENTITIES 0
00290 #define LUMP_PLANES 1
00291 #define LUMP_VERTEXES 2
00292 #define LUMP_VISIBILITY 3
00293 #define LUMP_NODES 4
00294 #define LUMP_TEXINFO 5
00295 #define LUMP_FACES 6
00296 #define LUMP_LIGHTING 7
00297 #define LUMP_LEAFS 8
00298 #define LUMP_LEAFFACES 9
00299 #define LUMP_LEAFBRUSHES 10
00300 #define LUMP_EDGES 11
00301 #define LUMP_SURFEDGES 12
00302 #define LUMP_MODELS 13
00303 #define LUMP_BRUSHES 14
00304 #define LUMP_BRUSHSIDES 15
00305 #define LUMP_POP 16
00306
00307 #define HEADER_LUMPS 17
00308
00309 typedef struct
00310 {
00311 int ident;
00312 int version;
00313 lump_t lumps[HEADER_LUMPS];
00314 } dheader_t;
00315
00316 typedef struct
00317 {
00318 float mins[3], maxs[3];
00319 float origin[3];
00320 int headnode;
00321 int firstface, numfaces;
00322
00323 } dmodel_t;
00324
00325
00326 typedef struct
00327 {
00328 float point[3];
00329 } dvertex_t;
00330
00331
00332
00333 #define PLANE_X 0
00334 #define PLANE_Y 1
00335 #define PLANE_Z 2
00336
00337
00338 #define PLANE_ANYX 3
00339 #define PLANE_ANYY 4
00340 #define PLANE_ANYZ 5
00341
00342
00343
00344 typedef struct
00345 {
00346 float normal[3];
00347 float dist;
00348 int type;
00349 } dplane_t;
00350
00351
00352
00353
00354
00355
00356
00357 #define CONTENTS_SOLID 1 // an eye is never valid in a solid
00358 #define CONTENTS_WINDOW 2 // translucent, but not watery
00359 #define CONTENTS_AUX 4
00360 #define CONTENTS_LAVA 8
00361 #define CONTENTS_SLIME 16
00362 #define CONTENTS_WATER 32
00363 #define CONTENTS_MIST 64
00364 #define LAST_VISIBLE_CONTENTS 64
00365
00366
00367 #define CONTENTS_PLAYERCLIP 0x10000
00368 #define CONTENTS_MONSTERCLIP 0x20000
00369
00370
00371 #define CONTENTS_CURRENT_0 0x40000
00372 #define CONTENTS_CURRENT_90 0x80000
00373 #define CONTENTS_CURRENT_180 0x100000
00374 #define CONTENTS_CURRENT_270 0x200000
00375 #define CONTENTS_CURRENT_UP 0x400000
00376 #define CONTENTS_CURRENT_DOWN 0x800000
00377
00378 #define CONTENTS_ORIGIN 0x1000000 // removed before bsping an entity
00379
00380 #define CONTENTS_MONSTER 0x2000000 // should never be on a brush, only in game
00381 #define CONTENTS_DEADMONSTER 0x4000000 // corpse
00382 #define CONTENTS_DETAIL 0x8000000 // brushes to be added after vis leafs
00383 #define CONTENTS_TRANSLUCENT 0x10000000 // auto set if any surface has trans
00384 #define CONTENTS_LADDER 0x20000000 // ladder
00385 #define CONTENTS_NEGATIVE_CURVE 0x40000000 // reverse inside / outside
00386
00387 #define CONTENTS_KEEP (CONTENTS_DETAIL | CONTENTS_NEGATIVE_CURVE)
00388
00389
00390 typedef struct
00391 {
00392 int planenum;
00393 int children[2];
00394 short mins[3];
00395 short maxs[3];
00396 unsigned short firstface;
00397 unsigned short numfaces;
00398 } dnode_t;
00399
00400
00401 typedef struct texinfo_s
00402 {
00403 float vecs[2][4];
00404 int flags;
00405 int value;
00406 char texture[32];
00407 int nexttexinfo;
00408 } texinfo_t;
00409
00410
00411 #define SURF_LIGHT 0x1 // value will hold the light strength
00412
00413 #define SURF_SLICK 0x2 // effects game physics
00414
00415 #define SURF_SKY 0x4 // don't draw, but add to skybox
00416 #define SURF_WARP 0x8 // turbulent water warp
00417 #define SURF_TRANS33 0x10
00418 #define SURF_TRANS66 0x20
00419 #define SURF_FLOWING 0x40 // scroll towards angle
00420 #define SURF_NODRAW 0x80 // don't bother referencing the texture
00421
00422 #define SURF_PATCH 0x20000000
00423 #define SURF_CURVE_FAKE 0x40000000
00424 #define SURF_CURVE 0x80000000
00425 #define SURF_KEEP (SURF_CURVE | SURF_CURVE_FAKE | SURF_PATCH)
00426
00427
00428
00429 typedef struct
00430 {
00431 unsigned short v[2];
00432 } dedge_t;
00433
00434 #define MAXLIGHTMAPS 4
00435 typedef struct
00436 {
00437 unsigned short planenum;
00438 short side;
00439
00440 int firstedge;
00441 short numedges;
00442 short texinfo;
00443
00444
00445 byte styles[MAXLIGHTMAPS];
00446 int lightofs;
00447 } dface_t;
00448
00449 typedef struct
00450 {
00451 int contents;
00452
00453 int pvsofs;
00454 int phsofs;
00455
00456 short mins[3];
00457 short maxs[3];
00458
00459 unsigned short firstleafface;
00460 unsigned short numleaffaces;
00461
00462 unsigned short firstleafbrush;
00463 unsigned short numleafbrushes;
00464 } dleaf_t;
00465
00466 typedef struct
00467 {
00468 unsigned short planenum;
00469 short texinfo;
00470 } dbrushside_t;
00471
00472 typedef struct
00473 {
00474 int firstside;
00475 int numsides;
00476 int contents;
00477 } dbrush_t;
00478
00479 #define ANGLE_UP -1
00480 #define ANGLE_DOWN -2
00481