mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-13 03:28:19 +00:00
fix min mouse pos for follow factor
This commit is contained in:
parent
71857fdb80
commit
8a8674b545
|
@ -504,17 +504,16 @@ void CControls::ClampMousePos()
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
float CameraMaxDistance = 200.0f;
|
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 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 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 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 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)
|
if(length(m_MousePos[g_Config.m_ClDummy]) < MouseMin)
|
||||||
m_MousePos[g_Config.m_ClDummy] = normalize(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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue