Skip to content

Commit

Permalink
Update WallLayerRenderer to use constant offset instead of width-base…
Browse files Browse the repository at this point in the history
…d offset. Fixes render issues with irregularly sized BU graphics.
  • Loading branch information
ethanmoffat committed Sep 10, 2022
1 parent 8c7c6c3 commit 405ed3a
Showing 1 changed file with 1 addition and 8 deletions.
Expand Up @@ -13,7 +13,6 @@ namespace EndlessClient.Rendering.MapEntityRenderers
public abstract class WallLayerRendererBase : BaseMapEntityRenderer
{
private const int WALL_FRAME_WIDTH = 68;
private const int STANDARD_WALL_WIDTH = 32;

private readonly INativeGraphicsManager _nativeGraphicsManager;
private readonly ICurrentMapProvider _currentMapProvider;
Expand Down Expand Up @@ -45,14 +44,8 @@ protected void DrawWall(SpriteBatch spriteBatch, int row, int col, int alpha, in
? new Rectangle?(new Rectangle(gfxWidthDelta * _frameIndex, 0, gfxWidthDelta, gfx.Height))
: null;

var wallAnimationAdjust = gfx.Width > WALL_FRAME_WIDTH
? -gfxWidthDelta
: gfx.Width > STANDARD_WALL_WIDTH
? 0
: gfx.Width / 2;

var pos = GetDrawCoordinatesFromGridUnits(col, row);
pos -= new Vector2((gfx.Width / 2) + wallAnimationAdjust, gfx.Height - 32);
pos -= new Vector2(32, gfx.Height - 32);

spriteBatch.Draw(gfx, pos + additionalOffset, src, Color.FromNonPremultiplied(255, 255, 255, alpha));
}
Expand Down

0 comments on commit 405ed3a

Please sign in to comment.