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

be_aas_bspc.c File Reference

#include "../game/q_shared.h"
#include "../bspc/l_log.h"
#include "../bspc/l_qfiles.h"
#include "../botlib/l_memory.h"
#include "../botlib/l_script.h"
#include "../botlib/l_precomp.h"
#include "../botlib/l_struct.h"
#include "../botlib/aasfile.h"
#include "../game/botlib.h"
#include "../game/be_aas.h"
#include "../botlib/be_aas_def.h"
#include "../qcommon/cm_public.h"

Include dependency graph for be_aas_bspc.c:

Include dependency graph

Go to the source code of this file.

Functions

void AAS_CalcReachAndClusters (struct quakefile_s *qf)
void AAS_ClearShownDebugLines (void)
void AAS_DebugLine (vec3_t start, vec3_t end, int color)
void AAS_Error (char *fmt,...)
void AAS_InitBotImport (void)
char * BotImport_BSPEntityData (void)
void BotImport_BSPModelMinsMaxsOrigin (int modelnum, vec3_t angles, vec3_t outmins, vec3_t outmaxs, vec3_t origin)
void * BotImport_GetMemory (int size)
int BotImport_PointContents (vec3_t p)
void BotImport_Print (int type, char *fmt,...)
void BotImport_Trace (bsp_trace_t *bsptrace, vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end, int passent, int contentmask)
int COM_Compress (char *data_p)
void Com_DPrintf (char *fmt,...)
void Com_Memcpy (void *dest, const void *src, const size_t count)
void Com_Memset (void *dest, const int val, const size_t count)
void Error (char *error,...)
int Sys_MilliSeconds (void)

Variables

botlib_import_t botimport
qboolean capsule_collision
clipHandle_t worldmodel


Function Documentation

void AAS_CalcReachAndClusters struct quakefile_s qf  ) 
 

Definition at line 260 of file be_aas_bspc.c.

References AAS_ContinueInitReachability(), AAS_InitAASLinkedEntities(), AAS_InitAASLinkHeap(), AAS_InitBotImport(), AAS_InitClustering(), AAS_InitReachability(), AAS_InitSettings(), AAS_LoadBSPFile(), AAS_SetViewPortalsAsClusterPortals(), aasworld, aas_s::bspchecksum, CM_InlineModel(), CM_LoadMap(), quakefile_s::filename, Log_Print(), aas_s::numclusters, quakefile_s::pakfile, qfalse, aas_s::reachabilitysize, strcpy(), time(), and worldmodel.

Referenced by main().

00261 {
00262     float time;
00263 
00264     Log_Print("loading collision map...\n");
00265     //
00266     if (!qf->pakfile[0]) strcpy(qf->pakfile, qf->filename);
00267     //load the map
00268     CM_LoadMap((char *) qf, qfalse, &aasworld.bspchecksum);
00269     //get a handle to the world model
00270     worldmodel = CM_InlineModel(0);     // 0 = world, 1 + are bmodels
00271     //initialize bot import structure
00272     AAS_InitBotImport();
00273     //load the BSP entity string
00274     AAS_LoadBSPFile();
00275     //init physics settings
00276     AAS_InitSettings();
00277     //initialize AAS link heap
00278     AAS_InitAASLinkHeap();
00279     //initialize the AAS linked entities for the new map
00280     AAS_InitAASLinkedEntities();
00281     //reset all reachabilities and clusters
00282     aasworld.reachabilitysize = 0;
00283     aasworld.numclusters = 0;
00284     //set all view portals as cluster portals in case we re-calculate the reachabilities and clusters (with -reach)
00285     AAS_SetViewPortalsAsClusterPortals();
00286     //calculate reachabilities
00287     AAS_InitReachability();
00288     time = 0;
00289     while(AAS_ContinueInitReachability(time)) time++;
00290     //calculate clusters
00291     AAS_InitClustering();
00292 } //end of the function AAS_CalcReachAndClusters

Here is the call graph for this function:

void AAS_ClearShownDebugLines void   ) 
 

Definition at line 88 of file be_aas_bspc.c.

References botimport, botlib_import_s::DebugLineDelete, debuglines, debuglinevisible, and i.

00089 {
00090 } //end of the function AAS_ClearShownDebugLines

void AAS_DebugLine vec3_t  start,
vec3_t  end,
int  color
 

Definition at line 79 of file be_aas_bspc.c.

