//=========================================================================== // called everytime a map changes // // Parameter: - // Returns: - // Changes Globals: - //=========================================================================== int AAS_LoadMap(const char *mapname) { int errnum; //if no mapname is provided then the string indexes are updated if (!mapname) { return 0; } //end if // aasworld.initialized = qfalse; //NOTE: free the routing caches before loading a new map because // to free the caches the old number of areas, number of clusters // and number of areas in a clusters must be available AAS_FreeRoutingCaches(); //load the map errnum = AAS_LoadFiles(mapname); if (errnum != BLERR_NOERROR) { aasworld.loaded = qfalse; return errnum; } //end if // AAS_InitSettings(); //initialize the AAS link heap for the new map AAS_InitAASLinkHeap(); //initialize the AAS linked entities for the new map AAS_InitAASLinkedEntities(); //initialize reachability for the new map AAS_InitReachability(); //initialize the alternative routing AAS_InitAlternativeRouting(); //everything went ok return 0; } //end of the function AAS_LoadMap
void AAS_CalcReachAndClusters( struct quakefile_s *qf ) { float time; Log_Print( "loading collision map...\n" ); // if ( !qf->pakfile[0] ) { strcpy( qf->pakfile, qf->filename ); } //load the map CM_LoadMap( (char *) qf, qfalse, &( *aasworld ).bspchecksum ); //get a handle to the world model worldmodel = CM_InlineModel( 0 ); // 0 = world, 1 + are bmodels //initialize bot import structure AAS_InitBotImport(); //load the BSP entity string AAS_LoadBSPFile(); //init physics settings AAS_InitSettings(); //initialize AAS link heap AAS_InitAASLinkHeap(); //initialize the AAS linked entities for the new map AAS_InitAASLinkedEntities(); //reset all reachabilities and clusters ( *aasworld ).reachabilitysize = 0; ( *aasworld ).numclusters = 0; //set all view portals as cluster portals in case we re-calculate the reachabilities and clusters (with -reach) AAS_SetViewPortalsAsClusterPortals(); //calculate reachabilities AAS_InitReachability(); time = 0; while ( AAS_ContinueInitReachability( time ) ) time++; //calculate clusters AAS_InitClustering(); } //end of the function AAS_CalcReachAndClusters
int AAS_LoadMap(const char *mapname) { int errnum; int i; char this_mapname[256]; //, intstr[4]; qboolean loaded = qfalse; int missingErrNum = 0; for(i = 0; i < MAX_AAS_WORLDS; i++) { AAS_SetCurrentWorld(i); strncpy(this_mapname, mapname, 256); //strncat( this_mapname, "_b", 256 ); //sprintf( intstr, "%i", i ); //strncat( this_mapname, intstr, 256 ); //if no mapname is provided then the string indexes are updated if(!mapname) { return 0; } //end if // (*aasworld).initialized = qfalse; //NOTE: free the routing caches before loading a new map because // to free the caches the old number of areas, number of clusters // and number of areas in a clusters must be available AAS_FreeRoutingCaches(); //load the map errnum = AAS_LoadFiles(this_mapname); if(errnum != BLERR_NOERROR) { (*aasworld).loaded = qfalse; // RF, we are allowed to skip one of the files, but not both //return errnum; missingErrNum = errnum; continue; } //end if // loaded = qtrue; // AAS_InitSettings(); //initialize the AAS link heap for the new map AAS_InitAASLinkHeap(); //initialize the AAS linked entities for the new map AAS_InitAASLinkedEntities(); //initialize reachability for the new map AAS_InitReachability(); //initialize the alternative routing AAS_InitAlternativeRouting(); } if(!loaded) { return missingErrNum; } //everything went ok return 0; } //end of the function AAS_LoadMap