File: bspfile.h

package info (click to toggle)
openmohaa 0.81.1%2Bdfsg-2
  • links: PTS, VCS
  • area: contrib
  • in suites: trixie
  • size: 29,124 kB
  • sloc: ansic: 270,865; cpp: 250,173; sh: 234; asm: 141; xml: 64; makefile: 7
file content (150 lines) | stat: -rw-r--r-- 4,282 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
/*
===========================================================================
Copyright (C) 1999-2005 Id Software, Inc.

This file is part of Quake III Arena source code.

Quake III Arena source code 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.

Quake III Arena source code 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.

You should have received a copy of the GNU General Public License
along with Foobar; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
===========================================================================
*/

// su44: use qfiles.h from OpenMoHAA codebase
#include "../../../qcommon/qfiles.h"
#include "../../../qcommon/surfaceflags.h"

// su44: q3map-only limits added for MoHAA bsp structures
// These values are exacly the same as in MoHAA's q3map
#define MAX_MAP_SIDEEQATIONS 131072
#define MAX_TERRAIN_PATCHES 2048
#define MAX_LEAF_STATICMODELS 0x8000
#define MAX_STATIC_MODELS 4096
// these are from MoHlight
#define MAX_MAP_LIGHTGRIDDATA 4194304
// added by me...
#define MAX_MAP_SPHERELIGHTS 8192
#define MAX_MAP_STATICMODELVERTCOLORS 0x80000
// Note: there are 6163 lightdefs on mohdm1
#define MAX_LIGHTDEFS 16384

extern	int			nummodels;
extern	dmodel_t	dmodels[MAX_MAP_MODELS];

extern	int			numShaders;
extern	dshader_t	dshaders[MAX_MAP_MODELS];

extern	int			entdatasize;
extern	char		dentdata[MAX_MAP_ENTSTRING];

extern	int			numleafs;
extern	dleaf_t		dleafs[MAX_MAP_LEAFS];

extern	int			numplanes;
extern	dplane_t	dplanes[MAX_MAP_PLANES];

extern	int			numnodes;
extern	dnode_t		dnodes[MAX_MAP_NODES];

extern	int			numleafsurfaces;
extern	int			dleafsurfaces[MAX_MAP_LEAFFACES];

extern	int			numleafbrushes;
extern	int			dleafbrushes[MAX_MAP_LEAFBRUSHES];

extern	int			numbrushes;
extern	dbrush_t	dbrushes[MAX_MAP_BRUSHES];

extern	int			numbrushsides;
extern	dbrushside_t	dbrushsides[MAX_MAP_BRUSHSIDES];

extern	int			numLightBytes;
extern	byte		lightBytes[MAX_MAP_LIGHTING];

extern	int			numGridPoints;
extern	byte		gridData[MAX_MAP_LIGHTGRID];

extern	int			numVisBytes;
extern	byte		visBytes[MAX_MAP_VISIBILITY];

extern	int			numDrawVerts;
extern	drawVert_t	drawVerts[MAX_MAP_DRAW_VERTS];

extern	int			numDrawIndexes;
extern	int			drawIndexes[MAX_MAP_DRAW_INDEXES];

extern	int			numDrawSurfaces;
extern	dsurface_t	drawSurfaces[MAX_MAP_DRAW_SURFS];

extern	int			numFogs;
extern	dfog_t		dfogs[MAX_MAP_FOGS];

extern	int			numLeafStaticModels;
extern	short			dleafStaticModels[MAX_LEAF_STATICMODELS];

extern	int			numStaticModels;
extern	dstaticModel_t staticModels[MAX_STATIC_MODELS];

extern	int			numStaticModelVertColors;
extern	byte		staticModelVertColors[MAX_MAP_STATICMODELVERTCOLORS];

extern	int			numSideEquations;
extern	dsideEquation_t sideEquations[MAX_MAP_SIDEEQATIONS];

extern	int			numSphereLights;
extern	dspherel_t	sphereLights[MAX_MAP_SPHERELIGHTS];

extern	int			numTerraPatches;
extern	dterPatch_t	terraPatches[MAX_TERRAIN_PATCHES];

extern	int			numLightDefs;
extern	dlightdef_t	lightDefs[MAX_LIGHTDEFS];

void	LoadBSPFile( const char *filename );
void	WriteBSPFile( const char *filename );
void	PrintBSPFileSizes( void );

//===============


typedef struct epair_s {
	struct epair_s	*next;
	char	*key;
	char	*value;
} epair_t;

typedef struct {
	vec3_t		origin;
	struct bspbrush_s	*brushes;
	struct parseMesh_s	*patches;
	int			firstDrawSurf;
	epair_t		*epairs;
} entity_t;

extern	int			num_entities;
extern	entity_t	entities[MAX_MAP_ENTITIES];

void	ParseEntities( void );
void	UnparseEntities( void );

void 	SetKeyValue( entity_t *ent, const char *key, const char *value );
const char 	*ValueForKey( const entity_t *ent, const char *key );
// will return "" if not present

vec_t	FloatForKey( const entity_t *ent, const char *key );
void 	GetVectorForKey( const entity_t *ent, const char *key, vec3_t vec );

epair_t *ParseEpair( void );

void	PrintEntity( const entity_t *ent );