fix local hookline direction when mouse is exactly center

This commit is contained in:
Tater 2022-04-11 06:32:02 -05:00
parent 0157deae61
commit 712b3f041d

View file

@ -138,8 +138,13 @@ void CPlayers::RenderHookCollLine(
vec2 ExDirection = Direction;
if(Local && Client()->State() != IClient::STATE_DEMOPLAYBACK)
{
ExDirection = normalize(vec2((int)m_pClient->m_Controls.m_MousePos[g_Config.m_ClDummy].x, (int)m_pClient->m_Controls.m_MousePos[g_Config.m_ClDummy].y));
// fix direction if mouse is exactly in the center
if(!(int)m_pClient->m_Controls.m_MousePos[g_Config.m_ClDummy].x && !(int)m_pClient->m_Controls.m_MousePos[g_Config.m_ClDummy].y)
ExDirection = vec2(1, 0);
}
Graphics()->TextureClear();
vec2 InitPos = Position;
vec2 FinishPos = InitPos + ExDirection * (m_pClient->m_Tuning[g_Config.m_ClDummy].m_HookLength - 42.0f);