From 9266a94488be76e8cb9700a1426832dfc914320c Mon Sep 17 00:00:00 2001 From: Guillaume Melquiond Date: Sat, 30 Dec 2006 15:06:46 +0000 Subject: Improved precise positionning of character with mouse cursor. --- src/localplayer.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/localplayer.cpp') diff --git a/src/localplayer.cpp b/src/localplayer.cpp index 962a1ae4..ba7b6117 100644 --- a/src/localplayer.cpp +++ b/src/localplayer.cpp @@ -218,9 +218,9 @@ void LocalPlayer::setDestination(Uint16 x, Uint16 y) { // Fix coordinates so that the player does not seem to dig into walls. int tx = x / 32, ty = y / 32, fx = x % 32, fy = y % 32; - if (fx != 16 && !mMap->getWalk(tx + fx / 16 * 2 - 1, ty)) fx = 16; - if (fy != 16 && !mMap->getWalk(tx, ty + fy / 16 * 2 - 1)) fy = 16; - if (fx != 16 && fy != 16 && !mMap->getWalk(tx + fx / 16 * 2 - 1, ty + fy / 16 * 2 - 1)) fx = 16; + if (fx != 16 && mMap->tileCollides(tx + fx / 16 * 2 - 1, ty)) fx = 16; + if (fy != 16 && mMap->tileCollides(tx, ty + fy / 16 * 2 - 1)) fy = 16; + if (fx != 16 && fy != 16 && mMap->tileCollides(tx + fx / 16 * 2 - 1, ty + fy / 16 * 2 - 1)) fx = 16; x = tx * 32 + fx; y = ty * 32 + fy; -- cgit v1.2.3-70-g09d2