| 1 |
|
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
|
|---|
| 19 |
|
|---|
| 20 |
|
|---|
| 21 |
|
|---|
| 22 |
|
|---|
| 23 |
|
|---|
| 24 |
|
|---|
| 25 |
|
|---|
| 26 |
|
|---|
| 27 |
|
|---|
| 28 |
|
|---|
| 29 |
|
|---|
| 30 |
|
|---|
| 31 |
|
|---|
| 32 |
|
|---|
| 33 |
|
|---|
| 34 |
|
|---|
| 35 |
|
|---|
| 36 |
#define IDPAKHEADER (('K'<<24)+('C'<<16)+('A'<<8)+'P') |
|---|
| 37 |
|
|---|
| 38 |
typedef struct |
|---|
| 39 |
{ |
|---|
| 40 |
char name[56]; |
|---|
| 41 |
int filepos, filelen; |
|---|
| 42 |
} dpackfile_t; |
|---|
| 43 |
|
|---|
| 44 |
typedef struct |
|---|
| 45 |
{ |
|---|
| 46 |
int ident; |
|---|
| 47 |
int dirofs; |
|---|
| 48 |
int dirlen; |
|---|
| 49 |
} dpackheader_t; |
|---|
| 50 |
|
|---|
| 51 |
#define MAX_FILES_IN_PACK 4096 |
|---|
| 52 |
|
|---|
| 53 |
|
|---|
| 54 |
|
|---|
| 55 |
|
|---|
| 56 |
|
|---|
| 57 |
|
|---|
| 58 |
|
|---|
| 59 |
|
|---|
| 60 |
|
|---|
| 61 |
|
|---|
| 62 |
typedef struct |
|---|
| 63 |
{ |
|---|
| 64 |
char manufacturer; |
|---|
| 65 |
char version; |
|---|
| 66 |
char encoding; |
|---|
| 67 |
char bits_per_pixel; |
|---|
| 68 |
unsigned short xmin,ymin,xmax,ymax; |
|---|
| 69 |
unsigned short hres,vres; |
|---|
| 70 |
unsigned char palette[48]; |
|---|
| 71 |
char reserved; |
|---|
| 72 |
char color_planes; |
|---|
| 73 |
unsigned short bytes_per_line; |
|---|
| 74 |
unsigned short palette_type; |
|---|
| 75 |
char filler[58]; |
|---|
| 76 |
unsigned char data; |
|---|
| 77 |
} pcx_t; |
|---|
| 78 |
|
|---|
| 79 |
|
|---|
| 80 |
|
|---|
| 81 |
|
|---|
| 82 |
|
|---|
| 83 |
|
|---|
| 84 |
|
|---|
| 85 |
|
|---|
| 86 |
|
|---|
| 87 |
|
|---|
| 88 |
#define IDALIASHEADER (('2'<<24)+('P'<<16)+('D'<<8)+'I') |
|---|
| 89 |
#define ALIAS_VERSION 8 |
|---|
| 90 |
|
|---|
| 91 |
#define MAX_TRIANGLES 4096 |
|---|
| 92 |
#define MAX_VERTS 2048 |
|---|
| 93 |
#define MAX_FRAMES 512 |
|---|
| 94 |
#define MAX_MD2SKINS 32 |
|---|
| 95 |
#define MAX_SKINNAME 64 |
|---|
| 96 |
|
|---|
| 97 |
typedef struct |
|---|
| 98 |
{ |
|---|
| 99 |
short s; |
|---|
| 100 |
short t; |
|---|
| 101 |
} dstvert_t; |
|---|
| 102 |
|
|---|
| 103 |
typedef struct |
|---|
| 104 |
{ |
|---|
| 105 |
short index_xyz[3]; |
|---|
| 106 |
short index_st[3]; |
|---|
| 107 |
} dtriangle_t; |
|---|
| 108 |
|
|---|
| 109 |
typedef struct |
|---|
| 110 |
{ |
|---|
| 111 |
byte v[3]; |
|---|
| 112 |
byte lightnormalindex; |
|---|
| 113 |
} dtrivertx_t; |
|---|
| 114 |
|
|---|
| 115 |
#define DTRIVERTX_V0 0 |
|---|
| 116 |
#define DTRIVERTX_V1 1 |
|---|
| 117 |
#define DTRIVERTX_V2 2 |
|---|
| 118 |
#define DTRIVERTX_LNI 3 |
|---|
| 119 |
#define DTRIVERTX_SIZE 4 |
|---|
| 120 |
|
|---|
| 121 |
typedef struct |
|---|
| 122 |
{ |
|---|
| 123 |
float scale[3]; |
|---|
| 124 |
float translate[3]; |
|---|
| 125 |
char name[16]; |
|---|
| 126 |
dtrivertx_t verts[1]; |
|---|
| 127 |
} daliasframe_t; |
|---|
| 128 |
|
|---|
| 129 |
|
|---|
| 130 |
|
|---|
| 131 |
|
|---|
| 132 |
|
|---|
| 133 |
|
|---|
| 134 |
|
|---|
| 135 |
|
|---|
| 136 |
|
|---|
| 137 |
|
|---|
| 138 |
|
|---|
| 139 |
typedef struct |
|---|
| 140 |
{ |
|---|
| 141 |
int ident; |
|---|
| 142 |
int version; |
|---|
| 143 |
|
|---|
| 144 |
int skinwidth; |
|---|
| 145 |
int skinheight; |
|---|
| 146 |
int framesize; |
|---|
| 147 |
|
|---|
| 148 |
int num_skins; |
|---|
| 149 |
int num_xyz; |
|---|
| 150 |
int num_st; |
|---|
| 151 |
int num_tris; |
|---|
| 152 |
int num_glcmds; |
|---|
| 153 |
int num_frames; |
|---|
| 154 |
|
|---|
| 155 |
int ofs_skins; |
|---|
| 156 |
int ofs_st; |
|---|
| 157 |
int ofs_tris; |
|---|
| 158 |
int ofs_frames; |
|---|
| 159 |
int ofs_glcmds; |
|---|
| 160 |
int ofs_end; |
|---|
| 161 |
|
|---|
| 162 |
} dmdl_t; |
|---|
| 163 |
|
|---|
| 164 |
|
|---|
| 165 |
|
|---|
| 166 |
|
|---|
| 167 |
|
|---|
| 168 |
|
|---|
| 169 |
|
|---|
| 170 |
|
|---|
| 171 |
|
|---|
| 172 |
#define IDSPRITEHEADER (('2'<<24)+('S'<<16)+('D'<<8)+'I') |
|---|
| 173 |
|
|---|
| 174 |
#define SPRITE_VERSION 2 |
|---|
| 175 |
|
|---|
| 176 |
typedef struct |
|---|
| 177 |
{ |
|---|
| 178 |
int width, height; |
|---|
| 179 |
int origin_x, origin_y; |
|---|
| 180 |
char name[MAX_SKINNAME]; |
|---|
| 181 |
} dsprframe_t; |
|---|
| 182 |
|
|---|
| 183 |
typedef struct { |
|---|
| 184 |
int ident; |
|---|
| 185 |
int version; |
|---|
| 186 |
int numframes; |
|---|
| 187 |
dsprframe_t frames[1]; |
|---|
| 188 |
} dsprite_t; |
|---|
| 189 |
|
|---|
| 190 |
|
|---|
| 191 |
|
|---|
| 192 |
|
|---|
| 193 |
|
|---|
| 194 |
|
|---|
| 195 |
|
|---|
| 196 |
|
|---|
| 197 |
|
|---|
| 198 |
|
|---|
| 199 |
#define MIPLEVELS 4 |
|---|
| 200 |
typedef struct miptex_s |
|---|
| 201 |
{ |
|---|
| 202 |
char name[32]; |
|---|
| 203 |
unsigned width, height; |
|---|
| 204 |
unsigned offsets[MIPLEVELS]; |
|---|
| 205 |
char animname[32]; |
|---|
| 206 |
int flags; |
|---|
| 207 |
int contents; |
|---|
| 208 |
int value; |
|---|
| 209 |
} miptex_t; |
|---|
| 210 |
|
|---|
| 211 |
|
|---|
| 212 |
|
|---|
| 213 |
|
|---|
| 214 |
|
|---|
| 215 |
|
|---|
| 216 |
|
|---|
| 217 |
|
|---|
| 218 |
|
|---|
| 219 |
|
|---|
| 220 |
|
|---|
| 221 |
#define IDBSPHEADER (('P'<<24)+('S'<<16)+('B'<<8)+'I') |
|---|
| 222 |
|
|---|
| 223 |
|
|---|
| 224 |
#define BSPVERSION 38 |
|---|
| 225 |
|
|---|
| 226 |
|
|---|
| 227 |
|
|---|
| 228 |
|
|---|
| 229 |
|
|---|
| 230 |
#define MAX_MAP_MODELS 1024 |
|---|
| 231 |
#define MAX_MAP_BRUSHES 8192 |
|---|
| 232 |
#define MAX_MAP_ENTITIES 2048 |
|---|
| 233 |
#define MAX_MAP_ENTSTRING 0x40000 |
|---|
| 234 |
#define MAX_MAP_TEXINFO 8192 |
|---|
| 235 |
|
|---|
| 236 |
#define MAX_MAP_AREAS 256 |
|---|
| 237 |
#define MAX_MAP_AREAPORTALS 1024 |
|---|
| 238 |
#define MAX_MAP_PLANES 65536 |
|---|
| 239 |
#define MAX_MAP_NODES 65536 |
|---|
| 240 |
#define MAX_MAP_BRUSHSIDES 65536 |
|---|
| 241 |
#define MAX_MAP_LEAFS 65536 |
|---|
| 242 |
#define MAX_MAP_VERTS 65536 |
|---|
| 243 |
#define MAX_MAP_FACES 65536 |
|---|
| 244 |
#define MAX_MAP_LEAFFACES 65536 |
|---|
| 245 |
#define MAX_MAP_LEAFBRUSHES 65536 |
|---|
| 246 |
#define MAX_MAP_PORTALS 65536 |
|---|
| 247 |
#define MAX_MAP_EDGES 128000 |
|---|
| 248 |
#define MAX_MAP_SURFEDGES 256000 |
|---|
| 249 |
#define MAX_MAP_LIGHTING 0x200000 |
|---|
| 250 |
#define MAX_MAP_VISIBILITY 0x100000 |
|---|
| 251 |
|
|---|
| 252 |
|
|---|
| 253 |
|
|---|
| 254 |
#define MAX_KEY 32 |
|---|
| 255 |
#define MAX_VALUE 1024 |
|---|
| 256 |
|
|---|
| 257 |
|
|---|
| 258 |
|
|---|
| 259 |
typedef struct |
|---|
| 260 |
{ |
|---|
| 261 |
int fileofs, filelen; |
|---|
| 262 |
} lump_t; |
|---|
| 263 |
|
|---|
| 264 |
#define LUMP_ENTITIES 0 |
|---|
| 265 |
#define LUMP_PLANES 1 |
|---|
| 266 |
#define LUMP_VERTEXES 2 |
|---|
| 267 |
#define LUMP_VISIBILITY 3 |
|---|
| 268 |
#define LUMP_NODES 4 |
|---|
| 269 |
#define LUMP_TEXINFO 5 |
|---|
| 270 |
#define LUMP_FACES 6 |
|---|
| 271 |
#define LUMP_LIGHTING 7 |
|---|
| 272 |
#define LUMP_LEAFS 8 |
|---|
| 273 |
#define LUMP_LEAFFACES 9 |
|---|
| 274 |
#define LUMP_LEAFBRUSHES 10 |
|---|
| 275 |
#define LUMP_EDGES 11 |
|---|
| 276 |
#define LUMP_SURFEDGES 12 |
|---|
| 277 |
#define LUMP_MODELS 13 |
|---|
| 278 |
#define LUMP_BRUSHES 14 |
|---|
| 279 |
#define LUMP_BRUSHSIDES 15 |
|---|
| 280 |
#define LUMP_POP 16 |
|---|
| 281 |
#define LUMP_AREAS 17 |
|---|
| 282 |
#define LUMP_AREAPORTALS 18 |
|---|
| 283 |
#define HEADER_LUMPS 19 |
|---|
| 284 |
|
|---|
| 285 |
typedef struct |
|---|
| 286 |
{ |
|---|
| 287 |
int ident; |
|---|
| 288 |
int version; |
|---|
| 289 |
lump_t lumps[HEADER_LUMPS]; |
|---|
| 290 |
} dheader_t; |
|---|
| 291 |
|
|---|
| 292 |
typedef struct |
|---|
| 293 |
{ |
|---|
| 294 |
float mins[3], maxs[3]; |
|---|
| 295 |
float origin[3]; |
|---|
| 296 |
int headnode; |
|---|
| 297 |
int firstface, numfaces; |
|---|
| 298 |
|
|---|
| 299 |
} dmodel_t; |
|---|
| 300 |
|
|---|
| 301 |
|
|---|
| 302 |
typedef struct |
|---|
| 303 |
{ |
|---|
| 304 |
float point[3]; |
|---|
| 305 |
} dvertex_t; |
|---|
| 306 |
|
|---|
| 307 |
|
|---|
| 308 |
|
|---|
| 309 |
#define PLANE_X 0 |
|---|
| 310 |
#define PLANE_Y 1 |
|---|
| 311 |
#define PLANE_Z 2 |
|---|
| 312 |
|
|---|
| 313 |
|
|---|
| 314 |
#define PLANE_ANYX 3 |
|---|
| 315 |
#define PLANE_ANYY 4 |
|---|
| 316 |
#define PLANE_ANYZ 5 |
|---|
| 317 |
|
|---|
| 318 |
|
|---|
| 319 |
|
|---|
| 320 |
typedef struct |
|---|
| 321 |
{ |
|---|
| 322 |
float normal[3]; |
|---|
| 323 |
float dist; |
|---|
| 324 |
int type; |
|---|
| 325 |
} dplane_t; |
|---|
| 326 |
|
|---|
| 327 |
|
|---|
| 328 |
|
|---|
| 329 |
|
|---|
| 330 |
|
|---|
| 331 |
|
|---|
| 332 |
|
|---|
| 333 |
|
|---|
| 334 |
|
|---|
| 335 |
#define CONTENTS_SOLID 1 // an eye is never valid in a solid |
|---|
| 336 |
#define CONTENTS_WINDOW 2 // translucent, but not watery |
|---|
| 337 |
#define CONTENTS_AUX 4 |
|---|
| 338 |
#define CONTENTS_LAVA 8 |
|---|
| 339 |
#define CONTENTS_SLIME 16 |
|---|
| 340 |
#define CONTENTS_WATER 32 |
|---|
| 341 |
#define CONTENTS_MIST 64 |
|---|
| 342 |
#define LAST_VISIBLE_CONTENTS 64 |
|---|
| 343 |
|
|---|
| 344 |
|
|---|
| 345 |
|
|---|
| 346 |
#define CONTENTS_AREAPORTAL 0x8000 |
|---|
| 347 |
|
|---|
| 348 |
#define CONTENTS_PLAYERCLIP 0x10000 |
|---|
| 349 |
#define CONTENTS_MONSTERCLIP 0x20000 |
|---|
| 350 |
|
|---|
| 351 |
|
|---|
| 352 |
#define CONTENTS_CURRENT_0 0x40000 |
|---|
| 353 |
#define CONTENTS_CURRENT_90 0x80000 |
|---|
| 354 |
#define CONTENTS_CURRENT_180 0x100000 |
|---|
| 355 |
#define CONTENTS_CURRENT_270 0x200000 |
|---|
| 356 |
#define CONTENTS_CURRENT_UP 0x400000 |
|---|
| 357 |
#define CONTENTS_CURRENT_DOWN 0x800000 |
|---|
| 358 |
|
|---|
| 359 |
#define CONTENTS_ORIGIN 0x1000000 // removed before bsping an entity |
|---|
| 360 |
|
|---|
| 361 |
#define CONTENTS_MONSTER 0x2000000 // should never be on a brush, only in game |
|---|
| 362 |
#define CONTENTS_DEADMONSTER 0x4000000 |
|---|
| 363 |
#define CONTENTS_DETAIL 0x8000000 // brushes to be added after vis leafs |
|---|
| 364 |
#define CONTENTS_TRANSLUCENT 0x10000000 // auto set if any surface has trans |
|---|
| 365 |
#define CONTENTS_LADDER 0x20000000 |
|---|
| 366 |
|
|---|
| 367 |
|
|---|
| 368 |
|
|---|
| 369 |
#define SURF_LIGHT 0x1 // value will hold the light strength |
|---|
| 370 |
|
|---|
| 371 |
#define SURF_SLICK 0x2 // effects game physics |
|---|
| 372 |
|
|---|
| 373 |
#define SURF_SKY 0x4 // don't draw, but add to skybox |
|---|
| 374 |
#define SURF_WARP 0x8 // turbulent water warp |
|---|
| 375 |
#define SURF_TRANS33 0x10 |
|---|
| 376 |
#define SURF_TRANS66 0x20 |
|---|
| 377 |
#define SURF_FLOWING 0x40 // scroll towards angle |
|---|
| 378 |
#define SURF_NODRAW 0x80 // don't bother referencing the texture |
|---|
| 379 |
|
|---|
| 380 |
#define SURF_HINT 0x100 // make a primary bsp splitter |
|---|
| 381 |
#define SURF_SKIP 0x200 // completely ignore, allowing non-closed brushes |
|---|
| 382 |
|
|---|
| 383 |
|
|---|
| 384 |
|
|---|
| 385 |
typedef struct |
|---|
| 386 |
{ |
|---|
| 387 |
int planenum; |
|---|
| 388 |
int children[2]; |
|---|
| 389 |
short mins[3]; |
|---|
| 390 |
short maxs[3]; |
|---|
| 391 |
unsigned short firstface; |
|---|
| 392 |
unsigned short numfaces; |
|---|
| 393 |
} dnode_t; |
|---|
| 394 |
|
|---|
| 395 |
|
|---|
| 396 |
typedef struct texinfo_s |
|---|
| 397 |
{ |
|---|
| 398 |
float vecs[2][4]; |
|---|
| 399 |
int flags; |
|---|
| 400 |
int value; |
|---|
| 401 |
char texture[32]; |
|---|
| 402 |
int nexttexinfo; |
|---|
| 403 |
} texinfo_t; |
|---|
| 404 |
|
|---|
| 405 |
|
|---|
| 406 |
|
|---|
| 407 |
|
|---|
| 408 |
typedef struct |
|---|
| 409 |
{ |
|---|
| 410 |
unsigned short v[2]; |
|---|
| 411 |
} dedge_t; |
|---|
| 412 |
|
|---|
| 413 |
#define MAXLIGHTMAPS 4 |
|---|
| 414 |
typedef struct |
|---|
| 415 |
{ |
|---|
| 416 |
unsigned short planenum; |
|---|
| 417 |
short side; |
|---|
| 418 |
|
|---|
| 419 |
int firstedge; |
|---|
| 420 |
short numedges; |
|---|
| 421 |
short texinfo; |
|---|
| 422 |
|
|---|
| 423 |
|
|---|
| 424 |
byte styles[MAXLIGHTMAPS]; |
|---|
| 425 |
int lightofs; |
|---|
| 426 |
} dface_t; |
|---|
| 427 |
|
|---|
| 428 |
typedef struct |
|---|
| 429 |
{ |
|---|
| 430 |
int contents; |
|---|
| 431 |
|
|---|
| 432 |
short cluster; |
|---|
| 433 |
short area; |
|---|
| 434 |
|
|---|
| 435 |
short mins[3]; |
|---|
| 436 |
short maxs[3]; |
|---|
| 437 |
|
|---|
| 438 |
unsigned short firstleafface; |
|---|
| 439 |
unsigned short numleaffaces; |
|---|
| 440 |
|
|---|
| 441 |
unsigned short firstleafbrush; |
|---|
| 442 |
unsigned short numleafbrushes; |
|---|
| 443 |
} dleaf_t; |
|---|
| 444 |
|
|---|
| 445 |
typedef struct |
|---|
| 446 |
{ |
|---|
| 447 |
unsigned short planenum; |
|---|
| 448 |
short texinfo; |
|---|
| 449 |
} dbrushside_t; |
|---|
| 450 |
|
|---|
| 451 |
typedef struct |
|---|
| 452 |
{ |
|---|
| 453 |
int firstside; |
|---|
| 454 |
int numsides; |
|---|
| 455 |
int contents; |
|---|
| 456 |
} dbrush_t; |
|---|
| 457 |
|
|---|
| 458 |
#define ANGLE_UP -1 |
|---|
| 459 |
#define ANGLE_DOWN -2 |
|---|
| 460 |
|
|---|
| 461 |
|
|---|
| 462 |
|
|---|
| 463 |
|
|---|
| 464 |
|
|---|
| 465 |
#define DVIS_PVS 0 |
|---|
| 466 |
#define DVIS_PHS 1 |
|---|
| 467 |
typedef struct |
|---|
| 468 |
{ |
|---|
| 469 |
int numclusters; |
|---|
| 470 |
int bitofs[8][2]; |
|---|
| 471 |
} dvis_t; |
|---|
| 472 |
|
|---|
| 473 |
|
|---|
| 474 |
|
|---|
| 475 |
|
|---|
| 476 |
typedef struct |
|---|
| 477 |
{ |
|---|
| 478 |
int portalnum; |
|---|
| 479 |
int otherarea; |
|---|
| 480 |
} dareaportal_t; |
|---|
| 481 |
|
|---|
| 482 |
typedef struct |
|---|
| 483 |
{ |
|---|
| 484 |
int numareaportals; |
|---|
| 485 |
int firstareaportal; |
|---|
| 486 |
} darea_t; |
|---|