From 511f2179bbf2cb89312ee1e99e3421f3cce6cd54 Mon Sep 17 00:00:00 2001 From: Flowaria Date: Mon, 8 Dec 2025 02:21:57 +0900 Subject: [PATCH] Remove LightingUtils --- Waters/BasaltGullyWater.cs | 6 +++--- Waters/MiddleAbyssWater.cs | 4 ++-- Waters/SulphuricDepthsWater.cs | 4 ++-- Waters/SulphuricWater.cs | 4 ++-- Waters/SunkenSeaBurrowsWater.cs | 2 +- Waters/SunkenSeaPolypWater.cs | 2 +- Waters/SunkenSeaReefsWater.cs | 2 +- Waters/SunkenSeaShoresWater.cs | 2 +- Waters/UpperAbyssWater.cs | 4 ++-- Waters/VoidWater.cs | 4 ++-- Utilities/LightingUtils.cs => Waters/WaterStyleCommon.cs | 9 +++++++-- 11 files changed, 24 insertions(+), 19 deletions(-) rename Utilities/LightingUtils.cs => Waters/WaterStyleCommon.cs (91%) diff --git a/Waters/BasaltGullyWater.cs b/Waters/BasaltGullyWater.cs index 825caaac77..9b0b2c97af 100644 --- a/Waters/BasaltGullyWater.cs +++ b/Waters/BasaltGullyWater.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Waters { public class BasaltGullyWaterflow : ModWaterfallStyle, IWaterfallStyleModifyColor { - public void ModifyColor(in Tile tile, int x, int y, ref VertexColors liquidColor) => CalamityUtils.ModifySulphuricWaterColor(x, y, ref liquidColor, false); + public void ModifyColor(in Tile tile, int x, int y, ref VertexColors liquidColor) => WaterStyleCommon.ModifyTransparentWaterColor(x, y, ref liquidColor, false); } public class BasaltGullyWater : ModWaterStyle, IWaterStyleModifyColor, IWaterStyleModifyLight @@ -30,7 +30,7 @@ namespace CalamityMod.Waters if (tile.TileType != RustyChestTile.TileType) { - CalamityUtils.SunkenSeaWaterLighting(i, j, WaterGlowColor, ref outputColor.X, ref outputColor.Y, ref outputColor.Z); + WaterStyleCommon.ModifySunkenSeaWaterLight(i, j, WaterGlowColor, ref outputColor.X, ref outputColor.Y, ref outputColor.Z); } r = outputColor.X; @@ -38,7 +38,7 @@ namespace CalamityMod.Waters b = outputColor.Z; } - public void ModifyColor(in Tile tile, int x, int y, ref VertexColors liquidColor, bool isSlope) => CalamityUtils.ModifySulphuricWaterColor(x, y, ref liquidColor, isSlope); + public void ModifyColor(in Tile tile, int x, int y, ref VertexColors liquidColor, bool isSlope) => WaterStyleCommon.ModifyTransparentWaterColor(x, y, ref liquidColor, isSlope); public override int ChooseWaterfallStyle() => ModContent.Find("CalamityMod/BasaltGullyWaterflow").Slot; public override int GetSplashDust() => ModContent.DustType(); diff --git a/Waters/MiddleAbyssWater.cs b/Waters/MiddleAbyssWater.cs index a31adb55e0..d891c79074 100644 --- a/Waters/MiddleAbyssWater.cs +++ b/Waters/MiddleAbyssWater.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Waters { public class MiddleAbyssWaterflow : ModWaterfallStyle, IWaterfallStyleModifyColor { - public void ModifyColor(in Tile tile, int x, int y, ref VertexColors liquidColor) => CalamityUtils.ModifySulphuricWaterColor(x, y, ref liquidColor, false); + public void ModifyColor(in Tile tile, int x, int y, ref VertexColors liquidColor) => WaterStyleCommon.ModifyTransparentWaterColor(x, y, ref liquidColor, false); } public class MiddleAbyssWater : ModWaterStyle, IWaterStyleModifyColor @@ -41,6 +41,6 @@ namespace CalamityMod.Waters public override int GetDropletGore() => DropletGore; public override Color BiomeHairColor() => new Color(36, 23, 19); - public void ModifyColor(in Tile tile, int x, int y, ref VertexColors liquidColor, bool isSlope) => CalamityUtils.ModifySulphuricWaterColor(x, y, ref liquidColor, isSlope); + public void ModifyColor(in Tile tile, int x, int y, ref VertexColors liquidColor, bool isSlope) => WaterStyleCommon.ModifyTransparentWaterColor(x, y, ref liquidColor, isSlope); } } diff --git a/Waters/SulphuricDepthsWater.cs b/Waters/SulphuricDepthsWater.cs index e506d10cdb..60249e4fe5 100644 --- a/Waters/SulphuricDepthsWater.cs +++ b/Waters/SulphuricDepthsWater.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Waters { public class SulphuricDepthsWaterflow : ModWaterfallStyle, IWaterfallStyleModifyColor { - public void ModifyColor(in Tile tile, int x, int y, ref VertexColors liquidColor) => CalamityUtils.ModifySulphuricWaterColor(x, y, ref liquidColor, false); + public void ModifyColor(in Tile tile, int x, int y, ref VertexColors liquidColor) => WaterStyleCommon.ModifyTransparentWaterColor(x, y, ref liquidColor, false); } public class SulphuricDepthsWater : ModWaterStyle, IWaterStyleModifyColor, IWaterStyleModifyLight @@ -44,7 +44,7 @@ namespace CalamityMod.Waters public override int GetSplashDust() => SplashDust; public override int GetDropletGore() => DropletGore; public override Color BiomeHairColor() => new Color(35, 117, 89); - public void ModifyColor(in Tile tile, int x, int y, ref VertexColors liquidColor, bool isSlope) => CalamityUtils.ModifySulphuricWaterColor(x, y, ref liquidColor, isSlope); + public void ModifyColor(in Tile tile, int x, int y, ref VertexColors liquidColor, bool isSlope) => WaterStyleCommon.ModifyTransparentWaterColor(x, y, ref liquidColor, isSlope); public void ModifyLight(in Tile tile, int i, int j, ref float r, ref float g, ref float b) { Vector3 outputColor = new Vector3(r, g, b); diff --git a/Waters/SulphuricWater.cs b/Waters/SulphuricWater.cs index 36228647f6..267115e3f5 100644 --- a/Waters/SulphuricWater.cs +++ b/Waters/SulphuricWater.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Waters { public class SulphuricWaterflow : ModWaterfallStyle, IWaterfallStyleModifyColor { - public void ModifyColor(in Tile tile, int x, int y, ref VertexColors liquidColor) => CalamityUtils.ModifySulphuricWaterColor(x, y, ref liquidColor, false); + public void ModifyColor(in Tile tile, int x, int y, ref VertexColors liquidColor) => WaterStyleCommon.ModifySulphuricWaterColor(x, y, ref liquidColor, false); } public class SulphuricWater : ModWaterStyle, IWaterStyleModifyColor, IWaterStyleModifyLight, IWaterStylePostDrawEffect @@ -50,7 +50,7 @@ namespace CalamityMod.Waters public override byte GetRainVariant() => (byte)Main.rand.Next(3); public override Color BiomeHairColor() => new Color(43, 168, 110); - public void ModifyColor(in Tile tile, int x, int y, ref VertexColors liquidColor, bool isSlope) => CalamityUtils.ModifySulphuricWaterColor(x, y, ref liquidColor, isSlope); + public void ModifyColor(in Tile tile, int x, int y, ref VertexColors liquidColor, bool isSlope) => WaterStyleCommon.ModifySulphuricWaterColor(x, y, ref liquidColor, isSlope); public void ModifyLight(in Tile tile, int i, int j, ref float r, ref float g, ref float b) { Vector3 outputColor = new Vector3(r, g, b); diff --git a/Waters/SunkenSeaBurrowsWater.cs b/Waters/SunkenSeaBurrowsWater.cs index 23fa8b8098..c64a56a0f4 100644 --- a/Waters/SunkenSeaBurrowsWater.cs +++ b/Waters/SunkenSeaBurrowsWater.cs @@ -42,7 +42,7 @@ namespace CalamityMod.Waters if (tile.TileType != RustyChestTile.TileType) { - CalamityUtils.SunkenSeaWaterLighting(i, j, WaterGlowColor, ref outputColor.X, ref outputColor.Y, ref outputColor.Z); + WaterStyleCommon.ModifySunkenSeaWaterLight(i, j, WaterGlowColor, ref outputColor.X, ref outputColor.Y, ref outputColor.Z); } r = outputColor.X; diff --git a/Waters/SunkenSeaPolypWater.cs b/Waters/SunkenSeaPolypWater.cs index 58888e60c3..104529fcd0 100644 --- a/Waters/SunkenSeaPolypWater.cs +++ b/Waters/SunkenSeaPolypWater.cs @@ -35,7 +35,7 @@ namespace CalamityMod.Waters if (tile.TileType != RustyChestTile.TileType) { - CalamityUtils.SunkenSeaWaterLighting(i, j, WaterGlowColor, ref outputColor.X, ref outputColor.Y, ref outputColor.Z); + WaterStyleCommon.ModifySunkenSeaWaterLight(i, j, WaterGlowColor, ref outputColor.X, ref outputColor.Y, ref outputColor.Z); } r = outputColor.X; diff --git a/Waters/SunkenSeaReefsWater.cs b/Waters/SunkenSeaReefsWater.cs index 984d526377..229f30f3d8 100644 --- a/Waters/SunkenSeaReefsWater.cs +++ b/Waters/SunkenSeaReefsWater.cs @@ -35,7 +35,7 @@ namespace CalamityMod.Waters if (tile.TileType != RustyChestTile.TileType) { - CalamityUtils.SunkenSeaWaterLighting(i, j, WaterGlowColor, ref outputColor.X, ref outputColor.Y, ref outputColor.Z); + WaterStyleCommon.ModifySunkenSeaWaterLight(i, j, WaterGlowColor, ref outputColor.X, ref outputColor.Y, ref outputColor.Z); } r = outputColor.X; diff --git a/Waters/SunkenSeaShoresWater.cs b/Waters/SunkenSeaShoresWater.cs index 7ac2747c99..2b8fcefc43 100644 --- a/Waters/SunkenSeaShoresWater.cs +++ b/Waters/SunkenSeaShoresWater.cs @@ -35,7 +35,7 @@ namespace CalamityMod.Waters if (tile.TileType != RustyChestTile.TileType) { - CalamityUtils.SunkenSeaWaterLighting(i, j, WaterGlowColor, ref outputColor.X, ref outputColor.Y, ref outputColor.Z); + WaterStyleCommon.ModifySunkenSeaWaterLight(i, j, WaterGlowColor, ref outputColor.X, ref outputColor.Y, ref outputColor.Z); } r = outputColor.X; diff --git a/Waters/UpperAbyssWater.cs b/Waters/UpperAbyssWater.cs index 0ec0088064..8946a23609 100644 --- a/Waters/UpperAbyssWater.cs +++ b/Waters/UpperAbyssWater.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Waters { public class UpperAbyssWaterflow : ModWaterfallStyle, IWaterfallStyleModifyColor { - public void ModifyColor(in Tile tile, int x, int y, ref VertexColors liquidColor) => CalamityUtils.ModifySulphuricWaterColor(x, y, ref liquidColor, false); + public void ModifyColor(in Tile tile, int x, int y, ref VertexColors liquidColor) => WaterStyleCommon.ModifyTransparentWaterColor(x, y, ref liquidColor, false); } public class UpperAbyssWater : ModWaterStyle, IWaterStyleModifyColor @@ -40,6 +40,6 @@ namespace CalamityMod.Waters public override int GetSplashDust() => SplashDust; public override int GetDropletGore() => DropletGore; public override Color BiomeHairColor() => new Color(9, 69, 82); - public void ModifyColor(in Tile tile, int x, int y, ref VertexColors liquidColor, bool isSlope) => CalamityUtils.ModifySulphuricWaterColor(x, y, ref liquidColor, isSlope); + public void ModifyColor(in Tile tile, int x, int y, ref VertexColors liquidColor, bool isSlope) => WaterStyleCommon.ModifyTransparentWaterColor(x, y, ref liquidColor, isSlope); } } diff --git a/Waters/VoidWater.cs b/Waters/VoidWater.cs index 36f62e2f54..b18e5f5c4b 100644 --- a/Waters/VoidWater.cs +++ b/Waters/VoidWater.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Waters { public class VoidWaterflow : ModWaterfallStyle, IWaterfallStyleModifyColor { - public void ModifyColor(in Tile tile, int x, int y, ref VertexColors liquidColor) => CalamityUtils.ModifySulphuricWaterColor(x, y, ref liquidColor, false); + public void ModifyColor(in Tile tile, int x, int y, ref VertexColors liquidColor) => WaterStyleCommon.ModifyTransparentWaterColor(x, y, ref liquidColor, false); } public class VoidWater : ModWaterStyle, IWaterStyleModifyColor @@ -40,6 +40,6 @@ namespace CalamityMod.Waters public override int GetSplashDust() => SplashDust; public override int GetDropletGore() => DropletGore; public override Color BiomeHairColor() => new Color(16, 8, 30); - public void ModifyColor(in Tile tile, int x, int y, ref VertexColors liquidColor, bool isSlope) => CalamityUtils.ModifySulphuricWaterColor(x, y, ref liquidColor, isSlope); + public void ModifyColor(in Tile tile, int x, int y, ref VertexColors liquidColor, bool isSlope) => WaterStyleCommon.ModifyTransparentWaterColor(x, y, ref liquidColor, isSlope); } } diff --git a/Utilities/LightingUtils.cs b/Waters/WaterStyleCommon.cs similarity index 91% rename from Utilities/LightingUtils.cs rename to Waters/WaterStyleCommon.cs index aa1bd268e0..d0f8cebe45 100644 --- a/Utilities/LightingUtils.cs +++ b/Waters/WaterStyleCommon.cs @@ -7,7 +7,7 @@ using Terraria.Graphics; namespace CalamityMod { - public static partial class CalamityUtils + internal static class WaterStyleCommon { public static void ModifySulphuricWaterColor(int x, int y, ref VertexColors initialColor, bool isSlope) { @@ -32,6 +32,11 @@ namespace CalamityMod ModifyColor(new(x + 0.5f, y + 0.5f), ref initialColor.BottomRightColor); } + ModifyTransparentWaterColor(x, y, ref initialColor, isSlope); + } + + public static void ModifyTransparentWaterColor(int x, int y, ref VertexColors initialColor, bool isSlope) + { if (isSlope) { initialColor.TopLeftColor *= 1f / 3; @@ -48,7 +53,7 @@ namespace CalamityMod } } - public static void SunkenSeaWaterLighting(int x, int y, Vector3 waterColor, ref float r, ref float g, ref float b) + public static void ModifySunkenSeaWaterLight(int x, int y, Vector3 waterColor, ref float r, ref float g, ref float b) { float tick = (float)Main.timeForVisualEffects; float brightness = MathHelper.Clamp(0.07f, 0f, 0.07f);