mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-19 14:38:18 +00:00
fixed dynamic camera when spectating a player. (#1485)
This commit is contained in:
parent
7a8687a618
commit
055685406a
|
@ -138,7 +138,7 @@ int CControls::SnapInput(int *pData)
|
|||
}
|
||||
else
|
||||
{
|
||||
|
||||
ClampMousePos();
|
||||
m_InputData.m_TargetX = (int)m_MousePos.x;
|
||||
m_InputData.m_TargetY = (int)m_MousePos.y;
|
||||
if(!m_InputData.m_TargetX && !m_InputData.m_TargetY)
|
||||
|
@ -196,6 +196,8 @@ int CControls::SnapInput(int *pData)
|
|||
|
||||
void CControls::OnRender()
|
||||
{
|
||||
ClampMousePos();
|
||||
|
||||
// update target pos
|
||||
if(m_pClient->m_Snap.m_pGameData && !m_pClient->m_Snap.m_SpecInfo.m_Active)
|
||||
m_TargetPos = m_pClient->m_LocalCharacterPos + m_MousePos;
|
||||
|
@ -212,7 +214,6 @@ bool CControls::OnMouseMove(float x, float y)
|
|||
return false;
|
||||
|
||||
m_MousePos += vec2(x, y); // TODO: ugly
|
||||
ClampMousePos();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -223,7 +224,6 @@ void CControls::ClampMousePos()
|
|||
{
|
||||
m_MousePos.x = clamp(m_MousePos.x, 200.0f, Collision()->GetWidth()*32-200.0f);
|
||||
m_MousePos.y = clamp(m_MousePos.y, 200.0f, Collision()->GetHeight()*32-200.0f);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue