fix min mouse pos for follow factor

This commit is contained in:
jupeyy 2019-12-18 20:58:42 +01:00
parent 71857fdb80
commit 8a8674b545

View file

@ -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;
}
}