From 9a89e6dc2c663c1ebf8de2398541cd56cc80bba9 Mon Sep 17 00:00:00 2001 From: Flowaria Date: Tue, 2 Dec 2025 00:22:48 +0900 Subject: [PATCH] Utilize TextureAssets.HighlightMask for Highlights --- Tiles/BaseTiles/BaseMonolith.cs | 11 +++-------- Tiles/DraedonStructures/PowerCellFactory.cs | 8 ++------ 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/Tiles/BaseTiles/BaseMonolith.cs b/Tiles/BaseTiles/BaseMonolith.cs index 5a08497ea7..50111964b9 100644 --- a/Tiles/BaseTiles/BaseMonolith.cs +++ b/Tiles/BaseTiles/BaseMonolith.cs @@ -25,11 +25,6 @@ namespace CalamityMod.Tiles.BaseTiles /// public Asset GlowMask; - /// - /// Highlight to use for Monolith - /// - public Asset Highlight; - /// /// Sound to play on right-clicked by player /// @@ -150,8 +145,8 @@ namespace CalamityMod.Tiles.BaseTiles // // Draws the Smart Cursor Highlight. Not 100% accurate, but its close enough Color highlightColor; - Highlight ??= ModContent.Request(HighlightTexture); - if (Highlight is not null && Main.InSmartCursorHighlightArea(i, j, out var actuallySelected)) + var highlight = TextureAssets.HighlightMask[Type]; + if (highlight != null && highlight.IsLoaded && Main.InSmartCursorHighlightArea(i, j, out var actuallySelected)) { if (actuallySelected) { @@ -161,7 +156,7 @@ namespace CalamityMod.Tiles.BaseTiles { highlightColor = new Color(125, 125, 125); } - Main.spriteBatch.Draw(Highlight.Value, new Vector2(i * 16 - (int)Main.screenPosition.X, j * 16 - (int)Main.screenPosition.Y) + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY + animateFrameOffset, 16, height), highlightColor, 0f, default(Vector2), 1f, SpriteEffects.None, 0f); ; + Main.spriteBatch.Draw(highlight.Value, new Vector2(i * 16 - (int)Main.screenPosition.X, j * 16 - (int)Main.screenPosition.Y) + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY + animateFrameOffset, 16, height), highlightColor, 0f, default(Vector2), 1f, SpriteEffects.None, 0f); ; } return false; diff --git a/Tiles/DraedonStructures/PowerCellFactory.cs b/Tiles/DraedonStructures/PowerCellFactory.cs index 550ce92313..121125919f 100644 --- a/Tiles/DraedonStructures/PowerCellFactory.cs +++ b/Tiles/DraedonStructures/PowerCellFactory.cs @@ -4,7 +4,6 @@ using CalamityMod.Items.Placeables.DraedonStructures; using CalamityMod.TileEntities; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.DataStructures; @@ -38,8 +37,6 @@ namespace CalamityMod.Tiles.DraedonStructures // With a delay of this many extra frames after that animation frame starts. public const int MagicFrameDelay = AnimationFramerate - 1; - public Asset Highlight; - public override void SetStaticDefaults() { Main.tileLighted[Type] = true; @@ -150,8 +147,7 @@ namespace CalamityMod.Tiles.DraedonStructures // Draws the Smart Cursor Highlight. Not 100% accurate, but its close enough Color highlightColor; - Highlight ??= ModContent.Request(HighlightTexture); - if (Main.InSmartCursorHighlightArea(i, j, out var actuallySelected)) + if (TileID.Sets.HasOutlines[Type] && Main.InSmartCursorHighlightArea(i, j, out var actuallySelected)) { if (actuallySelected) { @@ -161,7 +157,7 @@ namespace CalamityMod.Tiles.DraedonStructures { highlightColor = new Color(125, 125, 125); } - spriteBatch.Draw(Highlight.Value, drawOffset, new Rectangle(frameXPos, frameYPos, 16, 16), highlightColor, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + spriteBatch.Draw(TextureAssets.HighlightMask[Type].Value, drawOffset, new Rectangle(frameXPos, frameYPos, 16, 16), highlightColor, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); }