Main Page | Class Hierarchy | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

aas_store.h File Reference

#include "../game/be_aas.h"
#include "../botlib/be_aas_def.h"

Include dependency graph for aas_store.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Defines

#define AAS_MAX_AREAS   65536
#define AAS_MAX_AREASETTINGS   65536
#define AAS_MAX_BBOXES   5
#define AAS_MAX_CLUSTERS   65536
#define AAS_MAX_EDGEINDEXSIZE   512000
#define AAS_MAX_EDGES   512000
#define AAS_MAX_FACEINDEXSIZE   512000
#define AAS_MAX_FACES   512000
#define AAS_MAX_NODES   256000
#define AAS_MAX_PLANES   65536
#define AAS_MAX_PORTALINDEXSIZE   65536
#define AAS_MAX_PORTALS   65536
#define AAS_MAX_REACHABILITYSIZE   65536
#define AAS_MAX_VERTEXES   512000
#define BSPCINCLUDE

Functions

void AAS_AllocMaxAAS (void)
qboolean AAS_FindPlane (vec3_t normal, float dist, int *planenum)
void AAS_FreeMaxAAS (void)
void AAS_StoreFile (char *filename)

Variables

aas_t aasworld


Define Documentation

#define AAS_MAX_AREAS   65536
 

Definition at line 30 of file aas_store.h.

#define AAS_MAX_AREASETTINGS   65536
 

Definition at line 31 of file aas_store.h.

#define AAS_MAX_BBOXES   5
 

Definition at line 23 of file aas_store.h.

#define AAS_MAX_CLUSTERS   65536
 

Definition at line 36 of file aas_store.h.

#define AAS_MAX_EDGEINDEXSIZE   512000
 

Definition at line 27 of file aas_store.h.

#define AAS_MAX_EDGES   512000
 

Definition at line 26 of file aas_store.h.

#define AAS_MAX_FACEINDEXSIZE   512000
 

Definition at line 29 of file aas_store.h.

#define AAS_MAX_FACES   512000
 

Definition at line 28 of file aas_store.h.

#define AAS_MAX_NODES   256000
 

Definition at line 33 of file aas_store.h.

#define AAS_MAX_PLANES   65536
 

Definition at line 25 of file aas_store.h.

#define AAS_MAX_PORTALINDEXSIZE   65536
 

Definition at line 35 of file aas_store.h.

#define AAS_MAX_PORTALS   65536
 

Definition at line 34 of file aas_store.h.

#define AAS_MAX_REACHABILITYSIZE   65536
 

Definition at line 32 of file aas_store.h.

#define AAS_MAX_VERTEXES   512000
 

Definition at line 24 of file aas_store.h.

#define BSPCINCLUDE
 

Definition at line 38 of file aas_store.h.


Function Documentation

void AAS_AllocMaxAAS void   ) 
 

Definition at line 144 of file aas_store.c.

References aas_area_t, aas_areasettings_t, aas_bbox_t, aas_cluster_t, aas_edge_t, aas_edgechain, aas_edgeindex_t, aas_face_t, aas_faceindex_t, aas_hashedges, aas_hashplanes, aas_hashverts, AAS_InitMaxAAS(), aas_node_t, aas_plane_t, aas_planechain, aas_portal_t, aas_portalindex_t, aas_reachability_t, aas_vertex_t, aas_vertexchain, aasworld, allocatedaasmem, aas_s::areas, aas_s::areasettings, aas_s::bboxes, aas_s::clusters, aas_s::edgeindex, aas_s::edgeindexsize, aas_s::edges, aas_s::faceindex, aas_s::faceindexsize, aas_s::faces, GetClearedMemory(), i, Log_Print(), max_aas, max_aas_s::max_areas, max_aas_s::max_areasettings, max_aas_s::max_bboxes, max_aas_s::max_clusters, max_aas_s::max_edgeindexsize, max_aas_s::max_edges, max_aas_s::max_faceindexsize, max_aas_s::max_faces, max_aas_s::max_nodes, max_aas_s::max_planes, max_aas_s::max_portalindexsize, max_aas_s::max_portals, max_aas_s::max_reachabilitysize, max_aas_s::max_vertexes, aas_s::nodes, aas_s::numareas, aas_s::numareasettings, aas_s::numbboxes, aas_s::numclusters, aas_s::numedges, aas_s::numfaces, aas_s::numnodes, aas_s::numplanes, aas_s::numportals, aas_s::numvertexes, aas_s::planes, aas_s::portalindex, aas_s::portalindexsize, aas_s::portals, PrintMemorySize(), aas_s::reachability, aas_s::reachabilitysize, VERTEX_HASH_SIZE, and aas_s::vertexes.

