summaryrefslogtreecommitdiff
path: root/src/flooritem.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-07-04 22:15:48 +0300
committerAndrei Karas <akaras@inbox.ru>2012-07-04 22:15:48 +0300
commit5c30a24b51538c8a0656977caeeced94277aa5b8 (patch)
tree574a680074cf5f69522b79ef48430d57b8be0787 /src/flooritem.cpp
parent146e9182d8c930e62fbcc281615b96c95319a5ea (diff)
downloadManaVerse-5c30a24b51538c8a0656977caeeced94277aa5b8.tar.gz
ManaVerse-5c30a24b51538c8a0656977caeeced94277aa5b8.tar.bz2
ManaVerse-5c30a24b51538c8a0656977caeeced94277aa5b8.tar.xz
ManaVerse-5c30a24b51538c8a0656977caeeced94277aa5b8.zip
Add option to items.xml to set max floor item pixel offset.
Diffstat (limited to 'src/flooritem.cpp')
-rw-r--r--src/flooritem.cpp15
1 files changed, 12 insertions, 3 deletions
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<float>(x * map->getTileWidth() + subX);
- mPos.y = static_cast<float>(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<float>(x * map->getTileWidth() + subX + 16 - 8);
+ mPos.y = static_cast<float>(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;