Skip to content

Commit

Permalink
Update Effects.cpp for consistent behavior when rendering special pat…
Browse files Browse the repository at this point in the history
…terns (#734)
  • Loading branch information
LeandroLibanio28H authored Apr 2, 2024
1 parent b610d9d commit fe17f5b
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/client/effect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,16 @@ void Effect::draw(const Point& dest, bool drawThings, LightView* lightView)
animationPhase = std::min<int>(static_cast<int>(m_animationTimer.ticksElapsed() / ticks), getAnimationPhases() - 1);
}

int xPattern = m_numPatternX;
int yPattern = m_numPatternY;
if (g_game.getFeature(Otc::GameMapOldEffectRendering)) {
const int offsetX = m_position.x - g_map.getCentralPosition().x;
const int offsetY = m_position.y - g_map.getCentralPosition().y;
const int offsetX = m_position.x - g_map.getCentralPosition().x;
const int offsetY = m_position.y - g_map.getCentralPosition().y;

int xPattern = unsigned(offsetX) % getNumPatternX();
xPattern = 1 - xPattern - getNumPatternX();
if (xPattern < 0) xPattern += getNumPatternX();

int yPattern = unsigned(offsetY) % getNumPatternY();

if (g_game.getFeature(Otc::GameMapOldEffectRendering)) {
xPattern = offsetX % getNumPatternX();
if (xPattern < 0)
xPattern += getNumPatternX();
Expand Down

0 comments on commit fe17f5b

Please sign in to comment.