コード例 #1
0
ファイル: PhysicObject.cpp プロジェクト: AntonioModer/xray-16
void CPhysicObject::Interpolate()
{
	net_updatePhData* p = NetSync();
	CPHSynchronize* pSyncObj = this->PHGetSyncItem(0);

	//simple linear interpolation...
	if (!this->H_Parent() &&
		this->getVisible() &&
		this->m_pPhysicsShell &&
		!OnServer() &&
		p->NET_IItem.size())
	{
		SPHNetState newState = p->NET_IItem.front().State;
				
		if (p->NET_IItem.size() >= 2)
		{

			float ret_interpolate = interpolate_states(p->NET_IItem.front(), p->NET_IItem.back(), newState);
			//Msg("Interpolation factor is %0.4f", ret_interpolate);
			//Msg("Current position is: x = %3.3f, y = %3.3f, z = %3.3f", newState.position.x, newState.position.y, newState.position.z);
			if (ret_interpolate >= 1.f)
			{
				p->NET_IItem.pop_front();
				if (m_activated)
				{
					Msg("Deactivating object [%d] after interpolation finish", ID());
					processing_deactivate();
					m_activated = false;
				}
			}
		}
		pSyncObj->set_State(newState);
	}
}
コード例 #2
0
void CHangingLamp::TurnOff	()
{
	light_render->set_active						(false);
	if (glow_render)	glow_render->set_active		(false);
	if (light_ambient)	light_ambient->set_active	(false);
	if (Visual())		smart_cast<CKinematics*>(Visual())->LL_SetBoneVisible(light_bone, FALSE, TRUE);
	if(!PPhysicsShell())//if we have physiccs_shell it will call processing deactivate when disable
		processing_deactivate	();
}
コード例 #3
0
ファイル: CustomZone.cpp プロジェクト: AntonioModer/xray-16
void CCustomZone::o_switch_2_slow				()
{
	if (!m_zone_flags.test(eFastMode))	return	;
	m_zone_flags.set(eFastMode, FALSE);
	if ( !light_in_slow_mode() )
	{
		StopIdleLight();
	}
	processing_deactivate		();
}
コード例 #4
0
ファイル: Helicopter2.cpp プロジェクト: OLR-xray/XRay-NEW
void CHelicopter::DieHelicopter()
{
	if ( state() == CHelicopter::eDead )
		return;
	CEntity::Die(NULL);

	m_engineSound.stop				();

	m_brokenSound.create			(pSettings->r_string(*cNameSect(), "broken_snd"),st_Effect,sg_SourceType);
	m_brokenSound.play_at_pos		(0,XFORM().c,sm_Looped);


	CKinematics* K		= smart_cast<CKinematics*>(Visual());
	if(true /*!PPhysicsShell()*/){
		string256						I;
		LPCSTR bone;
		
		u16 bone_id;
		for (u32 i=0, n=_GetItemCount(*m_death_bones_to_hide); i<n; ++i){
			bone = _GetItem(*m_death_bones_to_hide,i,I);
			bone_id		= K->LL_BoneID	(bone);
			K->LL_SetBoneVisible(bone_id,FALSE,TRUE);
		}

		///PPhysicsShell()=P_build_Shell	(this,false);
		PPhysicsShell()->EnabledCallbacks(TRUE);
		PPhysicsShell()->set_ObjectContactCallback(CollisionCallbackDead);
		PPhysicsShell()->set_ContactCallback(ContactShotMark);
	}
	Fvector lin_vel;

	Fvector prev_pos				= PositionStack.front().vPosition;
	lin_vel.sub						(XFORM().c,prev_pos);

	if(Device.dwTimeGlobal != PositionStack.front().dwTime)
		lin_vel.div((Device.dwTimeGlobal-PositionStack.front().dwTime)/1000.0f);
	
	lin_vel.mul						(m_death_lin_vel_k);
	PPhysicsShell()->set_LinearVel	(lin_vel);
	PPhysicsShell()->set_AngularVel	(m_death_ang_vel);
	PPhysicsShell()->Enable			();
	K->CalculateBones_Invalidate	();
	K->CalculateBones				();
	setState						(CHelicopter::eDead);
	m_engineSound.stop				();
	processing_deactivate			();
	m_dead							= true;
}
コード例 #5
0
BOOL CAI_Crow::net_Spawn		(CSE_Abstract* DC)
{
	BOOL R		= inherited::net_Spawn	(DC);
	setVisible	(TRUE);
	setEnabled	(TRUE);

	// animations
	CKinematicsAnimated*	M		= smart_cast<CKinematicsAnimated*>(Visual()); R_ASSERT(M);
	m_Anims.m_death.Load		(M,"norm_death");
	m_Anims.m_death_dead.Load	(M,"norm_death_dead");
	m_Anims.m_death_idle.Load	(M,"norm_death_idle");
	m_Anims.m_fly.Load			(M,"norm_fly_fwd");
	m_Anims.m_idle.Load			(M,"norm_idle");

	// disable UpdateCL, enable only on HIT
	processing_deactivate		();

	return		R;
}
コード例 #6
0
ファイル: Car.cpp プロジェクト: AntonioModer/xray-16
void CCar::detach_Actor()
{
	if(!Owner()) return;
	Owner()->setVisible(1);
	CHolderCustom::detach_Actor();
	PPhysicsShell()->remove_ObjectContactCallback(ActorObstacleCallback);
	NeutralDrive();
	Unclutch();
	ResetKeys();
	m_current_rpm=m_min_rpm;
//	CurrentGameUI()->UIMainIngameWnd->CarPanel().Show(false);
	///Break();
	//H_SetParent(NULL);
	HandBreak();
	processing_deactivate();
#ifdef DEBUG
	DBgClearPlots();
#endif
}
コード例 #7
0
BOOL CBreakableObject::net_Spawn(CSE_Abstract* DC)
{

	CSE_Abstract			*e		= (CSE_Abstract*)(DC);
	CSE_ALifeObjectBreakable *obj	= smart_cast<CSE_ALifeObjectBreakable*>(e);
	R_ASSERT				(obj);
	inherited::net_Spawn	(DC);
	VERIFY(!collidable.model);
	collidable.model = xr_new<CCF_Skeleton>(this);
	// set bone id
	R_ASSERT				(Visual()&&smart_cast<IKinematics*>(Visual()));
//	IKinematics* K			= smart_cast<IKinematics*>(Visual());
	fHealth					= obj->m_health;
	processing_deactivate	();
	setVisible				(TRUE);
	setEnabled				(TRUE);
	CreateUnbroken			();
	//CreateBroken			();
	bRemoved				=false;
	//Break					();
//	shedule_unregister		();
	return					(TRUE);
}
コード例 #8
0
ファイル: ClimableObject.cpp プロジェクト: 2asoft/xray
BOOL CClimableObject::	net_Spawn			( CSE_Abstract* DC)
{
	CSE_Abstract				*e = (CSE_Abstract*)(DC);
	CSE_ALifeObjectClimable	*CLB=smart_cast<CSE_ALifeObjectClimable*>(e);
	const Fmatrix& b=CLB->shapes[0].data.box;
	m_box.m_halfsize.set(b._11,b._22,b._33);
	m_radius=_max(_max(m_box.m_halfsize.x,m_box.m_halfsize.y),m_box.m_halfsize.z);

	//m_box.m_halfsize.set(1.f,1.f,1.f);
	BOOL ret	= inherited::net_Spawn(DC);
	const float f_min_width=0.2f;
	Fvector shift;shift.set(0.f,0.f,0.f);
	SORT(b._11,m_axis.set(XFORM().i);m_axis.mul(m_box.m_halfsize.x),m_side.set(XFORM().i);m_side.mul(m_box.m_halfsize.x),m_norm.set(XFORM().i);if(m_box.m_halfsize.x<f_min_width){m_box.m_halfsize.x=f_min_width;shift.set(1.f,0.f,0.f);};m_norm.mul(m_box.m_halfsize.x),
		b._22,m_axis.set(XFORM().j);m_axis.mul(m_box.m_halfsize.y),m_side.set(XFORM().j);m_side.mul(m_box.m_halfsize.y),m_norm.set(XFORM().j);if(m_box.m_halfsize.y<f_min_width){m_box.m_halfsize.y=f_min_width;shift.set(0.f,1.f,0.f);};m_norm.mul(m_box.m_halfsize.y),
		b._33,m_axis.set(XFORM().k);m_axis.mul(m_box.m_halfsize.z),m_side.set(XFORM().k);m_side.mul(m_box.m_halfsize.z),m_norm.set(XFORM().k);if(m_box.m_halfsize.z<f_min_width){m_box.m_halfsize.z=f_min_width;shift.set(0.f,0.f,1.f);};m_norm.mul(m_box.m_halfsize.z)
		);
	shift.mul(f_min_width);
	
	XFORM().transform_dir(shift);
	CObject::Position().sub(shift);
	m_box.xform_set(Fidentity);
	m_pStaticShell= new CPHLeaderGeomShell(this);
	P_BuildStaticGeomShell(smart_cast<CPHStaticGeomShell*>(m_pStaticShell),smart_cast<CGameObject*>(this),0,m_box);
	m_pStaticShell->SetMaterial("materials\\fake_ladders");
	
	if(m_axis.y<0.f)
	{
		m_axis.invert();
		m_side.invert();

	}
//	shedule_unregister();
	processing_deactivate();
	m_pStaticShell->set_ObjectContactCallback(ObjectContactCallback);
	return ret;
}
コード例 #9
0
void CWeaponStatMgun::net_Destroy()
{
	inheritedPH::net_Destroy	();
	processing_deactivate		();
}