diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-04-12 00:04:11 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-04-12 00:04:11 +0300 |
commit | 0f83799770cf502fec89c3e13b325663162f2f93 (patch) | |
tree | b7974722d51092558c8633abc4acae0610c40cca | |
parent | c822a3affd3fcfc26d66b599d4450e4f10e5251d (diff) | |
download | mv-0f83799770cf502fec89c3e13b325663162f2f93.tar.gz mv-0f83799770cf502fec89c3e13b325663162f2f93.tar.bz2 mv-0f83799770cf502fec89c3e13b325663162f2f93.tar.xz mv-0f83799770cf502fec89c3e13b325663162f2f93.zip |
Fix move animation after path is empty.
This fix random stand animation while moving.
-rw-r--r-- | src/being/being.cpp | 11 | ||||
-rw-r--r-- | src/being/being.h | 3 | ||||
-rw-r--r-- | src/enums/being/beingaction.h | 3 |
3 files changed, 15 insertions, 2 deletions
diff --git a/src/being/being.cpp b/src/being/being.cpp index 6bb17ad4b..393e45dd6 100644 --- a/src/being/being.cpp +++ b/src/being/being.cpp @@ -160,6 +160,7 @@ Being::Being(const int id, mAttackRange(1), mLastAttackX(0), mLastAttackY(0), + mPreStandTime(0), mGender(Gender::UNSPECIFIED), mAction(BeingAction::STAND), mSubType(0xFFFF), @@ -1434,7 +1435,8 @@ void Being::nextTile() { if (mPath.empty()) { - setAction(BeingAction::STAND, 0); + mAction = BeingAction::PRESTAND; + mPreStandTime = tick_time; return; } @@ -1536,6 +1538,13 @@ void Being::logic() break; } + + case BeingAction::PRESTAND: + { + if (get_elapsed_time(mPreStandTime) > 100) + setAction(BeingAction::STAND, 0); + break; + } } if (mAction == BeingAction::MOVE || mNeedPosUpdate) diff --git a/src/being/being.h b/src/being/being.h index 767f7f3cd..52a2a5fc7 100644 --- a/src/being/being.h +++ b/src/being/being.h @@ -1002,6 +1002,9 @@ class Being notfinal : public ActorSprite, int mAttackRange; int mLastAttackX; int mLastAttackY; + + int mPreStandTime; + Gender::Type mGender; BeingAction::Action mAction; uint16_t mSubType; /**< Subtype (graphical view, basically) */ diff --git a/src/enums/being/beingaction.h b/src/enums/being/beingaction.h index aa09ff68c..408051d74 100644 --- a/src/enums/being/beingaction.h +++ b/src/enums/being/beingaction.h @@ -38,7 +38,8 @@ namespace BeingAction SIT, DEAD, HURT, - SPAWN + SPAWN, + PRESTAND }; } // namespace BeingAction |