| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
#include "../qcommon/q_shared.h" |
| 33 |
|
| 34 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 71 |
typedef struct aas_entity_s |
| 72 |
{ |
| 73 |
|
| 74 |
aas_entityinfo_t i; |
| 75 |
|
| 76 |
aas_link_t *areas; |
| 77 |
|
| 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 |
|
| 126 |
typedef struct aas_routingcache_s |
| 127 |
{ |
| 128 |
byte type; |
| 129 |
float time; |
| 130 |
int size; |
| 131 |
int cluster; |
| 132 |
int areanum; |
| 133 |
vec3_t origin; |
| 134 |
float starttraveltime; |
| 135 |
int travelflags; |
| 136 |
struct aas_routingcache_s *prev, *next; |
| 137 |
struct aas_routingcache_s *time_prev, *time_next; |
| 138 |
unsigned char *reachabilities; |
| 139 |
unsigned short int traveltimes[1]; |
| 140 |
} aas_routingcache_t; |
| 141 |
|
| 142 |
|
| 143 |
typedef struct aas_routingupdate_s |
| 144 |
{ |
| 145 |
int cluster; |
| 146 |
int areanum; |
| 147 |
vec3_t start; |
| 148 |
unsigned short int tmptraveltime; |
| 149 |
unsigned short int *areatraveltimes; |
| 150 |
qboolean inlist; |
| 151 |
struct aas_routingupdate_s *next; |
| 152 |
struct aas_routingupdate_s *prev; |
| 153 |
} aas_routingupdate_t; |
| 154 |
|
| 155 |
|
| 156 |
typedef struct aas_reversedlink_s |
| 157 |
{ |
| 158 |
int linknum; |
| 159 |
int areanum; |
| 160 |
struct aas_reversedlink_s *next; |
| 161 |
} aas_reversedlink_t; |
| 162 |
|
| 163 |
|
| 164 |
typedef struct aas_reversedreachability_s |
| 165 |
{ |
| 166 |
int numlinks; |
| 167 |
aas_reversedlink_t *first; |
| 168 |
} aas_reversedreachability_t; |
| 169 |
|
| 170 |
|
| 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; |
| 179 |
int initialized; |
| 180 |
int savefile; |
| 181 |
int bspchecksum; |
| 182 |
|
| 183 |
float time; |
| 184 |
int numframes; |
| 185 |
|
| 186 |
char filename[MAX_QPATH]; |
| 187 |
char mapname[MAX_QPATH]; |
| 188 |
|
| 189 |
int numbboxes; |
| 190 |
aas_bbox_t *bboxes; |
| 191 |
|
| 192 |
int numvertexes; |
| 193 |
aas_vertex_t *vertexes; |
| 194 |
|
| 195 |
int numplanes; |
| 196 |
aas_plane_t *planes; |
| 197 |
|
| 198 |
int numedges; |
| 199 |
aas_edge_t *edges; |
| 200 |
|
| 201 |
int edgeindexsize; |
| 202 |
aas_edgeindex_t *edgeindex; |
| 203 |
|
| 204 |
int numfaces; |
| 205 |
aas_face_t *faces; |
| 206 |
|
| 207 |
int faceindexsize; |
| 208 |
aas_faceindex_t *faceindex; |
| 209 |
|
| 210 |
int numareas; |
| 211 |
aas_area_t *areas; |
| 212 |
|
| 213 |
int numareasettings; |
| 214 |
aas_areasettings_t *areasettings; |
| 215 |
|
| 216 |
int reachabilitysize; |
| 217 |
aas_reachability_t *reachability; |
| 218 |
|
| 219 |
int numnodes; |
| 220 |
aas_node_t *nodes; |
| 221 |
|
| 222 |
int numportals; |
| 223 |
aas_portal_t *portals; |
| 224 |
|
| 225 |
int portalindexsize; |
| 226 |
aas_portalindex_t *portalindex; |
| 227 |
|
| 228 |
int numclusters; |
| 229 |
aas_cluster_t *clusters; |
| 230 |
|
| 231 |
int numreachabilityareas; |
| 232 |
float reachabilitytime; |
| 233 |
|
| 234 |
aas_link_t *linkheap; |
| 235 |
int linkheapsize; |
| 236 |
aas_link_t *freelinks; |
| 237 |
aas_link_t **arealinkedentities; |
| 238 |
|
| 239 |
int maxentities; |
| 240 |
int maxclients; |
| 241 |
aas_entity_t *entities; |
| 242 |
|
| 243 |
int travelflagfortype[MAX_TRAVELTYPES]; |
| 244 |
|
| 245 |
int *areacontentstravelflags; |
| 246 |
|
| 247 |
aas_routingupdate_t *areaupdate; |
| 248 |
aas_routingupdate_t *portalupdate; |
| 249 |
|
| 250 |
int frameroutingupdates; |
| 251 |
|
| 252 |
aas_reversedreachability_t *reversedreachability; |
| 253 |
|
| 254 |
unsigned short ***areatraveltimes; |
| 255 |
|
| 256 |
aas_routingcache_t ***clusterareacache; |
| 257 |
aas_routingcache_t **portalcache; |
| 258 |
|
| 259 |
aas_routingcache_t *oldestcache; |
| 260 |
aas_routingcache_t *newestcache; |
| 261 |
|
| 262 |
int *portalmaxtraveltimes; |
| 263 |
|
| 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 |