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