Referenced by AAS_StoreFile().

00145 {
00146     int i;
00147 
00148     AAS_InitMaxAAS();
00149     //bounding boxes
00150     aasworld.numbboxes = 0;
00151     aasworld.bboxes = (aas_bbox_t *) GetClearedMemory(max_aas.max_bboxes * sizeof(aas_bbox_t));
00152     allocatedaasmem += max_aas.max_bboxes * sizeof(aas_bbox_t);
00153     //vertexes
00154     aasworld.numvertexes = 0;
00155     aasworld.vertexes = (aas_vertex_t *) GetClearedMemory(max_aas.max_vertexes * sizeof(aas_vertex_t));
00156     allocatedaasmem += max_aas.max_vertexes * sizeof(aas_vertex_t);
00157     //planes
00158     aasworld.numplanes = 0;
00159     aasworld.planes = (aas_plane_t *) GetClearedMemory(max_aas.max_planes * sizeof(aas_plane_t));
00160     allocatedaasmem += max_aas.max_planes * sizeof(aas_plane_t);
00161     //edges
00162     aasworld.numedges = 0;
00163     aasworld.edges = (aas_edge_t *) GetClearedMemory(max_aas.max_edges * sizeof(aas_edge_t));
00164     allocatedaasmem += max_aas.max_edges * sizeof(aas_edge_t);
00165     //edge index
00166     aasworld.edgeindexsize = 0;
00167     aasworld.edgeindex = (aas_edgeindex_t *) GetClearedMemory(max_aas.max_edgeindexsize * sizeof(aas_edgeindex_t));
00168     allocatedaasmem += max_aas.max_edgeindexsize * sizeof(aas_edgeindex_t);
00169     //faces
00170     aasworld.numfaces = 0;
00171     aasworld.faces = (aas_face_t *) GetClearedMemory(max_aas.max_faces * sizeof(aas_face_t));
00172     allocatedaasmem += max_aas.max_faces * sizeof(aas_face_t);
00173     //face index
00174     aasworld.faceindexsize = 0;
00175     aasworld.faceindex = (aas_faceindex_t *) GetClearedMemory(max_aas.max_faceindexsize * sizeof(aas_faceindex_t));
00176     allocatedaasmem += max_aas.max_faceindexsize * sizeof(aas_faceindex_t);
00177     //convex areas
00178     aasworld.numareas = 0;
00179     aasworld.areas = (aas_area_t *) GetClearedMemory(max_aas.max_areas * sizeof(aas_area_t));
00180     allocatedaasmem += max_aas.max_areas * sizeof(aas_area_t);
00181     //convex area settings
00182     aasworld.numareasettings = 0;
00183     aasworld.areasettings = (aas_areasettings_t *) GetClearedMemory(max_aas.max_areasettings * sizeof(aas_areasettings_t));
00184     allocatedaasmem += max_aas.max_areasettings * sizeof(aas_areasettings_t);
00185     //reachablity list
00186     aasworld.reachabilitysize = 0;
00187     aasworld.reachability = (aas_reachability_t *) GetClearedMemory(max_aas.max_reachabilitysize * sizeof(aas_reachability_t));
00188     allocatedaasmem += max_aas.max_reachabilitysize * sizeof(aas_reachability_t);
00189     //nodes of the bsp tree
00190     aasworld.numnodes = 0;
00191     aasworld.nodes = (aas_node_t *) GetClearedMemory(max_aas.max_nodes * sizeof(aas_node_t));
00192     allocatedaasmem += max_aas.max_nodes * sizeof(aas_node_t);
00193     //cluster portals
00194     aasworld.numportals = 0;
00195     aasworld.portals = (aas_portal_t *) GetClearedMemory(max_aas.max_portals * sizeof(aas_portal_t));
00196     allocatedaasmem += max_aas.max_portals * sizeof(aas_portal_t);
00197     //cluster portal index
00198     aasworld.portalindexsize = 0;
00199     aasworld.portalindex = (aas_portalindex_t *) GetClearedMemory(max_aas.max_portalindexsize * sizeof(aas_portalindex_t));
00200     allocatedaasmem += max_aas.max_portalindexsize * sizeof(aas_portalindex_t);
00201     //cluster
00202     aasworld.numclusters = 0;
00203     aasworld.clusters = (aas_cluster_t *) GetClearedMemory(max_aas.max_clusters * sizeof(aas_cluster_t));
00204     allocatedaasmem += max_aas.max_clusters * sizeof(aas_cluster_t);
00205     //
00206     Log_Print("allocated ");
00207     PrintMemorySize(allocatedaasmem);
00208     Log_Print(" of AAS memory\n");
00209     //reset the has stuff
00210     aas_vertexchain = (int *) GetClearedMemory(max_aas.max_vertexes * sizeof(int));
00211     aas_planechain = (int *) GetClearedMemory(max_aas.max_planes * sizeof(int));
00212     aas_edgechain = (int *) GetClearedMemory(max_aas.max_edges * sizeof(int));
00213     //
00214     for (i = 0; i < max_aas.max_vertexes; i++) aas_vertexchain[i] = -1;
00215     for (i = 0; i < VERTEX_HASH_SIZE * VERTEX_HASH_SIZE; i++) aas_hashverts[i] = -1;
00216     //
00217     for (i = 0; i < max_aas.max_planes; i++) aas_planechain[i] = -1;
00218     for (i = 0; i < PLANE_HASH_SIZE; i++) aas_hashplanes[i] = -1;
00219     //
00220     for (i = 0; i < max_aas.max_edges; i++) aas_edgechain[i] = -1;
00221     for (i = 0; i < EDGE_HASH_SIZE; i++) aas_hashedges[i] = -1;
00222 } //end of the function AAS_AllocMaxAAS

