diff options
author | heinrich5991 <heinrich5991@gmail.com> | 2014-03-22 11:53:33 +0100 |
---|---|---|
committer | oy <Tom_Adams@web.de> | 2015-10-28 17:11:53 +0100 |
commit | 093c1f15db409efbcbb143312f2543c2cd946a1b (patch) | |
tree | 3c88cb78c92f0ba03899e3c6c02b7f73efa12a7a | |
parent | f17ccbfac3515893c9cb6556904019fdf840f8a3 (diff) |
Fix walking animation
Previously, when walking with negative x-coordinate, your walking direction was
inversed.
-rw-r--r-- | src/game/client/components/players.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/game/client/components/players.cpp b/src/game/client/components/players.cpp index 2eddd8a97..901e57910 100644 --- a/src/game/client/components/players.cpp +++ b/src/game/client/components/players.cpp @@ -274,7 +274,12 @@ void CPlayers::RenderPlayer( bool WantOtherDir = (Player.m_Direction == -1 && Vel.x > 0) || (Player.m_Direction == 1 && Vel.x < 0); // evaluate animation - float WalkTime = fmod(absolute(Position.x), 100.0f)/100.0f; + const float WalkTimeMagic = 100.0f; + float WalkTime = + ((Position.x >= 0) + ? fmod(Position.x, WalkTimeMagic) + : WalkTimeMagic - fmod(-Position.x, WalkTimeMagic)) + / WalkTimeMagic; CAnimState State; State.Set(&g_pData->m_aAnimations[ANIM_BASE], 0); |