From b2a54a54ce019f2d481d96fd69e656391477cb1a Mon Sep 17 00:00:00 2001 From: Joao Pasqualini Costa Date: Mon, 13 Nov 2023 20:43:41 -0300 Subject: [PATCH] fix: attached effect looping more than it should --- src/client/attachedeffect.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/client/attachedeffect.cpp b/src/client/attachedeffect.cpp index 29f9de94ee..dd7724bc13 100644 --- a/src/client/attachedeffect.cpp +++ b/src/client/attachedeffect.cpp @@ -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); @@ -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())