summaryrefslogtreecommitdiff
path: root/src/being/being.cpp
diff options
context:
space:
mode:
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)