From 94342625a7e97c1f4adda6f0788c85c8d112b3a5 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 31 Dec 2013 15:07:43 +0300 Subject: add pet offset if owner is dead. New pet db attributes: deadOffsetX, deadOffsetY --- src/being/being.cpp | 6 +++++- src/resources/beinginfo.cpp | 2 ++ src/resources/beinginfo.h | 14 ++++++++++++++ src/resources/db/petdb.cpp | 4 ++++ 4 files changed, 25 insertions(+), 1 deletion(-) diff --git a/src/being/being.cpp b/src/being/being.cpp index 600de11e8..d87eb5da6 100644 --- a/src/being/being.cpp +++ b/src/being/being.cpp @@ -3258,8 +3258,12 @@ void Being::fixPetSpawnPos(int &dstX, int &dstY) const offsetY1 = mInfo->getMoveOffsetY(); break; - case ATTACK: case DEAD: + offsetX1 = mInfo->getDeadOffsetX(); + offsetY1 = mInfo->getDeadOffsetY(); + break; + + case ATTACK: case SPAWN: case HURT: case STAND: diff --git a/src/resources/beinginfo.cpp b/src/resources/beinginfo.cpp index d79391ed9..5193ae4d3 100644 --- a/src/resources/beinginfo.cpp +++ b/src/resources/beinginfo.cpp @@ -68,6 +68,8 @@ BeingInfo::BeingInfo() : mSitOffsetY(0), mMoveOffsetX(0), mMoveOffsetY(0), + mDeadOffsetX(0), + mDeadOffsetY(0), mThinkTime(50), mDirectionType(1), mSitDirectionType(1), diff --git a/src/resources/beinginfo.h b/src/resources/beinginfo.h index 85d4af20b..f59dbe4d1 100644 --- a/src/resources/beinginfo.h +++ b/src/resources/beinginfo.h @@ -272,6 +272,18 @@ class BeingInfo final int getMoveOffsetY() const A_WARN_UNUSED { return mMoveOffsetY; } + void setDeadOffsetX(const int n) + { mDeadOffsetX = n; } + + int getDeadOffsetX() const A_WARN_UNUSED + { return mDeadOffsetX; } + + void setDeadOffsetY(const int n) + { mDeadOffsetY = n; } + + int getDeadOffsetY() const A_WARN_UNUSED + { return mDeadOffsetY; } + void setThinkTime(const int n) { mThinkTime = n; } @@ -328,6 +340,8 @@ class BeingInfo final int mSitOffsetY; int mMoveOffsetX; int mMoveOffsetY; + int mDeadOffsetX; + int mDeadOffsetY; int mThinkTime; int mDirectionType; int mSitDirectionType; diff --git a/src/resources/db/petdb.cpp b/src/resources/db/petdb.cpp index 046146cce..cb8208179 100644 --- a/src/resources/db/petdb.cpp +++ b/src/resources/db/petdb.cpp @@ -109,6 +109,10 @@ void PETDB::load() "moveOffsetX", 0)); currentInfo->setMoveOffsetY(XML::getProperty(petNode, "moveOffsetY", 1)); + currentInfo->setDeadOffsetX(XML::getProperty(petNode, + "deadOffsetX", 0)); + currentInfo->setDeadOffsetY(XML::getProperty(petNode, + "deadOffsetY", 1)); currentInfo->setThinkTime(XML::getProperty(petNode, "thinkTime", 500) / 10); -- cgit v1.2.3-70-g09d2