Fix smooth zoom with zero causing problems with multiview

This commit is contained in:
devdenn 2023-08-12 18:07:47 +02:00
parent 9eb73c9990
commit 9db53bd7a0

View file

@ -31,7 +31,7 @@ float CCamera::ZoomProgress(float CurrentTime) const
void CCamera::ScaleZoom(float Factor) void CCamera::ScaleZoom(float Factor)
{ {
float CurrentTarget = m_Zooming ? m_ZoomSmoothingTarget : m_Zoom; float CurrentTarget = m_Zooming ? m_ZoomSmoothingTarget : m_Zoom;
ChangeZoom(CurrentTarget * Factor, g_Config.m_ClSmoothZoomTime); ChangeZoom(CurrentTarget * Factor, m_pClient->m_Snap.m_SpecInfo.m_Active && GameClient()->m_MultiViewActivated ? g_Config.m_ClMultiViewZoomSmoothness : g_Config.m_ClSmoothZoomTime);
} }
float CCamera::MaxZoomLevel() float CCamera::MaxZoomLevel()
@ -218,7 +218,7 @@ void CCamera::ConZoom(IConsole::IResult *pResult, void *pUserData)
{ {
CCamera *pSelf = (CCamera *)pUserData; CCamera *pSelf = (CCamera *)pUserData;
float TargetLevel = pResult->NumArguments() ? pResult->GetFloat(0) : g_Config.m_ClDefaultZoom; float TargetLevel = pResult->NumArguments() ? pResult->GetFloat(0) : g_Config.m_ClDefaultZoom;
pSelf->ChangeZoom(std::pow(ZoomStep, TargetLevel - 10), g_Config.m_ClSmoothZoomTime); pSelf->ChangeZoom(std::pow(ZoomStep, TargetLevel - 10), pSelf->m_pClient->m_Snap.m_SpecInfo.m_Active && pSelf->GameClient()->m_MultiViewActivated ? g_Config.m_ClMultiViewZoomSmoothness : g_Config.m_ClSmoothZoomTime);
if(pSelf->GameClient()->m_MultiViewActivated) if(pSelf->GameClient()->m_MultiViewActivated)
pSelf->GameClient()->m_MultiViewPersonalZoom = 0; pSelf->GameClient()->m_MultiViewPersonalZoom = 0;