1/*
2Copyright (C) 1996-1997 Id Software, Inc.
3
4This program is free software; you can redistribute it and/or
5modify it under the terms of the GNU General Public License
6as published by the Free Software Foundation; either version 2
7of the License, or (at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12
13See the GNU General Public License for more details.
14
15You should have received a copy of the GNU General Public License
16along with this program; if not, write to the Free Software
17Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
18
19*/
20// world.h
21
22typedef struct
23{
24	vec3_t	normal;
25	float	dist;
26} plane_t;
27
28typedef struct
29{
30	qboolean	allsolid;	// if true, plane is not valid
31	qboolean	startsolid;	// if true, the initial point was in a solid area
32	qboolean	inopen, inwater;
33	float	fraction;		// time completed, 1.0 = didn't hit anything
34	vec3_t	endpos;			// final position
35	plane_t	plane;			// surface normal at impact
36	edict_t	*ent;			// entity the surface is on
37} trace_t;
38
39
40#define	MOVE_NORMAL		0
41#define	MOVE_NOMONSTERS	1
42#define	MOVE_MISSILE	2
43
44typedef struct areanode_s
45{
46	int		axis;		// -1 = leaf node
47	float	dist;
48	struct areanode_s	*children[2];
49	link_t	trigger_edicts;
50	link_t	solid_edicts;
51} areanode_t;
52
53#define	AREA_DEPTH	4
54#define	AREA_NODES	32
55
56extern	areanode_t	sv_areanodes[AREA_NODES];
57
58
59void SV_ClearWorld (void);
60// called after the world model has been loaded, before linking any entities
61
62void SV_UnlinkEdict (edict_t *ent);
63// call before removing an entity, and before trying to move one,
64// so it doesn't clip against itself
65// flags ent->v.modified
66
67void SV_LinkEdict (edict_t *ent, qboolean touch_triggers);
68// Needs to be called any time an entity changes origin, mins, maxs, or solid
69// flags ent->v.modified
70// sets ent->v.absmin and ent->v.absmax
71// if touchtriggers, calls prog functions for the intersected triggers
72
73int SV_PointContents (vec3_t p);
74// returns the CONTENTS_* value from the world at the given point.
75// does not check any entities at all
76
77edict_t	*SV_TestEntityPosition (edict_t *ent);
78
79trace_t SV_Move (vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end, int type, edict_t *passedict);
80// mins and maxs are reletive
81
82// if the entire move stays in a solid volume, trace.allsolid will be set
83
84// if the starting point is in a solid, it will be allowed to move out
85// to an open area
86
87// nomonsters is used for line of sight or edge testing, where mosnters
88// shouldn't be considered solid objects
89
90// passedict is explicitly excluded from clipping checks (normally NULL)
91
92
93edict_t	*SV_TestPlayerPosition (edict_t *ent, vec3_t origin);
94