diff --git a/Systems/Tile/TileSpecialDrawData.cs b/Systems/Tile/TileSpecialDrawData.cs
index 8b93ad1810..426676b53b 100644
--- a/Systems/Tile/TileSpecialDrawData.cs
+++ b/Systems/Tile/TileSpecialDrawData.cs
@@ -1,4 +1,5 @@
using Terraria;
+using Terraria.GameContent.Drawing;
namespace CalamityMod.Systems
{
@@ -6,10 +7,22 @@ namespace CalamityMod.Systems
{
private byte Data;
+ ///
+ /// Used for
+ ///
public bool HasBlendMergeData
{
get => TileDataPacking.GetBit(Data, offset: 0);
- set => TileDataPacking.SetBit(value, Data, offset: 0);
+ set => Data = (byte)TileDataPacking.SetBit(value, Data, offset: 0);
+ }
+
+ ///
+ /// Used for Tiles that have complicated conditions for
+ ///
+ public bool HasSpecialPoint
+ {
+ get => TileDataPacking.GetBit(Data, offset: 1);
+ set => Data = (byte)TileDataPacking.SetBit(value, Data, offset: 1);
}
}
}
diff --git a/Tiles/Crags/ScorchedRemainsGrass.cs b/Tiles/Crags/ScorchedRemainsGrass.cs
index f19df02c74..728a96dc12 100644
--- a/Tiles/Crags/ScorchedRemainsGrass.cs
+++ b/Tiles/Crags/ScorchedRemainsGrass.cs
@@ -1,7 +1,9 @@
using CalamityMod.Dusts;
+using CalamityMod.Systems;
using CalamityMod.Tiles.Crags.Lily;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
+using ReLogic.Content;
using Terraria;
using Terraria.DataStructures;
using Terraria.ID;
@@ -11,6 +13,8 @@ namespace CalamityMod.Tiles.Crags
{
public class ScorchedRemainsGrass : ModTile
{
+ public Asset GrassTexture;
+
private const short subsheetWidth = 234;
private const short subsheetHeight = 90;
private int extraFrameHeight = 36;
@@ -18,6 +22,8 @@ namespace CalamityMod.Tiles.Crags
public override void SetStaticDefaults()
{
+ GrassTexture = ModContent.Request("CalamityMod/Tiles/Crags/CinderBlossomGrassGrass");
+
Main.tileSolid[Type] = true;
Main.tileBlockLight[Type] = true;
Main.tileLighted[Type] = true;
@@ -119,6 +125,19 @@ namespace CalamityMod.Tiles.Crags
}
}
+ public override void PostTileFrame(int i, int j, int up, int down, int left, int right, int upLeft, int upRight, int downLeft, int downRight)
+ {
+ if (Main.tile[i - 1, j - 1].TileType != Type || Main.tile[i, j - 1].TileType != Type || Main.tile[i + 1, j - 1].TileType != Type ||
+ Main.tile[i - 1, j - 2].TileType != Type || Main.tile[i, j - 2].TileType != Type || Main.tile[i + 1, j - 2].TileType != Type)
+ {
+ Main.tile[i, j].Get().HasSpecialPoint = true;
+ }
+ else
+ {
+ Main.tile[i, j].Get().HasSpecialPoint = false;
+ }
+ }
+
public override void DrawEffects(int i, int j, SpriteBatch spriteBatch, ref TileDrawInfo drawData)
{
bool isPlayerNear = WorldGen.PlayerLOS(i, j);
@@ -133,26 +152,22 @@ namespace CalamityMod.Tiles.Crags
}
}
- if (Main.tile[i - 1, j - 1].TileType != Type || Main.tile[i, j - 1].TileType != Type || Main.tile[i + 1, j - 1].TileType != Type ||
- Main.tile[i - 1, j - 2].TileType != Type || Main.tile[i, j - 2].TileType != Type || Main.tile[i + 1, j - 2].TileType != Type)
+ if (Main.tile[i, j].Get().HasSpecialPoint)
{
- try
- {
- Main.instance.TilesRenderer.AddSpecialLegacyPoint(i, j);
- }
- catch { }
+ Main.instance.TilesRenderer.AddSpecialLegacyPoint(i, j);
}
}
public override void SpecialDraw(int i, int j, SpriteBatch spriteBatch)
{
- if (Main.tile[i, j].IsTileActuallyInvisible())
+ Tile tile = Main.tile[i, j];
+ if (tile.IsTileActuallyInvisible())
return;
Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange);
Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero;
- Color drawColour = CalamityUtils.ApplyPaint(Main.tile[i, j].TileColor, Lighting.GetColor(i, j));
- Texture2D leaves = ModContent.Request("CalamityMod/Tiles/Crags/CinderBlossomGrassGrass").Value;
+ Color drawColour = CalamityUtils.ApplyPaint(tile.TileColor, Lighting.GetColor(i, j));
+ Texture2D leaves = GrassTexture.Value;
DrawExtraTop(i, j, leaves, drawOffset, drawColour);
DrawExtraWallEnds(i, j, leaves, drawOffset, drawColour);
diff --git a/Tiles/SunkenSea/ScarletSeaGrassTile.cs b/Tiles/SunkenSea/ScarletSeaGrassTile.cs
index ce1027a16e..d74ca24d85 100644
--- a/Tiles/SunkenSea/ScarletSeaGrassTile.cs
+++ b/Tiles/SunkenSea/ScarletSeaGrassTile.cs
@@ -68,44 +68,33 @@ namespace CalamityMod.Tiles.SunkenSea
{
num = fail ? 1 : 3;
}
- public override void DrawEffects(int i, int j, SpriteBatch spriteBatch, ref TileDrawInfo drawData)
+
+ public override void PostTileFrame(int i, int j, int up, int down, int left, int right, int upLeft, int upRight, int downLeft, int downRight)
{
if (Main.tile[i - 1, j - 1].TileType != Type || Main.tile[i, j - 1].TileType != Type || Main.tile[i + 1, j - 1].TileType != Type ||
Main.tile[i - 1, j - 2].TileType != Type || Main.tile[i, j - 2].TileType != Type || Main.tile[i + 1, j - 2].TileType != Type)
{
- try
- {
- Main.instance.TilesRenderer.AddSpecialLegacyPoint(i, j);
- }
- catch { }
+ Main.tile[i, j].Get().HasSpecialPoint = true;
+ }
+ else
+ {
+ Main.tile[i, j].Get().HasSpecialPoint = false;
}
}
- private Color GetDrawColour(int i, int j)
+
+ public override void DrawEffects(int i, int j, SpriteBatch spriteBatch, ref TileDrawInfo drawData)
{
- int colType = Main.tile[i, j].TileColor;
- Color paintCol = WorldGen.paintColor(colType);
- if (colType < 13)
+ if (Main.tile[i, j].Get().HasSpecialPoint)
{
- paintCol.R = (byte)((paintCol.R / 2f) + 128);
- paintCol.G = (byte)((paintCol.G / 2f) + 128);
- paintCol.B = (byte)((paintCol.B / 2f) + 128);
+ Main.instance.TilesRenderer.AddSpecialLegacyPoint(i, j);
}
- if (colType == 29)
- {
- paintCol = Color.Black;
- }
- Color col = Lighting.GetColor(i, j);
- col.R = (byte)(paintCol.R / 255f * col.R);
- col.G = (byte)(paintCol.G / 255f * col.G);
- col.B = (byte)(paintCol.B / 255f * col.B);
- return col;
}
public override void SpecialDraw(int i, int j, SpriteBatch spriteBatch)
{
Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange);
Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero;
- Color drawColour = GetDrawColour(i, j);
+ Color drawColour = CalamityUtils.ApplyPaint(Main.tile[i, j].TileColor, Lighting.GetColor(i, j));
Texture2D leaves = GrassTexture.Value;
DrawExtraTop(i, j, leaves, drawOffset, drawColour);
@@ -124,6 +113,7 @@ namespace CalamityMod.Tiles.SunkenSea
g = 0f;
b = 0.1f;
}
+
public override void RandomUpdate(int i, int j)
{
Tile tile = Main.tile[i, j];
diff --git a/Tiles/VernalSoil.cs b/Tiles/VernalSoil.cs
index 38f33627f8..a70bd6612e 100644
--- a/Tiles/VernalSoil.cs
+++ b/Tiles/VernalSoil.cs
@@ -1,5 +1,7 @@
-using Microsoft.Xna.Framework;
+using CalamityMod.Systems;
+using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
+using ReLogic.Content;
using Terraria;
using Terraria.Audio;
using Terraria.DataStructures;
@@ -11,10 +13,15 @@ namespace CalamityMod.Tiles
{
public class VernalSoil : ModTile
{
+ public Asset GrassTexture;
+
private int extraFrameHeight = 36;
private int extraFrameWidth = 90;
+
public override void SetStaticDefaults()
{
+ GrassTexture = ModContent.Request("CalamityMod/Tiles/VernicFernGrass");
+
Main.tileSolid[Type] = true;
Main.tileBlockLight[Type] = false;
TileMaterials.SetForTileId(Type, TileMaterials._materialsByName["Organic"]);
@@ -32,16 +39,24 @@ namespace CalamityMod.Tiles
this.RegisterBlendMergeWith(TileID.Mud);
}
- public override void DrawEffects(int i, int j, SpriteBatch spriteBatch, ref TileDrawInfo drawData)
+ public override void PostTileFrame(int i, int j, int up, int down, int left, int right, int upLeft, int upRight, int downLeft, int downRight)
{
if (Main.tile[i - 1, j - 1].TileType != Type || Main.tile[i, j - 1].TileType != Type || Main.tile[i + 1, j - 1].TileType != Type ||
Main.tile[i - 1, j - 2].TileType != Type || Main.tile[i, j - 2].TileType != Type || Main.tile[i + 1, j - 2].TileType != Type)
{
- try
- {
- Main.instance.TilesRenderer.AddSpecialLegacyPoint(i, j);
- }
- catch { }
+ Main.tile[i, j].Get().HasSpecialPoint = true;
+ }
+ else
+ {
+ Main.tile[i, j].Get().HasSpecialPoint = false;
+ }
+ }
+
+ public override void DrawEffects(int i, int j, SpriteBatch spriteBatch, ref TileDrawInfo drawData)
+ {
+ if (Main.tile[i, j].Get().HasSpecialPoint)
+ {
+ Main.instance.TilesRenderer.AddSpecialLegacyPoint(i, j);
}
}
@@ -163,26 +178,22 @@ namespace CalamityMod.Tiles
public override void SpecialDraw(int i, int j, SpriteBatch spriteBatch)
{
- if (Main.tile[i, j].IsTileActuallyInvisible())
+ Tile tile = Main.tile[i, j];
+ if (tile.IsTileActuallyInvisible())
return;
+
Tile uptile = Main.tile[i, j - 1];
+ if (uptile.HasTile && uptile.IsTileFull())
+ return;
+
Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange);
Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero;
- Color drawColour = CalamityUtils.ApplyPaint(Main.tile[i, j].TileColor, Lighting.GetColor(i, j));
- Texture2D leaves = ModContent.Request("CalamityMod/Tiles/VernicFernGrass").Value;
+ Color drawColour = CalamityUtils.ApplyPaint(tile.TileColor, Lighting.GetColor(i, j));
+ Texture2D leaves = GrassTexture.Value;
- if (uptile.HasTile && uptile.IsTileFull())
- {
- return;
- }
- else
- {
-
-
- DrawExtraTop(i, j, leaves, drawOffset, drawColour);
- //DrawExtraWallEnds(i, j, leaves, drawOffset, drawColour);
- DrawExtraDrapes(i, j, leaves, drawOffset, drawColour);
- }
+ DrawExtraTop(i, j, leaves, drawOffset, drawColour);
+ //DrawExtraWallEnds(i, j, leaves, drawOffset, drawColour);
+ DrawExtraDrapes(i, j, leaves, drawOffset, drawColour);
}
#region 'Extra Drapes' Drawing