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