From a1f5338e93e5f8b2bdac2c305824a925fd2e4141 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 24 Dec 2013 15:06:37 +0300 Subject: add speed parameter for pets. New pet db option: walkSpeed --- src/being/being.cpp | 10 ++++++++++ src/being/being.h | 2 +- src/resources/beinginfo.cpp | 1 + src/resources/beinginfo.h | 7 +++++++ src/resources/db/petdb.cpp | 3 +++ 5 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/being/being.cpp b/src/being/being.cpp index 39cf09741..2da3c644f 100644 --- a/src/being/being.cpp +++ b/src/being/being.cpp @@ -292,6 +292,16 @@ void Being::setSubtype(const uint16_t subtype, const uint8_t look) { setupSpriteDisplay(mInfo->getDisplay(), false); mYDiff = mInfo->getSortOffsetY(); + const int speed = mInfo->getWalkSpeed(); + if (!speed) + { + setWalkSpeed(Net::getPlayerHandler() + ->getDefaultWalkSpeed()); + } + else + { + setWalkSpeed(Vector(speed, speed, 0)); + } } } else if (mType == PLAYER) diff --git a/src/being/being.h b/src/being/being.h index e20db69f4..6722e5d4c 100644 --- a/src/being/being.h +++ b/src/being/being.h @@ -478,7 +478,7 @@ class Being : public ActorSprite, public ConfigListener * in pixels per second for eAthena, * in tiles per second for Manaserv. */ - void setWalkSpeed(const Vector &speed) + void setWalkSpeed(Vector speed) { mWalkSpeed = speed; mSpeed = speed.x; } /** diff --git a/src/resources/beinginfo.cpp b/src/resources/beinginfo.cpp index 7a8d1e0ce..7d769acbe 100644 --- a/src/resources/beinginfo.cpp +++ b/src/resources/beinginfo.cpp @@ -62,6 +62,7 @@ BeingInfo::BeingInfo() : mHeight(0), mStartFollowDist(3), mFollowDist(1), + mWalkSpeed(0), mStaticMaxHP(false), mTargetSelection(true) { diff --git a/src/resources/beinginfo.h b/src/resources/beinginfo.h index a752898f8..556088380 100644 --- a/src/resources/beinginfo.h +++ b/src/resources/beinginfo.h @@ -236,6 +236,12 @@ class BeingInfo final int getFollowDist() { return mFollowDist; } + void setWalkSpeed(const int n) + { mWalkSpeed = n; } + + int getWalkSpeed() + { return mWalkSpeed; } + void setColorsList(const std::string &name); std::string getColor(const int idx) const; @@ -268,6 +274,7 @@ class BeingInfo final int mHeight; int mStartFollowDist; int mFollowDist; + int mWalkSpeed; bool mStaticMaxHP; bool mTargetSelection; }; diff --git a/src/resources/db/petdb.cpp b/src/resources/db/petdb.cpp index 829da3ef6..0af2621ae 100644 --- a/src/resources/db/petdb.cpp +++ b/src/resources/db/petdb.cpp @@ -87,6 +87,9 @@ void PETDB::load() currentInfo->setFollowDist(XML::getProperty(petNode, "followDistance", 1)); + currentInfo->setWalkSpeed(XML::getProperty(petNode, + "walkSpeed", 0)); + SpriteDisplay display; for_each_xml_child_node(spriteNode, petNode) { -- cgit v1.2.3-70-g09d2