Utilize TextureAssets.HighlightMask for Highlights

This commit is contained in:
Flowaria authored and Cameron Ewell committed 2025-12-02 17:44:30 -05:00
1 parent bdc2ce0cac
commit 9a89e6dc2c
2 files changed
+5 -14

No files matched your search

+3 -8
View File
@@ -25,11 +25,6 @@ namespace CalamityMod.Tiles.BaseTiles
/// </summary>
public Asset<Texture2D> GlowMask;
/// <summary>
/// Highlight to use for Monolith
/// </summary>
public Asset<Texture2D> Highlight;
/// <summary>
/// Sound to play on right-clicked by player
/// </summary>
@@ -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<Texture2D>(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;
+2 -6
View File
@@ -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<Texture2D> 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<Texture2D>(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);
}