Пример #1
0
void CHeavyMountedWeapon::SetUnMountedConfiguration()
{
	SwitchToRippedOffFireMode();

	IFireMode * pMountedFireMode = GetFireMode(0);
	assert(pMountedFireMode);
	
	pMountedFireMode->Enable(false);

	ExitZoom(true);

	//Second zoom mode is supposed to be unmounted
	if(GetZoomMode(1))
	{
		EnableZoomMode(1, true);
		SetCurrentZoomMode(1);
	}

	//Just in case, it was not clear properly
	CActor* pOwner = GetOwnerActor();
	if ((pOwner != NULL) && pOwner->IsClient())
	{
		float defaultFov = 55.0f;
		gEnv->pRenderer->EF_Query(EFQ_SetDrawNearFov,defaultFov);
	}
}
Пример #2
0
//------------------------------------------------------------------------
void CVehicleWeapon::StopUse(EntityId userId)
{
	if (m_owner.GetId() && userId != m_owner.GetId())
		return;

	if(userId == g_pGame->GetIGameFramework()->GetClientActorId())
	{
		IVehicle* pVehicle = GetVehicle();
		if(pVehicle)
		{
			pVehicle->UnregisterVehicleEventListener(this);
		}
		AudioCache(true, true);	//change cache to third person if it's not available
	}
 
  Select(false);  	
  m_stats.used = false;	

  SetOwnerId(0);

  EnableUpdate(false);

	if(IsZoomed() || IsZoomingInOrOut())
	{
		ExitZoom();
	}

	 m_shootCounter = 0;

	 if (userId == g_pGame->GetIGameFramework()->GetClientActorId())
	 {
		 SHUDEvent event;
		 event.eventType = eHUDEvent_OnItemSelected;
		 event.eventIntData = 0;

		 CHUDEventDispatcher::CallEvent(event);
	 }
}
Пример #3
0
//------------------------------------------------------------------------
void CVehicleWeapon::StopUse(EntityId userId)
{
	if (m_ownerId && userId != m_ownerId)
		return;

	SendMusicLogicEvent(eMUSICLOGICEVENT_WEAPON_UNMOUNT);
 
  Select(false);  	
  m_stats.used = false;	

  UseManualBlending(false);

  SetOwnerId(0);

  EnableUpdate(false);

	if(IsZoomed() || IsZoomingInOrOut())
	{
		ExitZoom();
	}

	LowerWeapon(false);

}
Пример #4
0
void CJaw::AutoZoomOut()
{
	if (!m_zoomTriggerDown && !m_zoomAlreadyToggled)
		ExitZoom(true);
}
Пример #5
0
void CHeavyMountedWeapon::PerformRipOff(CActor* pOwner)
{
	ExitZoom(true);

	UnlinkMountedGun();
	SetUnMountedConfiguration();	// This needs to come after the call to UnlinkMountedGun otherwise killcam doesn't work properly
	AttachToHand(true);
	StopFire();
	Physicalize(false, false);

	if (pOwner)
	{
		HandleHeavyWeaponPro(*pOwner);

		float speedOverride = 1.0f;
		if(pOwner->IsPlayer())
		{
			CPlayer* pOwnerPlayer = static_cast<CPlayer*>(pOwner);
			speedOverride = pOwnerPlayer->GetModifiableValues().GetValue(kPMV_HeavyWeaponRipOffSpeedOverride);
		}

		PlayAction(GetFragmentIds().rip_off, 0, false, eIPAF_Default, speedOverride);

		m_rippingOff = true;
		m_stats.dropped = false;

		DoRipOffPrompt(GetOwnerId(), false);

		int timeDelay = GetCurrentAnimationTime(eIGS_Owner);
		timeDelay = (timeDelay > 0) ? timeDelay : 2000;
		int removeViewLimitDelay = int(timeDelay * 0.65f);
		GetScheduler()->TimerAction(timeDelay, CSchedulerAction<EndRippingOff>::Create(EndRippingOff(this)), false);
		GetScheduler()->TimerAction(removeViewLimitDelay, CSchedulerAction<RemoveViewLimitsAction>::Create(RemoveViewLimitsAction(this)), false);

		if(!pOwner->IsThirdPerson() && !(m_stats.viewmode&eIVM_FirstPerson))
		{
			SetViewMode(eIVM_FirstPerson);
		}

		//Lock view in place during rip off
		SActorParams &params = pOwner->GetActorParams();

		Vec3 limitDir(ZERO);
		
		bool bUseMovementState = true;

		if (pOwner->IsClient() && (g_pGame->GetHostMigrationState() != CGame::eHMS_NotMigrating))
		{
			// If this happens during a host migration, our aim direction may not have made it into the movement
			// controller yet, get it from the saved migration params instead
			const CGameRules::SHostMigrationClientControlledParams *pHostMigrationParams = g_pGame->GetGameRules()->GetHostMigrationClientParams();
			if (pHostMigrationParams)
			{
				limitDir = pHostMigrationParams->m_aimDirection;
				bUseMovementState = false;
			}
		}

		if (bUseMovementState)
		{
			IMovementController *pMovementController = pOwner->GetMovementController();
			SMovementState state;
			pMovementController->GetMovementState(state);

			limitDir = state.aimDirection;
		}

		params.viewLimits.SetViewLimit(limitDir, 0.01f, 0.01f, 0.01f, 0.01f, SViewLimitParams::eVLS_Item);

		pOwner->SetSpeedMultipler(SActorParams::eSMR_Item, 0.0f);

		if(!gEnv->bMultiplayer)
			pOwner->LockInteractor(GetEntityId(), false);

	}

	TriggerRespawn();

	if (pOwner)
	{
		if (CRecordingSystem* pRecordingSystem = g_pGame->GetRecordingSystem()) 
		{
			pRecordingSystem->OnWeaponRippedOff(this);
		}

		BATTLECHATTER(BC_Ripoff, GetOwnerId());

		if(pOwner->IsClient())
		{
			g_pGame->GetPersistantStats()->IncrementClientStats(EIPS_RipOffMountedWeapon);
			ClearInputFlag(eWeaponAction_Zoom);
		}
	}
	else
	{
		//--- If ripped off without an actor we should finish instantly
		m_rippingOff = false;
		m_rippedOff = true;
	}
}