summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChuck Miller <shadowmil@gmail.com>2009-06-26 22:23:03 -0400
committerChuck Miller <shadowmil@gmail.com>2009-06-26 22:23:03 -0400
commit82431b7cc3ee57174981fec541c96c2e3344432d (patch)
tree6015e479530a2f40870f35c521dbd3c1bfb2256f /src
parent95fd0eb8877b395abfa02bb2fdeb0bfb812d4759 (diff)
downloadmana-client-82431b7cc3ee57174981fec541c96c2e3344432d.tar.gz
mana-client-82431b7cc3ee57174981fec541c96c2e3344432d.tar.bz2
mana-client-82431b7cc3ee57174981fec541c96c2e3344432d.tar.xz
mana-client-82431b7cc3ee57174981fec541c96c2e3344432d.zip
Fixes the walk after death on TMWServ builds
Diffstat (limited to 'src')
-rw-r--r--src/being.cpp69
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