References botimport, botlib_import_s::DebugLineCreate, debuglines, botlib_import_s::DebugLineShow, debuglinevisible, line, and numdebuglines.

Referenced by AAS_ClientMovementPrediction(), AAS_DrawArrow(), AAS_DrawCross(), AAS_DrawPermanentCross(), and AAS_ShowFace().

00080 {
00081 } //end of the function AAS_DebugLine

void AAS_Error char *  fmt,
  ...
 

Definition at line 52 of file be_aas_bspc.c.

References Error(), va_end, va_list, va_start, and vsprintf().

00053 {
00054     va_list argptr;
00055     char text[1024];
00056 
00057     va_start(argptr, fmt);
00058     vsprintf(text, fmt, argptr);
00059     va_end(argptr);
00060 
00061     Error(text);
00062 } //end of the function AAS_Error

Here is the call graph for this function:

void AAS_InitBotImport void   ) 
 

Definition at line 244 of file be_aas_bspc.c.

References botimport, botlib_import_s::BSPEntityData, botlib_import_s::BSPModelMinsMaxsOrigin, botlib_import_s::FreeMemory, botlib_import_s::GetMemory, botlib_import_s::PointContents, and botlib_import_s::Trace.

Referenced by AAS_CalcReachAndClusters(), and main().

00245 {
00246     botimport.BSPEntityData = BotImport_BSPEntityData;
00247     botimport.GetMemory = BotImport_GetMemory;
00248     botimport.FreeMemory = FreeMemory;
00249     botimport.Trace = BotImport_Trace;
00250     botimport.PointContents = BotImport_PointContents;
00251     botimport.Print = BotImport_Print;
00252     botimport.BSPModelMinsMaxsOrigin = BotImport_BSPModelMinsMaxsOrigin;
00253 } //end of the function AAS_InitBotImport

char* BotImport_BSPEntityData void   ) 
 

Definition at line 97 of file be_aas_bspc.c.

References CM_EntityString().

00098 {
00099     return CM_EntityString();
00100 } //end of the function AAS_GetEntityData

Here is the call graph for this function:

void BotImport_BSPModelMinsMaxsOrigin int  modelnum,
vec3_t  angles,
vec3_t  outmins,
vec3_t  outmaxs,
vec3_t  origin
 

Definition at line 170 of file be_aas_bspc.c.

References clipHandle_t, CM_InlineModel(), CM_ModelBounds(), h(), i, max, RadiusFromBounds(), vec3_t, VectorClear, and VectorCopy.

00171 {
00172     clipHandle_t h;
00173     vec3_t mins, maxs;
00174     float max;
00175     int i;
00176 
00177     h = CM_InlineModel(modelnum);
00178     CM_ModelBounds(h, mins, maxs);
00179     //if the model is rotated
00180     if ((angles[0] || angles[1] || angles[2]))
00181     {   // expand for rotation
00182 
00183         max = RadiusFromBounds(mins, maxs);
00184         for (i = 0; i < 3; i++)
00185         {
00186             mins[i] = (mins[i] + maxs[i]) * 0.5 - max;
00187             maxs[i] = (mins[i] + maxs[i]) * 0.5 + max;
00188         } //end for
00189     } //end if
00190     if (outmins) VectorCopy(mins, outmins);
00191     if (outmaxs) VectorCopy(maxs, outmaxs);
00192     if (origin) VectorClear(origin);
00193 } //end of the function BotImport_BSPModelMinsMaxsOrigin

Here is the call graph for this function:

void* BotImport_GetMemory int  size  ) 
 

Definition at line 143 of file be_aas_bspc.c.

References GetMemory().

00144 {
00145     return GetMemory(size);
00146 } //end of the function BotImport_GetMemory

Here is the call graph for this function:

int BotImport_PointContents vec3_t  p  ) 
 

Definition at line 133 of file be_aas_bspc.c.

References CM_PointContents(), p, and worldmodel.

00134 {
00135     return CM_PointContents(p, worldmodel);
00136 } //end of the function BotImport_PointContents

Here is the call graph for this function:

void BotImport_Print int  type,
char *  fmt,
  ...
 

Definition at line 153 of file be_aas_bspc.c.

References Log_Write(), printf(), va_end, va_list, va_start, and vsprintf().

00154 {
00155     va_list argptr;
00156     char buf[1024];
00157 
00158     va_start(argptr, fmt);
00159     vsprintf(buf, fmt, argptr);
00160     printf(buf);
00161     if (buf[0] != '\r') Log_Write(buf);
00162     va_end(argptr);
00163 } //end of the function BotImport_Print

