diff --git a/ILEditing/MechanicILChanges.cs b/ILEditing/MechanicILChanges.cs index 70f80a9b78..c4029918cb 100644 --- a/ILEditing/MechanicILChanges.cs +++ b/ILEditing/MechanicILChanges.cs @@ -983,13 +983,44 @@ namespace CalamityMod.ILEditing if (tile.TileType != (ushort)ModContent.TileType()) { - if (Main.waterStyle == ModContent.Find("CalamityMod/SulphuricWater").Slot) + if (Main.waterStyle == ModContent.Find("CalamityMod/SulphuricWater").Slot && Main.dayTime == true) { - outputColor = Vector3.Lerp(outputColor, Color.LightSeaGreen.ToVector3(), 0.41f); + float brightness = MathHelper.Clamp(0.2f - (y / 540), 0.0f, 0.2f); + float wave1 = (Main.GameUpdateCount * 0.014f) * -50 + (x + (-y / 2)) * 15; + float wave2 = (Main.GameUpdateCount * 0.10f) * -10 + (x + (-y / 2)) * 14; + float wave3 = (Main.GameUpdateCount * 0.014f) * -100 + (x + (-y / 2)) * 13; + float wave4 = (Main.GameUpdateCount * 0.10f) * 10 + (x + (-y / 2)) * 25; + float wave5 = (Main.GameUpdateCount * 0.014f) * -70 + (x + (-y / 2)) * 5; + float wave1angle = 0.55f + 0.45f * (float)Math.Sin(MathHelper.ToRadians(wave1)); + float wave2angle = 0.55f + 0.45f * (float)Math.Sin(MathHelper.ToRadians(wave2)); + float wave3angle = 0.55f + 0.45f * (float)Math.Sin(MathHelper.ToRadians(wave3)); + float wave4angle = 0.55f + 0.45f * (float)Math.Sin(MathHelper.ToRadians(wave4)); + float wave5angle = 0.55f + 0.45f * (float)Math.Sin(MathHelper.ToRadians(wave5)); + outputColor = Vector3.Lerp(outputColor, Color.LightSeaGreen.ToVector3(), (0.41f + wave1angle + wave2angle + wave3angle + wave4angle + wave5angle)); + outputColor *= brightness; } + if (Main.waterStyle == ModContent.Find("CalamityMod/SulphuricWater").Slot && Main.dayTime == false) + { + float brightness = MathHelper.Clamp(0.1f - (y / 540), 0.0f, 0.1f); + float wave1 = (Main.GameUpdateCount * 0.014f) * -50 + (x + (-y / 2)) * 15; + float wave2 = (Main.GameUpdateCount * 0.10f) * -10 + (x + (-y / 2)) * 14; + float wave3 = (Main.GameUpdateCount * 0.014f) * -100 + (x + (-y / 2)) * 13; + float wave4 = (Main.GameUpdateCount * 0.10f) * 10 + (x + (-y / 2)) * 25; + float wave5 = (Main.GameUpdateCount * 0.014f) * -70 + (x + (-y / 2)) * 5; + float wave1angle = 0.55f + 0.45f * (float)Math.Sin(MathHelper.ToRadians(wave1)); + float wave2angle = 0.55f + 0.45f * (float)Math.Sin(MathHelper.ToRadians(wave2)); + float wave3angle = 0.55f + 0.45f * (float)Math.Sin(MathHelper.ToRadians(wave3)); + float wave4angle = 0.55f + 0.45f * (float)Math.Sin(MathHelper.ToRadians(wave4)); + float wave5angle = 0.55f + 0.45f * (float)Math.Sin(MathHelper.ToRadians(wave5)); + outputColor = Vector3.Lerp(outputColor, Color.LightSeaGreen.ToVector3(), (0.41f + wave1angle + wave2angle + wave3angle + wave4angle + wave5angle)); + outputColor *= brightness; + } + if (Main.waterStyle == ModContent.Find("CalamityMod/SulphuricDepthsWater").Slot) { + outputColor = Vector3.Lerp(outputColor, Color.MediumSeaGreen.ToVector3(), 0.18f); + } } } diff --git a/Tiles/SunkenSea/EutrophicSand.cs b/Tiles/SunkenSea/EutrophicSand.cs index 3ffbdf967a..867797c8b3 100644 --- a/Tiles/SunkenSea/EutrophicSand.cs +++ b/Tiles/SunkenSea/EutrophicSand.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Tiles.SunkenSea CalamityUtils.MergeWithGeneral(Type); CalamityUtils.MergeWithDesert(Type); - Main.tileShine[Type] = 650; + Main.tileShine[Type] = 1000; Main.tileShine2[Type] = true; TileID.Sets.ChecksForMerge[Type] = true; diff --git a/Walls/VoidstoneWall.cs b/Walls/VoidstoneWall.cs index 357d70510a..9c11f93298 100644 --- a/Walls/VoidstoneWall.cs +++ b/Walls/VoidstoneWall.cs @@ -1,14 +1,20 @@ using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria.GameContent; using Terraria; using Terraria.ModLoader; +using ReLogic.Content; namespace CalamityMod.Walls { public class VoidstoneWall : ModWall { + internal static Texture2D GlowTexture; public override void SetStaticDefaults() { Main.wallHouse[Type] = true; + GlowTexture = ModContent.Request("CalamityMod/Walls/VoidstoneWall_Glowmask", AssetRequestMode.ImmediateLoad).Value; ItemDrop = ModContent.ItemType(); AddMapEntry(new Color(0, 0, 0)); @@ -19,6 +25,46 @@ namespace CalamityMod.Walls Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 180, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } + public static void DrawWallGlow(int wallType, int i, int j, SpriteBatch spriteBatch) + { + if (GlowTexture is null) + return; + + Tile tile = Main.tile[i, j]; + int xLength = 32; + int xOff = 0; + + Rectangle frame = new Rectangle(tile.WallFrameX + xOff, tile.WallFrameY, xLength, 32); + Color drawcolor; + drawcolor = WorldGen.paintColor((int)tile.WallColor) * (255f / 255f); + drawcolor.A = 255; + Vector2 zero = new Vector2(Main.offScreenRange, Main.offScreenRange); + + float brightness = 1f; + float declareThisHereToPreventRunningTheSameCalculationMultipleTimes = Main.GameUpdateCount * 0.007f; + brightness *= (float)MathF.Sin(i / 18f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes); + brightness *= (float)MathF.Sin(j / 18f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes); + brightness *= (float)MathF.Sin(i * 18f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes); + brightness *= (float)MathF.Sin(j * 18f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes); + drawcolor *= brightness; + + if (Main.drawToScreen) + { + zero = Vector2.Zero; + } + Vector2 pos = new Vector2((i * 16 - (int)Main.screenPosition.X), (j * 16 - (int)Main.screenPosition.Y)) + zero; + Main.spriteBatch.Draw(TextureAssets.Wall[wallType].Value, pos + new Vector2(-8 + xOff, -8), frame, Lighting.GetColor(i, j, Color.White), 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); + for (int k = 0; k < 3; k++) + { + Vector2 offset = new Vector2(Main.rand.NextFloat(-1, 1f), Main.rand.NextFloat(-1, 1f)) * 0.2f * k; + Main.spriteBatch.Draw(GlowTexture, pos + offset + new Vector2(-8 + xOff, -8), frame, drawcolor * 0.4f, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); + } + } + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) + { + DrawWallGlow(Type, i, j, spriteBatch); + return false; + } public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; } diff --git a/Walls/VoidstoneWallUnsafe _Glowmask.png b/Walls/VoidstoneWallUnsafe _Glowmask.png new file mode 100644 index 0000000000..a3f5c24d2b Binary files /dev/null and b/Walls/VoidstoneWallUnsafe _Glowmask.png differ diff --git a/Walls/VoidstoneWallUnsafe.cs b/Walls/VoidstoneWallUnsafe.cs index 1b6704ec1f..96cc65ae62 100644 --- a/Walls/VoidstoneWallUnsafe.cs +++ b/Walls/VoidstoneWallUnsafe.cs @@ -1,4 +1,8 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria.GameContent; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -7,8 +11,10 @@ namespace CalamityMod.Walls { public class VoidstoneWallUnsafe : ModWall { + internal static Texture2D GlowTexture; public override void SetStaticDefaults() { + GlowTexture = ModContent.Request("CalamityMod/Walls/VoidstoneWall_Glowmask", AssetRequestMode.ImmediateLoad).Value; DustType = 187; AddMapEntry(new Color(0, 0, 0)); } @@ -21,6 +27,46 @@ namespace CalamityMod.Walls Main.tile[i, j].Get().LiquidType = LiquidID.Water; } } + public static void DrawWallGlow(int wallType, int i, int j, SpriteBatch spriteBatch) + { + if (GlowTexture is null) + return; + + Tile tile = Main.tile[i, j]; + int xLength = 32; + int xOff = 0; + + Rectangle frame = new Rectangle(tile.WallFrameX + xOff, tile.WallFrameY, xLength, 32); + Color drawcolor; + drawcolor = WorldGen.paintColor((int)tile.WallColor) * (255f / 255f); + drawcolor.A = 255; + Vector2 zero = new Vector2(Main.offScreenRange, Main.offScreenRange); + + float brightness = 1f; + float declareThisHereToPreventRunningTheSameCalculationMultipleTimes = Main.GameUpdateCount * 0.007f; + brightness *= (float)MathF.Sin(i / 18f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes); + brightness *= (float)MathF.Sin(j / 18f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes); + brightness *= (float)MathF.Sin(i * 18f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes); + brightness *= (float)MathF.Sin(j * 18f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes); + drawcolor *= brightness; + + if (Main.drawToScreen) + { + zero = Vector2.Zero; + } + Vector2 pos = new Vector2((i * 16 - (int)Main.screenPosition.X), (j * 16 - (int)Main.screenPosition.Y)) + zero; + Main.spriteBatch.Draw(TextureAssets.Wall[wallType].Value, pos + new Vector2(-8 + xOff, -8), frame, Lighting.GetColor(i, j, Color.White), 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); + for (int k = 0; k < 3; k++) + { + Vector2 offset = new Vector2(Main.rand.NextFloat(-1, 1f), Main.rand.NextFloat(-1, 1f)) * 0.2f * k; + Main.spriteBatch.Draw(GlowTexture, pos + offset + new Vector2(-8 + xOff, -8), frame, drawcolor * 0.4f, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); + } + } + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) + { + DrawWallGlow(Type, i, j, spriteBatch); + return false; + } public override void KillWall(int i, int j, ref bool fail) => fail = true; diff --git a/Walls/VoidstoneWall_Glowmask.png b/Walls/VoidstoneWall_Glowmask.png new file mode 100644 index 0000000000..f8a69e96e1 Binary files /dev/null and b/Walls/VoidstoneWall_Glowmask.png differ