Skip to content

Commit

Permalink
Item animator for Enhanced Animations only
Browse files Browse the repository at this point in the history
  • Loading branch information
Oen44 committed Dec 16, 2024
1 parent fbe0dfd commit 03f5a7f
Showing 1 changed file with 20 additions and 14 deletions.
34 changes: 20 additions & 14 deletions src/client/item.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,10 @@ Item::Item() :
m_durationTimePaused(0),
m_durationIsPaused(false)
{
m_animator = std::make_shared<Animator>();
m_idleAnimator = std::make_shared<Animator>();
if (g_game.getFeature(Otc::GameEnhancedAnimations)) {
m_animator = std::make_shared<Animator>();
m_idleAnimator = std::make_shared<Animator>();
}
}

ItemPtr Item::create(int id, int countOrSubtype)
Expand Down Expand Up @@ -134,13 +136,15 @@ void Item::setId(uint32 id)
m_serverId = g_things.findItemTypeByClientId(id)->getServerId();
m_clientId = id;

if (auto thingType = rawGetThingType()) {
if (auto animator = thingType->getAnimator()) {
m_animator->copy(animator);
}
if (g_game.getFeature(Otc::GameEnhancedAnimations)) {
if (auto thingType = rawGetThingType()) {
if (auto animator = thingType->getAnimator()) {
m_animator->copy(animator);
}

if (auto animator = thingType->getIdleAnimator())
m_idleAnimator->copy(animator);
if (auto animator = thingType->getIdleAnimator())
m_idleAnimator->copy(animator);
}
}
}

Expand All @@ -156,13 +160,15 @@ void Item::setOtbId(uint16 id)
id = 0;
m_clientId = id;

if (auto thingType = rawGetThingType()) {
if (auto animator = thingType->getAnimator()) {
m_animator->copy(animator);
}
if (g_game.getFeature(Otc::GameEnhancedAnimations)) {
if (auto thingType = rawGetThingType()) {
if (auto animator = thingType->getAnimator()) {
m_animator->copy(animator);
}

if (auto animator = thingType->getIdleAnimator())
m_idleAnimator->copy(animator);
if (auto animator = thingType->getIdleAnimator())
m_idleAnimator->copy(animator);
}
}
}

Expand Down

0 comments on commit 03f5a7f

Please sign in to comment.