Skip to content

Commit

Permalink
Merge pull request ddnet#369 from user578/master
Browse files Browse the repository at this point in the history
Fix wrong calculation of weapon Angle in demo player
  • Loading branch information
H-M-H committed Nov 15, 2015
2 parents 2afaba1 + 4031149 commit 940e46a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -50,5 +50,6 @@ bam.exe
.settings
*.opensdf
*.pyc
*.dll

DDNet*
12 changes: 12 additions & 0 deletions src/game/client/components/players.cpp
Expand Up @@ -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
Expand Down

0 comments on commit 940e46a

Please sign in to comment.