Sea Prism wall and new glint effects

This commit is contained in:
Heart-Plus-Up committed 2025-08-19 01:37:06 -07:00
1 parent cd865595f8
commit a89696079d
11 files changed
+130 -6

No files matched your search

+1 -1
View File
@@ -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;
+1 -1
View File
@@ -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;
+1 -1
View File
@@ -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;
+37 -2
View File
@@ -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<Texture2D>("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;
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 414 KiB

+85
View File
@@ -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;
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 88 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 261 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 250 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 239 KiB

+5 -1
View File
@@ -1840,7 +1840,11 @@ namespace CalamityMod.World
{
new Actions.ClearTile(),
new Actions.SetLiquid(),
new Actions.PlaceWall((ushort)ModContent.WallType<NavystoneWall>())
}));
WorldUtils.Gen(new Point(X, Y), new Shapes.Circle(radius - 4), Actions.Chain(new GenAction[]
{
new Actions.PlaceWall((ushort)ModContent.WallType<SeaPrismWall>())
}));
return true;