예제 #1
0
//---------------------------------
void CScreenEffects::CamShake(Vec3 rotateShake, Vec3 shiftShake, float freq, float shakeTime, float randomness, int shakeID)
{
	if (g_pGameCVars && g_pGameCVars->g_detachCamera==0)
	{
		IViewSystem *pViewSystem = g_pGame->GetIGameFramework()->GetIViewSystem();
		if (pViewSystem)
		{
			IView *pView = pViewSystem->GetActiveView();
			if (pView)
			{
				const bool bClientActorView = pViewSystem->IsClientActorViewActive();;
				if (gEnv->pFlashUI)
				{
					gEnv->pFlashUI->SetHudElementsVisible(bClientActorView);
				}

				if (bClientActorView && shakeID == eCS_GID_Player)
				{
					CCCPOINT(Camera_DoShake);
					pView->SetViewShake(Ang3(rotateShake), shiftShake, shakeTime, freq, randomness, shakeID, false);
				}
			}
		}
	}
}
예제 #2
0
//--------------------------------------------------------------------------------------------------
// Name: ~CGameEffect
// Desc: Destructor
//--------------------------------------------------------------------------------------------------
CGameEffect::~CGameEffect()
{
#if DEBUG_GAME_FX_SYSTEM
	// Output message if effect hasn't been released before being deleted
	const bool bEffectIsReleased = (m_flags & GAME_EFFECT_RELEASED) ||			// -> Needs to be released before deleted
																 !(m_flags & GAME_EFFECT_INITIALISED) ||	// -> Except when not initialised
																 (gEnv->IsEditor());											// -> Or the editor (memory safely released by editor)
	if(!bEffectIsReleased)
	{
		string dbgMessage = m_debugName + " being destroyed without being released first";
		FX_ASSERT_MESSAGE(bEffectIsReleased,dbgMessage.c_str());
	}
#endif

	if(CGameEffectsSystem::Exists())
	{
		GAME_FX_SYSTEM.UnRegisterEffect(this);	// -> Effect should have been released and been unregistered, but to avoid
																						//    crashes call unregister here too
	}

	// Unregister as ViewSystem listener (for cut-scenes, ...)
	if (g_pGame)
	{
		IViewSystem *pViewSystem = g_pGame->GetIGameFramework()->GetIViewSystem();
		if (pViewSystem)
		{
			pViewSystem->RemoveListener(this);
		}
	}
}//-------------------------------------------------------------------------------------------------
예제 #3
0
	void CreateView()
	{
		if (gEnv->pGame == NULL)
			return;

		IGameFramework* pGF = gEnv->pGame->GetIGameFramework();

		if (pGF == NULL)
			return;

		m_pViewSystem = pGF->GetIViewSystem();

		if (m_pViewSystem == NULL)
			return;
		//if the game has a clientactor, cache the view
		if (pGF->GetClientActor())
		{
			m_pLocalPlayerView = m_pViewSystem->GetViewByEntityId(pGF->GetClientActor()->GetEntityId());
		}



		if (m_pLocalPlayerView && (m_pViewSystem->GetActiveView() != m_pLocalPlayerView))
			m_pViewSystem->SetActiveView(m_pLocalPlayerView);

		if (m_pView == NULL)
			m_pView = m_pViewSystem->CreateView();
	}
