Skip to content

Commit

Permalink
fix: attached effect looping more than it should
Browse files Browse the repository at this point in the history
  • Loading branch information
conde2 authored Nov 13, 2023
1 parent ae89ea0 commit b2a54a5
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/client/attachedeffect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ void AttachedEffect::draw(const Point& dest, bool isOnTop, LightView* lightView)
const int animation = getCurrentAnimationPhase();
if (m_loop > -1 && animation != m_lastAnimation) {
m_lastAnimation = animation;
if (animation == 0)
--m_loop;
if (animation == 0 && --m_loop == 0)
return;
}

if (m_shader) g_drawPool.setShaderProgram(m_shader, true);
Expand All @@ -75,8 +75,10 @@ void AttachedEffect::draw(const Point& dest, bool isOnTop, LightView* lightView)

int AttachedEffect::getCurrentAnimationPhase()
{
if (m_texture)
if (m_texture) {
m_texture->get(m_frame, m_animationTimer);
return m_frame;
}

const auto* animator = m_thingType->getIdleAnimator();
if (!animator && m_thingType->isAnimateAlways())
Expand Down

0 comments on commit b2a54a5

Please sign in to comment.