Merge pull request #369 from user578/master

Fix wrong calculation of weapon Angle in demo player
This commit is contained in:
H-M-H 2015-11-15 14:28:16 +01:00
commit 940e46ad88
2 changed files with 13 additions and 0 deletions

1
.gitignore vendored
View file

@ -50,5 +50,6 @@ bam.exe
.settings
*.opensdf
*.pyc
*.dll
DDNet*

View file

@ -417,6 +417,18 @@ void CPlayers::RenderPlayer(
}
else
{
// If player move his weapon through top then change the end angle on 2*Pi.
// So mix function will calculate offset angle by a short path, and not by long one.
if (Player.m_Angle > (256.0f * pi) && Prev.m_Angle < 0)
{
Player.m_Angle -= 256.0f * 2 * pi;
Angle = mix((float)Prev.m_Angle, (float)Player.m_Angle, IntraTick) / 256.0f;
}
else if (Player.m_Angle < 0 && Prev.m_Angle > (256.0f * pi))
{
Player.m_Angle += 256.0f * 2 * pi;
Angle = mix((float)Prev.m_Angle, (float)Player.m_Angle, IntraTick) / 256.0f;
}
/*
float mixspeed = Client()->FrameTime()*2.5f;
if(player.attacktick != prev.attacktick) // shooting boosts the mixing speed