예제 #4
0
	virtual void ProcessEvent( EFlowEvent event,SActivationInfo* pActInfo )
	{
		switch (event)
		{
		case eFE_Initialize:
		{
			CreateView();
			return;
		}
		break;
		case eFE_Activate:
		{
			if (IsPortActive(pActInfo, EIP_Enable))
			{
				if (m_pView == NULL)
					CreateView();

				if (m_pView == NULL)
					return;

				if (pActInfo->pEntity == NULL)
					return;

				SViewParams params;

				params.justActivated  = true;
				params.fov            = DEG2RAD(GetPortFloat(pActInfo, EIP_FOV));
				params.blend          = GetPortBool(pActInfo, EIP_Blend);
				params.blendFOVOffset = DEG2RAD(GetPortFloat(pActInfo, EIP_BlendFOVOffset));
				params.blendFOVSpeed  = GetPortFloat(pActInfo, EIP_BlendFOVSpeed);
				params.blendPosOffset = GetPortVec3(pActInfo, EIP_BlendPosOffset);
				params.blendPosSpeed  = GetPortFloat(pActInfo, EIP_BlendPosSpeed);
				params.blendRotSpeed  = GetPortFloat(pActInfo, EIP_BlendRotSpeed);
				params.blendRotOffset = Quat::CreateRotationXYZ(static_cast<Ang3>(GetPortVec3(pActInfo, EIP_BlendRotOffset)));

				m_pView->SetCurrentParams(params);
				m_pView->LinkTo(pActInfo->pEntity);

				m_pViewSystem->SetActiveView(m_pView);
			}
			else if (IsPortActive(pActInfo, EIP_Disable))
			{
				if (m_pLocalPlayerView)
					m_pViewSystem->SetActiveView(m_pLocalPlayerView);
			}
			else if (IsPortActive(pActInfo, EIP_FOV))
			{
				SViewParams params;
				params.fov = DEG2RAD(GetPortFloat(pActInfo, EIP_FOV));
				m_pView->SetCurrentParams(params);
			}
		}
		break;
		}
	}
예제 #5
0
bool CGameEffect::OnCameraChange(const SCameraParams& cameraParams)
{
	IViewSystem *pViewSystem = g_pGame->GetIGameFramework()->GetIViewSystem();
	if (pViewSystem)
	{
		const bool bClientActorView = pViewSystem->IsClientActorViewActive();
		SetFlag(GAME_EFFECT_ACTIVE, bClientActorView);
		if (!bClientActorView)
			ResetRenderParameters();
	}

	return true;
}
예제 #6
0
	~CFlowNode_CameraView()
	{
		if (m_pViewSystem && m_pView)
		{
			m_pViewSystem->RemoveView(m_pView);
		}
	}
예제 #7
0
//---------------------------------
CScreenEffects::~CScreenEffects(void)
{
	ClearAllBlendGroups(false);

	// Unregister as ViewSystem listener (for cut-scenes, ...)
	IViewSystem *pViewSystem = g_pGame->GetIGameFramework()->GetIViewSystem();
	if (pViewSystem)
	{
		pViewSystem->RemoveListener(this);
	}

	// Unregister as System listener
	if (gEnv->pSystem)
	{
		gEnv->pSystem->GetISystemEventDispatcher()->RemoveListener( this );
	}
}
예제 #8
0
//---------------------------------
void CScreenEffects::OnSystemEvent(ESystemEvent event, UINT_PTR wparam, UINT_PTR lparam)
{
	IViewSystem *pViewSystem = g_pGame->GetIGameFramework()->GetIViewSystem();
	if (pViewSystem)
	{
		switch ( event )
		{
		case ESYSTEM_EVENT_LEVEL_GAMEPLAY_START:
			// Register as ViewSystem listener (for cut-scenes, ...)
			pViewSystem->AddListener(this);
			break;
		case ESYSTEM_EVENT_LEVEL_UNLOAD:
			// Unregister as ViewSystem listener (for cut-scenes, ...)
			pViewSystem->RemoveListener(this);
			break;
		}
	}
}
예제 #9
0
void CCameraView::Reset()
{
	//initialize the camera view
	IViewSystem *pViewSystem = g_pGame->GetIGameFramework()->GetIViewSystem();
	IView *pView = pViewSystem->GetActiveView();
	CRY_ASSERT(pView);
	m_lastViewParams = *(pView->GetCurrentParams());

	//the player can still change camera angles etc.
	CPlayer *pHero = CPlayer::GetHero();
	CRY_ASSERT(pHero);


	m_pCamHelper = pHero->GetCameraInputHelper();
	CRY_ASSERT(m_pCamHelper);

	m_bModeTransition = false;
	m_fTransitionTimeout = 0.0f;

	m_curPolar.SetPitch(1.f);
}