summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-12-31 15:00:31 +0300
committerAndrei Karas <akaras@inbox.ru>2013-12-31 15:00:31 +0300
commit332334a876da21687911c6d22cf4a5dcb2cb586a (patch)
treea139c3d8562d2c9ca73b3b5f6ba079034b4bb684 /src
parent6e4517d3f46f11fc47b77e92bd2c439fdb5738b2 (diff)
downloadmanaverse-332334a876da21687911c6d22cf4a5dcb2cb586a.tar.gz
manaverse-332334a876da21687911c6d22cf4a5dcb2cb586a.tar.bz2
manaverse-332334a876da21687911c6d22cf4a5dcb2cb586a.tar.xz
manaverse-332334a876da21687911c6d22cf4a5dcb2cb586a.zip
add pet offset if owner is moving.
New pet db attributes: moveOffsetX, moveOffsetY
Diffstat (limited to 'src')
-rw-r--r--src/being/being.cpp28
-rw-r--r--src/resources/beinginfo.cpp2
-rw-r--r--src/resources/beinginfo.h14
-rw-r--r--src/resources/db/petdb.cpp4
4 files changed, 40 insertions, 8 deletions
diff --git a/src/being/being.cpp b/src/being/being.cpp
index 439cbd2c9..600de11e8 100644
--- a/src/being/being.cpp
+++ b/src/being/being.cpp
@@ -3246,15 +3246,27 @@ void Being::fixPetSpawnPos(int &dstX, int &dstY) const
int offsetX1;
int offsetY1;
- if (mOwner->getCurrentAction() == SIT)
+ switch (mOwner->getCurrentAction())
{
- offsetX1 = mInfo->getSitOffsetX();
- offsetY1 = mInfo->getSitOffsetY();
- }
- else
- {
- offsetX1 = mInfo->getTargetOffsetX();
- offsetY1 = mInfo->getTargetOffsetY();
+ case SIT:
+ offsetX1 = mInfo->getSitOffsetX();
+ offsetY1 = mInfo->getSitOffsetY();
+ break;
+
+ case MOVE:
+ offsetX1 = mInfo->getMoveOffsetX();
+ offsetY1 = mInfo->getMoveOffsetY();
+ break;
+
+ case ATTACK:
+ case DEAD:
+ case SPAWN:
+ case HURT:
+ case STAND:
+ default:
+ offsetX1 = mInfo->getTargetOffsetX();
+ offsetY1 = mInfo->getTargetOffsetY();
+ break;
}
int offsetX = offsetX1;
diff --git a/src/resources/beinginfo.cpp b/src/resources/beinginfo.cpp
index 20a15429c..d79391ed9 100644
--- a/src/resources/beinginfo.cpp
+++ b/src/resources/beinginfo.cpp
@@ -66,6 +66,8 @@ BeingInfo::BeingInfo() :
mWalkSpeed(0),
mSitOffsetX(0),
mSitOffsetY(0),
+ mMoveOffsetX(0),
+ mMoveOffsetY(0),
mThinkTime(50),
mDirectionType(1),
mSitDirectionType(1),
diff --git a/src/resources/beinginfo.h b/src/resources/beinginfo.h
index bb8f6b6ff..85d4af20b 100644
--- a/src/resources/beinginfo.h
+++ b/src/resources/beinginfo.h
@@ -260,6 +260,18 @@ class BeingInfo final
int getSitOffsetY() const A_WARN_UNUSED
{ return mSitOffsetY; }
+ void setMoveOffsetX(const int n)
+ { mMoveOffsetX = n; }
+
+ int getMoveOffsetX() const A_WARN_UNUSED
+ { return mMoveOffsetX; }
+
+ void setMoveOffsetY(const int n)
+ { mMoveOffsetY = n; }
+
+ int getMoveOffsetY() const A_WARN_UNUSED
+ { return mMoveOffsetY; }
+
void setThinkTime(const int n)
{ mThinkTime = n; }
@@ -314,6 +326,8 @@ class BeingInfo final
int mWalkSpeed;
int mSitOffsetX;
int mSitOffsetY;
+ int mMoveOffsetX;
+ int mMoveOffsetY;
int mThinkTime;
int mDirectionType;
int mSitDirectionType;
diff --git a/src/resources/db/petdb.cpp b/src/resources/db/petdb.cpp
index f975c25f9..046146cce 100644
--- a/src/resources/db/petdb.cpp
+++ b/src/resources/db/petdb.cpp
@@ -105,6 +105,10 @@ void PETDB::load()
"sitOffsetX", 0));
currentInfo->setSitOffsetY(XML::getProperty(petNode,
"sitOffsetY", 1));
+ currentInfo->setMoveOffsetX(XML::getProperty(petNode,
+ "moveOffsetX", 0));
+ currentInfo->setMoveOffsetY(XML::getProperty(petNode,
+ "moveOffsetY", 1));
currentInfo->setThinkTime(XML::getProperty(petNode,
"thinkTime", 500) / 10);