diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-12-30 21:38:56 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-12-30 21:55:00 +0300 |
commit | 78e438b7043eff243a21833d4709ef432eb7a818 (patch) | |
tree | cbaace2b8a39c078115cd48c803363f7a274ee51 /src/being/being.cpp | |
parent | 88efa77af94256992ba2c05f4d7b5b5a9d01d6e9 (diff) | |
download | ManaVerse-78e438b7043eff243a21833d4709ef432eb7a818.tar.gz ManaVerse-78e438b7043eff243a21833d4709ef432eb7a818.tar.bz2 ManaVerse-78e438b7043eff243a21833d4709ef432eb7a818.tar.xz ManaVerse-78e438b7043eff243a21833d4709ef432eb7a818.zip |
Fix animation time for new animated sprites.
Diffstat (limited to 'src/being/being.cpp')
-rw-r--r-- | src/being/being.cpp | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/being/being.cpp b/src/being/being.cpp index e0186e6d3..26bfab3ee 100644 --- a/src/being/being.cpp +++ b/src/being/being.cpp @@ -2500,6 +2500,8 @@ void Being::setSprite(const unsigned int slot, const ItemInfo &info = ItemDB::get(id); const std::string &restrict filename = info.getSprite( mGender, mSubType); + int lastTime = 0; + int startTime = 0; AnimatedSprite *restrict equipmentSprite = nullptr; if (!isTempSprite && mType == ActorType::Player) @@ -2522,10 +2524,8 @@ void Being::setSprite(const unsigned int slot, if (equipmentSprite) { equipmentSprite->setSpriteDirection(getSpriteDirection()); - - // call reset here is not the best idea, but for now this is - // only way to sync just loaded sprite - reset(); + startTime = getStartTime(); + lastTime = getLastTime(); } CompoundSprite::setSprite(slot, equipmentSprite); @@ -2537,6 +2537,14 @@ void Being::setSprite(const unsigned int slot, mEquippedWeapon = &ItemDB::get(id); setAction(mAction, 0); + if (equipmentSprite) + { + if (lastTime > 0) + { + equipmentSprite->setLastTime(startTime); + equipmentSprite->update(lastTime); + } + } } if (!isTempSprite) |