bspfile.h 3.1 KB

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