Visual adjustments and sea water ray effect

This commit is contained in:
Heart-Plus-Up committed 2023-02-15 05:41:46 -07:00
1 parent e1dcadfe9b
commit bb059f7080
6 files changed
+127 -4

No files matched your search

+33 -2
View File
@@ -983,13 +983,44 @@ namespace CalamityMod.ILEditing
if (tile.TileType != (ushort)ModContent.TileType<RustyChestTile>())
{
if (Main.waterStyle == ModContent.Find<ModWaterStyle>("CalamityMod/SulphuricWater").Slot)
if (Main.waterStyle == ModContent.Find<ModWaterStyle>("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<ModWaterStyle>("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<ModWaterStyle>("CalamityMod/SulphuricDepthsWater").Slot)
{
outputColor = Vector3.Lerp(outputColor, Color.MediumSeaGreen.ToVector3(), 0.18f);
}
}
}
+1 -1
View File
@@ -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;
+46
View File
@@ -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<Texture2D>("CalamityMod/Walls/VoidstoneWall_Glowmask", AssetRequestMode.ImmediateLoad).Value;
ItemDrop = ModContent.ItemType<Items.Placeables.Walls.VoidstoneWall>();
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;
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 7.0 KiB

+47 -1
View File
@@ -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<Texture2D>("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<LiquidData>().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;
Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB