From 545017e651250e14656a8ab21c3ab36b8b2fa760 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 3 Aug 2014 17:08:47 +0300 Subject: Fix floor items position if tile height is not zero. --- src/flooritem.cpp | 9 ++++++--- src/flooritem.h | 1 + 2 files changed, 7 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(mX * map->getTileWidth() + subX + mapTileSize / 2 - 8); mPos.y = static_cast(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) diff --git a/src/flooritem.h b/src/flooritem.h index c884d8db3..846a27802 100644 --- a/src/flooritem.h +++ b/src/flooritem.h @@ -104,6 +104,7 @@ class FloorItem final : public ActorSprite int mX, mY; int mDropTime; int mAmount; + int mHeightPosDiff; unsigned int mPickupCount; Cursor::Cursor mCursor; unsigned char mColor; -- cgit v1.2.3-70-g09d2