Beispiel #1
0
//===========================================================================
//
// Parameter:			-
// Returns:				-
// Changes Globals:		-
//===========================================================================
void BotInitInfoEntities( void ) {
	char classname[MAX_EPAIRKEY];
	maplocation_t *ml;
	campspot_t *cs;
	int ent, numlocations, numcampspots;

	BotFreeInfoEntities();
	//
	numlocations = 0;
	numcampspots = 0;
	for ( ent = AAS_NextBSPEntity( 0 ); ent; ent = AAS_NextBSPEntity( ent ) )
	{
		if ( !AAS_ValueForBSPEpairKey( ent, "classname", classname, MAX_EPAIRKEY ) ) {
			continue;
		}

		//map locations
		if ( !strcmp( classname, "target_location" ) ) {
			ml = (maplocation_t *) GetClearedMemory( sizeof( maplocation_t ) );
			AAS_VectorForBSPEpairKey( ent, "origin", ml->origin );
			AAS_ValueForBSPEpairKey( ent, "message", ml->name, sizeof( ml->name ) );
			ml->areanum = AAS_PointAreaNum( ml->origin );
			ml->next = maplocations;
			maplocations = ml;
			numlocations++;
		} //end if
		  //camp spots
		else if ( !strcmp( classname, "info_camp" ) ) {
			cs = (campspot_t *) GetClearedMemory( sizeof( campspot_t ) );
			AAS_VectorForBSPEpairKey( ent, "origin", cs->origin );
			//cs->origin[2] += 16;
			AAS_ValueForBSPEpairKey( ent, "message", cs->name, sizeof( cs->name ) );
			AAS_FloatForBSPEpairKey( ent, "range", &cs->range );
			AAS_FloatForBSPEpairKey( ent, "weight", &cs->weight );
			AAS_FloatForBSPEpairKey( ent, "wait", &cs->wait );
			AAS_FloatForBSPEpairKey( ent, "random", &cs->random );
			cs->areanum = AAS_PointAreaNum( cs->origin );
			if ( !cs->areanum ) {
				botimport.Print( PRT_MESSAGE, "camp spot at %1.1f %1.1f %1.1f in solid\n", cs->origin[0], cs->origin[1], cs->origin[2] );
				FreeMemory( cs );
				continue;
			} //end if
			cs->next = campspots;
			campspots = cs;
			//AAS_DrawPermanentCross(cs->origin, 4, LINECOLOR_YELLOW);
			numcampspots++;
		} //end else if
	} //end for
	if ( bot_developer ) {
		botimport.Print( PRT_MESSAGE, "%d map locations\n", numlocations );
		botimport.Print( PRT_MESSAGE, "%d camp spots\n", numcampspots );
	} //end if
} //end of the function BotInitInfoEntities
Beispiel #2
0
static void BotInitInfoEntities() {
	BotFreeInfoEntities();

	int numlocations = 0;
	int numcampspots = 0;
	for ( int ent = AAS_NextBSPEntity( 0 ); ent; ent = AAS_NextBSPEntity( ent ) ) {
		char classname[ MAX_EPAIRKEY ];
		if ( !AAS_ValueForBSPEpairKey( ent, "classname", classname, MAX_EPAIRKEY ) ) {
			continue;
		}

		//map locations
		if ( !String::Cmp( classname, "target_location" ) ) {
			maplocation_t* ml = ( maplocation_t* )Mem_ClearedAlloc( sizeof ( maplocation_t ) );
			AAS_VectorForBSPEpairKey( ent, "origin", ml->origin );
			AAS_ValueForBSPEpairKey( ent, "message", ml->name, sizeof ( ml->name ) );
			ml->areanum = AAS_PointAreaNum( ml->origin );
			ml->next = maplocations;
			maplocations = ml;
			numlocations++;
		}
		//camp spots
		else if ( !String::Cmp( classname, "info_camp" ) ) {
			campspot_t* cs = ( campspot_t* )Mem_ClearedAlloc( sizeof ( campspot_t ) );
			AAS_VectorForBSPEpairKey( ent, "origin", cs->origin );
			AAS_ValueForBSPEpairKey( ent, "message", cs->name, sizeof ( cs->name ) );
			AAS_FloatForBSPEpairKey( ent, "range", &cs->range );
			AAS_FloatForBSPEpairKey( ent, "weight", &cs->weight );
			AAS_FloatForBSPEpairKey( ent, "wait", &cs->wait );
			AAS_FloatForBSPEpairKey( ent, "random", &cs->random );
			cs->areanum = AAS_PointAreaNum( cs->origin );
			if ( !cs->areanum ) {
				BotImport_Print( PRT_MESSAGE, "camp spot at %1.1f %1.1f %1.1f in solid\n", cs->origin[ 0 ], cs->origin[ 1 ], cs->origin[ 2 ] );
				Mem_Free( cs );
				continue;
			}
			cs->next = campspots;
			campspots = cs;
			numcampspots++;
		}
	}
	if ( bot_developer ) {
		BotImport_Print( PRT_MESSAGE, "%d map locations\n", numlocations );
		BotImport_Print( PRT_MESSAGE, "%d camp spots\n", numcampspots );
	}
}
Beispiel #3
0
void BotShutdownGoalAI() {
	if ( itemconfig ) {
		Mem_Free( itemconfig );
	}
	itemconfig = NULL;
	if ( levelitemheap ) {
		Mem_Free( levelitemheap );
	}
	levelitemheap = NULL;
	freelevelitems = NULL;
	levelitems = NULL;
	numlevelitems = 0;

	BotFreeInfoEntities();

	for ( int i = 1; i <= MAX_CLIENTS_Q3; i++ ) {
		if ( botgoalstates[ i ] ) {
			BotFreeGoalState( i );
		}
	}
}
Beispiel #4
0
//===========================================================================
//
// Parameter:			-
// Returns:				-
// Changes Globals:		-
//===========================================================================
void BotShutdownGoalAI( void ) {
	int i;

	if ( itemconfig ) {
		FreeMemory( itemconfig );
	}
	itemconfig = NULL;
	if ( levelitemheap ) {
		FreeMemory( levelitemheap );
	}
	levelitemheap = NULL;
	freelevelitems = NULL;
	levelitems = NULL;
	numlevelitems = 0;

	BotFreeInfoEntities();

	for ( i = 1; i <= MAX_CLIENTS; i++ )
	{
		if ( botgoalstates[i] ) {
			BotFreeGoalState( i );
		} //end if
	} //end for
} //end of the function BotShutdownGoalAI