From 5c30a24b51538c8a0656977caeeced94277aa5b8 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 4 Jul 2012 22:15:48 +0300 Subject: Add option to items.xml to set max floor item pixel offset. --- src/flooritem.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'src/flooritem.cpp') diff --git a/src/flooritem.cpp b/src/flooritem.cpp index 0bb75fb1f..a6d45f788 100644 --- a/src/flooritem.cpp +++ b/src/flooritem.cpp @@ -53,10 +53,20 @@ FloorItem::FloorItem(int id, int itemId, int x, int y, Map *map, int amount, mHighlight(config.getBoolValue("floorItemsHighlight")) { setMap(map); + const ItemInfo &info = ItemDB::get(itemId); if (map) { - mPos.x = static_cast(x * map->getTileWidth() + subX); - mPos.y = static_cast(y * map->getTileHeight() + subY); + int max = info.getMaxFloorOffset(); + if (subX > max) + subX = max; + else if (subX < -max) + subX = -max; + if (subY > max) + subY = max; + else if (subY < -max) + subY = -max; + mPos.x = static_cast(x * map->getTileWidth() + subX + 16 - 8); + mPos.y = static_cast(y * map->getTileHeight() + subY + 32 - 8); } else { @@ -64,7 +74,6 @@ FloorItem::FloorItem(int id, int itemId, int x, int y, Map *map, int amount, mPos.y = 0; } - const ItemInfo &info = ItemDB::get(itemId); setupSpriteDisplay(info.getDisplay(), true, 1, info.getDyeColorsString(mColor)); mYDiff = 31; -- cgit v1.2.3-60-g2f50