From 9969fe5989ca84b6cec83947c82401722397202f Mon Sep 17 00:00:00 2001 From: Big E Date: Wed, 5 Nov 2025 13:37:21 -0500 Subject: [PATCH] + Sea Prism Walls and Sea Prism Crystals are now utilize the Sea Prism Color Blendign shader --- Effects/SeaPrismColorBlending.fx | 43 +- Effects/SeaPrismColorBlending.xnb | Bin 2936 -> 3060 bytes Tiles/SunkenSea/MediumSeaPrismCrystal.cs | 125 ------ Tiles/SunkenSea/SeaPrism.cs | 443 +++++++++++++++++++-- Tiles/SunkenSea/SeaPrismCrystals.cs | 116 ------ Tiles/SunkenSea/SeaPrismCrystals_Glint.png | Bin 0 -> 2676 bytes Walls/SeaPrismWall.cs | 85 ---- Walls/UnsafeWalls/UnsafeSeaPrismWall.cs | 90 ----- 8 files changed, 441 insertions(+), 461 deletions(-) delete mode 100644 Tiles/SunkenSea/MediumSeaPrismCrystal.cs delete mode 100644 Tiles/SunkenSea/SeaPrismCrystals.cs create mode 100644 Tiles/SunkenSea/SeaPrismCrystals_Glint.png delete mode 100644 Walls/SeaPrismWall.cs delete mode 100644 Walls/UnsafeWalls/UnsafeSeaPrismWall.cs diff --git a/Effects/SeaPrismColorBlending.fx b/Effects/SeaPrismColorBlending.fx index d5edd04ecb..6b941440ad 100644 --- a/Effects/SeaPrismColorBlending.fx +++ b/Effects/SeaPrismColorBlending.fx @@ -7,6 +7,7 @@ float time; float2 screenOffset; float2 offscreenOffset; float diagonalScreenLength; +bool doGlint; float4 PixelShaderFunction(float4 sampleColor : COLOR0, float2 coords : TEXCOORD0, float4 screenPos : VPOS) : COLOR { @@ -28,32 +29,34 @@ float4 PixelShaderFunction(float4 sampleColor : COLOR0, float2 coords : TEXCOORD result.rgb = lerp(result.rgb, greenColor.rgb, greenColor.a * fade1); result.rgb = lerp(result.rgb, purpleColor.rgb, purpleColor.a * fade2); - // Calculate glint effect - float2 projPos = screenPos.xy - offscreenOffset; - float projection = (screenPos.x / 2.0) - (screenPos.y / 2.0); + if(doGlint) + { + // Calculate glint effect + float2 projPos = screenPos.xy - offscreenOffset; + float projection = (screenPos.x / 2.0) - (screenPos.y / 2.0); - // Define glint beam centers - float beamCenter1 = diagonalScreenLength * 0.05; - float beamCenter2 = diagonalScreenLength * 0.5; - float beamCenter3 = diagonalScreenLength * 1.05; + // Define glint beam centers + float beamCenter1 = diagonalScreenLength * 0.05; + float beamCenter2 = diagonalScreenLength * 0.5; + float beamCenter3 = diagonalScreenLength * 1.05; - // Calculate glint strength for each beam - float dist1 = abs(projection - beamCenter1); - float dist2 = abs(projection - beamCenter2); - float dist3 = abs(projection - beamCenter3); + // Calculate glint strength for each beam + float dist1 = abs(projection - beamCenter1); + float dist2 = abs(projection - beamCenter2); + float dist3 = abs(projection - beamCenter3); - float strength1 = saturate(1.0 - dist1 / 100.0); - float strength2 = saturate(1.0 - dist2 / 100.0); - float strength3 = saturate(1.0 - dist3 / 100.0); + float strength1 = saturate(1.0 - dist1 / 100.0); + float strength2 = saturate(1.0 - dist2 / 100.0); + float strength3 = saturate(1.0 - dist3 / 100.0); - float totalGlintStrength = max(strength1, max(strength2, strength3)); + float totalGlintStrength = max(strength1, max(strength2, strength3)); - // Apply glint - result.rgb = lerp(result.rgb, glintColor.rgb, glintColor.a * totalGlintStrength); + // Apply glint + result.rgb = lerp(result.rgb, glintColor.rgb, glintColor.a * totalGlintStrength); - //Additive Blend Version (VERY BRIGHT) - //result.rgb = lerp(result.rgb, result.rgb + glintColor.rgb, glintColor.a * totalGlintStrength); - + //Additive Blend Version (VERY BRIGHT) + //result.rgb = lerp(result.rgb, result.rgb + glintColor.rgb, glintColor.a * totalGlintStrength); + } return result * sampleColor; } diff --git a/Effects/SeaPrismColorBlending.xnb b/Effects/SeaPrismColorBlending.xnb index f4c6478c9c33f464f05748fa7a773feca73e3343..2a5812d3480ebd7c31da3b4cce4d980fb9c9e679 100644 GIT binary patch delta 943 zcmY*XJ!lkB5T3Wc@AfXqX+(`&@F0;CXB%wN7z4#>w0zDRY%YL zmoxP|(U<(M{UZG{m5YbRA3pD>1;O^zSO#tuYWQpSR@U!qZt;qBMdkRJwX^sX=~o#A zj322l+rgO6h{Zku>+`aGzT1$3b{r4mO{z7Pt0ja+6u^9J62r=mf$hPuu@qU<7Zf(Y zvdB;RJAnTk>nE0tN6{qxhA&otUJykdm83rGqM|m$ULsxsDB^lTw15S)niAKsTjc)7 zyLsb5r_p(|_3(a&94a6u&&bjNAy9nRo#nFA{@8N{ijC{>6Ym^1ymD?BZ`0LQy_V+_ zdYa#R1%B&m9(eO=f)BlGYLXZI3a@I-xBbh!?`iJ)^O*NHzoG(mb%nqB1zyr+ZbP@G z&+-dhVxvzX`%d4Qb(3K!6HpvdvDtG7eUdU%q+Y-q!6nps9n|nX4Ce5j$j>On3;DS& z8KT%&&?~ZyOA+)@FN+mL#-nIgW`Z%HK7~>n*EhgKC;J%I1g9x{GtLX>O(?xhqfVwx z^4+u${)|vlGrW)-WM#$Cl)@oRqfwxWCM}vm4h`xkluKvDEL>tdmcxW^r+oF7Zy6h0 ze6B>_#s7tZ()CE-qymEAByQ@GpX6;!!od>EPB6KBghNM|0w$9r#KLWX=K%AGb|scc QN`s`Qk~-k^;+Pcu0gs!lfdBvi delta 832 zcmYjOziSjx5T5sTZ{ORy;4Ny5Vju^}fp8#pg4KDk^9O>r5U}#cVPmBcuaVm_g^&wl zBPhIp)m4g>aDs&vf?(_|EcOpbVUa?!e)Dc~?kw}>%{Mb|zM1{Kba2XS+~_^6so{=! zeP*vt^u4h^P3XU^ZP4eip2ZPFg@gQ5+Wc zXuW^Aw+y#06~H1G@gc42z+T`IKox0nup)1v0X{{?=#v1DJ*XgxBKjo&WFM;Gdonl@ zXiL#0Bx-@#BrwDsDJ&;t?gb#u?cQsG?h)9uDeQ757 zy3AMee4S}304kXFm`t8y%6#5f-k>BM&nHW0 zjGf09vF#u6I?l!V>RE% DefaultCrystals; - private static Asset PurpleCrystals; - private static Asset GreenCrystals; - - public override void SetStaticDefaults() - { - Main.tileLighted[Type] = true; - Main.tileNoFail[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileObsidianKill[Type] = true; - Main.tileSpelunker[Type] = true; - Main.tileShine[Type] = 5600; - Main.tileShine2[Type] = true; - - HitSound = SoundID.Item27; - DustType = DustID.IceRod; - MinPick = 55; - - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); - AddMapEntry(new Color(53, 136, 207), CalamityUtils.GetItemName()); - - // Attach to ground - TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); - TileObjectData.newTile.StyleHorizontal = true; - TileObjectData.newTile.StyleMultiplier = 32; // total 32 frames, all should be same "itemStyle" - TileObjectData.newTile.StyleWrapLimit = 8; // only 1 placement alternative per row - TileObjectData.newTile.RandomStyleRange = 8; // 8 different style will be selected upon placing - TileObjectData.newTile.Origin = new Point16(0, 1); - - // Attach to side (right) - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.AnchorRight = new AnchorData(AnchorType.SolidTile | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); - TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; - TileObjectData.newAlternate.Origin = new Point16(1, 0); - TileObjectData.addAlternate(8); - - // Attach to ceiling - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile | AnchorType.SolidBottom, TileObjectData.newTile.Width, 0); - TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; - TileObjectData.newAlternate.Origin = new Point16(0, 0); - TileObjectData.addAlternate(16); - - // Attach to side (left) - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.AnchorLeft = new AnchorData(AnchorType.SolidTile | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); - TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; - TileObjectData.newAlternate.Origin = new Point16(0, 0); - TileObjectData.addAlternate(24); - TileObjectData.addTile(Type); - - DefaultCrystals = ModContent.Request("CalamityMod/Tiles/SunkenSea/MediumSeaPrismCrystal_Blue"); - PurpleCrystals = ModContent.Request("CalamityMod/Tiles/SunkenSea/MediumSeaPrismCrystal_Purple"); - GreenCrystals = ModContent.Request("CalamityMod/Tiles/SunkenSea/MediumSeaPrismCrystal_Green"); - } - - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } - - public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) - { - float fade1 = GetFade1(i, j); - float fade2 = GetFade2(i, j); - - Color baseColor = new Color(162, 216, 218); //Blue - Color glow1 = new Color(171, 113, 215); //Purple - Color glow2 = new Color(56, 174, 117); //Green - - Vector3 blended = baseColor.ToVector3(); - - blended = Vector3.Lerp(blended, glow1.ToVector3(), fade1 * 0.5f); - blended = Vector3.Lerp(blended, glow2.ToVector3(), fade2 * 0.5f); - - float brightness = 0.6f; - blended *= brightness; - - r = blended.X; - g = blended.Y; - b = blended.Z; - } - - private static float GetFade1(int i, int j) => (MathF.Sin(Main.GlobalTimeWrappedHourly * 0.2f) + 1f) / 2f; - - private static float GetFade2(int i, int j) => (MathF.Sin(Main.GlobalTimeWrappedHourly * 0.1f + i * 0.08f - j * 0.05f) + 1f) / 2f; - - public override void PostDraw(int i, int j, SpriteBatch spriteBatch) - { - Tile tile = Framing.GetTileSafely(i, j); - Vector2 offScreen = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); - Vector2 position = new Vector2(i * 16, j * 16) - Main.screenPosition + offScreen; - - Rectangle sourceRect = new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16); - - spriteBatch.Draw(DefaultCrystals.Value, position, sourceRect, Lighting.GetColor(i, j) * 1.5f); - spriteBatch.Draw(PurpleCrystals.Value, position, sourceRect, Lighting.GetColor(i, j) * 1.5f * GetFade1(i, j)); - spriteBatch.Draw(GreenCrystals.Value, position, sourceRect, Lighting.GetColor(i, j) * 1.5f * GetFade2(i, j)); - } - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 32, 48, ModContent.ItemType(), 4); - } - } -} diff --git a/Tiles/SunkenSea/SeaPrism.cs b/Tiles/SunkenSea/SeaPrism.cs index 4480d1ba22..3ab40b19da 100644 --- a/Tiles/SunkenSea/SeaPrism.cs +++ b/Tiles/SunkenSea/SeaPrism.cs @@ -1,12 +1,17 @@ using System; using CalamityMod.Effects; +using CalamityMod.Items.Placeables.SunkenSea; using CalamityMod.Systems; +using CalamityMod.Walls; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; using Terraria.ID; using Terraria.ModLoader; +using Terraria.ObjectData; namespace CalamityMod.Tiles.SunkenSea { @@ -95,11 +100,260 @@ namespace CalamityMod.Tiles.SunkenSea public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) => false; } + public class SeaPrismWall : MultiVariantModWall + { + public override string Texture => "CalamityMod/Walls/SeaPrismWall"; + + internal static FramedMaskTexture GlowMaskBlue; + internal static FramedMaskTexture GlowMaskPurple; + internal static FramedMaskTexture GlowMaskGreen; + public override void SetStaticDefaults() + { + GlowMaskBlue = new("CalamityMod/Walls/SeaPrismWall_Blue", 36, 36); + GlowMaskPurple = new("CalamityMod/Walls/SeaPrismWall_Purple", 36, 36); + GlowMaskGreen = new("CalamityMod/Walls/SeaPrismWall_Green", 36, 36); + Main.wallHouse[Type] = true; + DustType = DustID.RainCloud; + + AddMapEntry(new Color(27, 123, 131)); + } + + public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; + + public override void PopulateWallVariant(int i, int j, ref int frameXOffset, ref int frameYOffset) + { + frameXOffset = (i % 8) * 468; + frameYOffset = (j % 8) * 180; + } + + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) => false; + } + + public class UnsafeSeaPrismWall : MultiVariantModWall + { + public override string Texture => "CalamityMod/Walls/SeaPrismWall"; + public override void SetStaticDefaults() + { + Main.wallHouse[Type] = false; + DustType = DustID.RainCloud; + + AddMapEntry(new Color(27, 123, 131)); + } + + public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; + + public override void PopulateWallVariant(int i, int j, ref int frameXOffset, ref int frameYOffset) + { + frameXOffset = (i % 8) * 468; + frameYOffset = (j % 8) * 180; + } + + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) => false; + + public override bool Drop(int i, int j, ref int type) => false; + } + + public class SeaPrismCrystals : ModTile + { + internal static Asset BlueCrystals; + internal static Asset PurpleCrystals; + internal static Asset GreenCrystals; + internal static Asset Glint; + + public override void SetStaticDefaults() + { + Main.tileLighted[Type] = true; + Main.tileNoFail[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileObsidianKill[Type] = true; + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); + AddMapEntry(new Color(53, 136, 207), CalamityUtils.GetItemName()); + HitSound = SoundID.Item27; + DustType = DustID.IceRod; + Main.tileSpelunker[Type] = true; + MinPick = 55; + + BlueCrystals = ModContent.Request("CalamityMod/Tiles/SunkenSea/SeaPrismCrystals"); + PurpleCrystals = ModContent.Request("CalamityMod/Tiles/SunkenSea/SeaPrismCrystals_Purple"); + GreenCrystals = ModContent.Request("CalamityMod/Tiles/SunkenSea/SeaPrismCrystals_Green"); + Glint = ModContent.Request("CalamityMod/Tiles/SunkenSea/SeaPrismCrystals_Glint"); + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + float fade1 = GetFade1(i, j); + float fade2 = GetFade2(i, j); + + Color baseColor = new Color(162, 216, 218); //Blue + Color glow1 = new Color(171, 113, 215); //Purple + Color glow2 = new Color(56, 174, 117); //Green + + Vector3 blended = baseColor.ToVector3(); + + blended = Vector3.Lerp(blended, glow1.ToVector3(), fade1 * 0.5f); + blended = Vector3.Lerp(blended, glow2.ToVector3(), fade2 * 0.5f); + + float brightness = 0.6f; + blended *= brightness; + + r = blended.X; + g = blended.Y; + b = blended.Z; + } + + private static float GetFade1(int i, int j) => (MathF.Sin(Main.GlobalTimeWrappedHourly * 0.2f) + 1f) / 2f; + + private static float GetFade2(int i, int j) => (MathF.Sin(Main.GlobalTimeWrappedHourly * 0.1f + i * 0.08f - j * 0.05f) + 1f) / 2f; + + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) => false; + + public override bool CanPlace(int i, int j) + { + Tile belowTile = Main.tile[i, j + 1]; + Tile aboveTile = Main.tile[i, j - 1]; + Tile rightTile = Main.tile[i + 1, j]; + Tile leftTile = Main.tile[i - 1, j]; + + if ((belowTile.Slope == SlopeType.Solid && !belowTile.IsHalfBlock && belowTile.HasTile && belowTile.IsTileSolid()) || + (aboveTile.Slope == SlopeType.Solid && !aboveTile.IsHalfBlock && aboveTile.HasTile && aboveTile.IsTileSolid()) || + (rightTile.Slope == SlopeType.Solid && !rightTile.IsHalfBlock && rightTile.HasTile && rightTile.IsTileSolid()) || + (leftTile.Slope == SlopeType.Solid && !leftTile.IsHalfBlock && leftTile.HasTile && leftTile.IsTileSolid())) + return true; + + return false; + } + + public override void PlaceInWorld(int i, int j, Item item) + { + Tile belowTile = Main.tile[i, j + 1]; + Tile aboveTile = Main.tile[i, j - 1]; + Tile rightTile = Main.tile[i + 1, j]; + Tile leftTile = Main.tile[i - 1, j]; + + if (belowTile.Slope == SlopeType.Solid && !belowTile.IsHalfBlock && belowTile.HasTile && belowTile.IsTileSolid()) + Main.tile[i, j].TileFrameY = 0; + else if (aboveTile.Slope == SlopeType.Solid && !aboveTile.IsHalfBlock && aboveTile.HasTile && aboveTile.IsTileSolid()) + Main.tile[i, j].TileFrameY = 18; + else if (rightTile.Slope == SlopeType.Solid && !rightTile.IsHalfBlock && rightTile.HasTile && rightTile.IsTileSolid()) + Main.tile[i, j].TileFrameY = 36; + else if (leftTile.Slope == SlopeType.Solid && !leftTile.IsHalfBlock && leftTile.HasTile && leftTile.IsTileSolid()) + Main.tile[i, j].TileFrameY = 54; + + Main.tile[i, j].TileFrameX = (short)(WorldGen.genRand.Next(18) * 18); + } + } + + public class MediumSeaPrismCrystal : ModTile + { + internal static Asset BlueCrystals; + internal static Asset PurpleCrystals; + internal static Asset GreenCrystals; + internal static Asset Glint; + + public override void SetStaticDefaults() + { + Main.tileLighted[Type] = true; + Main.tileNoFail[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileObsidianKill[Type] = true; + Main.tileSpelunker[Type] = true; + Main.tileShine[Type] = 5600; + Main.tileShine2[Type] = true; + + HitSound = SoundID.Item27; + DustType = DustID.IceRod; + MinPick = 55; + + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); + AddMapEntry(new Color(53, 136, 207), CalamityUtils.GetItemName()); + + // Attach to ground + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleMultiplier = 32; // total 32 frames, all should be same "itemStyle" + TileObjectData.newTile.StyleWrapLimit = 8; // only 1 placement alternative per row + TileObjectData.newTile.RandomStyleRange = 8; // 8 different style will be selected upon placing + TileObjectData.newTile.Origin = new Point16(0, 1); + + // Attach to side (right) + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorRight = new AnchorData(AnchorType.SolidTile | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(1, 0); + TileObjectData.addAlternate(8); + + // Attach to ceiling + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile | AnchorType.SolidBottom, TileObjectData.newTile.Width, 0); + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(0, 0); + TileObjectData.addAlternate(16); + + // Attach to side (left) + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorLeft = new AnchorData(AnchorType.SolidTile | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(0, 0); + TileObjectData.addAlternate(24); + TileObjectData.addTile(Type); + + BlueCrystals = ModContent.Request("CalamityMod/Tiles/SunkenSea/MediumSeaPrismCrystal_Blue"); + PurpleCrystals = ModContent.Request("CalamityMod/Tiles/SunkenSea/MediumSeaPrismCrystal_Purple"); + GreenCrystals = ModContent.Request("CalamityMod/Tiles/SunkenSea/MediumSeaPrismCrystal_Green"); + Glint = ModContent.Request("CalamityMod/Tiles/SunkenSea/MediumSeaPrismCrystal_Glint"); + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + float fade1 = GetFade1(i, j); + float fade2 = GetFade2(i, j); + + Color baseColor = new Color(162, 216, 218); //Blue + Color glow1 = new Color(171, 113, 215); //Purple + Color glow2 = new Color(56, 174, 117); //Green + + Vector3 blended = baseColor.ToVector3(); + + blended = Vector3.Lerp(blended, glow1.ToVector3(), fade1 * 0.5f); + blended = Vector3.Lerp(blended, glow2.ToVector3(), fade2 * 0.5f); + + float brightness = 0.6f; + blended *= brightness; + + r = blended.X; + g = blended.Y; + b = blended.Z; + } + + private static float GetFade1(int i, int j) => (MathF.Sin(Main.GlobalTimeWrappedHourly * 0.2f) + 1f) / 2f; + + private static float GetFade2(int i, int j) => (MathF.Sin(Main.GlobalTimeWrappedHourly * 0.1f + i * 0.08f - j * 0.05f) + 1f) / 2f; + + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) => false; + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 32, 48, ModContent.ItemType(), 4); + } + } + + public class SeaPrismShaderDrawing : ModSystem { public override void OnModLoad() { - On_Main.DrawTiles += DrawSeaPrisms; + On_Main.DrawTiles += DrawSeaPrismsAndCrystals; + On_Main.DrawWalls += DrawSeaPrismWalls; } private void GetScreenDrawArea(Vector2 screenPosition, Vector2 offSet, out int firstTileX, out int lastTileX, out int firstTileY, out int lastTileY) @@ -126,32 +380,166 @@ namespace CalamityMod.Tiles.SunkenSea } } - private void DrawSeaPrisms(On_Main.orig_DrawTiles orig, Main self, bool solidLayer, bool forRenderTargets, bool intoRenderTargets, int waterStyleOverride) + private void DrawSeaPrismsAndCrystals(On_Main.orig_DrawTiles orig, Main self, bool solidLayer, bool forRenderTargets, bool intoRenderTargets, int waterStyleOverride) { - if(!solidLayer) - { - orig(self, solidLayer, forRenderTargets, intoRenderTargets, waterStyleOverride); - return; - } - Vector2 offscreenPosition = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Main.spriteBatch.End(); - Main.instance.GraphicsDevice.Textures[1] = SeaPrism.Green.Value; - Main.instance.GraphicsDevice.SamplerStates[1] = SamplerState.LinearClamp; - Main.instance.GraphicsDevice.Textures[2] = SeaPrism.Purple.Value; - Main.instance.GraphicsDevice.SamplerStates[2] = SamplerState.LinearClamp; - Main.instance.GraphicsDevice.Textures[3] = SeaPrism.Glint.Value; - Main.instance.GraphicsDevice.SamplerStates[3] = SamplerState.LinearClamp; - Effect shader = CalamityShaders.SeaPrismColorBlendingShader; shader.Parameters["time"].SetValue(Main.GlobalTimeWrappedHourly); shader.Parameters["screenOffset"].SetValue(Main.screenPosition); shader.Parameters["offscreenOffset"].SetValue(offscreenPosition); shader.Parameters["diagonalScreenLength"].SetValue((Main.screenWidth / 2f) - (Main.screenHeight / 2f)); + shader.Parameters["doGlint"].SetValue(true); - Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, shader, Main.Transform); + Vector2 unscaledPosition = Main.Camera.UnscaledPosition; + + GetScreenDrawArea(unscaledPosition, offscreenPosition + (Main.Camera.UnscaledPosition - Main.Camera.ScaledPosition), out var firstTileX, out var lastTileX, out var firstTileY, out var lastTileY); + + if (solidLayer) + { + Main.instance.GraphicsDevice.Textures[1] = SeaPrism.Green.Value; + Main.instance.GraphicsDevice.SamplerStates[1] = SamplerState.LinearClamp; + Main.instance.GraphicsDevice.Textures[2] = SeaPrism.Purple.Value; + Main.instance.GraphicsDevice.SamplerStates[2] = SamplerState.LinearClamp; + Main.instance.GraphicsDevice.Textures[3] = SeaPrism.Glint.Value; + Main.instance.GraphicsDevice.SamplerStates[3] = SamplerState.LinearClamp; + + Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, shader, Matrix.Identity); + + for (int y = firstTileY; y < lastTileY + 4; y++) + { + for (int x = firstTileX - 2; x < lastTileX + 2; x++) + { + if (!WorldGen.InWorld(x, y)) + continue; + + Tile tile = Main.tile[x, y]; + if (tile == null) + continue; + + int type = tile.TileType; + if (type != ModContent.TileType()) + continue; + + Vector2 position = new Vector2(x * 16, y * 16) - Main.screenPosition + offscreenPosition; + + int frameX = tile.TileFrameX + (x % 8 * SeaPrism.subsheetWidth); + int frameY = tile.TileFrameY + (y % 8 * SeaPrism.subsheetHeight); + + Rectangle sourceRect = new Rectangle(frameX, frameY, 16, 16); + Color light = Lighting.GetColor(x, y) * 1.5f; + + Main.spriteBatch.Draw(SeaPrism.Blue.Value, position, sourceRect, light); + } + } + } + else + { + Main.instance.GraphicsDevice.Textures[1] = SeaPrismCrystals.GreenCrystals.Value; + Main.instance.GraphicsDevice.SamplerStates[1] = SamplerState.LinearClamp; + Main.instance.GraphicsDevice.Textures[2] = SeaPrismCrystals.PurpleCrystals.Value; + Main.instance.GraphicsDevice.SamplerStates[2] = SamplerState.LinearClamp; + Main.instance.GraphicsDevice.Textures[3] = SeaPrismCrystals.Glint.Value; + Main.instance.GraphicsDevice.SamplerStates[3] = SamplerState.LinearClamp; + + Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, shader, Matrix.Identity); + + for (int y = firstTileY; y < lastTileY + 4; y++) + { + for (int x = firstTileX - 2; x < lastTileX + 2; x++) + { + if (!WorldGen.InWorld(x, y)) + continue; + + Tile tile = Main.tile[x, y]; + if (tile == null) + continue; + + int type = tile.TileType; + if (type != ModContent.TileType()) + continue; + + Vector2 offScreen = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); + Vector2 position = new Vector2(x * 16, y * 16) - Main.screenPosition + offScreen; + + Rectangle sourceRect = new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16); + Color light = Lighting.GetColor(x, y) * 1.5f; + + Main.spriteBatch.Draw(SeaPrismCrystals.BlueCrystals.Value, position, sourceRect, light); + } + } + + Main.spriteBatch.End(); + + Main.instance.GraphicsDevice.Textures[1] = MediumSeaPrismCrystal.GreenCrystals.Value; + Main.instance.GraphicsDevice.SamplerStates[1] = SamplerState.LinearClamp; + Main.instance.GraphicsDevice.Textures[2] = MediumSeaPrismCrystal.PurpleCrystals.Value; + Main.instance.GraphicsDevice.SamplerStates[2] = SamplerState.LinearClamp; + Main.instance.GraphicsDevice.Textures[3] = MediumSeaPrismCrystal.Glint.Value; + Main.instance.GraphicsDevice.SamplerStates[3] = SamplerState.LinearClamp; + + Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, shader, Matrix.Identity); + + for (int y = firstTileY; y < lastTileY + 4; y++) + { + for (int x = firstTileX - 2; x < lastTileX + 2; x++) + { + if (!WorldGen.InWorld(x, y)) + continue; + + Tile tile = Main.tile[x, y]; + if (tile == null) + continue; + + int type = tile.TileType; + if (type != ModContent.TileType()) + continue; + + Vector2 offScreen = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); + Vector2 position = new Vector2(x * 16, y * 16) - Main.screenPosition + offScreen; + + Rectangle sourceRect = new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16); + Color light = Lighting.GetColor(x, y) * 1.5f; + + Main.spriteBatch.Draw(MediumSeaPrismCrystal.BlueCrystals.Value, position, sourceRect, light); + } + } + + } + + Main.spriteBatch.End(); + + Main.instance.GraphicsDevice.Textures[1] = null; + Main.instance.GraphicsDevice.Textures[2] = null; + Main.instance.GraphicsDevice.Textures[3] = null; + + Main.spriteBatch.Begin(); + + orig(self, solidLayer, forRenderTargets, intoRenderTargets, waterStyleOverride); + } + + private void DrawSeaPrismWalls(On_Main.orig_DrawWalls orig, Main self) + { + Vector2 offscreenPosition = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); + + Main.spriteBatch.End(); + + Main.instance.GraphicsDevice.Textures[1] = SeaPrismWall.GlowMaskGreen.Texture; + Main.instance.GraphicsDevice.SamplerStates[1] = SamplerState.LinearClamp; + Main.instance.GraphicsDevice.Textures[2] = SeaPrismWall.GlowMaskPurple.Texture; + Main.instance.GraphicsDevice.SamplerStates[2] = SamplerState.LinearClamp; + Main.instance.GraphicsDevice.Textures[3] = null; + + Effect shader = CalamityShaders.SeaPrismColorBlendingShader; + shader.Parameters["time"].SetValue(Main.GlobalTimeWrappedHourly); + shader.Parameters["screenOffset"].SetValue(Main.screenPosition); + shader.Parameters["offscreenOffset"].SetValue(offscreenPosition); + shader.Parameters["diagonalScreenLength"].SetValue((Main.screenWidth / 2f) - (Main.screenHeight / 2f)); + shader.Parameters["doGlint"].SetValue(false); + + Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, shader, Matrix.Identity); Vector2 unscaledPosition = Main.Camera.UnscaledPosition; @@ -168,19 +556,24 @@ namespace CalamityMod.Tiles.SunkenSea if (tile == null) continue; - int type = tile.TileType; - if (type != ModContent.TileType()) + int type = tile.WallType; + if (type != ModContent.WallType() && type != ModContent.WallType()) continue; Vector2 position = new Vector2(x * 16, y * 16) - Main.screenPosition + offscreenPosition; - int frameX = tile.TileFrameX + (x % 8 * SeaPrism.subsheetWidth); - int frameY = tile.TileFrameY + (y % 8 * SeaPrism.subsheetHeight); + int xLength = 32; - Rectangle sourceRect = new Rectangle(frameX, frameY, 16, 16); - Color light = Lighting.GetColor(x, y) * 1.5f; + int frameXOffset = (x % 8) * 468; + int frameYOffset = (y % 8) * 180; - Main.spriteBatch.Draw(SeaPrism.Blue.Value, position, sourceRect, light); + int xPos = tile.WallFrameX + frameXOffset; + int yPos = tile.WallFrameY + frameYOffset; + + Rectangle frame = new Rectangle(xPos, yPos, xLength, 32); + + if (SeaPrismWall.GlowMaskBlue.HasContentInFramePos(xPos, yPos)) + Main.spriteBatch.Draw(SeaPrismWall.GlowMaskBlue.Texture, position + new Vector2(-8, -8), frame, Color.White * 1.1f); } } @@ -190,9 +583,9 @@ namespace CalamityMod.Tiles.SunkenSea Main.instance.GraphicsDevice.Textures[2] = null; Main.instance.GraphicsDevice.Textures[3] = null; - Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.Transform); + Main.spriteBatch.Begin(); - orig(self, solidLayer, forRenderTargets, intoRenderTargets, waterStyleOverride); + orig(self); } } } diff --git a/Tiles/SunkenSea/SeaPrismCrystals.cs b/Tiles/SunkenSea/SeaPrismCrystals.cs deleted file mode 100644 index cd5e5fddbd..0000000000 --- a/Tiles/SunkenSea/SeaPrismCrystals.cs +++ /dev/null @@ -1,116 +0,0 @@ -using System; -using CalamityMod.Items.Placeables.SunkenSea; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using ReLogic.Content; -using Terraria; -using Terraria.ID; -using Terraria.Localization; -using Terraria.ModLoader; - -namespace CalamityMod.Tiles.SunkenSea -{ - public class SeaPrismCrystals : ModTile - { - private static Asset DefaultCrystals; - private static Asset PurpleCrystals; - private static Asset GreenCrystals; - - public override void SetStaticDefaults() - { - Main.tileLighted[Type] = true; - Main.tileNoFail[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileObsidianKill[Type] = true; - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); - AddMapEntry(new Color(53, 136, 207), CalamityUtils.GetItemName()); - HitSound = SoundID.Item27; - DustType = 67; - Main.tileSpelunker[Type] = true; - MinPick = 55; - - DefaultCrystals = ModContent.Request("CalamityMod/Tiles/SunkenSea/SeaPrismCrystals"); - PurpleCrystals = ModContent.Request("CalamityMod/Tiles/SunkenSea/SeaPrismCrystals_Purple"); - GreenCrystals = ModContent.Request("CalamityMod/Tiles/SunkenSea/SeaPrismCrystals_Green"); - } - - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } - - public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) - { - float fade1 = GetFade1(i, j); - float fade2 = GetFade2(i, j); - - Color baseColor = new Color(162, 216, 218); //Blue - Color glow1 = new Color(171, 113, 215); //Purple - Color glow2 = new Color(56, 174, 117); //Green - - Vector3 blended = baseColor.ToVector3(); - - blended = Vector3.Lerp(blended, glow1.ToVector3(), fade1 * 0.5f); - blended = Vector3.Lerp(blended, glow2.ToVector3(), fade2 * 0.5f); - - float brightness = 0.6f; - blended *= brightness; - - r = blended.X; - g = blended.Y; - b = blended.Z; - } - - private static float GetFade1(int i, int j) => (MathF.Sin(Main.GlobalTimeWrappedHourly * 0.2f) + 1f) / 2f; - - private static float GetFade2(int i, int j) => (MathF.Sin(Main.GlobalTimeWrappedHourly * 0.1f + i * 0.08f - j * 0.05f) + 1f) / 2f; - - public override void PostDraw(int i, int j, SpriteBatch spriteBatch) - { - Tile tile = Framing.GetTileSafely(i, j); - Vector2 offScreen = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); - Vector2 position = new Vector2(i * 16, j * 16) - Main.screenPosition + offScreen; - - Rectangle sourceRect = new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16); - - spriteBatch.Draw(DefaultCrystals.Value, position, sourceRect, Lighting.GetColor(i, j) * 1.5f); - spriteBatch.Draw(PurpleCrystals.Value, position, sourceRect, Lighting.GetColor(i, j) * 1.5f * GetFade1(i, j)); - spriteBatch.Draw(GreenCrystals.Value, position, sourceRect, Lighting.GetColor(i, j) * 1.5f * GetFade2(i, j)); - } - - public override bool CanPlace(int i, int j) - { - Tile belowTile = Main.tile[i, j + 1]; - Tile aboveTile = Main.tile[i, j - 1]; - Tile rightTile = Main.tile[i + 1, j]; - Tile leftTile = Main.tile[i - 1, j]; - - if ((belowTile.Slope == SlopeType.Solid && !belowTile.IsHalfBlock && belowTile.HasTile && belowTile.IsTileSolid()) || - (aboveTile.Slope == SlopeType.Solid && !aboveTile.IsHalfBlock && aboveTile.HasTile && aboveTile.IsTileSolid()) || - (rightTile.Slope == SlopeType.Solid && !rightTile.IsHalfBlock && rightTile.HasTile && rightTile.IsTileSolid()) || - (leftTile.Slope == SlopeType.Solid && !leftTile.IsHalfBlock && leftTile.HasTile && leftTile.IsTileSolid())) - return true; - - return false; - } - - public override void PlaceInWorld(int i, int j, Item item) - { - Tile belowTile = Main.tile[i, j + 1]; - Tile aboveTile = Main.tile[i, j - 1]; - Tile rightTile = Main.tile[i + 1, j]; - Tile leftTile = Main.tile[i - 1, j]; - - if (belowTile.Slope == SlopeType.Solid && !belowTile.IsHalfBlock && belowTile.HasTile && belowTile.IsTileSolid()) - Main.tile[i, j].TileFrameY = 0; - else if (aboveTile.Slope == SlopeType.Solid && !aboveTile.IsHalfBlock && aboveTile.HasTile && aboveTile.IsTileSolid()) - Main.tile[i, j].TileFrameY = 18; - else if (rightTile.Slope == SlopeType.Solid && !rightTile.IsHalfBlock && rightTile.HasTile && rightTile.IsTileSolid()) - Main.tile[i, j].TileFrameY = 36; - else if (leftTile.Slope == SlopeType.Solid && !leftTile.IsHalfBlock && leftTile.HasTile && leftTile.IsTileSolid()) - Main.tile[i, j].TileFrameY = 54; - - Main.tile[i, j].TileFrameX = (short)(WorldGen.genRand.Next(18) * 18); - } - } -} diff --git a/Tiles/SunkenSea/SeaPrismCrystals_Glint.png b/Tiles/SunkenSea/SeaPrismCrystals_Glint.png new file mode 100644 index 0000000000000000000000000000000000000000..c8300a945bdb14b3831e357cdc91a8610012ff04 GIT binary patch literal 2676 zcmZveXrYXI-QAR4RBQ8|p3Yu$|?wkAOJ};i<_ngn?e9nvW`+U#2?eFWU4%LT( zKp=H*FSj!wkP=>@y;M~c_ka@-t$38Kobhx8)pi+t27#alyxm+-iNVs64YI+}?Qc@a zK|54FWTnUD{CoqIs{wvN1%3WUKQ?Ee$Kf@0MqKr@KXr5V_`{v@y>ho$r=^K)-|vCc zazJVqy+^}OG4QY-I_FiPA9!ORWF&39b%GkwY&6GfZa&jNRPGp+Pq9YYs$yOFiqpDZ zJf|AigFjwk;;wcPSODe`5sXA|MCy5FxQZn&pwSm;9>RJ)S&A*)UYXK#|m zNJp!H-qo)bg4gduA;U}+D=9YL)N36UJzzkIIM{E+gWa8$kK-BIntR;&!f40wb%TQ1 z$5q13+NGWsj~fp^1>m>O(qcg7f+N1~&%q>DK1%re$Nj)3?qBWAhhsACsx%kaws)LI zvT#iW8Kr1|-O*&R_jhYuk@Cr+9BohGvUQpGP8St-I5MWH9^=f;y|29$hK~%3cJ)eM z5)KR8o&b(p7R!%8R*y9G2ieVLLNL1?<5aXeHM!BfLk&K&vbzg<8*w%VhqsFyuMyV} ztc%`+Pse|!bhq#9WLY@Y%?E~O6;hFTz0=$XK|L7m@CtDr1_UgHZ9zn5!TRuOw1I0- z*_*TVlYw!~iDJ$FCHWNr?YEsaXXy8m2noL&#B?59;pX#C{p zL|OPpu4+88w1!q@-(b}J=~G21!NO$`z&bo1PKb?;n{XD0QuT>SDm+yc4n5 zkR`v$!d=x6{k-&{>k(q%n50ZAOAfh3*9kxfns1w86{cS-2aGe>$y;@`C4nrOM^ykS zhrPR5q`?3@*M!PuoPeeXLGa8l=wo8y8gq;u`|NSG(2*R#;~c_U4VM#-u*ULABG+W>MqI*5c9W`W= z`MpG;_(O1~r(;h4^69eJKOOnA#DYA&hmDRhSSvb#WaP zDSQ87K+2=1XyC*Tamj9CfsxkrmTK2@4?MNiT);0fgNSsf49rUa-Wn%eO;GMFc? z)$90THCVfOCuQ|=gixH#mD<$>C7ehjJsEa)W~U(M(EKbhsbr1|D%f=sJhWF2CNZkT zp(}uawn~WTlR8%FVS)`Eia9P^n&!MhQ?JP7=imnzt<=?JGo$r~hCe0eieZv9N*U0t z76xToX?R-7)*T_qzJql-S|&);bvhf_?I6u+ZNQ1%`@KSkIi z{g^UBaK*m<|0J9*0?=vP3mUbheEg1Lsy3tfw(XzhE_WGtC9ZZUlZe z{ihDIECZ7pr}f(|GKCm1{WANA1{-<5wKZN~bNSaTn*G9|9d$ixI2_CmGZ?29Z5QfM zBzrN_XPY$Z@~b#4sL3+Jb3T$xig{eNk~!u_Fga29C0VRB0Tu=<#~uD=OzAjXY}|iAXlyfrU{zD1HpqYLLJx7n+8ocOuxfIwnh z4g(QQeln#eJdGa z_P5P)L2Ae0N>JIA)sk{EB`tfU^h4=0*NiS9+ar@M;*nGI%@y6@)Lia~w=4Kn(-n`A zUn_w~kuaKsrJ{C!#h8cou%W2M&dm)F0{)m{u zohO4w2rUuD3r+GK{SKOovOg`-@7};h5?n(u(L5D|PF#8$$OQ;k5;IhGj6Z{}V1oFi z`(^KPc$@adsWzlf=rsYfmfZV}R2(A5g;}PBmCEf`>6id=Bg0OcJS$1URGNPec}vQ7 zu9>$LMIlFGdDvFFu3&C3LJ-^=B05X6F+d2G#aZBujScKkM6AoUN>V{`roWj%zgzuj zTEn)aEes2>;9T@do-2O;eT_R{Pra@0G{^5y4#f~n-Yo^UL``9nqL6>js6{rgEXo&V z5DkWJYYb6B4Rd|!CuNmR7XJG~ipgex!=%quf}tA+9}kx zdcEBc5j3;toK>#Fzp-q{Xgu|MEuqGYTf8dV4TV`9FtQ`jh~x_{@7t?rxZ d`Zm>@`?ntmpMIlQB0=8nzHYUy=Wl>O{{iNl7^46H literal 0 HcmV?d00001 diff --git a/Walls/SeaPrismWall.cs b/Walls/SeaPrismWall.cs deleted file mode 100644 index 333b163bdf..0000000000 --- a/Walls/SeaPrismWall.cs +++ /dev/null @@ -1,85 +0,0 @@ -using System; -using CalamityMod.Tiles; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.GameContent; -using Terraria.ID; - -namespace CalamityMod.Walls -{ - public class SeaPrismWall : MultiVariantModWall - { - internal static FramedMaskTexture GlowMaskBlue; - internal static FramedMaskTexture GlowMaskPurple; - internal static FramedMaskTexture GlowMaskGreen; - public override void SetStaticDefaults() - { - GlowMaskBlue = new("CalamityMod/Walls/SeaPrismWall_Blue", 36, 36); - GlowMaskPurple = new("CalamityMod/Walls/SeaPrismWall_Purple", 36, 36); - GlowMaskGreen = new("CalamityMod/Walls/SeaPrismWall_Green", 36, 36); - Main.wallHouse[Type] = true; - DustType = 108; - - AddMapEntry(new Color(27, 123, 131)); - } - - public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; - - public override void PopulateWallVariant(int i, int j, ref int frameXOffset, ref int frameYOffset) - { - frameXOffset = (i % 8) * 468; - frameYOffset = (j % 8) * 180; - } - private static float GetFade1(int i, int j) => - (MathF.Sin(Main.GlobalTimeWrappedHourly * 0.2f) + 1f) / 2f; - - private static float GetFade2(int i, int j) => - (MathF.Sin(Main.GlobalTimeWrappedHourly * 0.1f + i * 0.08f - j * 0.05f) + 1f) / 2f; - - public static void DrawWallGlow(int wallType, int i, int j, SpriteBatch spriteBatch) - { - Tile tile = Main.tile[i, j]; - int xLength = 32; - - int frameXOffset = (i % 8) * 468; - int frameYOffset = (j % 8) * 180; - - int xPos = tile.WallFrameX + frameXOffset; - int yPos = tile.WallFrameY + frameYOffset; - - Rectangle frame = new Rectangle(xPos, yPos, xLength, 32); - Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); - Vector2 pos = new Vector2(i * 16 - (int)Main.screenPosition.X, j * 16 - (int)Main.screenPosition.Y) + zero; - - // base wall - spriteBatch.Draw(TextureAssets.Wall[wallType].Value, pos + new Vector2(-8, -8), frame, Lighting.GetColor(i, j)); - - // glow layers - float fade1 = GetFade1(i, j); - float fade2 = GetFade2(i, j); - - if (GlowMaskBlue.HasContentInFramePos(xPos, yPos)) - { - spriteBatch.Draw(GlowMaskBlue.Texture, pos + new Vector2(-8, -8), frame, (Color.White * 1.1f)); - } - if (GlowMaskPurple.HasContentInFramePos(xPos, yPos)) - { - spriteBatch.Draw(GlowMaskPurple.Texture, pos + new Vector2(-8, -8), frame, Color.White * (fade1 * 1.1f)); - } - if (GlowMaskGreen.HasContentInFramePos(xPos, yPos)) - { - spriteBatch.Draw(GlowMaskGreen.Texture, pos + new Vector2(-8, -8), frame, Color.White * (fade2 * 1.5f)); - } - - Color wallColor = Lighting.GetColor(i, j) * 1.2f; // brighten a bit - wallColor.A = 255; - } - - public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) - { - DrawWallGlow(Type, i, j, spriteBatch); - return false; - } - } -} diff --git a/Walls/UnsafeWalls/UnsafeSeaPrismWall.cs b/Walls/UnsafeWalls/UnsafeSeaPrismWall.cs deleted file mode 100644 index f2d8b7972c..0000000000 --- a/Walls/UnsafeWalls/UnsafeSeaPrismWall.cs +++ /dev/null @@ -1,90 +0,0 @@ -using System; -using CalamityMod.Tiles; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.GameContent; -using Terraria.ID; - -namespace CalamityMod.Walls.UnsafeWalls -{ - public class UnsafeSeaPrismWall : MultiVariantModWall - { - public override string Texture => "CalamityMod/Walls/SeaPrismWall"; - internal static FramedMaskTexture GlowMaskBlue; - internal static FramedMaskTexture GlowMaskPurple; - internal static FramedMaskTexture GlowMaskGreen; - public override void SetStaticDefaults() - { - GlowMaskBlue = new("CalamityMod/Walls/SeaPrismWall_Blue", 36, 36); - GlowMaskPurple = new("CalamityMod/Walls/SeaPrismWall_Purple", 36, 36); - GlowMaskGreen = new("CalamityMod/Walls/SeaPrismWall_Green", 36, 36); - Main.wallHouse[Type] = false; - DustType = 108; - - AddMapEntry(new Color(27, 123, 131)); - } - - public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; - - public override void PopulateWallVariant(int i, int j, ref int frameXOffset, ref int frameYOffset) - { - frameXOffset = (i % 8) * 468; - frameYOffset = (j % 8) * 180; - } - private static float GetFade1(int i, int j) => - (MathF.Sin(Main.GlobalTimeWrappedHourly * 0.2f) + 1f) / 2f; - - private static float GetFade2(int i, int j) => - (MathF.Sin(Main.GlobalTimeWrappedHourly * 0.1f + i * 0.08f - j * 0.05f) + 1f) / 2f; - - public static void DrawWallGlow(int wallType, int i, int j, SpriteBatch spriteBatch) - { - Tile tile = Main.tile[i, j]; - int xLength = 32; - - int frameXOffset = (i % 8) * 468; - int frameYOffset = (j % 8) * 180; - - int xPos = tile.WallFrameX + frameXOffset; - int yPos = tile.WallFrameY + frameYOffset; - - Rectangle frame = new Rectangle(xPos, yPos, xLength, 32); - Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); - Vector2 pos = new Vector2(i * 16 - (int)Main.screenPosition.X, j * 16 - (int)Main.screenPosition.Y) + zero; - - // base wall - spriteBatch.Draw(TextureAssets.Wall[wallType].Value, pos + new Vector2(-8, -8), frame, Lighting.GetColor(i, j)); - - // glow layers - float fade1 = GetFade1(i, j); - float fade2 = GetFade2(i, j); - - if (GlowMaskBlue.HasContentInFramePos(xPos, yPos)) - { - spriteBatch.Draw(GlowMaskBlue.Texture, pos + new Vector2(-8, -8), frame, (Color.White * 1.1f)); - } - if (GlowMaskPurple.HasContentInFramePos(xPos, yPos)) - { - spriteBatch.Draw(GlowMaskPurple.Texture, pos + new Vector2(-8, -8), frame, Color.White * (fade1 * 1.1f)); - } - if (GlowMaskGreen.HasContentInFramePos(xPos, yPos)) - { - spriteBatch.Draw(GlowMaskGreen.Texture, pos + new Vector2(-8, -8), frame, Color.White * (fade2 * 1.5f)); - } - - Color wallColor = Lighting.GetColor(i, j) * 1.2f; // brighten a bit - wallColor.A = 255; - } - - public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) - { - DrawWallGlow(Type, i, j, spriteBatch); - return false; - } - public override bool Drop(int i, int j, ref int type) - { - return false; - } - } -}