00001 /* 00002 =========================================================================== 00003 Copyright (C) 1999-2005 Id Software, Inc. 00004 00005 This file is part of Quake III Arena source code. 00006 00007 Quake III Arena source code is free software; you can redistribute it 00008 and/or modify it under the terms of the GNU General Public License as 00009 published by the Free Software Foundation; either version 2 of the License, 00010 or (at your option) any later version. 00011 00012 Quake III Arena source code is distributed in the hope that it will be 00013 useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 GNU General Public License for more details. 00016 00017 You should have received a copy of the GNU General Public License 00018 along with Foobar; if not, write to the Free Software 00019 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00020 =========================================================================== 00021 */ 00022 00023 /***************************************************************************** 00024 * name: be_aas_def.h 00025 * 00026 * desc: AAS 00027 * 00028 * $Archive: /source/code/botlib/be_aas_def.h $ 00029 * 00030 *****************************************************************************/ 00031 00032 //debugging on 00033 #define AAS_DEBUG 00034 00035 #define MAX_CLIENTS 64 00036 #define MAX_MODELS 256 // these are sent over the net as 8 bits 00037 #define MAX_SOUNDS 256 // so they cannot be blindly increased 00038 #define MAX_CONFIGSTRINGS 1024 00039 00040 #define CS_SCORES 32 00041 #define CS_MODELS (CS_SCORES+MAX_CLIENTS) 00042 #define CS_SOUNDS (CS_MODELS+MAX_MODELS) 00043 00044 #define DF_AASENTNUMBER(x) (x - aasworld.entities) 00045 #define DF_NUMBERAASENT(x) (&aasworld.entities[x]) 00046 #define DF_AASENTCLIENT(x) (x - aasworld.entities - 1) 00047 #define DF_CLIENTAASENT(x) (&aasworld.entities[x + 1]) 00048 00049 #ifndef MAX_PATH 00050 #define MAX_PATH MAX_QPATH 00051 #endif 00052 00053 //string index (for model, sound and image index) 00054 typedef struct aas_stringindex_s 00055 { 00056 int numindexes; 00057 char **index; 00058 } aas_stringindex_t; 00059 00060 //structure to link entities to areas and areas to entities 00061 typedef struct aas_link_s 00062 { 00063 int entnum; 00064 int areanum; 00065 struct aas_link_s *next_ent, *prev_ent; 00066 struct aas_link_s *next_area, *prev_area; 00067 } aas_link_t; 00068 00069 //structure to link entities to leaves and leaves to entities 00070 typedef struct bsp_link_s 00071 { 00072 int entnum; 00073 int leafnum; 00074 struct bsp_link_s *next_ent, *prev_ent; 00075 struct bsp_link_s *next_leaf, *prev_leaf; 00076 } bsp_link_t; 00077 00078 typedef struct bsp_entdata_s 00079 { 00080 vec3_t origin; 00081 vec3_t angles; 00082 vec3_t absmins; 00083 vec3_t absmaxs; 00084 int solid; 00085 int modelnum; 00086 } bsp_entdata_t; 00087 00088 //entity 00089 typedef struct aas_entity_s 00090 { 00091 //entity info 00092 aas_entityinfo_t i; 00093 //links into the AAS areas 00094 aas_link_t *areas; 00095 //links into the BSP leaves 00096 bsp_link_t *leaves; 00097 } aas_entity_t; 00098 00099 typedef struct aas_settings_s 00100 { 00101 vec3_t phys_gravitydirection; 00102 float phys_friction; 00103 float phys_stopspeed; 00104 float phys_gravity; 00105 float phys_waterfriction; 00106 float phys_watergravity; 00107 float phys_maxvelocity; 00108 float phys_maxwalkvelocity; 00109 float phys_maxcrouchvelocity; 00110 float phys_maxswimvelocity; 00111 float phys_walkaccelerate; 00112 float phys_airaccelerate; 00113 float phys_swimaccelerate; 00114 float phys_maxstep; 00115 float phys_maxsteepness; 00116 float phys_maxwaterjump; 00117 float phys_maxbarrier; 00118 float phys_jumpvel; 00119 float phys_falldelta5; 00120 float phys_falldelta10; 00121 float rs_waterjump; 00122 float rs_teleport; 00123 float rs_barrierjump; 00124 float rs_startcrouch; 00125 float rs_startgrapple; 00126 float rs_startwalkoffledge; 00127 float rs_startjump; 00128 float rs_rocketjump; 00129 float rs_bfgjump; 00130 float rs_jumppad; 00131 float rs_aircontrolledjumppad; 00132 float rs_funcbob; 00133 float rs_startelevator; 00134 float rs_falldamage5; 00135 float rs_falldamage10; 00136 float rs_maxfallheight; 00137 float rs_maxjumpfallheight; 00138 } aas_settings_t; 00139 00140 #define CACHETYPE_PORTAL 0 00141 #define CACHETYPE_AREA 1 00142 00143 //routing cache 00144 typedef struct aas_routingcache_s 00145 { 00146 byte type; //portal or area cache 00147 float time; //last time accessed or updated 00148 int size; //size of the routing cache 00149 int cluster; //cluster the cache is for 00150 int areanum; //area the cache is created for 00151 vec3_t origin; //origin within the area 00152 float starttraveltime; //travel time to start with 00153 int travelflags; //combinations of the travel flags 00154 struct aas_routingcache_s *prev, *next; 00155 struct aas_routingcache_s *time_prev, *time_next; 00156 unsigned char *reachabilities; //reachabilities used for routing 00157 unsigned short int traveltimes[1]; //travel time for every area (variable sized) 00158 } aas_routingcache_t; 00159 00160 //fields for the routing algorithm 00161 typedef struct aas_routingupdate_s 00162 { 00163 int cluster; 00164 int areanum; //area number of the update 00165 vec3_t start; //start point the area was entered 00166 unsigned short int tmptraveltime; //temporary travel time 00167 unsigned short int *areatraveltimes; //travel times within the area 00168 qboolean inlist; //true if the update is in the list 00169 struct aas_routingupdate_s *next; 00170 struct aas_routingupdate_s *prev; 00171 } aas_routingupdate_t; 00172 00173 //reversed reachability link 00174 typedef struct aas_reversedlink_s 00175 { 00176 int linknum; //the aas_areareachability_t 00177 int areanum; //reachable from this area 00178 struct aas_reversedlink_s *next; //next link 00179 } aas_reversedlink_t; 00180 00181 //reversed area reachability 00182 typedef struct aas_reversedreachability_s 00183 { 00184 int numlinks; 00185 aas_reversedlink_t *first; 00186 } aas_reversedreachability_t; 00187 00188 //areas a reachability goes through 00189 typedef struct aas_reachabilityareas_s 00190 { 00191 int firstarea, numareas; 00192 } aas_reachabilityareas_t; 00193 00194 typedef struct aas_s 00195 { 00196 int loaded; //true when an AAS file is loaded 00197 int initialized; //true when AAS has been initialized 00198 int savefile; //set true when file should be saved 00199 int bspchecksum; 00200 //current time 00201 float time; 00202 int numframes; 00203 //name of the aas file 00204 char filename[MAX_PATH]; 00205 char mapname[MAX_PATH]; 00206 //bounding boxes 00207 int numbboxes; 00208 aas_bbox_t *bboxes; 00209 //vertexes 00210 int numvertexes; 00211 aas_vertex_t *vertexes; 00212 //planes 00213 int numplanes; 00214 aas_plane_t *planes; 00215 //edges 00216 int numedges; 00217 aas_edge_t *edges; 00218 //edge index 00219 int edgeindexsize; 00220 aas_edgeindex_t *edgeindex; 00221 //faces 00222 int numfaces; 00223 aas_face_t *faces; 00224 //face index 00225 int faceindexsize; 00226 aas_faceindex_t *faceindex; 00227 //convex areas 00228 int numareas; 00229 aas_area_t *areas; 00230 //convex area settings 00231 int numareasettings; 00232 aas_areasettings_t *areasettings; 00233 //reachablity list 00234 int reachabilitysize; 00235 aas_reachability_t *reachability; 00236 //nodes of the bsp tree 00237 int numnodes; 00238 aas_node_t *nodes; 00239 //cluster portals 00240 int numportals; 00241 aas_portal_t *portals; 00242 //cluster portal index 00243 int portalindexsize; 00244 aas_portalindex_t *portalindex; 00245 //clusters 00246 int numclusters; 00247 aas_cluster_t *clusters; 00248 // 00249 int numreachabilityareas; 00250 float reachabilitytime; 00251 //enities linked in the areas 00252 aas_link_t *linkheap; //heap with link structures 00253 int linkheapsize; //size of the link heap 00254 aas_link_t *freelinks; //first free link 00255 aas_link_t **arealinkedentities; //entities linked into areas 00256 //entities 00257 int maxentities; 00258 int maxclients; 00259 aas_entity_t *entities; 00260 //string indexes 00261 char *configstrings[MAX_CONFIGSTRINGS]; 00262 int indexessetup; 00263 //index to retrieve travel flag for a travel type 00264 int travelflagfortype[MAX_TRAVELTYPES]; 00265 //travel flags for each area based on contents 00266 int *areacontentstravelflags; 00267 //routing update 00268 aas_routingupdate_t *areaupdate; 00269 aas_routingupdate_t *portalupdate; 00270 //number of routing updates during a frame (reset every frame) 00271 int frameroutingupdates; 00272 //reversed reachability links 00273 aas_reversedreachability_t *reversedreachability; 00274 //travel times within the areas 00275 unsigned short ***areatraveltimes; 00276 //array of size numclusters with cluster cache 00277 aas_routingcache_t ***clusterareacache; 00278 aas_routingcache_t **portalcache; 00279 //cache list sorted on time 00280 aas_routingcache_t *oldestcache; // start of cache list sorted on time 00281 aas_routingcache_t *newestcache; // end of cache list sorted on time 00282 //maximum travel time through portal areas 00283 int *portalmaxtraveltimes; 00284 //areas the reachabilities go through 00285 int *reachabilityareaindex; 00286 aas_reachabilityareas_t *reachabilityareas; 00287 } aas_t; 00288 00289 #define AASINTERN 00290 00291 #ifndef BSPCINCLUDE 00292 00293 #include "be_aas_main.h" 00294 #include "be_aas_entity.h" 00295 #include "be_aas_sample.h" 00296 #include "be_aas_cluster.h" 00297 #include "be_aas_reach.h" 00298 #include "be_aas_route.h" 00299 #include "be_aas_routealt.h" 00300 #include "be_aas_debug.h" 00301 #include "be_aas_file.h" 00302 #include "be_aas_optimize.h" 00303 #include "be_aas_bsp.h" 00304 #include "be_aas_move.h" 00305 00306 #endif //BSPCINCLUDE
1.3.9.1