diff options
author | Andrei Karas <akaras@inbox.ru> | 2013-09-18 12:01:45 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2013-09-18 12:01:45 +0300 |
commit | 64b82129075e7608e94f8e27ee6c446213032cfb (patch) | |
tree | af4b77c7574624a73e3da62dbc1ed5832aeb3016 /src/being | |
parent | 845ff2f18c34c76982755c756214daa982b7eb1f (diff) | |
download | manaplus-64b82129075e7608e94f8e27ee6c446213032cfb.tar.gz manaplus-64b82129075e7608e94f8e27ee6c446213032cfb.tar.bz2 manaplus-64b82129075e7608e94f8e27ee6c446213032cfb.tar.xz manaplus-64b82129075e7608e94f8e27ee6c446213032cfb.zip |
improve a bit being move calculations.
Diffstat (limited to 'src/being')
-rw-r--r-- | src/being/being.cpp | 34 |
1 files changed, 21 insertions, 13 deletions
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<float>(mX * 32 + 16 + xOffset), - static_cast<float>(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<float>(mX * 32 + 16 + xOffset), + static_cast<float>(mY * 32 + 32 + yOffset2)); + } + else + { + setPosition(static_cast<float>(mX * 32 + 16), + static_cast<float>(mY * 32 + 32)); + } } if (mEmotionSprite) |