From 8357e89fc0923f4b97cf8b990a4ffba2716bfabf Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 25 Dec 2013 17:13:24 +0300 Subject: add support for pet sit direction logic. New pet db attribute: sitDirectionType It can be set same values like in directionType. --- src/being/being.cpp | 3 ++- src/resources/beinginfo.cpp | 3 +++ src/resources/beinginfo.h | 7 +++++++ src/resources/db/petdb.cpp | 3 +++ 4 files changed, 15 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/being/being.cpp b/src/being/being.cpp index 235bd6455..7a3a198c1 100644 --- a/src/being/being.cpp +++ b/src/being/being.cpp @@ -1713,7 +1713,8 @@ void Being::petLogic() } if (mAction == STAND) { - const int directionType = mInfo->getDirectionType(); + const int directionType = mOwner->getCurrentAction() != SIT + ? mInfo->getDirectionType() : mInfo->getSitDirectionType(); int newDir = 0; switch (directionType) { diff --git a/src/resources/beinginfo.cpp b/src/resources/beinginfo.cpp index fc23bf231..20a15429c 100644 --- a/src/resources/beinginfo.cpp +++ b/src/resources/beinginfo.cpp @@ -66,6 +66,9 @@ BeingInfo::BeingInfo() : mWalkSpeed(0), mSitOffsetX(0), mSitOffsetY(0), + mThinkTime(50), + mDirectionType(1), + mSitDirectionType(1), mStaticMaxHP(false), mTargetSelection(true) { diff --git a/src/resources/beinginfo.h b/src/resources/beinginfo.h index c1d53ccde..bb8f6b6ff 100644 --- a/src/resources/beinginfo.h +++ b/src/resources/beinginfo.h @@ -272,6 +272,12 @@ class BeingInfo final int getDirectionType() const A_WARN_UNUSED { return mDirectionType; } + void setSitDirectionType(const int n) + { mSitDirectionType = n; } + + int getSitDirectionType() const A_WARN_UNUSED + { return mSitDirectionType; } + void setColorsList(const std::string &name); std::string getColor(const int idx) const A_WARN_UNUSED; @@ -310,6 +316,7 @@ class BeingInfo final int mSitOffsetY; int mThinkTime; int mDirectionType; + int mSitDirectionType; bool mStaticMaxHP; bool mTargetSelection; }; diff --git a/src/resources/db/petdb.cpp b/src/resources/db/petdb.cpp index 072dad7c0..631dceb60 100644 --- a/src/resources/db/petdb.cpp +++ b/src/resources/db/petdb.cpp @@ -103,8 +103,11 @@ void PETDB::load() currentInfo->setThinkTime(XML::getProperty(petNode, "thinkTime", 500) / 10); + currentInfo->setDirectionType(XML::getProperty(petNode, "directionType", 1)); + currentInfo->setSitDirectionType(XML::getProperty(petNode, + "sitDirectionType", 1)); SpriteDisplay display; for_each_xml_child_node(spriteNode, petNode) -- cgit v1.2.3-60-g2f50