1 /* 2 Copyright (C) 1999-2006 Id Software, Inc. and contributors. 3 For a list of contributors, see the accompanying CONTRIBUTORS file. 4 5 This file is part of GtkRadiant. 6 7 GtkRadiant is free software; you can redistribute it and/or modify 8 it under the terms of the GNU General Public License as published by 9 the Free Software Foundation; either version 2 of the License, or 10 (at your option) any later version. 11 12 GtkRadiant is distributed in the hope that it will be useful, 13 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 GtkRadiant; if not, write to the Free Software 19 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 20 */ 21 22 #include "qfiles.h" 23 #include "surfaceflags.h" 24 25 extern int bsp_version; 26 27 extern int nummodels; 28 extern dmodel_t dmodels[MAX_MAP_MODELS]; 29 30 extern int numShaders; 31 extern dshader_t dshaders[MAX_MAP_MODELS]; 32 33 extern int entdatasize; 34 extern char dentdata[MAX_MAP_ENTSTRING]; 35 36 extern int numleafs; 37 extern dleaf_t dleafs[MAX_MAP_LEAFS]; 38 39 extern int numplanes; 40 extern dplane_t dplanes[MAX_MAP_PLANES]; 41 42 extern int numnodes; 43 extern dnode_t dnodes[MAX_MAP_NODES]; 44 45 extern int numleafsurfaces; 46 extern int dleafsurfaces[MAX_MAP_LEAFFACES]; 47 48 extern int numleafbrushes; 49 extern int dleafbrushes[MAX_MAP_LEAFBRUSHES]; 50 51 extern int numbrushes; 52 extern dbrush_t dbrushes[MAX_MAP_BRUSHES]; 53 54 extern int numbrushsides; 55 extern dbrushside_t dbrushsides[MAX_MAP_BRUSHSIDES]; 56 57 void SetLightBytes( int n ); 58 extern int numLightBytes; 59 extern byte *lightBytes; 60 61 void SetGridPoints( int n ); 62 extern int numGridPoints; 63 extern byte *gridData; 64 65 extern int numVisBytes; 66 extern byte visBytes[MAX_MAP_VISIBILITY]; 67 68 void SetDrawVerts( int n ); 69 void IncDrawVerts(); 70 extern int numDrawVerts; 71 extern drawVert_t *drawVerts; 72 73 extern int numDrawIndexes; 74 extern int drawIndexes[MAX_MAP_DRAW_INDEXES]; 75 76 void SetDrawSurfaces( int n ); 77 void SetDrawSurfacesBuffer(); 78 extern int numDrawSurfaces; 79 extern dsurface_t *drawSurfaces; 80 81 extern int numFogs; 82 extern dfog_t dfogs[MAX_MAP_FOGS]; 83 84 void LoadBSPFile( const char *filename ); 85 void WriteBSPFile( const char *filename ); 86 void PrintBSPFileSizes( void ); 87 88 //=============== 89 90 91 typedef struct epair_s { 92 struct epair_s *next; 93 char *key; 94 char *value; 95 } epair_t; 96 97 typedef struct { 98 vec3_t origin; 99 struct bspbrush_s *brushes; 100 struct parseMesh_s *patches; 101 int firstDrawSurf; 102 epair_t *epairs; 103 } entity_t; 104 105 extern int num_entities; 106 extern entity_t entities[MAX_MAP_ENTITIES]; 107 108 void ParseEntities( void ); 109 void UnparseEntities( void ); 110 111 void SetKeyValue( entity_t *ent, const char *key, const char *value ); 112 const char *ValueForKey( const entity_t *ent, const char *key ); 113 // will return "" if not present 114 115 vec_t FloatForKey( const entity_t *ent, const char *key ); 116 void GetVectorForKey( const entity_t *ent, const char *key, vec3_t vec ); 117 118 epair_t *ParseEpair( void ); 119 120 void PrintEntity( const entity_t *ent ); 121