Annotation of quakeworld/client/bspfile.h, revision 1.1

1.1     ! root        1: /*
        !             2: Copyright (C) 1996-1997 Id Software, Inc.
        !             3: 
        !             4: This program is free software; you can redistribute it and/or
        !             5: modify it under the terms of the GNU General Public License
        !             6: as published by the Free Software Foundation; either version 2
        !             7: of the License, or (at your option) any later version.
        !             8: 
        !             9: This program is distributed in the hope that it will be useful,
        !            10: but WITHOUT ANY WARRANTY; without even the implied warranty of
        !            11: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
        !            12: 
        !            13: See the GNU General Public License for more details.
        !            14: 
        !            15: You should have received a copy of the GNU General Public License
        !            16: along with this program; if not, write to the Free Software
        !            17: Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
        !            18: 
        !            19: */
        !            20: 
        !            21: 
        !            22: // upper design bounds
        !            23: 
        !            24: #define        MAX_MAP_HULLS           4
        !            25: 
        !            26: #define        MAX_MAP_MODELS          256
        !            27: #define        MAX_MAP_BRUSHES         4096
        !            28: #define        MAX_MAP_ENTITIES        1024
        !            29: #define        MAX_MAP_ENTSTRING       65536
        !            30: 
        !            31: #define        MAX_MAP_PLANES          8192
        !            32: #define        MAX_MAP_NODES           32767           // because negative shorts are contents
        !            33: #define        MAX_MAP_CLIPNODES       32767           //
        !            34: #define        MAX_MAP_LEAFS           32767           // 
        !            35: #define        MAX_MAP_VERTS           65535
        !            36: #define        MAX_MAP_FACES           65535
        !            37: #define        MAX_MAP_MARKSURFACES 65535
        !            38: #define        MAX_MAP_TEXINFO         4096
        !            39: #define        MAX_MAP_EDGES           256000
        !            40: #define        MAX_MAP_SURFEDGES       512000
        !            41: #define        MAX_MAP_MIPTEX          0x200000
        !            42: #define        MAX_MAP_LIGHTING        0x100000
        !            43: #define        MAX_MAP_VISIBILITY      0x100000
        !            44: 
        !            45: // key / value pair sizes
        !            46: 
        !            47: #define        MAX_KEY         32
        !            48: #define        MAX_VALUE       1024
        !            49: 
        !            50: 
        !            51: //=============================================================================
        !            52: 
        !            53: 
        !            54: #define BSPVERSION     29
        !            55: 
        !            56: typedef struct
        !            57: {
        !            58:        int             fileofs, filelen;
        !            59: } lump_t;
        !            60: 
        !            61: #define        LUMP_ENTITIES   0
        !            62: #define        LUMP_PLANES             1
        !            63: #define        LUMP_TEXTURES   2
        !            64: #define        LUMP_VERTEXES   3
        !            65: #define        LUMP_VISIBILITY 4
        !            66: #define        LUMP_NODES              5
        !            67: #define        LUMP_TEXINFO    6
        !            68: #define        LUMP_FACES              7
        !            69: #define        LUMP_LIGHTING   8
        !            70: #define        LUMP_CLIPNODES  9
        !            71: #define        LUMP_LEAFS              10
        !            72: #define        LUMP_MARKSURFACES 11
        !            73: #define        LUMP_EDGES              12
        !            74: #define        LUMP_SURFEDGES  13
        !            75: #define        LUMP_MODELS             14
        !            76: 
        !            77: #define        HEADER_LUMPS    15
        !            78: 
        !            79: typedef struct
        !            80: {
        !            81:        float           mins[3], maxs[3];
        !            82:        float           origin[3];
        !            83:        int                     headnode[MAX_MAP_HULLS];
        !            84:        int                     visleafs;               // not including the solid leaf 0
        !            85:        int                     firstface, numfaces;
        !            86: } dmodel_t;
        !            87: 
        !            88: typedef struct
        !            89: {
        !            90:        int                     version;        
        !            91:        lump_t          lumps[HEADER_LUMPS];
        !            92: } dheader_t;
        !            93: 
        !            94: typedef struct
        !            95: {
        !            96:        int                     nummiptex;
        !            97:        int                     dataofs[4];             // [nummiptex]
        !            98: } dmiptexlump_t;
        !            99: 
        !           100: #define        MIPLEVELS       4
        !           101: typedef struct miptex_s
        !           102: {
        !           103:        char            name[16];
        !           104:        unsigned        width, height;
        !           105:        unsigned        offsets[MIPLEVELS];             // four mip maps stored
        !           106: } miptex_t;
        !           107: 
        !           108: 
        !           109: typedef struct
        !           110: {
        !           111:        float   point[3];
        !           112: } dvertex_t;
        !           113: 
        !           114: 
        !           115: // 0-2 are axial planes
        !           116: #define        PLANE_X                 0
        !           117: #define        PLANE_Y                 1
        !           118: #define        PLANE_Z                 2
        !           119: 
        !           120: // 3-5 are non-axial planes snapped to the nearest
        !           121: #define        PLANE_ANYX              3
        !           122: #define        PLANE_ANYY              4
        !           123: #define        PLANE_ANYZ              5
        !           124: 
        !           125: typedef struct
        !           126: {
        !           127:        float   normal[3];
        !           128:        float   dist;
        !           129:        int             type;           // PLANE_X - PLANE_ANYZ ?remove? trivial to regenerate
        !           130: } dplane_t;
        !           131: 
        !           132: 
        !           133: 
        !           134: #define        CONTENTS_EMPTY          -1
        !           135: #define        CONTENTS_SOLID          -2
        !           136: #define        CONTENTS_WATER          -3
        !           137: #define        CONTENTS_SLIME          -4
        !           138: #define        CONTENTS_LAVA           -5
        !           139: #define        CONTENTS_SKY            -6
        !           140: 
        !           141: // !!! if this is changed, it must be changed in asm_i386.h too !!!
        !           142: typedef struct
        !           143: {
        !           144:        int                     planenum;
        !           145:        short           children[2];    // negative numbers are -(leafs+1), not nodes
        !           146:        short           mins[3];                // for sphere culling
        !           147:        short           maxs[3];
        !           148:        unsigned short  firstface;
        !           149:        unsigned short  numfaces;       // counting both sides
        !           150: } dnode_t;
        !           151: 
        !           152: typedef struct
        !           153: {
        !           154:        int                     planenum;
        !           155:        short           children[2];    // negative numbers are contents
        !           156: } dclipnode_t;
        !           157: 
        !           158: 
        !           159: typedef struct texinfo_s
        !           160: {
        !           161:        float           vecs[2][4];             // [s/t][xyz offset]
        !           162:        int                     miptex;
        !           163:        int                     flags;
        !           164: } texinfo_t;
        !           165: #define        TEX_SPECIAL             1               // sky or slime, no lightmap or 256 subdivision
        !           166: 
        !           167: // note that edge 0 is never used, because negative edge nums are used for
        !           168: // counterclockwise use of the edge in a face
        !           169: typedef struct
        !           170: {
        !           171:        unsigned short  v[2];           // vertex numbers
        !           172: } dedge_t;
        !           173: 
        !           174: #define        MAXLIGHTMAPS    4
        !           175: typedef struct
        !           176: {
        !           177:        short           planenum;
        !           178:        short           side;
        !           179: 
        !           180:        int                     firstedge;              // we must support > 64k edges
        !           181:        short           numedges;       
        !           182:        short           texinfo;
        !           183: 
        !           184: // lighting info
        !           185:        byte            styles[MAXLIGHTMAPS];
        !           186:        int                     lightofs;               // start of [numstyles*surfsize] samples
        !           187: } dface_t;
        !           188: 
        !           189: 
        !           190: 
        !           191: #define        AMBIENT_WATER   0
        !           192: #define        AMBIENT_SKY             1
        !           193: #define        AMBIENT_SLIME   2
        !           194: #define        AMBIENT_LAVA    3
        !           195: 
        !           196: #define        NUM_AMBIENTS                    4               // automatic ambient sounds
        !           197: 
        !           198: // leaf 0 is the generic CONTENTS_SOLID leaf, used for all solid areas
        !           199: // all other leafs need visibility info
        !           200: typedef struct
        !           201: {
        !           202:        int                     contents;
        !           203:        int                     visofs;                         // -1 = no visibility info
        !           204: 
        !           205:        short           mins[3];                        // for frustum culling
        !           206:        short           maxs[3];
        !           207: 
        !           208:        unsigned short          firstmarksurface;
        !           209:        unsigned short          nummarksurfaces;
        !           210: 
        !           211:        byte            ambient_level[NUM_AMBIENTS];
        !           212: } dleaf_t;
        !           213: 
        !           214: //============================================================================
        !           215: 
        !           216: #ifndef QUAKE_GAME
        !           217: 
        !           218: // the utilities get to be lazy and just use large static arrays
        !           219: 
        !           220: extern int                     nummodels;
        !           221: extern dmodel_t        dmodels[MAX_MAP_MODELS];
        !           222: 
        !           223: extern int                     visdatasize;
        !           224: extern byte            dvisdata[MAX_MAP_VISIBILITY];
        !           225: 
        !           226: extern int                     lightdatasize;
        !           227: extern byte            dlightdata[MAX_MAP_LIGHTING];
        !           228: 
        !           229: extern int                     texdatasize;
        !           230: extern byte            dtexdata[MAX_MAP_MIPTEX]; // (dmiptexlump_t)
        !           231: 
        !           232: extern int                     entdatasize;
        !           233: extern char            dentdata[MAX_MAP_ENTSTRING];
        !           234: 
        !           235: extern int                     numleafs;
        !           236: extern dleaf_t         dleafs[MAX_MAP_LEAFS];
        !           237: 
        !           238: extern int                     numplanes;
        !           239: extern dplane_t        dplanes[MAX_MAP_PLANES];
        !           240: 
        !           241: extern int                     numvertexes;
        !           242: extern dvertex_t       dvertexes[MAX_MAP_VERTS];
        !           243: 
        !           244: extern int                     numnodes;
        !           245: extern dnode_t         dnodes[MAX_MAP_NODES];
        !           246: 
        !           247: extern int                     numtexinfo;
        !           248: extern texinfo_t       texinfo[MAX_MAP_TEXINFO];
        !           249: 
        !           250: extern int                     numfaces;
        !           251: extern dface_t         dfaces[MAX_MAP_FACES];
        !           252: 
        !           253: extern int                     numclipnodes;
        !           254: extern dclipnode_t     dclipnodes[MAX_MAP_CLIPNODES];
        !           255: 
        !           256: extern int                     numedges;
        !           257: extern dedge_t         dedges[MAX_MAP_EDGES];
        !           258: 
        !           259: extern int                     nummarksurfaces;
        !           260: extern unsigned short  dmarksurfaces[MAX_MAP_MARKSURFACES];
        !           261: 
        !           262: extern int                     numsurfedges;
        !           263: extern int                     dsurfedges[MAX_MAP_SURFEDGES];
        !           264: 
        !           265: 
        !           266: 
        !           267: void   LoadBSPFile (char *filename);
        !           268: void   WriteBSPFile (char *filename);
        !           269: void   PrintBSPFileSizes (void);
        !           270: 
        !           271: #endif

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.