Пример #1
0
//-------------------------------------------------------------------------
bool CWeapon::OnActionModify(EntityId actorId, const ActionId& actionId, int activationMode, float value)
{
	COffHand * offHandWeapon = NULL;
	bool isOffHandSelected = false;
	GetOffHandInfo(this,isOffHandSelected,&offHandWeapon);

	if (!IsBusy() && !isOffHandSelected)
	{
		if (m_fm)
			m_fm->StopFire();

		if(m_zm && m_zm->IsZoomed())
			m_zm->StopZoom();

		if(m_weaponRaised)
			RaiseWeapon(false,true);

		if (m_modifying && !m_transitioning)
		{
			StopLayer(g_pItemStrings->modify_layer, eIPAF_Default, false);
			PlayAction(g_pItemStrings->leave_modify, 0);
			m_dofSpeed = -1.0f/((float)GetCurrentAnimationTime(eIGS_FirstPerson)/1000.0f);
			m_dofValue = 1.0f;
			m_focusValue = -1.0f;

			GetScheduler()->TimerAction(GetCurrentAnimationTime(eIGS_FirstPerson), CSchedulerAction<ScheduleLayer_Leave>::Create(this), false);
			m_transitioning = true;

			SAFE_HUD_FUNC(WeaponAccessoriesInterface(false));
			m_modifying = false;

			GetGameObject()->InvokeRMI(CItem::SvRequestLeaveModify(), CItem::EmptyParams(), eRMI_ToServer);
		}
		else if (!m_modifying && !m_transitioning)
		{
			gEnv->p3DEngine->SetPostEffectParam("Dof_Active", 1.0f);
			gEnv->p3DEngine->SetPostEffectParam("Dof_FocusRange", -1.0f);
			gEnv->p3DEngine->SetPostEffectParam("Dof_FocusMin", 0.0f);
			gEnv->p3DEngine->SetPostEffectParam("Dof_FocusMax", 5.0f);
			gEnv->p3DEngine->SetPostEffectParam("Dof_FocusLimit", 20.0f);
			gEnv->p3DEngine->SetPostEffectParam("Dof_UseMask", 0.0f);

			PlayAction(g_pItemStrings->enter_modify, 0, false, eIPAF_Default | eIPAF_RepeatLastFrame);
			m_dofSpeed = 1.0f/((float)GetCurrentAnimationTime(eIGS_FirstPerson)/1000.0f);
			m_dofValue = 0.0f;
			m_transitioning = true;

			GetScheduler()->TimerAction(GetCurrentAnimationTime(eIGS_FirstPerson), CSchedulerAction<ScheduleLayer_Enter>::Create(this), false);
			m_modifying = true;

			GetGameObject()->InvokeRMI(CItem::SvRequestEnterModify(), CItem::EmptyParams(), eRMI_ToServer);
		}
	}

	return true;
}
Пример #2
0
//------------------------------------------------------------------------
void CItem::ResetAccessoriesScreen(CActor *pOwner)
{
	m_modifying = false;
	m_transitioning = false;

	StopLayer(g_pItemStrings->modify_layer, eIPAF_Default, false);

	if(pOwner && pOwner->IsClient())
	{
		if(m_sharedparams->params.update_hud)
		{
		}
	}
}
Пример #3
0
//------------------------------------------------------------------------
void CItem::AttachAccessoryPlaceHolder(const ItemString &name, bool attach)
{
	const SAccessoryParams *params = GetAccessoryParams(name);

	if(!params)
		return;

	CItem *pPlaceHolder = GetAccessoryPlaceHolder(name);

	if(!pPlaceHolder)
		return;

	if(attach)
	{
		SetCharacterAttachment(eIGS_FirstPerson, params->attach_helper, pPlaceHolder->GetEntity(), eIGS_FirstPerson, 0);
		PlayLayer(params->attach_layer, eIPAF_FirstPerson, false);
	}
	else
	{
		ResetCharacterAttachment(eIGS_FirstPerson, params->attach_helper);
		StopLayer(params->attach_layer, eIPAF_FirstPerson, false);
	}
}
Пример #4
0
void CItem::AttachAccessory(const ItemString &name, bool attach, bool noanim, bool force, bool initialSetup)
{
	if(!force && IsBusy())
		return;

	bool anim = !noanim && m_stats.fp;
	SAccessoryParams *params = GetAccessoryParams(name);

	if(!params)
		return;

	if(attach)
	{
		if(!IsAccessoryHelperFree(params->attach_helper))
			return;

		if(CItem *pAccessory = AddAccessory(name))
		{
			pAccessory->Physicalize(false, false);
			pAccessory->SetViewMode(m_stats.viewmode);

			if(!initialSetup)
				pAccessory->m_bonusAccessoryAmmo.clear();

			SetCharacterAttachment(eIGS_FirstPerson, params->attach_helper, pAccessory->GetEntity(), eIGS_FirstPerson, 0);
			SetBusy(true);

			AttachAction action(pAccessory, params);

			if(anim)
			{
				PlayAction(params->attach_action, 0, false, eIPAF_Default|eIPAF_NoBlend);
				m_scheduler.TimerAction(GetCurrentAnimationTime(eIGS_FirstPerson), CSchedulerAction<AttachAction>::Create(action), false);
			}
			else
				action.execute(this);

		}
	}
	else
	{
		if(CItem *pAccessory = GetAccessory(name))
		{
			DetachAction action(pAccessory, params);

			if(anim)
			{
				StopLayer(params->attach_layer, eIPAF_Default|eIPAF_NoBlend);
				PlayAction(params->detach_action, 0, false, eIPAF_Default|eIPAF_NoBlend);
				m_scheduler.TimerAction(GetCurrentAnimationTime(eIGS_FirstPerson), CSchedulerAction<DetachAction>::Create(action), false);
				SetBusy(true);
			}
			else
			{
				SetBusy(true);
				action.execute(this);
			}
		}
	}

	//Skip all this for the offhand
	if(GetEntity()->GetClass()!=CItem::sOffHandClass)
		FixAccessories(params, attach);

	//Attach silencer to 2nd SOCOM
	/////////////////////////////////////////////////////////////
	bool isDualWield = IsDualWieldMaster();
	CItem *dualWield = 0;

	if(isDualWield)
	{
		IItem *slave = GetDualWieldSlave();

		if(slave && slave->GetIWeapon())
			dualWield = static_cast<CItem *>(slave);
		else
			isDualWield = false;
	}

	if(isDualWield)
		dualWield->AttachAccessory(name,attach,noanim);

	//////////////////////////////////////////////////////////////

	//Luciano - send game event
	g_pGame->GetIGameFramework()->GetIGameplayRecorder()->Event(GetOwner(), GameplayEvent(eGE_AttachedAccessory, name, (float)attach, (void *)GetEntityId()));

}