summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-07-27 21:27:28 +0300
committerAndrei Karas <akaras@inbox.ru>2014-07-27 21:27:28 +0300
commit5f61b3a8ec592bc251a08366656b55bdfe3736a0 (patch)
tree156cbe63e9a5790c17439003041b46cf8a1ce362
parente8568355d85fb3972df517a4520120fc681c937c (diff)
downloadmv-5f61b3a8ec592bc251a08366656b55bdfe3736a0.tar.gz
mv-5f61b3a8ec592bc251a08366656b55bdfe3736a0.tar.bz2
mv-5f61b3a8ec592bc251a08366656b55bdfe3736a0.tar.xz
mv-5f61b3a8ec592bc251a08366656b55bdfe3736a0.zip
Fix height being position if player not moving.
-rw-r--r--src/being/being.cpp18
-rw-r--r--src/being/being.h1
2 files changed, 12 insertions, 7 deletions
diff --git a/src/being/being.cpp b/src/being/being.cpp
index 35e90590c..487749a0d 100644
--- a/src/being/being.cpp
+++ b/src/being/being.cpp
@@ -204,7 +204,8 @@ Being::Being(const int id,
mAdvanced(false),
mShop(false),
mAway(false),
- mInactive(false)
+ mInactive(false),
+ mNeedPosUpdate(true)
{
for (int f = 0; f < 20; f ++)
{
@@ -1385,6 +1386,7 @@ void Being::nextTile()
mY = pos.y;
const uint8_t height = mMap->getHeightOffset(mX, mY);
mOffsetY = height - mOldHeight;
+ mNeedPosUpdate = true;
setAction(BeingAction::MOVE, 0);
}
@@ -1451,8 +1453,9 @@ void Being::logic()
}
}
- if (mAction == BeingAction::MOVE)
+ if (mAction == BeingAction::MOVE || mNeedPosUpdate)
{
+ mNeedPosUpdate = false;
const int xOffset = getXOffset();
const int yOffset = getYOffset();
int offset = xOffset;
@@ -1469,11 +1472,6 @@ void Being::logic()
+ mapTileSize / 2 + xOffset), static_cast<float>(
mY * mapTileSize + mapTileSize + yOffset2));
}
- else
- {
- setPosition(static_cast<float>(mX * mapTileSize + mapTileSize / 2),
- static_cast<float>(mY * mapTileSize + mapTileSize));
- }
if (mEmotionSprite)
{
@@ -3339,14 +3337,20 @@ void Being::setTileCoords(const int x, const int y)
mX = x;
mY = y;
if (mMap)
+ {
mOffsetY = mMap->getHeightOffset(mX, mY);
+ mNeedPosUpdate = true;
+ }
}
void Being::setMap(Map *const map)
{
ActorSprite::setMap(map);
if (mMap)
+ {
mOffsetY = mMap->getHeightOffset(mX, mY);
+ mNeedPosUpdate = true;
+ }
}
void Being::removeAllItemsParticles()
diff --git a/src/being/being.h b/src/being/being.h
index ccfabe9a1..776af36dc 100644
--- a/src/being/being.h
+++ b/src/being/being.h
@@ -1061,6 +1061,7 @@ class Being notfinal : public ActorSprite,
bool mShop;
bool mAway;
bool mInactive;
+ bool mNeedPosUpdate;
};
extern std::list<BeingCacheEntry*> beingInfoCache;