summaryrefslogtreecommitdiff
path: root/src/being/flooritem.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-02-14 02:29:16 +0300
committerAndrei Karas <akaras@inbox.ru>2016-02-14 02:29:16 +0300
commit6db83b4ee1c20162a9dd31428cbc36ce7405352d (patch)
tree502c13b828500568dbc842469ae44522a1b2ca2c /src/being/flooritem.cpp
parent4e3b36697e96e30008aea877a625d1be1e920073 (diff)
downloadmv-6db83b4ee1c20162a9dd31428cbc36ce7405352d.tar.gz
mv-6db83b4ee1c20162a9dd31428cbc36ce7405352d.tar.bz2
mv-6db83b4ee1c20162a9dd31428cbc36ce7405352d.tar.xz
mv-6db83b4ee1c20162a9dd31428cbc36ce7405352d.zip
Dont check and modify floor item position if server support haveExtendedDropsPosition.
Also add for legacy servers support for maxFloorOffsetX/Y.
Diffstat (limited to 'src/being/flooritem.cpp')
-rw-r--r--src/being/flooritem.cpp31
1 files changed, 20 insertions, 11 deletions
diff --git a/src/being/flooritem.cpp b/src/being/flooritem.cpp
index c8f0687d6..a33a5b09b 100644
--- a/src/being/flooritem.cpp
+++ b/src/being/flooritem.cpp
@@ -80,20 +80,29 @@ void FloorItem::postInit(Map *const map, int subX, int subY)
const ItemInfo &info = ItemDB::get(mItemId);
if (map)
{
- const 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;
+ const int maxX = info.getMaxFloorOffsetX();
+ const int maxY = info.getMaxFloorOffsetY();
+
+ if (!serverFeatures->haveExtendedDropsPosition())
+ {
+ if (subX > maxX)
+ subX = maxX;
+ else if (subX < -maxX)
+ subX = -maxX;
+ if (subY > maxY)
+ subY = maxY;
+ else if (subY < -maxY)
+ subY = -maxY;
+
+ subX -= 8;
+ subY -= 8;
+ }
+
mHeightPosDiff = map->getHeightOffset(mX, mY) * 16;
mPos.x = static_cast<float>(mX * map->getTileWidth()
- + subX + mapTileSize / 2 - 8);
+ + subX + mapTileSize / 2);
mPos.y = static_cast<float>(mY * map->getTileHeight()
- + subY + mapTileSize - 8 - mHeightPosDiff);
+ + subY + mapTileSize - mHeightPosDiff);
mYDiff = 31 - mHeightPosDiff;
}
else