bspfile.h (3201B)
1 /* 2 =========================================================================== 3 Copyright (C) 1999-2005 Id Software, Inc. 4 5 This file is part of Quake III Arena source code. 6 7 Quake III Arena source code is free software; you can redistribute it 8 and/or modify it under the terms of the GNU General Public License as 9 published by the Free Software Foundation; either version 2 of the License, 10 or (at your option) any later version. 11 12 Quake III Arena source code is distributed in the hope that it will be 13 useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 GNU General Public License for more details. 16 17 You should have received a copy of the GNU General Public License 18 along with Foobar; if not, write to the Free Software 19 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 20 =========================================================================== 21 */ 22 #ifdef _TTIMOBUILD 23 #include "qfiles.h" 24 #include "surfaceflags.h" 25 #else 26 #include "../code/qcommon/qfiles.h" 27 #include "../code/game/surfaceflags.h" 28 #endif 29 30 extern int nummodels; 31 extern dmodel_t dmodels[MAX_MAP_MODELS]; 32 33 extern int numShaders; 34 extern dshader_t dshaders[MAX_MAP_MODELS]; 35 36 extern int entdatasize; 37 extern char dentdata[MAX_MAP_ENTSTRING]; 38 39 extern int numleafs; 40 extern dleaf_t dleafs[MAX_MAP_LEAFS]; 41 42 extern int numplanes; 43 extern dplane_t dplanes[MAX_MAP_PLANES]; 44 45 extern int numnodes; 46 extern dnode_t dnodes[MAX_MAP_NODES]; 47 48 extern int numleafsurfaces; 49 extern int dleafsurfaces[MAX_MAP_LEAFFACES]; 50 51 extern int numleafbrushes; 52 extern int dleafbrushes[MAX_MAP_LEAFBRUSHES]; 53 54 extern int numbrushes; 55 extern dbrush_t dbrushes[MAX_MAP_BRUSHES]; 56 57 extern int numbrushsides; 58 extern dbrushside_t dbrushsides[MAX_MAP_BRUSHSIDES]; 59 60 extern int numLightBytes; 61 extern byte lightBytes[MAX_MAP_LIGHTING]; 62 63 extern int numGridPoints; 64 extern byte gridData[MAX_MAP_LIGHTGRID]; 65 66 extern int numVisBytes; 67 extern byte visBytes[MAX_MAP_VISIBILITY]; 68 69 extern int numDrawVerts; 70 extern drawVert_t drawVerts[MAX_MAP_DRAW_VERTS]; 71 72 extern int numDrawIndexes; 73 extern int drawIndexes[MAX_MAP_DRAW_INDEXES]; 74 75 extern int numDrawSurfaces; 76 extern dsurface_t drawSurfaces[MAX_MAP_DRAW_SURFS]; 77 78 extern int numFogs; 79 extern dfog_t dfogs[MAX_MAP_FOGS]; 80 81 void LoadBSPFile( const char *filename ); 82 void WriteBSPFile( const char *filename ); 83 void PrintBSPFileSizes( void ); 84 85 //=============== 86 87 88 typedef struct epair_s { 89 struct epair_s *next; 90 char *key; 91 char *value; 92 } epair_t; 93 94 typedef struct { 95 vec3_t origin; 96 struct bspbrush_s *brushes; 97 struct parseMesh_s *patches; 98 int firstDrawSurf; 99 epair_t *epairs; 100 } entity_t; 101 102 extern int num_entities; 103 extern entity_t entities[MAX_MAP_ENTITIES]; 104 105 void ParseEntities( void ); 106 void UnparseEntities( void ); 107 108 void SetKeyValue( entity_t *ent, const char *key, const char *value ); 109 const char *ValueForKey( const entity_t *ent, const char *key ); 110 // will return "" if not present 111 112 vec_t FloatForKey( const entity_t *ent, const char *key ); 113 void GetVectorForKey( const entity_t *ent, const char *key, vec3_t vec ); 114 115 epair_t *ParseEpair( void ); 116 117 void PrintEntity( const entity_t *ent ); 118