diff --git a/src/client/effect.cpp b/src/client/effect.cpp index 81dd9b0d..7656c1c4 100644 --- a/src/client/effect.cpp +++ b/src/client/effect.cpp @@ -24,7 +24,7 @@ #include "map.h" #include -void Effect::draw(const Point& dest, float scaleFactor, bool animate, LightView *lightView) +void Effect::draw(const Point& dest, float scaleFactor, bool animate, int offsetX, int offsetY, LightView *lightView) { if(m_id == 0) return; @@ -32,7 +32,16 @@ void Effect::draw(const Point& dest, float scaleFactor, bool animate, LightView int animationPhase = 0; if(animate) animationPhase = std::min((int)(m_animationTimer.ticksElapsed() / m_phaseDuration), getAnimationPhases() - 1); - rawGetThingType()->draw(dest, scaleFactor, 0, 0, 0, 0, animationPhase, lightView); + + int xPattern = offsetX % getNumPatternX(); + if(xPattern < 0) + xPattern += getNumPatternX(); + + int yPattern = offsetY % getNumPatternY(); + if(yPattern < 0) + yPattern += getNumPatternY(); + + rawGetThingType()->draw(dest, scaleFactor, 0, xPattern, yPattern, 0, animationPhase, lightView); } void Effect::onAppear() diff --git a/src/client/effect.h b/src/client/effect.h index 1be41231..75d8822c 100644 --- a/src/client/effect.h +++ b/src/client/effect.h @@ -35,7 +35,7 @@ class Effect : public Thing }; public: - void draw(const Point& dest, float scaleFactor, bool animate, LightView *lightView = nullptr); + void draw(const Point& dest, float scaleFactor, bool animate, int offsetX = 0, int offsetY = 0, LightView *lightView = nullptr); void setId(uint32 id); uint32 getId() { return m_id; } diff --git a/src/client/tile.cpp b/src/client/tile.cpp index afbeb697..2083151b 100644 --- a/src/client/tile.cpp +++ b/src/client/tile.cpp @@ -155,7 +155,7 @@ void Tile::draw(const Point& dest, float scaleFactor, int drawFlags, LightView * // effects if(drawFlags & Otc::DrawEffects) for(const EffectPtr& effect : m_effects) - effect->draw(dest - m_drawElevation*scaleFactor, scaleFactor, animate, lightView); + effect->draw(dest - m_drawElevation*scaleFactor, scaleFactor, animate, m_position.x - g_map.getCentralPosition().x, m_position.y - g_map.getCentralPosition().y, lightView); // top items if(drawFlags & Otc::DrawOnTop)