diff options
author | Chuck Miller <shadowmil@gmail.com> | 2009-06-26 22:23:03 -0400 |
---|---|---|
committer | Chuck Miller <shadowmil@gmail.com> | 2009-06-26 22:23:03 -0400 |
commit | 82431b7cc3ee57174981fec541c96c2e3344432d (patch) | |
tree | 6015e479530a2f40870f35c521dbd3c1bfb2256f /src/being.cpp | |
parent | 95fd0eb8877b395abfa02bb2fdeb0bfb812d4759 (diff) | |
download | mana-82431b7cc3ee57174981fec541c96c2e3344432d.tar.gz mana-82431b7cc3ee57174981fec541c96c2e3344432d.tar.bz2 mana-82431b7cc3ee57174981fec541c96c2e3344432d.tar.xz mana-82431b7cc3ee57174981fec541c96c2e3344432d.zip |
Fixes the walk after death on TMWServ builds
Diffstat (limited to 'src/being.cpp')
-rw-r--r-- | src/being.cpp | 69 |
1 files changed, 36 insertions, 33 deletions
diff --git a/src/being.cpp b/src/being.cpp index 85095804..8d05c81b 100644 --- a/src/being.cpp +++ b/src/being.cpp @@ -531,39 +531,42 @@ void Being::logic() } #ifdef TMWSERV_SUPPORT - const Vector dest = (mPath.empty()) ? - mDest : Vector(mPath.front().x, - mPath.front().y); - - Vector dir = dest - mPos; - const float length = dir.length(); - - // When we're over 2 pixels from our destination, move to it - // TODO: Should be possible to make it even pixel exact, but this solves - // the jigger caused by moving too far. - if (length > 2.0f) { - const float speed = mWalkSpeed / 100.0f; - setPosition(mPos + (dir / (length / speed))); - - if (mAction != WALK) - setAction(WALK); - - // Update the player sprite direction - int direction = 0; - const float dx = std::abs(dir.x); - const float dy = std::abs(dir.y); - if (dx > dy) - direction |= (dir.x > 0) ? RIGHT : LEFT; - else - direction |= (dir.y > 0) ? DOWN : UP; - setDirection(direction); - } - else if (!mPath.empty()) { - // TODO: Pop as soon as there is a direct unblocked line to the next - // point on the path. - mPath.pop_front(); - } else if (mAction == WALK) { - setAction(STAND); + if (mAction != DEAD) + { + const Vector dest = (mPath.empty()) ? + mDest : Vector(mPath.front().x, + mPath.front().y); + + Vector dir = dest - mPos; + const float length = dir.length(); + + // When we're over 2 pixels from our destination, move to it + // TODO: Should be possible to make it even pixel exact, but this solves + // the jigger caused by moving too far. + if (length > 2.0f) { + const float speed = mWalkSpeed / 100.0f; + setPosition(mPos + (dir / (length / speed))); + + if (mAction != WALK) + setAction(WALK); + + // Update the player sprite direction + int direction = 0; + const float dx = std::abs(dir.x); + const float dy = std::abs(dir.y); + if (dx > dy) + direction |= (dir.x > 0) ? RIGHT : LEFT; + else + direction |= (dir.y > 0) ? DOWN : UP; + setDirection(direction); + } + else if (!mPath.empty()) { + // TODO: Pop as soon as there is a direct unblocked line to the next + // point on the path. + mPath.pop_front(); + } else if (mAction == WALK) { + setAction(STAND); + } } #else // Update pixel coordinates |