summaryrefslogtreecommitdiff
path: root/src
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
parent4e3b36697e96e30008aea877a625d1be1e920073 (diff)
downloadplus-6db83b4ee1c20162a9dd31428cbc36ce7405352d.tar.gz
plus-6db83b4ee1c20162a9dd31428cbc36ce7405352d.tar.bz2
plus-6db83b4ee1c20162a9dd31428cbc36ce7405352d.tar.xz
plus-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')
-rw-r--r--src/being/flooritem.cpp31
-rw-r--r--src/resources/db/itemdb.cpp7
-rw-r--r--src/resources/iteminfo.cpp3
-rw-r--r--src/resources/iteminfo.h17
4 files changed, 40 insertions, 18 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
diff --git a/src/resources/db/itemdb.cpp b/src/resources/db/itemdb.cpp
index d07301e88..e953aa433 100644
--- a/src/resources/db/itemdb.cpp
+++ b/src/resources/db/itemdb.cpp
@@ -320,6 +320,10 @@ void ItemDB::loadXmlFile(const std::string &fileName, int &tagNum)
int pet = XML::getProperty(node, "pet", 0);
const int maxFloorOffset = XML::getIntProperty(
node, "maxFloorOffset", mapTileSize, 0, mapTileSize);
+ const int maxFloorOffsetX = XML::getIntProperty(
+ node, "maxFloorOffsetX", maxFloorOffset, 0, mapTileSize);
+ const int maxFloorOffsetY = XML::getIntProperty(
+ node, "maxFloorOffsetY", maxFloorOffset, 0, mapTileSize);
std::string useButton = XML::langProperty(node, "useButton", "");
std::string useButton2 = XML::langProperty(node, "useButton2", "");
std::string colors = XML::getProperty(node, "colors", "");
@@ -500,7 +504,8 @@ void ItemDB::loadXmlFile(const std::string &fileName, int &tagNum)
if (iconColors.empty() && inheritItemInfo)
iconColors = inheritItemInfo->getIconColorsListName();
itemInfo->setIconColorsList(iconColors);
- itemInfo->setMaxFloorOffset(maxFloorOffset);
+ itemInfo->setMaxFloorOffsetX(maxFloorOffsetX);
+ itemInfo->setMaxFloorOffsetY(maxFloorOffsetY);
itemInfo->setPickupCursor(XML::getProperty(
node, "pickupCursor", "pickup"));
diff --git a/src/resources/iteminfo.cpp b/src/resources/iteminfo.cpp
index 9fd4f2ba2..133242567 100644
--- a/src/resources/iteminfo.cpp
+++ b/src/resources/iteminfo.cpp
@@ -68,7 +68,8 @@ ItemInfo::ItemInfo() :
mHitEffectId(-1),
mCriticalHitEffectId(-1),
mMissEffectId(-1),
- maxFloorOffset(mapTileSize),
+ maxFloorOffsetX(mapTileSize),
+ maxFloorOffsetY(mapTileSize),
mPickupCursor(Cursor::CURSOR_POINTER),
mPet(0),
mProtected(false)
diff --git a/src/resources/iteminfo.h b/src/resources/iteminfo.h
index 2bf4e7980..c07136581 100644
--- a/src/resources/iteminfo.h
+++ b/src/resources/iteminfo.h
@@ -219,11 +219,17 @@ class ItemInfo final
bool isRemoveSprites() const A_WARN_UNUSED
{ return mIsRemoveSprites; }
- void setMaxFloorOffset(const int i)
- { maxFloorOffset = i; }
+ void setMaxFloorOffsetX(const int i)
+ { maxFloorOffsetX = i; }
- int getMaxFloorOffset() const A_WARN_UNUSED
- { return maxFloorOffset; }
+ void setMaxFloorOffsetY(const int i)
+ { maxFloorOffsetY = i; }
+
+ int getMaxFloorOffsetX() const A_WARN_UNUSED
+ { return maxFloorOffsetX; }
+
+ int getMaxFloorOffsetY() const A_WARN_UNUSED
+ { return maxFloorOffsetY; }
bool isRemoveItemId(int id) const A_WARN_UNUSED;
@@ -360,7 +366,8 @@ class ItemInfo final
int mHitEffectId;
int mCriticalHitEffectId;
int mMissEffectId;
- int maxFloorOffset;
+ int maxFloorOffsetX;
+ int maxFloorOffsetY;
Cursor::Cursor mPickupCursor;
int mPet;
bool mProtected;