summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-12-25 12:35:27 +0300
committerAndrei Karas <akaras@inbox.ru>2013-12-25 12:35:27 +0300
commit5c0999cb674ceb43d2244e4eaba225f8ffa4ccb4 (patch)
treea2bcd31ace81a4a3df29ff4c580d6d57cb10a0b0
parent219424dc0e194a722bc93ba51b973fda8715869f (diff)
downloadmv-5c0999cb674ceb43d2244e4eaba225f8ffa4ccb4.tar.gz
mv-5c0999cb674ceb43d2244e4eaba225f8ffa4ccb4.tar.bz2
mv-5c0999cb674ceb43d2244e4eaba225f8ffa4ccb4.tar.xz
mv-5c0999cb674ceb43d2244e4eaba225f8ffa4ccb4.zip
extend pet follow logic with follow in fixed position to owner.
-rw-r--r--src/being/being.cpp44
-rw-r--r--src/resources/db/petdb.cpp2
2 files changed, 26 insertions, 20 deletions
diff --git a/src/being/being.cpp b/src/being/being.cpp
index b7d6019ec..a8b3eaf8c 100644
--- a/src/being/being.cpp
+++ b/src/being/being.cpp
@@ -1650,28 +1650,34 @@ void Being::petLogic()
}
else if (divX > followDist || divY > followDist)
{
- if (divX > followDist)
+ if (!dist)
{
- if (dstX > mX + dist)
- dstX -= dist;
- else if (dstX + dist <= mX)
- dstX += dist;
+ fixPetSpawnPos(dstX, dstY);
}
else
{
- dstX = mX;
- }
-
- if (divY > followDist)
- {
- if (dstY > mY + dist)
- dstY -= dist;
- else if (dstX + dist <= mX)
- dstY += dist;
- }
- else
- {
- dstY = mY;
+ if (divX > followDist)
+ {
+ if (dstX > mX + dist)
+ dstX -= dist;
+ else if (dstX + dist <= mX)
+ dstX += dist;
+ }
+ else
+ {
+ dstX = mX;
+ }
+ if (divY > followDist)
+ {
+ if (dstY > mY + dist)
+ dstY -= dist;
+ else if (dstX + dist <= mX)
+ dstY += dist;
+ }
+ else
+ {
+ dstY = mY;
+ }
}
const int walkMask = getWalkMask();
@@ -3191,7 +3197,7 @@ void Being::fixPetSpawnPos(int &dstX, int &dstY) const
switch (mOwner->getDirection())
{
case LEFT:
- offsetX = offsetY1;
+ offsetX = -offsetY1;
offsetY = -offsetX1;
break;
case RIGHT:
diff --git a/src/resources/db/petdb.cpp b/src/resources/db/petdb.cpp
index eeb8af9a0..d50c44dc7 100644
--- a/src/resources/db/petdb.cpp
+++ b/src/resources/db/petdb.cpp
@@ -85,7 +85,7 @@ void PETDB::load()
currentInfo->setStartFollowDist(XML::getProperty(petNode,
"startFollowDistance", 3));
currentInfo->setFollowDist(XML::getProperty(petNode,
- "followDistance", 1));
+ "followDistance", 0));
currentInfo->setWarpDist(XML::getProperty(petNode,
"warpDistance", 11));