2007-11-04 03:34:51 +00:00
|
|
|
/*
|
2012-03-17 20:01:54 +00:00
|
|
|
Copyright (C) 1999-2007 id Software, Inc. and contributors.
|
|
|
|
For a list of contributors, see the accompanying CONTRIBUTORS file.
|
2007-11-04 03:34:51 +00:00
|
|
|
|
2012-03-17 20:01:54 +00:00
|
|
|
This file is part of GtkRadiant.
|
2007-11-04 03:34:51 +00:00
|
|
|
|
2012-03-17 20:01:54 +00:00
|
|
|
GtkRadiant is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
2007-11-04 03:34:51 +00:00
|
|
|
|
2012-03-17 20:01:54 +00:00
|
|
|
GtkRadiant is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
2007-11-04 03:34:51 +00:00
|
|
|
|
2012-03-17 20:01:54 +00:00
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with GtkRadiant; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
*/
|
2007-11-04 03:34:51 +00:00
|
|
|
|
|
|
|
#include "qfiles.h"
|
|
|
|
#include "surfaceflags.h"
|
|
|
|
|
2012-03-17 20:01:54 +00:00
|
|
|
extern int bsp_version;
|
2007-11-04 03:34:51 +00:00
|
|
|
|
2012-03-17 20:01:54 +00:00
|
|
|
extern int nummodels;
|
|
|
|
extern dmodel_t dmodels[MAX_MAP_MODELS];
|
2007-11-04 03:34:51 +00:00
|
|
|
|
2012-03-17 20:01:54 +00:00
|
|
|
extern int numShaders;
|
|
|
|
extern dshader_t dshaders[MAX_MAP_MODELS];
|
2007-11-04 03:34:51 +00:00
|
|
|
|
2012-03-17 20:01:54 +00:00
|
|
|
extern int entdatasize;
|
|
|
|
extern char dentdata[MAX_MAP_ENTSTRING];
|
2007-11-04 03:34:51 +00:00
|
|
|
|
2012-03-17 20:01:54 +00:00
|
|
|
extern int numleafs;
|
|
|
|
extern dleaf_t dleafs[MAX_MAP_LEAFS];
|
2007-11-04 03:34:51 +00:00
|
|
|
|
2012-03-17 20:01:54 +00:00
|
|
|
extern int numplanes;
|
|
|
|
extern dplane_t dplanes[MAX_MAP_PLANES];
|
2007-11-04 03:34:51 +00:00
|
|
|
|
2012-03-17 20:01:54 +00:00
|
|
|
extern int numnodes;
|
|
|
|
extern dnode_t dnodes[MAX_MAP_NODES];
|
2007-11-04 03:34:51 +00:00
|
|
|
|
2012-03-17 20:01:54 +00:00
|
|
|
extern int numleafsurfaces;
|
|
|
|
extern int dleafsurfaces[MAX_MAP_LEAFFACES];
|
2007-11-04 03:34:51 +00:00
|
|
|
|
2012-03-17 20:01:54 +00:00
|
|
|
extern int numleafbrushes;
|
|
|
|
extern int dleafbrushes[MAX_MAP_LEAFBRUSHES];
|
2007-11-04 03:34:51 +00:00
|
|
|
|
2012-03-17 20:01:54 +00:00
|
|
|
extern int numbrushes;
|
|
|
|
extern dbrush_t dbrushes[MAX_MAP_BRUSHES];
|
2007-11-04 03:34:51 +00:00
|
|
|
|
2012-03-17 20:01:54 +00:00
|
|
|
extern int numbrushsides;
|
|
|
|
extern dbrushside_t dbrushsides[MAX_MAP_BRUSHSIDES];
|
2007-11-04 03:34:51 +00:00
|
|
|
|
2012-03-17 20:01:54 +00:00
|
|
|
void SetLightBytes( int n );
|
|
|
|
extern int numLightBytes;
|
|
|
|
extern byte *lightBytes;
|
2007-11-04 03:34:51 +00:00
|
|
|
|
2012-03-17 20:01:54 +00:00
|
|
|
void SetGridPoints( int n );
|
|
|
|
extern int numGridPoints;
|
|
|
|
extern byte *gridData;
|
2007-11-04 03:34:51 +00:00
|
|
|
|
2012-03-17 20:01:54 +00:00
|
|
|
extern int numVisBytes;
|
|
|
|
extern byte visBytes[MAX_MAP_VISIBILITY];
|
2007-11-04 03:34:51 +00:00
|
|
|
|
2012-03-17 20:01:54 +00:00
|
|
|
void SetDrawVerts( int n );
|
2007-11-04 03:34:51 +00:00
|
|
|
void IncDrawVerts();
|
2012-03-17 20:01:54 +00:00
|
|
|
extern int numDrawVerts;
|
|
|
|
extern drawVert_t *drawVerts;
|
2007-11-04 03:34:51 +00:00
|
|
|
|
2012-03-17 20:01:54 +00:00
|
|
|
extern int numDrawIndexes;
|
|
|
|
extern int drawIndexes[MAX_MAP_DRAW_INDEXES];
|
2007-11-04 03:34:51 +00:00
|
|
|
|
2012-03-17 20:01:54 +00:00
|
|
|
void SetDrawSurfaces( int n );
|
2007-11-04 03:34:51 +00:00
|
|
|
void SetDrawSurfacesBuffer();
|
2012-03-17 20:01:54 +00:00
|
|
|
extern int numDrawSurfaces;
|
|
|
|
extern dsurface_t *drawSurfaces;
|
2007-11-04 03:34:51 +00:00
|
|
|
|
2012-03-17 20:01:54 +00:00
|
|
|
extern int numFogs;
|
|
|
|
extern dfog_t dfogs[MAX_MAP_FOGS];
|
2007-11-04 03:34:51 +00:00
|
|
|
|
2012-03-17 20:01:54 +00:00
|
|
|
void LoadBSPFile( const char *filename );
|
|
|
|
void WriteBSPFile( const char *filename );
|
|
|
|
void PrintBSPFileSizes( void );
|
2007-11-04 03:34:51 +00:00
|
|
|
|
|
|
|
//===============
|
|
|
|
|
|
|
|
|
|
|
|
typedef struct epair_s {
|
2012-03-17 20:01:54 +00:00
|
|
|
struct epair_s *next;
|
|
|
|
char *key;
|
|
|
|
char *value;
|
2007-11-04 03:34:51 +00:00
|
|
|
} epair_t;
|
|
|
|
|
|
|
|
typedef struct {
|
2012-03-17 20:01:54 +00:00
|
|
|
vec3_t origin;
|
|
|
|
struct bspbrush_s *brushes;
|
|
|
|
struct parseMesh_s *patches;
|
|
|
|
int firstDrawSurf;
|
|
|
|
epair_t *epairs;
|
2007-11-04 03:34:51 +00:00
|
|
|
} entity_t;
|
|
|
|
|
2012-03-17 20:01:54 +00:00
|
|
|
extern int num_entities;
|
|
|
|
extern entity_t entities[MAX_MAP_ENTITIES];
|
2007-11-04 03:34:51 +00:00
|
|
|
|
2012-03-17 20:01:54 +00:00
|
|
|
void ParseEntities( void );
|
|
|
|
void UnparseEntities( void );
|
2007-11-04 03:34:51 +00:00
|
|
|
|
2012-03-17 20:01:54 +00:00
|
|
|
void SetKeyValue( entity_t *ent, const char *key, const char *value );
|
|
|
|
const char *ValueForKey( const entity_t *ent, const char *key );
|
2007-11-04 03:34:51 +00:00
|
|
|
// will return "" if not present
|
|
|
|
|
2012-03-17 20:01:54 +00:00
|
|
|
vec_t FloatForKey( const entity_t *ent, const char *key );
|
|
|
|
void GetVectorForKey( const entity_t *ent, const char *key, vec3_t vec );
|
2007-11-04 03:34:51 +00:00
|
|
|
|
|
|
|
epair_t *ParseEpair( void );
|
|
|
|
|
2012-03-17 20:01:54 +00:00
|
|
|
void PrintEntity( const entity_t *ent );
|