Ejemplo n.º 1
0
void
texture::gl_activate(const view& v)
{
	damage_check();
	if (damaged) {
		gl_init(v);
		damaged = false;
		check_gl_error();
	}
	if (!handle) return;
	
	glBindTexture( enable_type(), handle );
	this->gl_transform();
	check_gl_error();
}
Ejemplo n.º 2
0
Archivo: pilot.C Proyecto: zear/sabre
void Pilot::update(int aiActive)
{
	// Get elapsed time in microseconds
	t = time_frame;

	// aiActive == 0 means we're not on
	// "autopilot" so just update
	// weapons, navigation & communications info ..
	// we are the player
	if (!aiActive)
	{
		SetRemoteControl(1);
		SetAsPlayer(1);
	}
	else
	{
		SetRemoteControl(0);
		SetAsPlayer(0);
	}

	/*
	 * Select target for player if 
	 * he has not
	 */
	if (!aiActive && task == ENGAGE_TARGET && TARGET_ACTIVE && target_pilot == NULL)
	{
		aiPilot *pil = GetaiPilot(engageTarget.idx);
		if (pil)
			set_target((Pilot *)pil);
	}

	// Do some special tweaking based on task
	switch (task)
	{
	case FORMATION_FLY:
		{
			aiPilot *pil = GetaiPilot(formationTarget.idx);
			if (pil != NULL)
				set_target((Pilot *)pil);
			if (!aiActive)
				GetTargetGeometry(formationTarget.idx,formationTarget.geometry);
			flight->controls.armed_w = 0;
			break;
		}
	default:
		if (!aiActive)
		{
			if (target_pilot != NULL)
				GetTargetGeometry(target_pilot->GetIdx(),engageTarget.geometry);		
			else
				gun_point = sel_weapon->predict_path(*flight,1.0);
			GetWeaponLimits(weaponLimits);
		}
		break;
	}

	if (aiActive)
	{
		if (task == ENGAGE_TARGET && TARGET_ACTIVE)
		{
			selWeapon(0);
			/*
			 *  Dramatically drop stores if engaged
			 */
			if (nstores > 0)
			{
				flight->controls.bang_bang = 1;
				weapons[stores[nstores-1]].update(*flight,Unguided_Manager::the_umanager,
															 target_obj);
				if (weapons[stores[nstores-1]].rounds_remaining <= 0)
					nstores--;
				flight->controls.bang_bang = 0;
			}
			flight->controls.armed_w = 1;
			aiPilot *pil = GetaiPilot(engageTarget.idx);
			if (pil)
				set_target((Pilot *)pil);
		}
		else
			flight->controls.armed_w = 0;
		flight->controls.auto_coord = 1;
	}
	else
		flight->controls.auto_coord = 0;
	message.update();
	damage_check();

	Update(t);
}