Here is the call graph for this function:

void BotImport_Trace bsp_trace_t bsptrace,
vec3_t  start,
vec3_t  mins,
vec3_t  maxs,
vec3_t  end,
int  passent,
int  contentmask
 

Definition at line 107 of file be_aas_bspc.c.

References trace_t::allsolid, bsp_trace_s::allsolid, bsp_trace_t, capsule_collision, CM_BoxTrace(), trace_t::contents, bsp_trace_s::contents, cplane_s::dist, bsp_trace_s::endpos, trace_t::endpos, bsp_trace_s::ent, trace_t::entityNum, bsp_trace_s::exp_dist, bsp_surface_s::flags, trace_t::fraction, bsp_trace_s::fraction, cplane_s::normal, trace_t::plane, bsp_trace_s::plane, bsp_trace_s::sidenum, cplane_s::signbits, trace_t::startsolid, bsp_trace_s::startsolid, bsp_trace_s::surface, trace_t::surfaceFlags, cplane_s::type, VectorCopy, and worldmodel.

00108 {
00109     trace_t result;
00110 
00111     CM_BoxTrace(&result, start, end, mins, maxs, worldmodel, contentmask, capsule_collision);
00112 
00113     bsptrace->allsolid = result.allsolid;
00114     bsptrace->contents = result.contents;
00115     VectorCopy(result.endpos, bsptrace->endpos);
00116     bsptrace->ent = result.entityNum;
00117     bsptrace->fraction = result.fraction;
00118     bsptrace->exp_dist = 0;
00119     bsptrace->plane.dist = result.plane.dist;
00120     VectorCopy(result.plane.normal, bsptrace->plane.normal);
00121     bsptrace->plane.signbits = result.plane.signbits;
00122     bsptrace->plane.type = result.plane.type;
00123     bsptrace->sidenum = 0;
00124     bsptrace->startsolid = result.startsolid;
00125     bsptrace->surface.flags = result.surfaceFlags;
00126 } //end of the function BotImport_Trace

Here is the call graph for this function:

int COM_Compress char *  data_p  ) 
 

Definition at line 217 of file be_aas_bspc.c.

00217                                  {
00218     return strlen(data_p);
00219 }

void Com_DPrintf char *  fmt,
  ...
 

Definition at line 200 of file be_aas_bspc.c.

References Log_Write(), printf(), va_end, va_list, va_start, and vsprintf().

00201 {
00202     va_list argptr;
00203     char buf[1024];
00204 
00205     va_start(argptr, fmt);
00206     vsprintf(buf, fmt, argptr);
00207     printf(buf);
00208     if (buf[0] != '\r') Log_Write(buf);
00209     va_end(argptr);
00210 } //end of the function Com_DPrintf

Here is the call graph for this function:

void Com_Memcpy void *  dest,
const void *  src,
const size_t  count
 

Definition at line 235 of file be_aas_bspc.c.

00235                                                                   {
00236     memcpy(dest, src, count);
00237 }

void Com_Memset void *  dest,
const int  val,
const size_t  count
 

Definition at line 226 of file be_aas_bspc.c.

00226                                                                 {
00227     memset(dest, val, count);
00228 }

void Error char *  error,
  ...
 

Definition at line 178 of file l_cmd.c.

Referenced by AAS_StoreArea().

00179 {
00180     va_list argptr;
00181     char    text[1024];
00182 
00183     va_start(argptr, error);
00184     vsprintf(text, error, argptr);
00185     va_end(argptr);
00186     printf("ERROR: %s\n", text);
00187 
00188     Log_Write(text);
00189     Log_Close();
00190 
00191     exit (1);
00192 } //end of the function Error

int Sys_MilliSeconds void   ) 
 

Definition at line 69 of file be_aas_bspc.c.

References clock().

00070 {
00071     return clock() * 1000 / CLOCKS_PER_SEC;
00072 } //end of the function Sys_MilliSeconds

Here is the call graph for this function:


Variable Documentation

botlib_import_t botimport
 

Definition at line 41 of file be_aas_bspc.c.

qboolean capsule_collision
 

Definition at line 78 of file bspc.c.

Referenced by BotImport_Trace(), and main().

clipHandle_t worldmodel
 

Definition at line 42 of file be_aas_bspc.c.

Referenced by AAS_CalcReachAndClusters(), BotImport_PointContents(), and BotImport_Trace().


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