| 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 IDALIASHEADER (('2'<<24)+('P'<<16)+('D'<<8)+'I') |
| 37 |
#define ALIAS_VERSION 8 |
| 38 |
|
| 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 |
| 44 |
|
| 45 |
typedef struct |
| 46 |
{ |
| 47 |
short s; |
| 48 |
short t; |
| 49 |
} dstvert_t; |
| 50 |
|
| 51 |
typedef struct |
| 52 |
{ |
| 53 |
short index_xyz[3]; |
| 54 |
short index_st[3]; |
| 55 |
} dtriangle_t; |
| 56 |
|
| 57 |
typedef struct |
| 58 |
{ |
| 59 |
byte v[3]; |
| 60 |
byte lightnormalindex; |
| 61 |
} dtrivertx_t; |
| 62 |
|
| 63 |
typedef struct |
| 64 |
{ |
| 65 |
float scale[3]; |
| 66 |
float translate[3]; |
| 67 |
char name[16]; |
| 68 |
dtrivertx_t verts[1]; |
| 69 |
} daliasframe_t; |
| 70 |
|
| 71 |
|
| 72 |
|
| 73 |
|
| 74 |
|
| 75 |
|
| 76 |
|
| 77 |
|
| 78 |
|
| 79 |
|
| 80 |
|
| 81 |
typedef struct |
| 82 |
{ |
| 83 |
int ident; |
| 84 |
int version; |
| 85 |
|
| 86 |
int skinwidth; |
| 87 |
int skinheight; |
| 88 |
int framesize; |
| 89 |
|
| 90 |
int num_skins; |
| 91 |
int num_xyz; |
| 92 |
int num_st; |
| 93 |
int num_tris; |
| 94 |
int num_glcmds; |
| 95 |
int num_frames; |
| 96 |
|
| 97 |
int ofs_skins; |
| 98 |
int ofs_st; |
| 99 |
int ofs_tris; |
| 100 |
int ofs_frames; |
| 101 |
int ofs_glcmds; |
| 102 |
int ofs_end; |
| 103 |
|
| 104 |
} dmdl_t; |
| 105 |
|
| 106 |
|
| 107 |
|
| 108 |
|
| 109 |
|
| 110 |
|
| 111 |
|
| 112 |
|
| 113 |
|
| 114 |
#define IDSPRITEHEADER (('2'<<24)+('S'<<16)+('D'<<8)+'I') |
| 115 |
|
| 116 |
#define SPRITE_VERSION 2 |
| 117 |
|
| 118 |
typedef struct |
| 119 |
{ |
| 120 |
int width, height; |
| 121 |
int origin_x, origin_y; |
| 122 |
char name[MAX_SKINNAME]; |
| 123 |
} dsprframe_t; |
| 124 |
|
| 125 |
typedef struct { |
| 126 |
int ident; |
| 127 |
int version; |
| 128 |
int numframes; |
| 129 |
dsprframe_t frames[1]; |
| 130 |
} dsprite_t; |
| 131 |
|
| 132 |
|
| 133 |
|
| 134 |
|
| 135 |
|
| 136 |
|
| 137 |
|
| 138 |
|
| 139 |
|
| 140 |
|
| 141 |
#define MIPLEVELS 4 |
| 142 |
typedef struct miptex_s |
| 143 |
{ |
| 144 |
char name[32]; |
| 145 |
unsigned width, height; |
| 146 |
unsigned offsets[MIPLEVELS]; |
| 147 |
char animname[32]; |
| 148 |
int flags; |
| 149 |
int contents; |
| 150 |
int value; |
| 151 |
} miptex_t; |
| 152 |
|
| 153 |
|
| 154 |
|
| 155 |
|
| 156 |
|
| 157 |
|
| 158 |
|
| 159 |
|
| 160 |
|
| 161 |
|
| 162 |
|
| 163 |
#define IDBSPHEADER (('P'<<24)+('S'<<16)+('B'<<8)+'I') |
| 164 |
|
| 165 |
|
| 166 |
#define BSPVERSION 36 |
| 167 |
|
| 168 |
|
| 169 |
|
| 170 |
|
| 171 |
|
| 172 |
#define MAX_MAP_MODELS 1024 |
| 173 |
#define MAX_MAP_BRUSHES 8192 |
| 174 |
#define MAX_MAP_ENTITIES 2048 |
| 175 |
#define MAX_MAP_ENTSTRING 0x20000 |
| 176 |
#define MAX_MAP_TEXINFO 8192 |
| 177 |
|
| 178 |
#define MAX_MAP_PLANES 65536 |
| 179 |
#define MAX_MAP_NODES 65536 |
| 180 |
#define MAX_MAP_BRUSHSIDES 65536 |
| 181 |
#define MAX_MAP_LEAFS 65536 |
| 182 |
#define MAX_MAP_VERTS 65536 |
| 183 |
#define MAX_MAP_FACES 65536 |
| 184 |
#define MAX_MAP_LEAFFACES 65536 |
| 185 |
#define MAX_MAP_LEAFBRUSHES 65536 |
| 186 |
#define MAX_MAP_PORTALS 65536 |
| 187 |
#define MAX_MAP_EDGES 128000 |
| 188 |
#define MAX_MAP_SURFEDGES 256000 |
| 189 |
#define MAX_MAP_LIGHTING 0x200000 |
| 190 |
#define MAX_MAP_VISIBILITY 0x100000 |
| 191 |
|
| 192 |
|
| 193 |
|
| 194 |
#define MAX_KEY 32 |
| 195 |
#define MAX_VALUE 1024 |
| 196 |
|
| 197 |
|
| 198 |
|
| 199 |
typedef struct |
| 200 |
{ |
| 201 |
int fileofs, filelen; |
| 202 |
} lump_t; |
| 203 |
|
| 204 |
#define LUMP_ENTITIES 0 |
| 205 |
#define LUMP_PLANES 1 |
| 206 |
#define LUMP_VERTEXES 2 |
| 207 |
#define LUMP_VISIBILITY 3 |
| 208 |
#define LUMP_NODES 4 |
| 209 |
#define LUMP_TEXINFO 5 |
| 210 |
#define LUMP_FACES 6 |
| 211 |
#define LUMP_LIGHTING 7 |
| 212 |
#define LUMP_LEAFS 8 |
| 213 |
#define LUMP_LEAFFACES 9 |
| 214 |
#define LUMP_LEAFBRUSHES 10 |
| 215 |
#define LUMP_EDGES 11 |
| 216 |
#define LUMP_SURFEDGES 12 |
| 217 |
#define LUMP_MODELS 13 |
| 218 |
#define LUMP_BRUSHES 14 |
| 219 |
#define LUMP_BRUSHSIDES 15 |
| 220 |
#define LUMP_POP 16 |
| 221 |
|
| 222 |
#define HEADER_LUMPS 17 |
| 223 |
|
| 224 |
typedef struct |
| 225 |
{ |
| 226 |
int ident; |
| 227 |
int version; |
| 228 |
lump_t lumps[HEADER_LUMPS]; |
| 229 |
} dheader_t; |
| 230 |
|
| 231 |
typedef struct |
| 232 |
{ |
| 233 |
float mins[3], maxs[3]; |
| 234 |
float origin[3]; |
| 235 |
int headnode; |
| 236 |
int firstface, numfaces; |
| 237 |
|
| 238 |
} dmodel_t; |
| 239 |
|
| 240 |
|
| 241 |
typedef struct |
| 242 |
{ |
| 243 |
float point[3]; |
| 244 |
} dvertex_t; |
| 245 |
|
| 246 |
|
| 247 |
|
| 248 |
#define PLANE_X 0 |
| 249 |
#define PLANE_Y 1 |
| 250 |
#define PLANE_Z 2 |
| 251 |
|
| 252 |
|
| 253 |
#define PLANE_ANYX 3 |
| 254 |
#define PLANE_ANYY 4 |
| 255 |
#define PLANE_ANYZ 5 |
| 256 |
|
| 257 |
|
| 258 |
|
| 259 |
typedef struct |
| 260 |
{ |
| 261 |
float normal[3]; |
| 262 |
float dist; |
| 263 |
int type; |
| 264 |
} dplane_t; |
| 265 |
|
| 266 |
|
| 267 |
|
| 268 |
|
| 269 |
|
| 270 |
|
| 271 |
|
| 272 |
#define CONTENTS_SOLID 1 // an eye is never valid in a solid |
| 273 |
#define CONTENTS_WINDOW 2 // translucent, but not watery |
| 274 |
#define CONTENTS_AUX 4 |
| 275 |
#define CONTENTS_LAVA 8 |
| 276 |
#define CONTENTS_SLIME 16 |
| 277 |
#define CONTENTS_WATER 32 |
| 278 |
#define CONTENTS_MIST 64 |
| 279 |
#define LAST_VISIBLE_CONTENTS 64 |
| 280 |
|
| 281 |
|
| 282 |
#define CONTENTS_PLAYERCLIP 0x10000 |
| 283 |
#define CONTENTS_MONSTERCLIP 0x20000 |
| 284 |
|
| 285 |
|
| 286 |
#define CONTENTS_CURRENT_0 0x40000 |
| 287 |
#define CONTENTS_CURRENT_90 0x80000 |
| 288 |
#define CONTENTS_CURRENT_180 0x100000 |
| 289 |
#define CONTENTS_CURRENT_270 0x200000 |
| 290 |
#define CONTENTS_CURRENT_UP 0x400000 |
| 291 |
#define CONTENTS_CURRENT_DOWN 0x800000 |
| 292 |
|
| 293 |
#define CONTENTS_ORIGIN 0x1000000 // removed before bsping an entity |
| 294 |
|
| 295 |
#define CONTENTS_MONSTER 0x2000000 // should never be on a brush, only in game |
| 296 |
#define CONTENTS_DEADMONSTER 0x4000000 |
| 297 |
#define CONTENTS_DETAIL 0x8000000 // brushes to be added after vis leafs |
| 298 |
#define CONTENTS_TRANSLUCENT 0x10000000 // auto set if any surface has trans |
| 299 |
|
| 300 |
|
| 301 |
|
| 302 |
typedef struct |
| 303 |
{ |
| 304 |
int planenum; |
| 305 |
int children[2]; |
| 306 |
short mins[3]; |
| 307 |
short maxs[3]; |
| 308 |
unsigned short firstface; |
| 309 |
unsigned short numfaces; |
| 310 |
} dnode_t; |
| 311 |
|
| 312 |
|
| 313 |
typedef struct texinfo_s |
| 314 |
{ |
| 315 |
float vecs[2][4]; |
| 316 |
int flags; |
| 317 |
int value; |
| 318 |
char texture[32]; |
| 319 |
int nexttexinfo; |
| 320 |
} texinfo_t; |
| 321 |
|
| 322 |
|
| 323 |
#define SURF_LIGHT 0x1 // value will hold the light strength |
| 324 |
|
| 325 |
#define SURF_SLICK 0x2 // effects game physics |
| 326 |
|
| 327 |
#define SURF_SKY 0x4 // don't draw, but add to skybox |
| 328 |
#define SURF_WARP 0x8 // turbulent water warp |
| 329 |
#define SURF_TRANS33 0x10 |
| 330 |
#define SURF_TRANS66 0x20 |
| 331 |
#define SURF_FLOWING 0x40 // scroll towards angle |
| 332 |
#define SURF_NODRAW 0x80 // don't bother referencing the texture |
| 333 |
|
| 334 |
|
| 335 |
|
| 336 |
|
| 337 |
typedef struct |
| 338 |
{ |
| 339 |
unsigned short v[2]; |
| 340 |
} dedge_t; |
| 341 |
|
| 342 |
#define MAXLIGHTMAPS 4 |
| 343 |
typedef struct |
| 344 |
{ |
| 345 |
unsigned short planenum; |
| 346 |
short side; |
| 347 |
|
| 348 |
int firstedge; |
| 349 |
short numedges; |
| 350 |
short texinfo; |
| 351 |
|
| 352 |
|
| 353 |
byte styles[MAXLIGHTMAPS]; |
| 354 |
int lightofs; |
| 355 |
} dface_t; |
| 356 |
|
| 357 |
typedef struct |
| 358 |
{ |
| 359 |
int contents; |
| 360 |
|
| 361 |
int pvsofs; |
| 362 |
int phsofs; |
| 363 |
|
| 364 |
short mins[3]; |
| 365 |
short maxs[3]; |
| 366 |
|
| 367 |
unsigned short firstleafface; |
| 368 |
unsigned short numleaffaces; |
| 369 |
|
| 370 |
unsigned short firstleafbrush; |
| 371 |
unsigned short numleafbrushes; |
| 372 |
} dleaf_t; |
| 373 |
|
| 374 |
typedef struct |
| 375 |
{ |
| 376 |
unsigned short planenum; |
| 377 |
short texinfo; |
| 378 |
} dbrushside_t; |
| 379 |
|
| 380 |
typedef struct |
| 381 |
{ |
| 382 |
int firstside; |
| 383 |
int numsides; |
| 384 |
int contents; |
| 385 |
} dbrush_t; |
| 386 |
|
| 387 |
#define ANGLE_UP -1 |
| 388 |
#define ANGLE_DOWN -2 |
| 389 |
|