]> icculus.org git repositories - divverent/darkplaces.git/blob - world.h
fixed a typo in cl_particles.c that happened to work in Linux (random() instead of...
[divverent/darkplaces.git] / world.h
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 // world.h
21
22 typedef struct
23 {
24         vec3_t  normal;
25         float   dist;
26 } plane_t;
27
28 typedef 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         int             startcontents;  // if not zero, treats this value as empty, and
38                                                         // all others as solid (impact on content change)
39         int             endcontents;    // set to the contents that was hit at the end point
40 } trace_t;
41
42
43 #define MOVE_NORMAL             0
44 #define MOVE_NOMONSTERS 1
45 #define MOVE_MISSILE    2
46
47
48 void SV_ClearWorld (void);
49 // called after the world model has been loaded, before linking any entities
50
51 void SV_UnlinkEdict (edict_t *ent);
52 // call before removing an entity, and before trying to move one,
53 // so it doesn't clip against itself
54 // flags ent->v.modified
55
56 void SV_LinkEdict (edict_t *ent, qboolean touch_triggers);
57 // Needs to be called any time an entity changes origin, mins, maxs, or solid
58 // flags ent->v.modified
59 // sets ent->v.absmin and ent->v.absmax
60 // if touchtriggers, calls prog functions for the intersected triggers
61
62 extern int SV_HullPointContents (hull_t *hull, int num, vec3_t p);
63 // LordHavoc: waste of time to wrap it
64 //int SV_PointContents (vec3_t p);
65 #define SV_PointContents(testpoint) SV_HullPointContents(&sv.worldmodel->hulls[0], 0, (testpoint))
66 // returns the CONTENTS_* value from the world at the given point.
67 // does not check any entities at all
68 // the non-true version remaps the water current contents to content_water
69
70 edict_t *SV_TestEntityPosition (edict_t *ent);
71
72 trace_t SV_Move (vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end, int type, edict_t *passedict);
73 // mins and maxs are reletive
74
75 // if the entire move stays in a solid volume, trace.allsolid will be set
76
77 // if the starting point is in a solid, it will be allowed to move out
78 // to an open area
79
80 // nomonsters is used for line of sight or edge testing, where mosnters
81 // shouldn't be considered solid objects
82
83 // passedict is explicitly excluded from clipping checks (normally NULL)
84
85 int SV_RecursiveHullCheck (int num, float p1f, float p2f, vec3_t p1, vec3_t p2);
86
87 typedef struct
88 {
89         hull_t *hull;
90         trace_t *trace;
91         vec3_t start;
92         vec3_t dist;
93 }
94 RecursiveHullCheckTraceInfo_t;
95
96 // LordHavoc: FIXME: this is not thread safe, if threading matters here, pass
97 // this as a struct to RecursiveHullCheck, RecursiveHullCheck_Impact, etc...
98 extern RecursiveHullCheckTraceInfo_t RecursiveHullCheckInfo;
99
100 // optimized variant of RecursiveHullCheck that only returns success/failure
101 // FIXME: broken, fix it
102 //extern qboolean SV_TestLine (hull_t *hull, int num, vec3_t p1, vec3_t p2);