From 64b82129075e7608e94f8e27ee6c446213032cfb Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 18 Sep 2013 12:01:45 +0300 Subject: improve a bit being move calculations. --- src/being/being.cpp | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/being/being.cpp b/src/being/being.cpp index 5b1e49a8c..2e7f6d67b 100644 --- a/src/being/being.cpp +++ b/src/being/being.cpp @@ -1521,19 +1521,27 @@ void Being::logic() } } - const int xOffset = getXOffset(); - const int yOffset = getYOffset(); - int offset = xOffset; - if (!offset) - offset = yOffset; - - mSortOffsetY = (mOldHeight * 16) + (mOffsetY * 16) - * (32 - abs(offset)) / 32; - const int yOffset2 = yOffset - mSortOffsetY; - - // Update pixel coordinates - setPosition(static_cast(mX * 32 + 16 + xOffset), - static_cast(mY * 32 + 32 + yOffset2)); + if (mAction == MOVE) + { + const int xOffset = getXOffset(); + const int yOffset = getYOffset(); + int offset = xOffset; + if (!offset) + offset = yOffset; + + mSortOffsetY = (mOldHeight * 16) + (mOffsetY * 16) + * (32 - abs(offset)) / 32; + const int yOffset2 = yOffset - mSortOffsetY; + + // Update pixel coordinates + setPosition(static_cast(mX * 32 + 16 + xOffset), + static_cast(mY * 32 + 32 + yOffset2)); + } + else + { + setPosition(static_cast(mX * 32 + 16), + static_cast(mY * 32 + 32)); + } } if (mEmotionSprite) -- cgit v1.2.3-70-g09d2