diff --git a/Tiles/ScoriaBrick.cs b/Tiles/ScoriaBrick.cs index d9e86aca98..0e0933ed20 100644 --- a/Tiles/ScoriaBrick.cs +++ b/Tiles/ScoriaBrick.cs @@ -1,4 +1,6 @@ using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.GameContent.Metadata; using Terraria.ModLoader; @@ -11,8 +13,13 @@ namespace CalamityMod.Tiles { int subsheetHeight = 72; int subsheetWidth = 216; + internal static Texture2D GlowTexture; public override void SetStaticDefaults() { + if (!Main.dedServ) + { + GlowTexture = ModContent.Request("CalamityMod/Tiles/ScoriaBrickGlow", AssetRequestMode.ImmediateLoad).Value; + } Main.tileLighted[Type] = true; Main.tileSolid[Type] = true; Main.tileBlockLight[Type] = true; @@ -36,11 +43,8 @@ namespace CalamityMod.Tiles public override void AnimateIndividualTile(int type, int i, int j, ref int frameXOffset, ref int frameYOffset) { - int xPos = i % 1; - int yPos = j % 2; - - frameXOffset = xPos * subsheetWidth; - frameYOffset = yPos * subsheetHeight; + int frameOffset = (i + j) % 2; + frameYOffset = frameOffset * AnimationFrameHeight; } public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) @@ -48,5 +52,28 @@ namespace CalamityMod.Tiles TileFraming.CompactFraming(i, j, resetFrame); return false; } + + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + // If the cached textures don't exist for some reason, don't bother using them. + if (GlowTexture is null) + return; + + Tile tile = CalamityUtils.ParanoidTileRetrieval(i, j); + int xPos = tile.TileFrameX; + int frameOffset = (i + j) % 2 * AnimationFrameHeight; + int yPos = tile.TileFrameY + frameOffset; + Vector2 drawOffset = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); + Vector2 drawPosition = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + drawOffset; + + if (!tile.IsHalfBlock && tile.Slope == 0) + { + spriteBatch.Draw(GlowTexture, drawPosition, new Rectangle?(new Rectangle(xPos, yPos, 18, 18)), Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); + } + else if (tile.IsHalfBlock) + { + spriteBatch.Draw(GlowTexture, drawPosition + new Vector2(0f, 8f), new Rectangle?(new Rectangle(xPos, yPos, 18, 8)), Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); + } + } } } diff --git a/Tiles/ScoriaBrick.png b/Tiles/ScoriaBrick.png index d1c449da8e..b3f6557161 100644 Binary files a/Tiles/ScoriaBrick.png and b/Tiles/ScoriaBrick.png differ diff --git a/Tiles/ScoriaBrickGlow.png b/Tiles/ScoriaBrickGlow.png new file mode 100644 index 0000000000..4747dd9cb3 Binary files /dev/null and b/Tiles/ScoriaBrickGlow.png differ