Here is the call graph for this function:

qboolean AAS_FindPlane vec3_t  normal,
float  dist,
int *  planenum
 

Definition at line 634 of file aas_store.c.

References AAS_PlaneEqual(), aasworld, i, aas_s::numplanes, and qboolean.

00635 {
00636     int i;
00637 
00638     for (i = 0; i < aasworld.numplanes; i++)
00639     {
00640         if (AAS_PlaneEqual(normal, dist, i))
00641         {
00642             *planenum = i;
00643             return true;
00644         } //end if
00645     } //end for
00646     return false;
00647 } //end of the function AAS_FindPlane

Here is the call graph for this function:

void AAS_FreeMaxAAS void   ) 
 

Definition at line 229 of file aas_store.c.

References aas_edgechain, aas_planechain, aas_vertexchain, aasworld, allocatedaasmem, aas_s::areas, aas_s::areasettings, aas_s::bboxes, aas_s::clusters, aas_s::edgeindex, aas_s::edgeindexsize, aas_s::edges, aas_s::faceindex, aas_s::faceindexsize, aas_s::faces, FreeMemory(), Log_Print(), aas_s::nodes, aas_s::numareas, aas_s::numareasettings, aas_s::numbboxes, aas_s::numclusters, aas_s::numedges, aas_s::numfaces, aas_s::numnodes, aas_s::numplanes, aas_s::numportals, aas_s::numvertexes, aas_s::planes, aas_s::portalindex, aas_s::portalindexsize, aas_s::portals, PrintMemorySize(), aas_s::reachability, aas_s::reachabilitysize, and aas_s::vertexes.

Referenced by main().

