Main Page | Class Hierarchy | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

l_bsp_hl.h

Go to the documentation of this file.
00001 /*
00002 ===========================================================================
00003 Copyright (C) 1999-2005 Id Software, Inc.
00004 
00005 This file is part of Quake III Arena source code.
00006 
00007 Quake III Arena source code is free software; you can redistribute it
00008 and/or modify it under the terms of the GNU General Public License as
00009 published by the Free Software Foundation; either version 2 of the License,
00010 or (at your option) any later version.
00011 
00012 Quake III Arena source code is distributed in the hope that it will be
00013 useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015 GNU General Public License for more details.
00016 
00017 You should have received a copy of the GNU General Public License
00018 along with Foobar; if not, write to the Free Software
00019 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00020 ===========================================================================
00021 */
00022 // upper design bounds
00023 
00024 #define HL_MAX_MAP_HULLS            4
00025 
00026 #define HL_MAX_MAP_MODELS           400
00027 #define HL_MAX_MAP_BRUSHES      4096
00028 #define HL_MAX_MAP_ENTITIES     1024
00029 #define HL_MAX_MAP_ENTSTRING        (128*1024)
00030 
00031 #define HL_MAX_MAP_PLANES           32767
00032 #define HL_MAX_MAP_NODES            32767       // because negative shorts are contents
00033 #define HL_MAX_MAP_CLIPNODES        32767       //
00034 #define HL_MAX_MAP_LEAFS            8192
00035 #define HL_MAX_MAP_VERTS            65535
00036 #define HL_MAX_MAP_FACES            65535
00037 #define HL_MAX_MAP_MARKSURFACES 65535
00038 #define HL_MAX_MAP_TEXINFO      8192
00039 #define HL_MAX_MAP_EDGES            256000
00040 #define HL_MAX_MAP_SURFEDGES        512000
00041 #define HL_MAX_MAP_TEXTURES     512
00042 #define HL_MAX_MAP_MIPTEX           0x200000
00043 #define HL_MAX_MAP_LIGHTING     0x200000
00044 #define HL_MAX_MAP_VISIBILITY   0x200000
00045 
00046 #define HL_MAX_MAP_PORTALS      65536
00047 
00048 // key / value pair sizes
00049 
00050 #define MAX_KEY     32
00051 #define MAX_VALUE   1024
00052 
00053 //=============================================================================
00054 
00055 
00056 #define HL_BSPVERSION   30
00057 #define HL_TOOLVERSION  2
00058 
00059 
00060 typedef struct
00061 {
00062     int     fileofs, filelen;
00063 } hl_lump_t;
00064 
00065 #define HL_LUMP_ENTITIES    0
00066 #define HL_LUMP_PLANES      1
00067 #define HL_LUMP_TEXTURES    2
00068 #define HL_LUMP_VERTEXES    3
00069 #define HL_LUMP_VISIBILITY  4
00070 #define HL_LUMP_NODES       5
00071 #define HL_LUMP_TEXINFO 6
00072 #define HL_LUMP_FACES       7
00073 #define HL_LUMP_LIGHTING    8
00074 #define HL_LUMP_CLIPNODES   9
00075 #define HL_LUMP_LEAFS       10
00076 #define HL_LUMP_MARKSURFACES 11
00077 #define HL_LUMP_EDGES       12
00078 #define HL_LUMP_SURFEDGES   13
00079 #define HL_LUMP_MODELS      14
00080 
00081 #define HL_HEADER_LUMPS 15
00082 
00083 typedef struct
00084 {
00085     float       mins[3], maxs[3];
00086     float       origin[3];
00087     int     headnode[HL_MAX_MAP_HULLS];
00088     int     visleafs;       // not including the solid leaf 0
00089     int     firstface, numfaces;
00090 } hl_dmodel_t;
00091 
00092 typedef struct
00093 {
00094     int         version;    
00095     hl_lump_t   lumps[HL_HEADER_LUMPS];
00096 } hl_dheader_t;
00097 
00098 typedef struct
00099 {
00100     int         nummiptex;
00101     int         dataofs[4];     // [nummiptex]
00102 } hl_dmiptexlump_t;
00103 
00104 #define MIPLEVELS   4
00105 typedef struct hl_miptex_s
00106 {
00107     char        name[16];
00108     unsigned    width, height;
00109     unsigned    offsets[MIPLEVELS];     // four mip maps stored
00110 } hl_miptex_t;
00111 
00112 
00113 typedef struct
00114 {
00115     float   point[3];
00116 } hl_dvertex_t;
00117 
00118 
00119 // 0-2 are axial planes
00120 #define PLANE_X         0
00121 #define PLANE_Y         1
00122 #define PLANE_Z         2
00123 
00124 // 3-5 are non-axial planes snapped to the nearest
00125 #define PLANE_ANYX      3
00126 #define PLANE_ANYY      4
00127 #define PLANE_ANYZ      5
00128 
00129 typedef struct
00130 {
00131     float   normal[3];
00132     float   dist;
00133     int type;       // PLANE_X - PLANE_ANYZ ?remove? trivial to regenerate
00134 } hl_dplane_t;
00135 
00136 
00137 
00138 #define HL_CONTENTS_EMPTY               -1
00139 #define HL_CONTENTS_SOLID               -2
00140 #define HL_CONTENTS_WATER               -3
00141 #define HL_CONTENTS_SLIME               -4
00142 #define HL_CONTENTS_LAVA                -5
00143 #define HL_CONTENTS_SKY             -6
00144 #define HL_CONTENTS_ORIGIN          -7      // removed at csg time
00145 #define HL_CONTENTS_CLIP                -8      // changed to contents_solid
00146 
00147 #define HL_CONTENTS_CURRENT_0       -9
00148 #define HL_CONTENTS_CURRENT_90      -10
00149 #define HL_CONTENTS_CURRENT_180     -11
00150 #define HL_CONTENTS_CURRENT_270     -12
00151 #define HL_CONTENTS_CURRENT_UP      -13
00152 #define HL_CONTENTS_CURRENT_DOWN    -14
00153 
00154 #define HL_CONTENTS_TRANSLUCENT     -15
00155 
00156 // !!! if this is changed, it must be changed in asm_i386.h too !!!
00157 typedef struct
00158 {
00159     int     planenum;
00160     short       children[2];    // negative numbers are -(leafs+1), not nodes
00161     short       mins[3];        // for sphere culling
00162     short       maxs[3];
00163     unsigned short  firstface;
00164     unsigned short  numfaces;   // counting both sides
00165 } hl_dnode_t;
00166 
00167 typedef struct
00168 {
00169     int     planenum;
00170     short       children[2];    // negative numbers are contents
00171 } hl_dclipnode_t;
00172 
00173 
00174 typedef struct hl_texinfo_s
00175 {
00176     float       vecs[2][4];     // [s/t][xyz offset]
00177     int     miptex;
00178     int     flags;
00179 } hl_texinfo_t;
00180 #define TEX_SPECIAL     1       // sky or slime, no lightmap or 256 subdivision
00181 
00182 // note that edge 0 is never used, because negative edge nums are used for
00183 // counterclockwise use of the edge in a face
00184 typedef struct
00185 {
00186     unsigned short  v[2];       // vertex numbers
00187 } hl_dedge_t;
00188 
00189 #define MAXLIGHTMAPS    4
00190 typedef struct
00191 {
00192     short       planenum;
00193     short       side;
00194 
00195     int     firstedge;      // we must support > 64k edges
00196     short       numedges;   
00197     short       texinfo;
00198 
00199 // lighting info
00200     byte        styles[MAXLIGHTMAPS];
00201     int     lightofs;       // start of [numstyles*surfsize] samples
00202 } hl_dface_t;
00203 
00204 
00205 #define AMBIENT_WATER   0
00206 #define AMBIENT_SKY     1
00207 #define AMBIENT_SLIME   2
00208 #define AMBIENT_LAVA    3
00209 
00210 #define NUM_AMBIENTS            4       // automatic ambient sounds
00211 
00212 // leaf 0 is the generic HL_CONTENTS_SOLID leaf, used for all solid areas
00213 // all other leafs need visibility info
00214 typedef struct
00215 {
00216     int         contents;
00217     int         visofs;             // -1 = no visibility info
00218 
00219     short           mins[3];            // for frustum culling
00220     short           maxs[3];
00221 
00222     unsigned short      firstmarksurface;
00223     unsigned short      nummarksurfaces;
00224 
00225     byte        ambient_level[NUM_AMBIENTS];
00226 } hl_dleaf_t;
00227 
00228 
00229 //============================================================================
00230 
00231 #ifndef QUAKE_GAME
00232 
00233 #define ANGLE_UP    -1
00234 #define ANGLE_DOWN  -2
00235 
00236 
00237 // the utilities get to be lazy and just use large static arrays
00238 
00239 extern  int             hl_nummodels;
00240 extern  hl_dmodel_t     *hl_dmodels;//[MAX_MAP_MODELS];
00241 extern  int             hl_dmodels_checksum;
00242 
00243 extern  int             hl_visdatasize;
00244 extern  byte                *hl_dvisdata;//[MAX_MAP_VISIBILITY];
00245 extern  int             hl_dvisdata_checksum;
00246 
00247 extern  int             hl_lightdatasize;
00248 extern  byte                *hl_dlightdata;//[MAX_MAP_LIGHTING];
00249 extern  int             hl_dlightdata_checksum;
00250 
00251 extern  int             hl_texdatasize;
00252 extern  byte                *hl_dtexdata;//[MAX_MAP_MIPTEX]; // (dmiptexlump_t)
00253 extern  int             hl_dtexdata_checksum;
00254 
00255 extern  int             hl_entdatasize;
00256 extern  char                *hl_dentdata;//[MAX_MAP_ENTSTRING];
00257 extern  int             hl_dentdata_checksum;
00258 
00259 extern  int             hl_numleafs;
00260 extern  hl_dleaf_t      *hl_dleafs;//[MAX_MAP_LEAFS];
00261 extern  int             hl_dleafs_checksum;
00262 
00263 extern  int             hl_numplanes;
00264 extern  hl_dplane_t     *hl_dplanes;//[MAX_MAP_PLANES];
00265 extern  int             hl_dplanes_checksum;
00266 
00267 extern  int             hl_numvertexes;
00268 extern  hl_dvertex_t    *hl_dvertexes;//[MAX_MAP_VERTS];
00269 extern  int             hl_dvertexes_checksum;
00270 
00271 extern  int             hl_numnodes;
00272 extern  hl_dnode_t      *hl_dnodes;//[MAX_MAP_NODES];
00273 extern  int             hl_dnodes_checksum;
00274 
00275 extern  int             hl_numtexinfo;
00276 extern  hl_texinfo_t    *hl_texinfo;//[MAX_MAP_TEXINFO];
00277 extern  int             hl_texinfo_checksum;
00278 
00279 extern  int             hl_numfaces;
00280 extern  hl_dface_t      *hl_dfaces;//[MAX_MAP_FACES];
00281 extern  int             hl_dfaces_checksum;
00282 
00283 extern  int             hl_numclipnodes;
00284 extern  hl_dclipnode_t  *hl_dclipnodes;//[MAX_MAP_CLIPNODES];
00285 extern  int             hl_dclipnodes_checksum;
00286 
00287 extern  int             hl_numedges;
00288 extern  hl_dedge_t      *hl_dedges;//[MAX_MAP_EDGES];
00289 extern  int             hl_dedges_checksum;
00290 
00291 extern  int             hl_nummarksurfaces;
00292 extern  unsigned short  *hl_dmarksurfaces;//[MAX_MAP_MARKSURFACES];
00293 extern  int             hl_dmarksurfaces_checksum;
00294 
00295 extern  int             hl_numsurfedges;
00296 extern  int             *hl_dsurfedges;//[MAX_MAP_SURFEDGES];
00297 extern  int             hl_dsurfedges_checksum;
00298 
00299 int FastChecksum(void *buffer, int bytes);
00300 
00301 void HL_AllocMaxBSP(void);
00302 void HL_FreeMaxBSP(void);
00303 
00304 void HL_DecompressVis(byte *in, byte *decompressed);
00305 int HL_CompressVis(byte *vis, byte *dest);
00306 
00307 void HL_LoadBSPFile(char *filename, int offset, int length);
00308 void HL_WriteBSPFile(char *filename);
00309 void HL_PrintBSPFileSizes(void);
00310 void HL_PrintBSPFileSizes(void);
00311 void HL_ParseEntities(void);
00312 void HL_UnparseEntities(void);
00313 
00314 #endif

Generated on Thu Aug 25 12:37:15 2005 for Quake III Arena by  doxygen 1.3.9.1