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 #define SIN
00032
00033 #define SINBSPVERSION 41
00034
00035
00036
00037
00038 #define SIN_MAX_MAP_MODELS 1024
00039 #define SIN_MAX_MAP_BRUSHES 8192
00040 #define SIN_MAX_MAP_ENTITIES 2048
00041 #define SIN_MAX_MAP_ENTSTRING 0x40000
00042 #define SIN_MAX_MAP_TEXINFO 8192
00043
00044 #define SIN_MAX_MAP_AREAS 256
00045 #define SIN_MAX_MAP_AREAPORTALS 1024
00046 #define SIN_MAX_MAP_PLANES 65536
00047 #define SIN_MAX_MAP_NODES 65536
00048 #define SIN_MAX_MAP_BRUSHSIDES 65536
00049 #define SIN_MAX_MAP_LEAFS 65536
00050 #define SIN_MAX_MAP_VERTS 65536
00051 #define SIN_MAX_MAP_FACES 65536
00052 #define SIN_MAX_MAP_LEAFFACES 65536
00053 #define SIN_MAX_MAP_LEAFBRUSHES 65536
00054 #define SIN_MAX_MAP_PORTALS 65536
00055 #define SIN_MAX_MAP_EDGES 128000
00056 #define SIN_MAX_MAP_SURFEDGES 256000
00057 #define SIN_MAX_MAP_LIGHTING 0x320000
00058 #define SIN_MAX_MAP_VISIBILITY 0x280000
00059
00060 #ifdef SIN
00061 #define SIN_MAX_MAP_LIGHTINFO 8192
00062 #endif
00063
00064 #ifdef SIN
00065 #undef SIN_MAX_MAP_LIGHTING //undef the Quake2 bsp version
00066 #define SIN_MAX_MAP_LIGHTING 0x300000
00067 #endif
00068
00069 #ifdef SIN
00070 #undef SIN_MAX_MAP_VISIBILITY //undef the Quake2 bsp version
00071 #define SIN_MAX_MAP_VISIBILITY 0x280000
00072 #endif
00073
00074
00075
00076 typedef struct
00077 {
00078 int fileofs, filelen;
00079 } sin_lump_t;
00080
00081 #define SIN_LUMP_ENTITIES 0
00082 #define SIN_LUMP_PLANES 1
00083 #define SIN_LUMP_VERTEXES 2
00084 #define SIN_LUMP_VISIBILITY 3
00085 #define SIN_LUMP_NODES 4
00086 #define SIN_LUMP_TEXINFO 5
00087 #define SIN_LUMP_FACES 6
00088 #define SIN_LUMP_LIGHTING 7
00089 #define SIN_LUMP_LEAFS 8
00090 #define SIN_LUMP_LEAFFACES 9
00091 #define SIN_LUMP_LEAFBRUSHES 10
00092 #define SIN_LUMP_EDGES 11
00093 #define SIN_LUMP_SURFEDGES 12
00094 #define SIN_LUMP_MODELS 13
00095 #define SIN_LUMP_BRUSHES 14
00096 #define SIN_LUMP_BRUSHSIDES 15
00097 #define SIN_LUMP_POP 16
00098 #define SIN_LUMP_AREAS 17
00099 #define SIN_LUMP_AREAPORTALS 18
00100
00101 #ifdef SIN
00102 #define SIN_LUMP_LIGHTINFO 19
00103 #define SINHEADER_LUMPS 20
00104 #endif
00105
00106 typedef struct
00107 {
00108 int ident;
00109 int version;
00110 sin_lump_t lumps[SINHEADER_LUMPS];
00111 } sin_dheader_t;
00112
00113 typedef struct
00114 {
00115 float mins[3], maxs[3];
00116 float origin[3];
00117 int headnode;
00118 int firstface, numfaces;
00119
00120 } sin_dmodel_t;
00121
00122 typedef struct
00123 {
00124 float point[3];
00125 } sin_dvertex_t;
00126
00127
00128
00129 #define PLANE_X 0
00130 #define PLANE_Y 1
00131 #define PLANE_Z 2
00132
00133
00134 #define PLANE_ANYX 3
00135 #define PLANE_ANYY 4
00136 #define PLANE_ANYZ 5
00137
00138
00139
00140 typedef struct
00141 {
00142 float normal[3];
00143 float dist;
00144 int type;
00145 } sin_dplane_t;
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155 #ifdef SIN
00156 #define CONTENTS_FENCE 4
00157 #endif
00158
00159
00160 #ifdef SIN
00161 #define CONTENTS_DUMMYFENCE 0x1000
00162 #endif
00163
00164 #ifdef SIN
00165 #define SURF_MASKED 0x2 // surface texture is masked
00166 #endif
00167
00168 #define SURF_SKY 0x4 // don't draw, but add to skybox
00169 #define SURF_WARP 0x8 // turbulent water warp
00170
00171 #ifdef SIN
00172 #define SURF_NONLIT 0x10 // surface is not lit
00173 #define SURF_NOFILTER 0x20 // surface is not bi-linear filtered
00174 #endif
00175
00176 #define SURF_FLOWING 0x40 // scroll towards angle
00177 #define SURF_NODRAW 0x80 // don't bother referencing the texture
00178
00179 #define SURF_HINT 0x100 // make a primary bsp splitter
00180 #define SURF_SKIP 0x200 // completely ignore, allowing non-closed brushes
00181
00182 #ifdef SIN
00183 #define SURF_CONVEYOR 0x40 // surface is not lit
00184 #endif
00185
00186 #ifdef SIN
00187 #define SURF_WAVY 0x400 // surface has waves
00188 #define SURF_RICOCHET 0x800 // projectiles bounce literally bounce off this surface
00189 #define SURF_PRELIT 0x1000 // surface has intensity information for pre-lighting
00190 #define SURF_MIRROR 0x2000 // surface is a mirror
00191 #define SURF_CONSOLE 0x4000 // surface is a console
00192 #define SURF_USECOLOR 0x8000 // surface is lit with non-lit * color
00193 #define SURF_HARDWAREONLY 0x10000 // surface has been damaged
00194 #define SURF_DAMAGE 0x20000 // surface can be damaged
00195 #define SURF_WEAK 0x40000 // surface has weak hit points
00196 #define SURF_NORMAL 0x80000 // surface has normal hit points
00197 #define SURF_ADD 0x100000 // surface will be additive
00198 #define SURF_ENVMAPPED 0x200000 // surface is envmapped
00199 #define SURF_RANDOMANIMATE 0x400000 // surface start animating on a random frame
00200 #define SURF_ANIMATE 0x800000 // surface animates
00201 #define SURF_RNDTIME 0x1000000 // time between animations is random
00202 #define SURF_TRANSLATE 0x2000000 // surface translates
00203 #define SURF_NOMERGE 0x4000000 // surface is not merged in csg phase
00204 #define SURF_TYPE_BIT0 0x8000000 // 0 bit of surface type
00205 #define SURF_TYPE_BIT1 0x10000000 // 1 bit of surface type
00206 #define SURF_TYPE_BIT2 0x20000000 // 2 bit of surface type
00207 #define SURF_TYPE_BIT3 0x40000000 // 3 bit of surface type
00208
00209 #define SURF_START_BIT 27
00210 #define SURFACETYPE_FROM_FLAGS( x ) ( ( x >> (SURF_START_BIT) ) & 0xf )
00211
00212
00213 #define SURF_TYPE_SHIFT(x) ( (x) << (SURF_START_BIT) ) // macro for getting proper bit mask
00214
00215 #define SURF_TYPE_NONE SURF_TYPE_SHIFT(0)
00216 #define SURF_TYPE_WOOD SURF_TYPE_SHIFT(1)
00217 #define SURF_TYPE_METAL SURF_TYPE_SHIFT(2)
00218 #define SURF_TYPE_STONE SURF_TYPE_SHIFT(3)
00219 #define SURF_TYPE_CONCRETE SURF_TYPE_SHIFT(4)
00220 #define SURF_TYPE_DIRT SURF_TYPE_SHIFT(5)
00221 #define SURF_TYPE_FLESH SURF_TYPE_SHIFT(6)
00222 #define SURF_TYPE_GRILL SURF_TYPE_SHIFT(7)
00223 #define SURF_TYPE_GLASS SURF_TYPE_SHIFT(8)
00224 #define SURF_TYPE_FABRIC SURF_TYPE_SHIFT(9)
00225 #define SURF_TYPE_MONITOR SURF_TYPE_SHIFT(10)
00226 #define SURF_TYPE_GRAVEL SURF_TYPE_SHIFT(11)
00227 #define SURF_TYPE_VEGETATION SURF_TYPE_SHIFT(12)
00228 #define SURF_TYPE_PAPER SURF_TYPE_SHIFT(13)
00229 #define SURF_TYPE_DUCT SURF_TYPE_SHIFT(14)
00230 #define SURF_TYPE_WATER SURF_TYPE_SHIFT(15)
00231 #endif
00232
00233
00234 typedef struct
00235 {
00236 int planenum;
00237 int children[2];
00238 short mins[3];
00239 short maxs[3];
00240 unsigned short firstface;
00241 unsigned short numfaces;
00242 } sin_dnode_t;
00243
00244 #ifdef SIN
00245
00246 typedef struct sin_lightvalue_s
00247 {
00248 int value;
00249 vec3_t color;
00250 float direct;
00251 float directangle;
00252 float directstyle;
00253 char directstylename[32];
00254 } sin_lightvalue_t;
00255
00256 typedef struct sin_texinfo_s
00257 {
00258 float vecs[2][4];
00259 int flags;
00260 char texture[64];
00261 int nexttexinfo;
00262 float trans_mag;
00263 int trans_angle;
00264 int base_angle;
00265 float animtime;
00266 float nonlit;
00267 float translucence;
00268 float friction;
00269 float restitution;
00270 vec3_t color;
00271 char groupname[32];
00272 } sin_texinfo_t;
00273
00274 #endif //SIN
00275
00276
00277
00278 typedef struct
00279 {
00280 unsigned short v[2];
00281 } sin_dedge_t;
00282
00283 #ifdef MAXLIGHTMAPS
00284 #undef MAXLIGHTMAPS
00285 #endif
00286 #define MAXLIGHTMAPS 16
00287 typedef struct
00288 {
00289 unsigned short planenum;
00290 short side;
00291
00292 int firstedge;
00293 short numedges;
00294 short texinfo;
00295
00296
00297 byte styles[MAXLIGHTMAPS];
00298 int lightofs;
00299 #ifdef SIN
00300 int lightinfo;
00301 #endif
00302 } sin_dface_t;
00303
00304 typedef struct
00305 {
00306 int contents;
00307
00308 short cluster;
00309 short area;
00310
00311 short mins[3];
00312 short maxs[3];
00313
00314 unsigned short firstleafface;
00315 unsigned short numleaffaces;
00316
00317 unsigned short firstleafbrush;
00318 unsigned short numleafbrushes;
00319 } sin_dleaf_t;
00320
00321 typedef struct
00322 {
00323 unsigned short planenum;
00324 short texinfo;
00325 #ifdef SIN
00326 int lightinfo;
00327 #endif
00328 } sin_dbrushside_t;
00329
00330 typedef struct
00331 {
00332 int firstside;
00333 int numsides;
00334 int contents;
00335 } sin_dbrush_t;
00336
00337 #define ANGLE_UP -1
00338 #define ANGLE_DOWN -2
00339
00340
00341
00342
00343
00344 #define DVIS_PVS 0
00345 #define DVIS_PHS 1
00346 typedef struct
00347 {
00348 int numclusters;
00349 int bitofs[8][2];
00350 } sin_dvis_t;
00351
00352
00353
00354
00355 typedef struct
00356 {
00357 int portalnum;
00358 int otherarea;
00359 } sin_dareaportal_t;
00360
00361 typedef struct
00362 {
00363 int numareaportals;
00364 int firstareaportal;
00365 } sin_darea_t;