00230 {
00231     //bounding boxes
00232     if (aasworld.bboxes) FreeMemory(aasworld.bboxes);
00233     aasworld.bboxes = NULL;
00234     aasworld.numbboxes = 0;
00235     //vertexes
00236     if (aasworld.vertexes) FreeMemory(aasworld.vertexes);
00237     aasworld.vertexes = NULL;
00238     aasworld.numvertexes = 0;
00239     //planes
00240     if (aasworld.planes) FreeMemory(aasworld.planes);
00241     aasworld.planes = NULL;
00242     aasworld.numplanes = 0;
00243     //edges
00244     if (aasworld.edges) FreeMemory(aasworld.edges);
00245     aasworld.edges = NULL;
00246     aasworld.numedges = 0;
00247     //edge index
00248     if (aasworld.edgeindex) FreeMemory(aasworld.edgeindex);
00249     aasworld.edgeindex = NULL;
00250     aasworld.edgeindexsize = 0;
00251     //faces
00252     if (aasworld.faces) FreeMemory(aasworld.faces);
00253     aasworld.faces = NULL;
00254     aasworld.numfaces = 0;
00255     //face index
00256     if (aasworld.faceindex) FreeMemory(aasworld.faceindex);
00257     aasworld.faceindex = NULL;
00258     aasworld.faceindexsize = 0;
00259     //convex areas
00260     if (aasworld.areas) FreeMemory(aasworld.areas);
00261     aasworld.areas = NULL;
00262     aasworld.numareas = 0;
00263     //convex area settings
00264     if (aasworld.areasettings) FreeMemory(aasworld.areasettings);
00265     aasworld.areasettings = NULL;
00266     aasworld.numareasettings = 0;
00267     //reachablity list
00268     if (aasworld.reachability) FreeMemory(aasworld.reachability);
00269     aasworld.reachability = NULL;
00270     aasworld.reachabilitysize = 0;
00271     //nodes of the bsp tree
00272     if (aasworld.nodes) FreeMemory(aasworld.nodes);
00273     aasworld.nodes = NULL;
00274     aasworld.numnodes = 0;
00275     //cluster portals
00276     if (aasworld.portals) FreeMemory(aasworld.portals);
00277     aasworld.portals = NULL;
00278     aasworld.numportals = 0;
00279     //cluster portal index
00280     if (aasworld.portalindex) FreeMemory(aasworld.portalindex);
00281     aasworld.portalindex = NULL;
00282     aasworld.portalindexsize = 0;
00283     //clusters
00284     if (aasworld.clusters) FreeMemory(aasworld.clusters);
00285     aasworld.clusters = NULL;
00286     aasworld.numclusters = 0;
00287     
00288     Log_Print("freed ");
00289     PrintMemorySize(allocatedaasmem);
00290     Log_Print(" of AAS memory\n");
00291     allocatedaasmem = 0;
00292     //
00293     if (aas_vertexchain) FreeMemory(aas_vertexchain);
00294     aas_vertexchain = NULL;
00295     if (aas_planechain) FreeMemory(aas_planechain);
00296     aas_planechain = NULL;
00297     if (aas_edgechain) FreeMemory(aas_edgechain);
00298     aas_edgechain = NULL;
00299 } //end of the function AAS_FreeMaxAAS

Here is the call graph for this function:

void AAS_StoreFile char *  filename  ) 
 

Definition at line 1068 of file aas_store.c.

References AAS_AllocMaxAAS(), AAS_StoreBoundingBoxes(), AAS_StoreTree_r(), aasworld, aas_s::loaded, Log_Write(), tmp_aas_s::nodes, aas_s::numareas, qprintf(), and tmpaasworld.

Referenced by AAS_Create().

01069 {
01070     AAS_AllocMaxAAS();
01071 
01072     Log_Write("AAS_StoreFile\r\n");
01073     //
01074     AAS_StoreBoundingBoxes();
01075     //
01076     qprintf("%6d areas stored", 0);
01077     //start with node 1 because node zero is a dummy
01078     AAS_StoreTree_r(tmpaasworld.nodes);
01079     qprintf("\n");
01080     Log_Write("%6d areas stored\r\n", aasworld.numareas);
01081     aasworld.loaded = true;
01082 } //end of the function AAS_StoreFile

Here is the call graph for this function:


Variable Documentation

aas_t aasworld
 

Definition at line 47 of file be_aas_main.c.


Generated on Thu Aug 25 12:46:46 2005 for Quake III Arena by  doxygen 1.3.9.1