예제 #1
0
BasicArmor::BasicArmor()
{
	maximum_amount = _maxAmount;
	setName( "BasicArmor" );
	turnThinkOn();

	_lastAddTime = 0.0f;
}
예제 #2
0
void Animate::SetTime( int index, float time )
{
	if( index >= numframes ) {
		return;
	}

	frame[ index ].time = time;

	turnThinkOn();
}
예제 #3
0
World::World()
{
	const char  *text;
	str         mapname;
	int		   i;

	assert( this->entnum == ENTITYNUM_WORLD );

	world = this;
	world_dying = false;

	setMoveType( MOVETYPE_NONE );
	setSolidType( SOLID_BSP );

	// world model is always index 1
	edict->s.modelindex = 1;
	model = "*1";

	turnThinkOn();

	UpdateConfigStrings();

	groupcoordinator = NULL;

	// Anything that modifies configstrings, or spawns things is ignored when loading savegames
	if ( LoadingSavegame )
	{
		return;
	}

	// clear out the soundtrack from the last level
	ChangeSoundtrack( "" );

	// set the default farplane parameters
	farplane_distance = 0;
	farplane_color = Vector(0, 0, 0);
	farplane_cull = true;
	farplane_fog = true;
	UpdateFog();

	terrain_global = false;
	terrain_global_min = MIN_WORLD_COORD;
	UpdateTerrain();

	entity_fade_dist = DEFAULT_ENTITY_FADE_DIST;
	UpdateEntityFadeDist();

	UpdateDynamicLights();

	UpdateWeather();

	time_scale = 1.0f;
	sky_alpha = 1.0f;
	sky_portal = true;
	UpdateSky();

	//
	// see if this is a cinematic level
	//
	level.cinematic = ( spawnflags & CINEMATIC ) ? true : false;

	if ( level.cinematic )
		gi.cvar_set( "sv_cinematic", "1" );
	else
		gi.cvar_set( "sv_cinematic", "0" );

	level.nextmap = "";
	level.level_name = level.mapname;

	// Set up the mapname as the default script
	mapname = "maps/";
	mapname += level.mapname;
	for( i = mapname.length() - 1; i >= 0; i-- )
	{
		if ( mapname[ i ] == '.' )
		{
			mapname[ i ] = 0;
			break;
		}
	}

	mapname += ".scr";
	text = &mapname[ 5 ];

	// If there isn't a script with the same name as the map, then don't try to load script
	if ( gi.FS_ReadFile( mapname.c_str(), NULL, true ) != -1 )
	{
		gi.DPrintf( "Adding script: '%s'\n", text );

		// just set the script, we will start it in G_Spawn
		level.SetGameScript( mapname.c_str() );
	}
	else
	{
		level.SetGameScript( "" );
	}

	level.consoleThread = Director.CreateThread();

	SoundMan.Init();
	SoundMan.Load();

	// Set the color for the blends.
	level.water_color       = Vector( 0.0f, 0.0f, 0.5f );
	level.water_alpha       = 0.4f;

	level.slime_color       = Vector( 0.2f, 0.4f, 0.2f );
	level.slime_alpha       = 0.6f;

	level.lava_color        = Vector( 0.5f, 0.15f, 0.0f );
	level.lava_alpha        = 0.6f;

	//
	// set the targetname of the world
	//
	SetTargetName( "world" );

	groupcoordinator = new GroupCoordinator;

	// Initialize movement info

	for ( i = 0 ; i < WORLD_PHYSICS_TOTAL_NUMBER ; i++ )
	{
		_physicsInfo[ i ] = -1.0f;
	}

	_canShakeCamera = false;
}