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(); }
//--------------------------------- 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); } } } } }
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); }