mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
Merge pull request #369 from user578/master
Fix wrong calculation of weapon Angle in demo player
This commit is contained in:
commit
940e46ad88
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -50,5 +50,6 @@ bam.exe
|
|||
.settings
|
||||
*.opensdf
|
||||
*.pyc
|
||||
*.dll
|
||||
|
||||
DDNet*
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue