]> icculus.org git repositories - divverent/netradiant.git/blob - tools/quake2/common/bspfile.h
initial
[divverent/netradiant.git] / tools / quake2 / common / bspfile.h
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
24
25 extern  int                     nummodels;
26 extern  dmodel_t        dmodels[MAX_MAP_MODELS];
27
28 extern  int                     visdatasize;
29 extern  byte            dvisdata[MAX_MAP_VISIBILITY];
30 extern  dvis_t          *dvis;
31
32 extern  int                     lightdatasize;
33 extern  byte            dlightdata[MAX_MAP_LIGHTING];
34
35 extern  int                     entdatasize;
36 extern  char            dentdata[MAX_MAP_ENTSTRING];
37
38 extern  int                     numleafs;
39 extern  dleaf_t         dleafs[MAX_MAP_LEAFS];
40
41 extern  int                     numplanes;
42 extern  dplane_t        dplanes[MAX_MAP_PLANES];
43
44 extern  int                     numvertexes;
45 extern  dvertex_t       dvertexes[MAX_MAP_VERTS];
46
47 extern  int                     numnodes;
48 extern  dnode_t         dnodes[MAX_MAP_NODES];
49
50 extern  int                     numtexinfo;
51 extern  texinfo_t       texinfo[MAX_MAP_TEXINFO];
52
53 extern  int                     numfaces;
54 extern  dface_t         dfaces[MAX_MAP_FACES];
55
56 extern  int                     numedges;
57 extern  dedge_t         dedges[MAX_MAP_EDGES];
58
59 extern  int                     numleaffaces;
60 extern  unsigned short  dleaffaces[MAX_MAP_LEAFFACES];
61
62 extern  int                     numleafbrushes;
63 extern  unsigned short  dleafbrushes[MAX_MAP_LEAFBRUSHES];
64
65 extern  int                     numsurfedges;
66 extern  int                     dsurfedges[MAX_MAP_SURFEDGES];
67
68 extern  int                     numareas;
69 extern  darea_t         dareas[MAX_MAP_AREAS];
70
71 extern  int                     numareaportals;
72 extern  dareaportal_t   dareaportals[MAX_MAP_AREAPORTALS];
73
74 extern  int                     numbrushes;
75 extern  dbrush_t        dbrushes[MAX_MAP_BRUSHES];
76
77 extern  int                     numbrushsides;
78 extern  dbrushside_t    dbrushsides[MAX_MAP_BRUSHSIDES];
79
80 extern  byte            dpop[256];
81
82 void DecompressVis (byte *in, byte *decompressed);
83 int CompressVis (byte *vis, byte *dest);
84
85 void    LoadBSPFile (char *filename);
86 void    LoadBSPFileTexinfo (char *filename);    // just for qdata
87 void    WriteBSPFile (char *filename);
88 void    PrintBSPFileSizes (void);
89
90 //===============
91
92
93 typedef struct epair_s
94 {
95         struct epair_s  *next;
96         char    *key;
97         char    *value;
98 } epair_t;
99
100 typedef struct
101 {
102         vec3_t          origin;
103         int                     firstbrush;
104         int                     numbrushes;
105         epair_t         *epairs;
106
107 // only valid for func_areaportals
108         int                     areaportalnum;
109         int                     portalareas[2];
110 } entity_t;
111
112 extern  int                     num_entities;
113 extern  entity_t        entities[MAX_MAP_ENTITIES];
114
115 void    ParseEntities (void);
116 void    UnparseEntities (void);
117
118 void    SetKeyValue (entity_t *ent, char *key, char *value);
119 char    *ValueForKey (entity_t *ent, char *key);
120 // will return "" if not present
121
122 vec_t   FloatForKey (entity_t *ent, char *key);
123 void    GetVectorForKey (entity_t *ent, char *key, vec3_t vec);
124
125 epair_t *ParseEpair (void);
126
127 void PrintEntity (entity_t *ent);
128