From 8a8674b545329bd7be04a9bad355d17219695ce5 Mon Sep 17 00:00:00 2001 From: jupeyy Date: Wed, 18 Dec 2019 20:58:42 +0100 Subject: [PATCH] fix min mouse pos for follow factor --- src/game/client/components/controls.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/game/client/components/controls.cpp b/src/game/client/components/controls.cpp index 5aef0085f..45cf340b3 100644 --- a/src/game/client/components/controls.cpp +++ b/src/game/client/components/controls.cpp @@ -504,17 +504,16 @@ void CControls::ClampMousePos() else { float CameraMaxDistance = 200.0f; - float CameraMinDistance = 0.0f; float FollowFactor = (g_Config.m_ClDyncam ? g_Config.m_ClDyncamFollowFactor : g_Config.m_ClMouseFollowfactor) / 100.0f; float DeadZone = g_Config.m_ClDyncam ? g_Config.m_ClDyncamDeadzone : g_Config.m_ClMouseDeadzone; float MaxDistance = g_Config.m_ClDyncam ? g_Config.m_ClDyncamMaxDistance : g_Config.m_ClMouseMaxDistance; - float MouseMax = minimum(CameraMaxDistance/FollowFactor + DeadZone, MaxDistance); + float MouseMax = minimum((FollowFactor != 0 ? CameraMaxDistance/FollowFactor + DeadZone : MaxDistance), MaxDistance); float MinDistance = g_Config.m_ClDyncam ? g_Config.m_ClDyncamMinDistance : g_Config.m_ClMouseMinDistance; - float MouseMin = minimum(CameraMinDistance/FollowFactor + DeadZone, MinDistance); + float MouseMin = MinDistance; - if(length(m_MousePos[g_Config.m_ClDummy]) > MouseMax) - m_MousePos[g_Config.m_ClDummy] = normalize(m_MousePos[g_Config.m_ClDummy])*MouseMax; if(length(m_MousePos[g_Config.m_ClDummy]) < MouseMin) m_MousePos[g_Config.m_ClDummy] = normalize(m_MousePos[g_Config.m_ClDummy])*MouseMin; + if(length(m_MousePos[g_Config.m_ClDummy]) > MouseMax) + m_MousePos[g_Config.m_ClDummy] = normalize(m_MousePos[g_Config.m_ClDummy])*MouseMax; } }