1313
1414#define PI_2 6 .283185307179586476925286766559f
1515
16+ // Camera FOV constants
17+ constexpr const std::uintptr_t VAR_CurrentCameraFOV = 0x8D5038 ; // CCamera::CurrentFOV
18+
1619CClientCamera::CClientCamera (CClientManager* pManager) : ClassInit(this ), CClientEntity(INVALID_ELEMENT_ID)
1720{
1821 CClientEntityRefManager::AddEntityRefs (ENTITY_REF_DEBUG (this , " CClientCamera" ), &m_pFocusedPlayer, &m_pFocusedEntity, NULL );
@@ -27,7 +30,7 @@ CClientCamera::CClientCamera(CClientManager* pManager) : ClassInit(this), CClien
2730 m_bInvalidated = false ;
2831 m_bFixed = false ;
2932 m_fRoll = 0 .0f ;
30- m_fFOV = 70 . 0f ;
33+ m_fFOV = DEFAULT_FOV ;
3134 SetTypeName (" camera" );
3235
3336 m_pCamera = g_pGame->GetCamera ();
@@ -359,7 +362,7 @@ void CClientCamera::SetFocus(CClientEntity* pEntity, eCamMode eMode, bool bSmoot
359362 }
360363
361364 m_fRoll = 0 .0f ;
362- m_fFOV = 70 . 0f ;
365+ m_fFOV = DEFAULT_FOV ;
363366}
364367
365368void CClientCamera::SetFocus (CClientPlayer* pPlayer, eCamMode eMode, bool bSmoothTransition)
@@ -387,7 +390,7 @@ void CClientCamera::SetFocus(CClientPlayer* pPlayer, eCamMode eMode, bool bSmoot
387390 // Store the player we focused
388391 m_pFocusedPlayer = pPlayer;
389392 m_fRoll = 0 .0f ;
390- m_fFOV = 70 . 0f ;
393+ m_fFOV = DEFAULT_FOV ;
391394 m_bFixed = false ;
392395}
393396
@@ -427,7 +430,7 @@ void CClientCamera::Reset()
427430 m_pFocusedGameEntity = NULL ;
428431 m_bFixed = false ;
429432 m_fRoll = 0 .0f ;
430- m_fFOV = 70 . 0f ;
433+ m_fFOV = DEFAULT_FOV ;
431434}
432435
433436void CClientCamera::SetFocusToLocalPlayerImpl ()
@@ -542,7 +545,7 @@ void CClientCamera::ToggleCameraFixedMode(bool bEnabled)
542545 SetFocusToLocalPlayer ();
543546
544547 m_fRoll = 0 .0f ;
545- m_fFOV = 70 . 0f ;
548+ m_fFOV = DEFAULT_FOV ;
546549 }
547550}
548551
@@ -606,6 +609,9 @@ bool CClientCamera::ProcessFixedCamera(CCam* pCam)
606609//
607610CMatrix CClientCamera::GetGtaMatrix () const
608611{
612+ if (IsInCameraTransition ())
613+ return GetInterpolatedCameraMatrix ();
614+
609615 CCam* pCam = m_pCamera->GetCam (m_pCamera->GetActiveCam ());
610616
611617 CMatrix matResult;
@@ -644,3 +650,28 @@ void CClientCamera::ResetShakeCamera() noexcept
644650{
645651 m_pCamera->ResetShakeCamera ();
646652}
653+
654+ bool CClientCamera::IsInCameraTransition () const
655+ {
656+ return m_pCamera ? m_pCamera->IsInTransition () : false ;
657+ }
658+
659+ CMatrix CClientCamera::GetInterpolatedCameraMatrix () const
660+ {
661+ CMatrix matrix;
662+ if (m_pCamera && m_pCamera->GetTransitionMatrix (matrix))
663+ return matrix;
664+
665+ return CMatrix ();
666+ }
667+
668+ float CClientCamera::GetAccurateFOV () const
669+ {
670+ if (!m_pCamera)
671+ return DEFAULT_FOV;
672+
673+ if (IsInCameraTransition ())
674+ return m_pCamera->GetTransitionFOV ();
675+
676+ return *(float *)VAR_CurrentCameraFOV;
677+ }
0 commit comments