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
//=========================================================================== // 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
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
int Export_BotLibLoadMap( const char *mapname ) { #ifdef DEBUG int starttime = Sys_MilliSeconds(); #endif int errnum; if ( !BotLibSetup( "BotLoadMap" ) ) { return BLERR_LIBRARYNOTSETUP; } // #if defined RTCW_ET // if the mapname is NULL, then this is a restart if ( !mapname ) { // START Arnout changes, 29-08-2002. // don't init the heap if no aas loaded, causes "SV_Bot_HunkAlloc: Alloc with marks already set" if ( ( *aasworld ).loaded ) { AAS_InitAASLinkHeap(); AAS_EnableAllAreas(); } // END Arnout changes, 29-08-2002. ( *aasworld ).numframes = 0; memset( ( *aasworld ).arealinkedentities, 0, ( *aasworld ).numareas * sizeof( aas_link_t * ) ); memset( ( *aasworld ).entities, 0, ( *aasworld ).maxentities * sizeof( aas_entity_t ) ); return BLERR_NOERROR; } // #endif // RTCW_XX botimport.Print( PRT_MESSAGE, "------------ Map Loading ------------\n" ); //startup AAS for the current map, model and sound index errnum = AAS_LoadMap( mapname ); if ( errnum != BLERR_NOERROR ) { return errnum; } //initialize the items in the level BotInitLevelItems(); //be_ai_goal.h BotSetBrushModelTypes(); //be_ai_move.h // botimport.Print( PRT_MESSAGE, "-------------------------------------\n" ); #ifdef DEBUG botimport.Print( PRT_MESSAGE, "map loaded in %d msec\n", Sys_MilliSeconds() - starttime ); #endif // return BLERR_NOERROR; } //end of the function Export_BotLibLoadMap
int BotLibLoadMap( const char* mapname ) { #ifdef DEBUG int starttime = Sys_Milliseconds(); #endif if ( !IsBotLibSetup( "BotLoadMap" ) ) { return BLERR_LIBRARYNOTSETUP; } // if the mapname is NULL, then this is a restart if ( GGameType & GAME_ET && !mapname ) { // don't init the heap if no aas loaded, causes "SV_Bot_HunkAlloc: Alloc with marks already set" if ( aasworld->loaded ) { AAS_InitAASLinkHeap(); AAS_EnableAllAreas(); } aasworld->numframes = 0; memset( aasworld->arealinkedentities, 0, aasworld->numareas * sizeof ( aas_link_t* ) ); memset( aasworld->entities, 0, aasworld->maxentities * sizeof ( aas_entity_t ) ); return BLERR_NOERROR; } BotImport_Print( PRT_MESSAGE, "------------ Map Loading ------------\n" ); //startup AAS for the current map, model and sound index int errnum = AAS_LoadMap( mapname ); if ( errnum != BLERR_NOERROR ) { return errnum; } //initialize the items in the level BotInitLevelItems(); BotSetBrushModelTypes(); BotImport_Print( PRT_MESSAGE, "-------------------------------------\n" ); #ifdef DEBUG BotImport_Print( PRT_MESSAGE, "map loaded in %d msec\n", Sys_Milliseconds() - starttime ); #endif return BLERR_NOERROR; }