diff options
author | Bertram <yohanndotferreiraatorange.fr> | 2010-03-08 17:17:30 +0100 |
---|---|---|
committer | Bertram <yohanndotferreiraatorange.fr> | 2010-03-08 17:17:30 +0100 |
commit | ae774999ad279b0b4d627c13464bc4818a14a6da (patch) | |
tree | 3abb475657ba7d0899fccfacc5aa5f5f01923f9c | |
parent | 9951bf6c1c2e3966f92f1545b60a9e23a1f32565 (diff) | |
download | mana-ae774999ad279b0b4d627c13464bc4818a14a6da.tar.gz mana-ae774999ad279b0b4d627c13464bc4818a14a6da.tar.bz2 mana-ae774999ad279b0b4d627c13464bc4818a14a6da.tar.xz mana-ae774999ad279b0b4d627c13464bc4818a14a6da.zip |
Revert "Added diagonal movement corrections and corrected some comments."
This reverts commit b1845e9e081df1fc77d9bcbed3ab95792d6ba682.
-rw-r--r-- | src/being.cpp | 39 |
1 files changed, 10 insertions, 29 deletions
diff --git a/src/being.cpp b/src/being.cpp index 64fe635e..2c7ba016 100644 --- a/src/being.cpp +++ b/src/being.cpp @@ -139,13 +139,13 @@ Position Being::checkNodeOffsets(const Position &position) const // Compute the being radius: // FIXME: the beings' radius should be obtained from xml values - // and stored into the Being objects. + // and stored into the Being ojects. int radius = getWidth() / 2; - // FIXME: Handle beings with more than 1/2 tile radius by not letting them + // FIXME: Hande beings with more than 1/2 tile radius by not letting them // go or spawn in too narrow places. The server will have to be aware // of being's radius value (in tiles) to handle this gracefully. if (radius > 32 / 2) radius = 32 / 2; - // Set a default value if no value returned. + // set a default value if no value returned. if (radius < 1) radius = 32 / 3; // Fix coordinates so that the player does not seem to dig into walls. @@ -158,32 +158,13 @@ Position Being::checkNodeOffsets(const Position &position) const else if (fy < radius && !mMap->getWalk(tx, ty - 1, getWalkMask())) fy = radius; - // Top-left border check - if (!mMap->getWalk(tx - 1, ty - 1, getWalkMask()) - && fy < radius && fx < radius) - { - fx = fy = radius; - } - // Top-right border check - if (!mMap->getWalk(tx + 1, ty - 1, getWalkMask()) - && (fy < radius) && fx > (32 - radius)) - { - fx = 32 -radius; - fy = radius; - } - // Bottom-left border check - if (!mMap->getWalk(tx - 1, ty + 1, getWalkMask()) - && fy > (32 - radius) && fx < radius) - { - fx = radius; - fy = 32 - radius; - } - // Bottom-right border check - if (!mMap->getWalk(tx + 1, ty + 1, getWalkMask()) - && fy > (32 - radius) && fx > (32 - radius)) - { - fx = fy = 32 -radius; - } + // FIXME: Check also diagonal positions. + + // Test also the current character's position, to avoid the corner case + // where a player can approach an obstacle by walking from slightly + // under, diagonally. First part to the walk on water bug. + //if (offsetY < 16 && !mMap->getWalk(posX, posY - 1, getWalkMask())) + //fy = 16; return Position(tx * 32 + fx, ty * 32 + fy); } |