diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-08-03 17:08:47 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-08-03 17:08:47 +0300 |
commit | 545017e651250e14656a8ab21c3ab36b8b2fa760 (patch) | |
tree | 85d70f7ca099320591ff547dd8e0531f578bf194 /src/flooritem.cpp | |
parent | 4f00e33aae207561fc0b34ee7d181d7a74755fd5 (diff) | |
download | manaverse-545017e651250e14656a8ab21c3ab36b8b2fa760.tar.gz manaverse-545017e651250e14656a8ab21c3ab36b8b2fa760.tar.bz2 manaverse-545017e651250e14656a8ab21c3ab36b8b2fa760.tar.xz manaverse-545017e651250e14656a8ab21c3ab36b8b2fa760.zip |
Fix floor items position if tile height is not zero.
Diffstat (limited to 'src/flooritem.cpp')
-rw-r--r-- | src/flooritem.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/flooritem.cpp b/src/flooritem.cpp index 4abe9047f..1d0b9948d 100644 --- a/src/flooritem.cpp +++ b/src/flooritem.cpp @@ -50,6 +50,7 @@ FloorItem::FloorItem(const int id, const int itemId, const int x, const int y, mY(y), mDropTime(cur_time), mAmount(amount), + mHeightPosDiff(0), mPickupCount(0), mCursor(Cursor::CURSOR_PICKUP), mColor(color), @@ -73,21 +74,23 @@ void FloorItem::postInit(Map *const map, int subX, int subY) subY = max; else if (subY < -max) subY = -max; + mHeightPosDiff = map->getHeightOffset(mX, mY) * 16; mPos.x = static_cast<float>(mX * map->getTileWidth() + subX + mapTileSize / 2 - 8); mPos.y = static_cast<float>(mY * map->getTileHeight() - + subY + mapTileSize - 8); + + subY + mapTileSize - 8 - mHeightPosDiff); + mYDiff = 31 - mHeightPosDiff; } else { mPos.x = 0; mPos.y = 0; + mYDiff = 31; } mCursor = info.getPickupCursor(); setupSpriteDisplay(info.getDisplay(), true, 1, info.getDyeColorsString(mColor)); - mYDiff = 31; } const ItemInfo &FloorItem::getInfo() const @@ -112,7 +115,7 @@ void FloorItem::draw(Graphics *const graphics, BLOCK_START("FloorItem::draw") const int x = mX * mMap->getTileWidth() + offsetX; - const int y = mY * mMap->getTileHeight() + offsetY; + const int y = mY * mMap->getTileHeight() + offsetY - mHeightPosDiff; Font *font = nullptr; if (mHighlight) |