From 0e518f6afe9aaeeb5bd9b3f256bcbbd4cf6f4abb Mon Sep 17 00:00:00 2001 From: DominicKarma42 <51094361+DominicKarma@users.noreply.github.com> Date: Thu, 6 Aug 2020 17:06:48 -0500 Subject: [PATCH] Sulphurous Seas can no longer be flat --- World/Abyss.cs | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/World/Abyss.cs b/World/Abyss.cs index b3ce4ecf5a..bcafd4b3ff 100644 --- a/World/Abyss.cs +++ b/World/Abyss.cs @@ -170,6 +170,7 @@ namespace CalamityMod.World public const float PerlinThreshold = 0.1f; // Be careful with this number public static void CreateWater() { + // Generate water underground. int[] seeds = new int[PerlinIterations]; for (int i = 0; i < seeds.Length; i++) { @@ -203,6 +204,25 @@ namespace CalamityMod.World } } } + + // Generate water above-ground. + int startingDepth = (int)(WorldGen.genRand.Next(4, 8 + 1) * Main.maxTilesX / 4200f); + int endingDepth = (int)(WorldGen.genRand.Next(27, 35 + 1) * Main.maxTilesX / 4200f); + float waterFinishingAngle = WorldGen.genRand.NextFloat(MathHelper.ToRadians(145f), MathHelper.ToRadians(170f)); + for (int x = 30; x < BiomeWidth - 30; x++) + { + float xRatio = (x - 30) / (BiomeWidth - 30f); + int trueX = CalamityWorld.abyssSide ? x : Main.maxTilesX - x; + for (int y = YStart; y <= YStart + (int)(Math.Sin((1f - xRatio) * waterFinishingAngle) * (endingDepth - startingDepth) + startingDepth); y++) + { + ushort oldWall = Main.tile[trueX, y].wall; + Main.tile[trueX, y] = new Tile() + { + wall = oldWall, + liquid = 255 + }; + } + } } #endregion @@ -264,7 +284,7 @@ namespace CalamityMod.World #endregion #region Generating Islands - public const int IslandCount = 4; + public const int IslandCount = 6; public const int IslandXPadding = 20; public const int IslandMinWidth = 15; @@ -273,7 +293,6 @@ namespace CalamityMod.World public const int IslandMinDepth = 5; public const int IslandMaxDepth = 10; - public const int CragmawIslandCount = 2; public static void SettleWater() { Liquid.QuickWater(3, -1, -1);