예제 #1
0
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
예제 #2
0
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;
}