//------------------------------------------------------------------------
bool CVehicleMountedWeapon::CanZoom() const
{
	if (!CHeavyMountedWeapon::CanZoom())
		return false;

	IVehicle *pVehicle = gEnv->pGame->GetIGameFramework()->GetIVehicleSystem()->GetVehicle(m_vehicleId);
	if(pVehicle && !IsRippedOff())
	{
		if (m_pSeatUser != m_pOwnerSeat)
			return false;

		IActor* pActor = GetOwnerActor();
		IVehicleSeat* pSeat = pActor ? pVehicle->GetSeatForPassenger(pActor->GetEntityId()) : NULL;
		IVehicleView* pView = pSeat ? pSeat->GetCurrentView() : NULL;
		if (pView && pView->IsThirdPerson())
			return false;
	}

	return true;
}
Beispiel #2
0
//------------------------------------------------------------------------
bool CVehicleWeapon::CanZoom() const
{
  if (!CWeapon::CanZoom())
    return false;

  if (!m_bOwnerInSeat)
    return false;

	IVehicle *pVehicle = GetVehicle();
	if(!pVehicle)
		return false;

  IActor* pActor = GetOwnerActor();
	IVehicleSeat* pSeat = pActor ? pVehicle->GetSeatForPassenger(pActor->GetEntityId()) : NULL;
	IVehicleView* pView = pSeat ? pSeat->GetCurrentView() : NULL;
  if (pView && pView->IsThirdPerson())
    return false;

  return true;
}
Beispiel #3
0
//-----------------------------------------------------------------------
void CVehiclePartLight::UpdateLight(const float frameTime)
{ 
  if (m_slot == -1)
    return;

	// move to vehicle event change view?
  if (m_diffuseMult[0] != m_diffuseMult[1])
  {
    SEntitySlotInfo info;
    if (m_pVehicle->GetEntity()->GetSlotInfo(m_slot, info) && info.pLight)
    {
      CDLight& light = info.pLight->GetLightProperties();    

      IActor* pActor = CCryAction::GetCryAction()->GetClientActor();
      bool localPlayer = (pActor != NULL) && (pActor->GetLinkedVehicle() == m_pVehicle);

			IVehicleSeat* pSeat = pActor ? m_pVehicle->GetSeatForPassenger(pActor->GetEntityId()) : NULL;
			IVehicleView* pView = pSeat? pSeat->GetView(pSeat->GetCurrentView()) : NULL;
			bool isThirdPersonView = pView? pView->IsThirdPerson() : true;
      if (localPlayer && !isThirdPersonView)
				light.SetLightColor(ColorF(m_diffuseCol * m_diffuseMult[0], 1.f));
      else
				light.SetLightColor(ColorF(m_diffuseCol * m_diffuseMult[1], 1.f));    
    }
  }  

  if (m_pHelper)
  { 
    const static Matrix33 rot(Matrix33::CreateRotationXYZ(Ang3(0.f, 0.f, DEG2RAD(90.f))));
    
    Matrix34 helperTM;
		m_pHelper->GetVehicleTM(helperTM);
    Matrix34 localTM = Matrix33(helperTM) * rot;
    localTM.SetTranslation(helperTM.GetTranslation());

    GetEntity()->SetSlotLocalTM(m_slot, localTM);  
  }

}