feat: Made custom drawing for Smart Cursor highlights more accurate.
This commit is contained in:
1 parent
7185f13815
commit
968a1f87ff
3 files changed
+17
-26
No files matched your search
@@ -143,20 +143,17 @@ namespace CalamityMod.Tiles.BaseTiles
|
||||
// 02FEB2025: Ozzatron: code lifted from https://github.com/CalamityTeam/CalamityModPublic/pull/77
|
||||
// transplanted into base monolith as part of manual cherry pick merge
|
||||
//
|
||||
// Draws the Smart Cursor Highlight. Not 100% accurate, but its close enough
|
||||
// Draws the Smart Cursor Highlight.
|
||||
Color highlightColor;
|
||||
var highlight = TextureAssets.HighlightMask[Type];
|
||||
if (highlight != null && highlight.IsLoaded && Main.InSmartCursorHighlightArea(i, j, out var actuallySelected))
|
||||
{
|
||||
if (actuallySelected)
|
||||
{
|
||||
highlightColor = new Color(252, 252, 84);
|
||||
int avgBrightness = (drawColor.R + drawColor.G + drawColor.B) / 3;
|
||||
if (avgBrightness > 10)
|
||||
{
|
||||
highlightColor = Colors.GetSelectionGlowColor(actuallySelected, avgBrightness);
|
||||
Main.spriteBatch.Draw(highlight.Value, new Vector2(i * 16 - (int)Main.screenPosition.X, j * 16 - (int)Main.screenPosition.Y) + zero, rect, highlightColor, 0f, default(Vector2), 1f, SpriteEffects.None, 0f);
|
||||
}
|
||||
else
|
||||
{
|
||||
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); ;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
@@ -145,19 +145,16 @@ namespace CalamityMod.Tiles.DraedonStructures
|
||||
else if (t.IsHalfBlock)
|
||||
spriteBatch.Draw(tex, drawOffset + Vector2.UnitY * 8f, new Rectangle(frameXPos, frameYPos, 16, 16), drawColor, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f);
|
||||
|
||||
// Draws the Smart Cursor Highlight. Not 100% accurate, but its close enough
|
||||
// Draws the Smart Cursor Highlight.
|
||||
Color highlightColor;
|
||||
if (TileID.Sets.HasOutlines[Type] && Main.InSmartCursorHighlightArea(i, j, out var actuallySelected))
|
||||
{
|
||||
if (actuallySelected)
|
||||
int avgBrightness = (drawColor.R + drawColor.G + drawColor.B) / 3;
|
||||
if (avgBrightness > 10)
|
||||
{
|
||||
highlightColor = new Color(252, 252, 84);
|
||||
highlightColor = Colors.GetSelectionGlowColor(actuallySelected, avgBrightness);
|
||||
spriteBatch.Draw(TextureAssets.HighlightMask[Type].Value, drawOffset, new Rectangle(frameXPos, frameYPos, 16, 16), highlightColor, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f);
|
||||
}
|
||||
else
|
||||
{
|
||||
highlightColor = new Color(125, 125, 125);
|
||||
}
|
||||
spriteBatch.Draw(TextureAssets.HighlightMask[Type].Value, drawOffset, new Rectangle(frameXPos, frameYPos, 16, 16), highlightColor, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -234,19 +234,16 @@ namespace CalamityMod.Tiles.DraedonSummoner
|
||||
if (codebreakerTileEntity.ContainsDecryptionComputer && codebreakerTileEntity.ContainsSensorArray && !codebreakerTileEntity.ContainsAdvancedDisplay && codebreakerTileEntity.ContainsVoltageRegulationSystem)
|
||||
return false;
|
||||
|
||||
bool actuallySelected;
|
||||
// Draws the appropriate Smart Cursor highlight sprite selected from above.
|
||||
Color highlightColor;
|
||||
if (Main.InSmartCursorHighlightArea(i, j, out actuallySelected) && codebreakerTileEntity.ContainsDecryptionComputer)
|
||||
if (Main.InSmartCursorHighlightArea(i, j, out var actuallySelected) && codebreakerTileEntity.ContainsDecryptionComputer)
|
||||
{
|
||||
if (actuallySelected)
|
||||
int avgBrightness = (drawColor.R + drawColor.G + drawColor.B) / 3;
|
||||
if (avgBrightness > 10)
|
||||
{
|
||||
highlightColor = new Color(252, 252, 84);
|
||||
highlightColor = Colors.GetSelectionGlowColor(actuallySelected, avgBrightness);
|
||||
spriteBatch.Draw(HighlightToUse, drawPosition, frame, highlightColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f);
|
||||
}
|
||||
else
|
||||
{
|
||||
highlightColor = new Color(125, 125, 125);
|
||||
}
|
||||
spriteBatch.Draw(HighlightToUse, drawPosition, frame, highlightColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user