Skip to content

Commit

Permalink
fix mouse position in spectate with zoom options
Browse files Browse the repository at this point in the history
  • Loading branch information
sjrc6 committed Nov 24, 2024
1 parent 8b97512 commit 918ed17
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions src/game/client/components/controls.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -210,11 +210,11 @@ int CControls::SnapInput(int *pData)
// even if chat or menu are activated
vec2 Pos = m_pClient->m_Controls.m_aMousePos[g_Config.m_ClDummy];
const int MaxDistance = g_Config.m_ClDyncam ? g_Config.m_ClDyncamMaxDistance : g_Config.m_ClMouseMaxDistance;
if(MaxDistance > 5) // Only multiply mouse coords if not angle bind
if(!m_pClient->m_Snap.m_SpecInfo.m_Active && MaxDistance > 5) // Only multiply mouse coords if not angle bind
{
if(g_Config.m_ClImproveMousePrecision && MaxDistance < 1000) // Don't scale if it would reduce precision
Pos *= length(Pos) * 1000.0f / (float)MaxDistance;
if(!m_pClient->m_Snap.m_SpecInfo.m_Active && !g_Config.m_ClOldMouseZoom)
if(!g_Config.m_ClOldMouseZoom)
Pos *= m_pClient->m_Camera.m_Zoom;
}
m_aInputData[g_Config.m_ClDummy].m_TargetX = (int)Pos.x;
Expand All @@ -235,17 +235,15 @@ int CControls::SnapInput(int *pData)
m_aMousePosOnAction[g_Config.m_ClDummy] = vec2(0.0f, 0.0f);
}
else
Pos = m_pClient->m_Controls.m_aMousePos[g_Config.m_ClDummy];
if(!m_pClient->m_Snap.m_SpecInfo.m_Active)

Pos = m_pClient->m_Controls.m_aMousePos[g_Config.m_ClDummy];
const int MaxDistance = g_Config.m_ClDyncam ? g_Config.m_ClDyncamMaxDistance : g_Config.m_ClMouseMaxDistance;
if(!m_pClient->m_Snap.m_SpecInfo.m_Active && MaxDistance > 5) // Only multiply mouse coords if not angle bind
{
const int MaxDistance = g_Config.m_ClDyncam ? g_Config.m_ClDyncamMaxDistance : g_Config.m_ClMouseMaxDistance;
if(MaxDistance > 5) // Only multiply mouse coords if not angle bind
{
if(g_Config.m_ClImproveMousePrecision && MaxDistance < 1000) // Don't scale if it would reduce precision
Pos *= length(Pos) * 1000.0f / (float)(g_Config.m_ClDyncam ? g_Config.m_ClDyncamMaxDistance : g_Config.m_ClMouseMaxDistance);
if(!g_Config.m_ClOldMouseZoom)
Pos *= m_pClient->m_Camera.m_Zoom;
}
if(g_Config.m_ClImproveMousePrecision && MaxDistance < 1000) // Don't scale if it would reduce precision
Pos *= length(Pos) * 1000.0f / (float)(g_Config.m_ClDyncam ? g_Config.m_ClDyncamMaxDistance : g_Config.m_ClMouseMaxDistance);
if(!g_Config.m_ClOldMouseZoom)
Pos *= m_pClient->m_Camera.m_Zoom;
}
m_aInputData[g_Config.m_ClDummy].m_TargetX = (int)Pos.x;
m_aInputData[g_Config.m_ClDummy].m_TargetY = (int)Pos.y;
Expand Down

0 comments on commit 918ed17

Please sign in to comment.