diff --git a/Tiles/SunkenSea/EutrophicSand.cs b/Tiles/SunkenSea/EutrophicSand.cs index 586129ae10..ccc3937af7 100644 --- a/Tiles/SunkenSea/EutrophicSand.cs +++ b/Tiles/SunkenSea/EutrophicSand.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Tiles.SunkenSea CalamityUtils.MergeWithGeneral(Type); CalamityUtils.MergeWithDesert(Type); // Tile blends with sandstone, which it is set to merge with here - Main.tileShine[Type] = 1800; + Main.tileShine[Type] = 2500; TileID.Sets.ChecksForMerge[Type] = true; TileID.Sets.CanBeDugByShovel[Type] = true; diff --git a/Tiles/SunkenSea/HardenedEutrophicSand.cs b/Tiles/SunkenSea/HardenedEutrophicSand.cs index c85a907006..3f6f04dd97 100644 --- a/Tiles/SunkenSea/HardenedEutrophicSand.cs +++ b/Tiles/SunkenSea/HardenedEutrophicSand.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Tiles.SunkenSea CalamityUtils.MergeWithGeneral(Type); CalamityUtils.MergeWithDesert(Type); - Main.tileShine[Type] = 1800; + Main.tileShine[Type] = 2500; Main.tileShine2[Type] = true; TileID.Sets.ChecksForMerge[Type] = true; diff --git a/Tiles/SunkenSea/MediumSeaPrismCrystal.cs b/Tiles/SunkenSea/MediumSeaPrismCrystal.cs index 7643048aeb..97f84eec2c 100644 --- a/Tiles/SunkenSea/MediumSeaPrismCrystal.cs +++ b/Tiles/SunkenSea/MediumSeaPrismCrystal.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Tiles.SunkenSea Main.tileFrameImportant[Type] = true; Main.tileObsidianKill[Type] = true; Main.tileSpelunker[Type] = true; - Main.tileShine[Type] = 3500; + Main.tileShine[Type] = 5600; Main.tileShine2[Type] = true; HitSound = SoundID.Item27; diff --git a/Tiles/SunkenSea/SeaPrism.cs b/Tiles/SunkenSea/SeaPrism.cs index 37d02cbb70..d8b451de63 100644 --- a/Tiles/SunkenSea/SeaPrism.cs +++ b/Tiles/SunkenSea/SeaPrism.cs @@ -3,6 +3,7 @@ using CalamityMod.Systems; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; @@ -11,8 +12,8 @@ namespace CalamityMod.Tiles.SunkenSea public class SeaPrism : ModTile { private const short subsheetWidth = 468; - private const short subsheetHeight = 90; - + private const short subsheetHeight = 90; + public override void SetStaticDefaults() { Main.tileSolid[Type] = true; @@ -103,7 +104,41 @@ namespace CalamityMod.Tiles.SunkenSea spriteBatch.Draw(tex1, position, sourceRect, Lighting.GetColor(i, j) * 1.5f * GetFade1(i, j)); spriteBatch.Draw(tex2, position, sourceRect, Lighting.GetColor(i, j) * 1.5f * GetFade2(i, j)); + + //Not sure sure how everything below will run on stuff so we may need to kill this cool glint thing I did + + Texture2D GlintTex = ModContent.Request("CalamityMod/Tiles/SunkenSea/SeaPrism_GlintMask").Value; + + Vector2 glintDir = new Vector2(1f, -1f); + glintDir.Normalize(); + + Vector2 screenPos = position; + + float projection = Vector2.Dot(screenPos, glintDir); + + // this sets the length between the glints diagonally + float screenDiagonalLength = Vector2.Dot(new Vector2(Main.screenWidth, Main.screenHeight), glintDir); + float[] beamCenters = new float[] + { + screenDiagonalLength * 0.05f, // upper glint + screenDiagonalLength * 0.5f, // middle glint + screenDiagonalLength * 1.05f // lower glint + }; + + float stripeWidth = 100f; + + foreach (float bc in beamCenters) + { + float dist = Math.Abs(projection - bc); + float strength = MathHelper.Clamp(1f - dist / stripeWidth, 0f, 1f); + + if (strength > 0f) + { + spriteBatch.Draw(GlintTex, position, sourceRect, Color.White * strength, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); + } +} return true; + } } } diff --git a/Tiles/SunkenSea/SeaPrism_GlintMask.png b/Tiles/SunkenSea/SeaPrism_GlintMask.png new file mode 100644 index 0000000000..b80a7aaa41 Binary files /dev/null and b/Tiles/SunkenSea/SeaPrism_GlintMask.png differ diff --git a/Walls/SeaPrismWall.cs b/Walls/SeaPrismWall.cs new file mode 100644 index 0000000000..9ed4f5c545 --- /dev/null +++ b/Walls/SeaPrismWall.cs @@ -0,0 +1,85 @@ +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(11, 56, 81)); + } + + 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/SeaPrismWall.png b/Walls/SeaPrismWall.png new file mode 100644 index 0000000000..5e4988e6b2 Binary files /dev/null and b/Walls/SeaPrismWall.png differ diff --git a/Walls/SeaPrismWall_Blue.png b/Walls/SeaPrismWall_Blue.png new file mode 100644 index 0000000000..63996bc848 Binary files /dev/null and b/Walls/SeaPrismWall_Blue.png differ diff --git a/Walls/SeaPrismWall_Green.png b/Walls/SeaPrismWall_Green.png new file mode 100644 index 0000000000..228fcd2e0b Binary files /dev/null and b/Walls/SeaPrismWall_Green.png differ diff --git a/Walls/SeaPrismWall_Purple.png b/Walls/SeaPrismWall_Purple.png new file mode 100644 index 0000000000..600a9643ff Binary files /dev/null and b/Walls/SeaPrismWall_Purple.png differ diff --git a/World/SunkenSea.cs b/World/SunkenSea.cs index 30a5dffd7a..efcc2c88a0 100644 --- a/World/SunkenSea.cs +++ b/World/SunkenSea.cs @@ -1840,7 +1840,11 @@ namespace CalamityMod.World { new Actions.ClearTile(), new Actions.SetLiquid(), - new Actions.PlaceWall((ushort)ModContent.WallType()) + })); + + WorldUtils.Gen(new Point(X, Y), new Shapes.Circle(radius - 4), Actions.Chain(new GenAction[] + { + new Actions.PlaceWall((ushort)ModContent.WallType()) })); return true;