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
|
/*
Copyright (C) 1997-2001 Id Software, Inc.
This program 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.
This program 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 this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
//
// cmodel.h
//
// bitmasks communicated by server
#define MAX_MAP_AREA_BYTES ( MAX_MAP_AREAS / 8 )
#define MAX_MAP_PORTAL_BYTES MAX_MAP_AREA_BYTES
typedef struct {
bsp_t *cache;
int *floodnums; // if two areas have equal floodnums,
// they are connected
qboolean *portalopen;
} cm_t;
void CM_Init( void );
void CM_FreeMap( cm_t *cm );
qerror_t CM_LoadMap( cm_t *cm, const char *name );
int CM_NumClusters( cm_t *cm );
int CM_NumInlineModels( cm_t *cm );
char *CM_EntityString( cm_t *cm );
mnode_t *CM_NodeNum( cm_t *cm, int number );
mleaf_t *CM_LeafNum( cm_t *cm, int number );
#define CM_InlineModel( cm, name ) BSP_InlineModel( (cm)->cache, name )
#define CM_NumNode( cm, node ) ( (node) ? ( (node) - (cm)->cache->nodes ) : -1 )
// creates a clipping hull for an arbitrary box
mnode_t *CM_HeadnodeForBox( vec3_t mins, vec3_t maxs );
// returns an ORed contents mask
int CM_PointContents( vec3_t p, mnode_t *headnode );
int CM_TransformedPointContents( vec3_t p, mnode_t *headnode,
vec3_t origin, vec3_t angles );
void CM_BoxTrace( trace_t *trace, vec3_t start, vec3_t end,
vec3_t mins, vec3_t maxs,
mnode_t *headnode, int brushmask );
void CM_TransformedBoxTrace( trace_t *trace, vec3_t start, vec3_t end,
vec3_t mins, vec3_t maxs,
mnode_t * headnode, int brushmask,
vec3_t origin, vec3_t angles );
void CM_ClipEntity( trace_t *dst, const trace_t *src, struct edict_s *ent );
// call with topnode set to the headnode, returns with topnode
// set to the first node that splits the box
int CM_BoxLeafs( cm_t *cm, vec3_t mins, vec3_t maxs, mleaf_t **list,
int listsize, mnode_t **topnode );
mleaf_t *CM_PointLeaf( cm_t *cm, vec3_t p );
#define CM_LeafContents( leaf ) (leaf)->contents
#define CM_LeafCluster( leaf ) (leaf)->cluster
#define CM_LeafArea( leaf ) (leaf)->area
byte *CM_FatPVS( cm_t *cm, byte *mask, const vec3_t org );
void CM_SetAreaPortalState ( cm_t *cm, int portalnum, qboolean open );
qboolean CM_AreasConnected( cm_t *cm, int area1, int area2 );
int CM_WriteAreaBits( cm_t *cm, byte *buffer, int area );
int CM_WritePortalBits( cm_t *cm, byte *buffer );
void CM_SetPortalStates( cm_t *cm, byte *buffer, int bytes );
qboolean CM_HeadnodeVisible( mnode_t *headnode, byte *visbits );
void CM_WritePortalState( cm_t *cm, qhandle_t f );
void CM_ReadPortalState( cm_t *cm, qhandle_t f );
|