summaryrefslogtreecommitdiff
path: root/src/being/being.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-12-30 21:38:56 +0300
committerAndrei Karas <akaras@inbox.ru>2015-12-30 21:55:00 +0300
commit78e438b7043eff243a21833d4709ef432eb7a818 (patch)
treecbaace2b8a39c078115cd48c803363f7a274ee51 /src/being/being.cpp
parent88efa77af94256992ba2c05f4d7b5b5a9d01d6e9 (diff)
downloadmanaplus-78e438b7043eff243a21833d4709ef432eb7a818.tar.gz
manaplus-78e438b7043eff243a21833d4709ef432eb7a818.tar.bz2
manaplus-78e438b7043eff243a21833d4709ef432eb7a818.tar.xz
manaplus-78e438b7043eff243a21833d4709ef432eb7a818.zip
Fix animation time for new animated sprites.
Diffstat (limited to 'src/being/being.cpp')
-rw-r--r--src/being/being.cpp16
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)