Debian Codegraph @

code/botlib/be_aas_def.h

raw symbols SCIP
1 /*
2 ===========================================================================
3 Copyright (C) 1999-2005 Id Software, Inc.
4
5 This file is part of Quake III Arena source code.
6
7 Quake III Arena source code is free software; you can redistribute it
8 and/or modify it under the terms of the GNU General Public License as
9 published by the Free Software Foundation; either version 2 of the License,
10 or (at your option) any later version.
11
12 Quake III Arena source code is distributed in the hope that it will be
13 useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with Quake III Arena source code; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 ===========================================================================
21 */
22
23 /*****************************************************************************
24 * name: be_aas_def.h
25 *
26 * desc: AAS
27 *
28 * $Archive: /source/code/botlib/be_aas_def.h $
29 *
30 *****************************************************************************/
31
32 #include "../qcommon/q_shared.h"
33
34 //debugging on
35 #define AAS_DEBUG
36
37 #define DF_AASENTNUMBER(x) (x - aasworld.entities)
38 #define DF_NUMBERAASENT(x) (&aasworld.entities[x])
39 #define DF_AASENTCLIENT(x) (x - aasworld.entities - 1)
40 #define DF_CLIENTAASENT(x) (&aasworld.entities[x + 1])
41
42 //structure to link entities to areas and areas to entities
43 typedef struct aas_link_s
44 {
45 int entnum;
46 int areanum;
47 struct aas_link_s *next_ent, *prev_ent;
48 struct aas_link_s *next_area, *prev_area;
49 } aas_link_t;
50
51 //structure to link entities to leaves and leaves to entities
52 typedef struct bsp_link_s
53 {
54 int entnum;
55 int leafnum;
56 struct bsp_link_s *next_ent, *prev_ent;
57 struct bsp_link_s *next_leaf, *prev_leaf;
58 } bsp_link_t;
59
60 typedef struct bsp_entdata_s
61 {
62 vec3_t origin;
63 vec3_t angles;
64 vec3_t absmins;
65 vec3_t absmaxs;
66 int solid;
67 int modelnum;
68 } bsp_entdata_t;
69
70 //entity
71 typedef struct aas_entity_s
72 {
73 //entity info
74 aas_entityinfo_t i;
75 //links into the AAS areas
76 aas_link_t *areas;
77 //links into the BSP leaves
78 bsp_link_t *leaves;
79 } aas_entity_t;
80
81 typedef struct aas_settings_s
82 {
83 vec3_t phys_gravitydirection;
84 float phys_friction;
85 float phys_stopspeed;
86 float phys_gravity;
87 float phys_waterfriction;
88 float phys_watergravity;
89 float phys_maxvelocity;
90 float phys_maxwalkvelocity;
91 float phys_maxcrouchvelocity;
92 float phys_maxswimvelocity;
93 float phys_walkaccelerate;
94 float phys_airaccelerate;
95 float phys_swimaccelerate;
96 float phys_maxstep;
97 float phys_maxsteepness;
98 float phys_maxwaterjump;
99 float phys_maxbarrier;
100 float phys_jumpvel;
101 float phys_falldelta5;
102 float phys_falldelta10;
103 float rs_waterjump;
104 float rs_teleport;
105 float rs_barrierjump;
106 float rs_startcrouch;
107 float rs_startgrapple;
108 float rs_startwalkoffledge;
109 float rs_startjump;
110 float rs_rocketjump;
111 float rs_bfgjump;
112 float rs_jumppad;
113 float rs_aircontrolledjumppad;
114 float rs_funcbob;
115 float rs_startelevator;
116 float rs_falldamage5;
117 float rs_falldamage10;
118 float rs_maxfallheight;
119 float rs_maxjumpfallheight;
120 } aas_settings_t;
121
122 #define CACHETYPE_PORTAL 0
123 #define CACHETYPE_AREA 1
124
125 //routing cache
126 typedef struct aas_routingcache_s
127 {
128 byte type; //portal or area cache
129 float time; //last time accessed or updated
130 int size; //size of the routing cache
131 int cluster; //cluster the cache is for
132 int areanum; //area the cache is created for
133 vec3_t origin; //origin within the area
134 float starttraveltime; //travel time to start with
135 int travelflags; //combinations of the travel flags
136 struct aas_routingcache_s *prev, *next;
137 struct aas_routingcache_s *time_prev, *time_next;
138 unsigned char *reachabilities; //reachabilities used for routing
139 unsigned short int traveltimes[1]; //travel time for every area (variable sized)
140 } aas_routingcache_t;
141
142 //fields for the routing algorithm
143 typedef struct aas_routingupdate_s
144 {
145 int cluster;
146 int areanum; //area number of the update
147 vec3_t start; //start point the area was entered
148 unsigned short int tmptraveltime; //temporary travel time
149 unsigned short int *areatraveltimes; //travel times within the area
150 qboolean inlist; //true if the update is in the list
151 struct aas_routingupdate_s *next;
152 struct aas_routingupdate_s *prev;
153 } aas_routingupdate_t;
154
155 //reversed reachability link
156 typedef struct aas_reversedlink_s
157 {
158 int linknum; //the aas_areareachability_t
159 int areanum; //reachable from this area
160 struct aas_reversedlink_s *next; //next link
161 } aas_reversedlink_t;
162
163 //reversed area reachability
164 typedef struct aas_reversedreachability_s
165 {
166 int numlinks;
167 aas_reversedlink_t *first;
168 } aas_reversedreachability_t;
169
170 //areas a reachability goes through
171 typedef struct aas_reachabilityareas_s
172 {
173 int firstarea, numareas;
174 } aas_reachabilityareas_t;
175
176 typedef struct aas_s
177 {
178 int loaded; //true when an AAS file is loaded
179 int initialized; //true when AAS has been initialized
180 int savefile; //set true when file should be saved
181 int bspchecksum;
182 //current time
183 float time;
184 int numframes;
185 //name of the aas file
186 char filename[MAX_QPATH];
187 char mapname[MAX_QPATH];
188 //bounding boxes
189 int numbboxes;
190 aas_bbox_t *bboxes;
191 //vertexes
192 int numvertexes;
193 aas_vertex_t *vertexes;
194 //planes
195 int numplanes;
196 aas_plane_t *planes;
197 //edges
198 int numedges;
199 aas_edge_t *edges;
200 //edge index
201 int edgeindexsize;
202 aas_edgeindex_t *edgeindex;
203 //faces
204 int numfaces;
205 aas_face_t *faces;
206 //face index
207 int faceindexsize;
208 aas_faceindex_t *faceindex;
209 //convex areas
210 int numareas;
211 aas_area_t *areas;
212 //convex area settings
213 int numareasettings;
214 aas_areasettings_t *areasettings;
215 //reachablity list
216 int reachabilitysize;
217 aas_reachability_t *reachability;
218 //nodes of the bsp tree
219 int numnodes;
220 aas_node_t *nodes;
221 //cluster portals
222 int numportals;
223 aas_portal_t *portals;
224 //cluster portal index
225 int portalindexsize;
226 aas_portalindex_t *portalindex;
227 //clusters
228 int numclusters;
229 aas_cluster_t *clusters;
230 //
231 int numreachabilityareas;
232 float reachabilitytime;
233 //enities linked in the areas
234 aas_link_t *linkheap; //heap with link structures
235 int linkheapsize; //size of the link heap
236 aas_link_t *freelinks; //first free link
237 aas_link_t **arealinkedentities; //entities linked into areas
238 //entities
239 int maxentities;
240 int maxclients;
241 aas_entity_t *entities;
242 //index to retrieve travel flag for a travel type
243 int travelflagfortype[MAX_TRAVELTYPES];
244 //travel flags for each area based on contents
245 int *areacontentstravelflags;
246 //routing update
247 aas_routingupdate_t *areaupdate;
248 aas_routingupdate_t *portalupdate;
249 //number of routing updates during a frame (reset every frame)
250 int frameroutingupdates;
251 //reversed reachability links
252 aas_reversedreachability_t *reversedreachability;
253 //travel times within the areas
254 unsigned short ***areatraveltimes;
255 //array of size numclusters with cluster cache
256 aas_routingcache_t ***clusterareacache;
257 aas_routingcache_t **portalcache;
258 //cache list sorted on time
259 aas_routingcache_t *oldestcache; // start of cache list sorted on time
260 aas_routingcache_t *newestcache; // end of cache list sorted on time
261 //maximum travel time through portal areas
262 int *portalmaxtraveltimes;
263 //areas the reachabilities go through
264 int *reachabilityareaindex;
265 aas_reachabilityareas_t *reachabilityareas;
266 } aas_t;
267
268 #define AASINTERN
269
270 #ifndef BSPCINCLUDE
271
272 #include "be_aas_main.h"
273 #include "be_aas_entity.h"
274 #include "be_aas_sample.h"
275 #include "be_aas_cluster.h"
276 #include "be_aas_reach.h"
277 #include "be_aas_route.h"
278 #include "be_aas_routealt.h"
279 #include "be_aas_debug.h"
280 #include "be_aas_file.h"
281 #include "be_aas_optimize.h"
282 #include "be_aas_bsp.h"
283 #include "be_aas_move.h"
284
285 #endif //BSPCINCLUDE