diff --git a/Backgrounds/AstralDesertSurfaceBGStyle.cs b/Backgrounds/AstralDesertSurfaceBGStyle.cs index 181f0d7222..6fb209d35d 100644 --- a/Backgrounds/AstralDesertSurfaceBGStyle.cs +++ b/Backgrounds/AstralDesertSurfaceBGStyle.cs @@ -5,6 +5,7 @@ using Terraria.Graphics.Effects; using Terraria; using Terraria.ModLoader; using Microsoft.Xna.Framework; +using CalamityMod.Skies; namespace CalamityMod.Backgrounds { @@ -80,7 +81,7 @@ namespace CalamityMod.Backgrounds var bgParallax = 0.4; var bgTopY = (int)(backgroundTopMagicNumber * 1800.0 + 1500.0) + (int)scAdj + pushBGTopHack; bgScale *= bgGlobalScaleMultiplier; - var bgWidthScaled = (int)((float)CalamityMod.AstralDesertSurfaceMiddle.Width * bgScale); + var bgWidthScaled = (int)((float)SkyTextureRefs.AstralDesertSurfaceMiddle.Width * bgScale); SkyManager.Instance.DrawToDepth(Main.spriteBatch, 1.2f / (float)bgParallax); var bgStartX = (int)(0.0 - Math.IEEERemainder((double)Main.screenPosition.X * bgParallax, bgWidthScaled) - (double)(bgWidthScaled / 2)); if (Main.gameMenu) @@ -91,7 +92,7 @@ namespace CalamityMod.Backgrounds { for (int i = 0; i < bgLoops; i++) { - Main.spriteBatch.Draw(CalamityMod.AstralDesertSurfaceMiddle, new Vector2(bgStartX + bgWidthScaled * i, bgTopY + MiddleBGYOffset), new Rectangle(0, 0, CalamityMod.AstralDesertSurfaceMiddle.Width, CalamityMod.AstralDesertSurfaceMiddle.Height), ColorOfSurfaceBackgroundsModified, 0f, default(Vector2), bgScale, SpriteEffects.None, 0f); + Main.spriteBatch.Draw(SkyTextureRefs.AstralDesertSurfaceMiddle, new Vector2(bgStartX + bgWidthScaled * i, bgTopY + MiddleBGYOffset), new Rectangle(0, 0, SkyTextureRefs.AstralDesertSurfaceMiddle.Width, SkyTextureRefs.AstralDesertSurfaceMiddle.Height), ColorOfSurfaceBackgroundsModified, 0f, default(Vector2), bgScale, SpriteEffects.None, 0f); } } @@ -99,7 +100,7 @@ namespace CalamityMod.Backgrounds bgParallax = 0.43; bgTopY = (int)(backgroundTopMagicNumber * 1950.0 + 1750.0) + (int)scAdj + pushBGTopHack; bgScale *= bgGlobalScaleMultiplier; - bgWidthScaled = (int)((float)CalamityMod.AstralDesertSurfaceClose.Width * bgScale); + bgWidthScaled = (int)((float)SkyTextureRefs.AstralDesertSurfaceClose.Width * bgScale); SkyManager.Instance.DrawToDepth(Main.spriteBatch, 1f / (float)bgParallax); bgStartX = (int)(0.0 - Math.IEEERemainder((double)Main.screenPosition.X * bgParallax, bgWidthScaled) - (double)(bgWidthScaled / 2)); if (Main.gameMenu) @@ -113,7 +114,7 @@ namespace CalamityMod.Backgrounds { for (int i = 0; i < bgLoops; i++) { - Main.spriteBatch.Draw(CalamityMod.AstralDesertSurfaceClose, new Vector2(bgStartX + bgWidthScaled * i, bgTopY + CloseBGYOffset), new Rectangle(0, 0, CalamityMod.AstralDesertSurfaceClose.Width, CalamityMod.AstralDesertSurfaceClose.Height), ColorOfSurfaceBackgroundsModified, 0f, default(Vector2), bgScale, SpriteEffects.None, 0f); + Main.spriteBatch.Draw(SkyTextureRefs.AstralDesertSurfaceClose, new Vector2(bgStartX + bgWidthScaled * i, bgTopY + CloseBGYOffset), new Rectangle(0, 0, SkyTextureRefs.AstralDesertSurfaceClose.Width, SkyTextureRefs.AstralDesertSurfaceClose.Height), ColorOfSurfaceBackgroundsModified, 0f, default(Vector2), bgScale, SpriteEffects.None, 0f); } } } diff --git a/Backgrounds/AstralSnowSurfaceBGStyle.cs b/Backgrounds/AstralSnowSurfaceBGStyle.cs index 239fc427b3..aad9d204b6 100644 --- a/Backgrounds/AstralSnowSurfaceBGStyle.cs +++ b/Backgrounds/AstralSnowSurfaceBGStyle.cs @@ -6,6 +6,7 @@ using Terraria; using Terraria.ModLoader; using Microsoft.Xna.Framework; using Terraria.GameContent.UI.States; +using CalamityMod.Skies; namespace CalamityMod.Backgrounds { @@ -82,7 +83,7 @@ namespace CalamityMod.Backgrounds var bgParallax = 0.4; var bgTopY = (int)(backgroundTopMagicNumber * 1800.0 + 1500.0) + (int)scAdj + pushBGTopHack; bgScale *= bgGlobalScaleMultiplier; - var bgWidthScaled = (int)((float)CalamityMod.AstralSnowSurfaceMiddle.Width * bgScale); + var bgWidthScaled = (int)((float)SkyTextureRefs.AstralSnowSurfaceMiddle.Width * bgScale); SkyManager.Instance.DrawToDepth(Main.spriteBatch, 1.2f / (float)bgParallax); var bgStartX = (int)(0.0 - Math.IEEERemainder((double)Main.screenPosition.X * bgParallax, bgWidthScaled) - (double)(bgWidthScaled / 2)); if (Main.gameMenu) @@ -93,7 +94,7 @@ namespace CalamityMod.Backgrounds { for (int i = 0; i < bgLoops; i++) { - Main.spriteBatch.Draw(CalamityMod.AstralSnowSurfaceMiddle, new Vector2(bgStartX + bgWidthScaled * i, bgTopY + MiddleBGYOffset), new Rectangle(0, 0, CalamityMod.AstralSnowSurfaceMiddle.Width, CalamityMod.AstralSnowSurfaceMiddle.Height), ColorOfSurfaceBackgroundsModified, 0f, default(Vector2), bgScale, SpriteEffects.None, 0f); + Main.spriteBatch.Draw(SkyTextureRefs.AstralSnowSurfaceMiddle, new Vector2(bgStartX + bgWidthScaled * i, bgTopY + MiddleBGYOffset), new Rectangle(0, 0, SkyTextureRefs.AstralSnowSurfaceMiddle.Width, SkyTextureRefs.AstralSnowSurfaceMiddle.Height), ColorOfSurfaceBackgroundsModified, 0f, default(Vector2), bgScale, SpriteEffects.None, 0f); } } @@ -101,7 +102,7 @@ namespace CalamityMod.Backgrounds bgParallax = 0.43; bgTopY = (int)(backgroundTopMagicNumber * 1950.0 + 1750.0) + (int)scAdj + pushBGTopHack; bgScale *= bgGlobalScaleMultiplier; - bgWidthScaled = (int)((float)CalamityMod.AstralSurfaceClose.Width * bgScale); + bgWidthScaled = (int)((float)SkyTextureRefs.AstralSurfaceClose.Width * bgScale); SkyManager.Instance.DrawToDepth(Main.spriteBatch, 1f / (float)bgParallax); bgStartX = (int)(0.0 - Math.IEEERemainder((double)Main.screenPosition.X * bgParallax, bgWidthScaled) - (double)(bgWidthScaled / 2)); if (Main.gameMenu) @@ -115,15 +116,15 @@ namespace CalamityMod.Backgrounds { for (int i = 0; i < bgLoops; i++) { - Main.spriteBatch.Draw(CalamityMod.AstralSurfaceClose, new Vector2(bgStartX + bgWidthScaled * i, bgTopY + CloseBGYOffset), new Rectangle(0, 0, CalamityMod.AstralSurfaceClose.Width, CalamityMod.AstralSurfaceClose.Height), ColorOfSurfaceBackgroundsModified, 0f, default(Vector2), bgScale, SpriteEffects.None, 0f); - Main.spriteBatch.Draw(CalamityMod.AstralSurfaceCloseGlow, new Vector2(bgStartX + bgWidthScaled * i, bgTopY + CloseBGYOffset), new Rectangle(0, 0, CalamityMod.AstralSurfaceCloseGlow.Width, CalamityMod.AstralSurfaceCloseGlow.Height), new Color(Color.White.R * 0.7f, Color.White.G * 0.7f, Color.White.B * 0.7f, COSBMAplha.A), 0f, default(Vector2), bgScale, SpriteEffects.None, 0f); + Main.spriteBatch.Draw(SkyTextureRefs.AstralSurfaceClose, new Vector2(bgStartX + bgWidthScaled * i, bgTopY + CloseBGYOffset), new Rectangle(0, 0, SkyTextureRefs.AstralSurfaceClose.Width, SkyTextureRefs.AstralSurfaceClose.Height), ColorOfSurfaceBackgroundsModified, 0f, default(Vector2), bgScale, SpriteEffects.None, 0f); + Main.spriteBatch.Draw(SkyTextureRefs.AstralSurfaceCloseGlow, new Vector2(bgStartX + bgWidthScaled * i, bgTopY + CloseBGYOffset), new Rectangle(0, 0, SkyTextureRefs.AstralSurfaceCloseGlow.Width, SkyTextureRefs.AstralSurfaceCloseGlow.Height), new Color(Color.White.R * 0.7f, Color.White.G * 0.7f, Color.White.B * 0.7f, COSBMAplha.A), 0f, default(Vector2), bgScale, SpriteEffects.None, 0f); } } bgScale = 1.34f; bgParallax = 0.49; bgTopY = (int)(backgroundTopMagicNumber * 2100.0 + 2000.0) + (int)scAdj + pushBGTopHack; bgScale *= bgGlobalScaleMultiplier; - bgWidthScaled = (int)(CalamityMod.AstralSurfaceFront.Width * bgScale); + bgWidthScaled = (int)(SkyTextureRefs.AstralSurfaceFront.Width * bgScale); SkyManager.Instance.DrawToDepth(Main.spriteBatch, 1f / (float)bgParallax); bgStartX = (int)(0.0 - Math.IEEERemainder((double)Main.screenPosition.X * bgParallax, bgWidthScaled) - (double)(bgWidthScaled / 2)); if (Main.gameMenu) @@ -137,8 +138,8 @@ namespace CalamityMod.Backgrounds { for (int i = 0; i < bgLoops; i++) { - Main.spriteBatch.Draw(CalamityMod.AstralSurfaceFront, new Vector2(bgStartX + bgWidthScaled * i, bgTopY + FrontBGYOffset), new Rectangle(0, 0, CalamityMod.AstralSurfaceFront.Width, CalamityMod.AstralSurfaceFront.Height), ColorOfSurfaceBackgroundsModified, 0f, default(Vector2), bgScale, SpriteEffects.None, 0f); - Main.spriteBatch.Draw(CalamityMod.AstralSurfaceFrontGlow, new Vector2(bgStartX + bgWidthScaled * i, bgTopY + FrontBGYOffset), new Rectangle(0, 0, CalamityMod.AstralSurfaceFrontGlow.Width, CalamityMod.AstralSurfaceFrontGlow.Height), new Color(Color.White.R * 0.9f, Color.White.G * 0.9f, Color.White.B * 0.9f, COSBMAplha.A), 0f, default(Vector2), bgScale, SpriteEffects.None, 0f); + Main.spriteBatch.Draw(SkyTextureRefs.AstralSurfaceFront, new Vector2(bgStartX + bgWidthScaled * i, bgTopY + FrontBGYOffset), new Rectangle(0, 0, SkyTextureRefs.AstralSurfaceFront.Width, SkyTextureRefs.AstralSurfaceFront.Height), ColorOfSurfaceBackgroundsModified, 0f, default(Vector2), bgScale, SpriteEffects.None, 0f); + Main.spriteBatch.Draw(SkyTextureRefs.AstralSurfaceFrontGlow, new Vector2(bgStartX + bgWidthScaled * i, bgTopY + FrontBGYOffset), new Rectangle(0, 0, SkyTextureRefs.AstralSurfaceFrontGlow.Width, SkyTextureRefs.AstralSurfaceFrontGlow.Height), new Color(Color.White.R * 0.9f, Color.White.G * 0.9f, Color.White.B * 0.9f, COSBMAplha.A), 0f, default(Vector2), bgScale, SpriteEffects.None, 0f); } } } diff --git a/Backgrounds/AstralSurfaceBGStyle.cs b/Backgrounds/AstralSurfaceBGStyle.cs index bc53eed640..06810d6f3d 100644 --- a/Backgrounds/AstralSurfaceBGStyle.cs +++ b/Backgrounds/AstralSurfaceBGStyle.cs @@ -5,6 +5,7 @@ using System; using Terraria.Graphics.Effects; using Terraria; using Terraria.ModLoader; +using CalamityMod.Skies; namespace CalamityMod.Backgrounds { @@ -86,7 +87,7 @@ namespace CalamityMod.Backgrounds var bgParallax = 0.4; //The parallax of the background layer var bgTopY = (int)(backgroundTopMagicNumber * 1800.0 + 1500.0) + (int)scAdj + pushBGTopHack; //the Y position of the background bgScale *= bgGlobalScaleMultiplier; //Scale of the background - var bgWidthScaled = (int)((float)CalamityMod.AstralSurfaceMiddle.Width * bgScale); //The Width of the bg texture scaled to the correct size + var bgWidthScaled = (int)((float)SkyTextureRefs.AstralSurfaceMiddle.Width * bgScale); //The Width of the bg texture scaled to the correct size SkyManager.Instance.DrawToDepth(Main.spriteBatch, 1.2f / (float)bgParallax); var bgStartX = (int)(0.0 - Math.IEEERemainder((double)Main.screenPosition.X * bgParallax, bgWidthScaled) - (double)(bgWidthScaled / 2)); //The starting position of the background layer if (Main.gameMenu) @@ -98,8 +99,8 @@ namespace CalamityMod.Backgrounds for (int i = 0; i < bgLoops; i++) { //Draw the texture and its glowmask to each loop of the texture - Main.spriteBatch.Draw(CalamityMod.AstralSurfaceMiddle, new Vector2(bgStartX + bgWidthScaled * i, bgTopY + MiddleBGYOffset), new Rectangle(0, 0, CalamityMod.AstralSurfaceMiddle.Width, CalamityMod.AstralSurfaceMiddle.Height), ColorOfSurfaceBackgroundsModified, 0f, default(Vector2), bgScale, SpriteEffects.None, 0f); - Main.spriteBatch.Draw(CalamityMod.AstralSurfaceMiddleGlow, new Vector2(bgStartX + bgWidthScaled * i, bgTopY + MiddleBGYOffset), new Rectangle(0, 0, CalamityMod.AstralSurfaceMiddleGlow.Width, CalamityMod.AstralSurfaceMiddleGlow.Height), new Color(Color.White.R * 0.5f, Color.White.G * 0.5f, Color.White.B * 0.5f, COSBMAplha.A), 0f, default(Vector2), bgScale, SpriteEffects.None, 0f); + Main.spriteBatch.Draw(SkyTextureRefs.AstralSurfaceMiddle, new Vector2(bgStartX + bgWidthScaled * i, bgTopY + MiddleBGYOffset), new Rectangle(0, 0, SkyTextureRefs.AstralSurfaceMiddle.Width, SkyTextureRefs.AstralSurfaceMiddle.Height), ColorOfSurfaceBackgroundsModified, 0f, default(Vector2), bgScale, SpriteEffects.None, 0f); + Main.spriteBatch.Draw(SkyTextureRefs.AstralSurfaceMiddleGlow, new Vector2(bgStartX + bgWidthScaled * i, bgTopY + MiddleBGYOffset), new Rectangle(0, 0, SkyTextureRefs.AstralSurfaceMiddleGlow.Width, SkyTextureRefs.AstralSurfaceMiddleGlow.Height), new Color(Color.White.R * 0.5f, Color.White.G * 0.5f, Color.White.B * 0.5f, COSBMAplha.A), 0f, default(Vector2), bgScale, SpriteEffects.None, 0f); } } @@ -109,7 +110,7 @@ namespace CalamityMod.Backgrounds bgParallax = 0.43; bgTopY = (int)(backgroundTopMagicNumber * 1950.0 + 1750.0) + (int)scAdj + pushBGTopHack; bgScale *= bgGlobalScaleMultiplier; - bgWidthScaled = (int)((float)CalamityMod.AstralSurfaceClose.Width * bgScale); + bgWidthScaled = (int)((float)SkyTextureRefs.AstralSurfaceClose.Width * bgScale); SkyManager.Instance.DrawToDepth(Main.spriteBatch, 1f / (float)bgParallax); bgStartX = (int)(0.0 - Math.IEEERemainder((double)Main.screenPosition.X * bgParallax, bgWidthScaled) - (double)(bgWidthScaled / 2)); if (Main.gameMenu) @@ -123,8 +124,8 @@ namespace CalamityMod.Backgrounds { for (int i = 0; i < bgLoops; i++) { - Main.spriteBatch.Draw(CalamityMod.AstralSurfaceClose, new Vector2(bgStartX + bgWidthScaled * i, bgTopY + CloseBGYOffset), new Rectangle(0, 0, CalamityMod.AstralSurfaceClose.Width, CalamityMod.AstralSurfaceClose.Height), ColorOfSurfaceBackgroundsModified, 0f, default(Vector2), bgScale, SpriteEffects.None, 0f); - Main.spriteBatch.Draw(CalamityMod.AstralSurfaceCloseGlow, new Vector2(bgStartX + bgWidthScaled * i, bgTopY + CloseBGYOffset), new Rectangle(0, 0, CalamityMod.AstralSurfaceCloseGlow.Width, CalamityMod.AstralSurfaceCloseGlow.Height), new Color(Color.White.R * 0.7f, Color.White.G * 0.7f, Color.White.B * 0.7f, COSBMAplha.A), 0f, default(Vector2), bgScale, SpriteEffects.None, 0f); + Main.spriteBatch.Draw(SkyTextureRefs.AstralSurfaceClose, new Vector2(bgStartX + bgWidthScaled * i, bgTopY + CloseBGYOffset), new Rectangle(0, 0, SkyTextureRefs.AstralSurfaceClose.Width, SkyTextureRefs.AstralSurfaceClose.Height), ColorOfSurfaceBackgroundsModified, 0f, default(Vector2), bgScale, SpriteEffects.None, 0f); + Main.spriteBatch.Draw(SkyTextureRefs.AstralSurfaceCloseGlow, new Vector2(bgStartX + bgWidthScaled * i, bgTopY + CloseBGYOffset), new Rectangle(0, 0, SkyTextureRefs.AstralSurfaceCloseGlow.Width, SkyTextureRefs.AstralSurfaceCloseGlow.Height), new Color(Color.White.R * 0.7f, Color.White.G * 0.7f, Color.White.B * 0.7f, COSBMAplha.A), 0f, default(Vector2), bgScale, SpriteEffects.None, 0f); } } @@ -134,7 +135,7 @@ namespace CalamityMod.Backgrounds bgParallax = 0.49; bgTopY = (int)(backgroundTopMagicNumber * 2100.0 + 2000.0) + (int)scAdj + pushBGTopHack; bgScale *= bgGlobalScaleMultiplier; - bgWidthScaled = (int)(CalamityMod.AstralSurfaceFront.Width * bgScale); + bgWidthScaled = (int)(SkyTextureRefs.AstralSurfaceFront.Width * bgScale); SkyManager.Instance.DrawToDepth(Main.spriteBatch, 1f / (float)bgParallax); bgStartX = (int)(0.0 - Math.IEEERemainder((double)Main.screenPosition.X * bgParallax, bgWidthScaled) - (double)(bgWidthScaled / 2)); if (Main.gameMenu) @@ -148,8 +149,8 @@ namespace CalamityMod.Backgrounds { for (int i = 0; i < bgLoops; i++) { - Main.spriteBatch.Draw(CalamityMod.AstralSurfaceFront, new Vector2(bgStartX + bgWidthScaled * i, bgTopY + FrontBGYOffset), new Rectangle(0, 0, CalamityMod.AstralSurfaceFront.Width, CalamityMod.AstralSurfaceFront.Height), ColorOfSurfaceBackgroundsModified, 0f, default(Vector2), bgScale, SpriteEffects.None, 0f); - Main.spriteBatch.Draw(CalamityMod.AstralSurfaceFrontGlow, new Vector2(bgStartX + bgWidthScaled * i, bgTopY + FrontBGYOffset), new Rectangle(0, 0, CalamityMod.AstralSurfaceFrontGlow.Width, CalamityMod.AstralSurfaceFrontGlow.Height), new Color(Color.White.R * 0.9f, Color.White.G * 0.9f, Color.White.B * 0.9f, COSBMAplha.A), 0f, default(Vector2), bgScale, SpriteEffects.None, 0f); + Main.spriteBatch.Draw(SkyTextureRefs.AstralSurfaceFront, new Vector2(bgStartX + bgWidthScaled * i, bgTopY + FrontBGYOffset), new Rectangle(0, 0, SkyTextureRefs.AstralSurfaceFront.Width, SkyTextureRefs.AstralSurfaceFront.Height), ColorOfSurfaceBackgroundsModified, 0f, default(Vector2), bgScale, SpriteEffects.None, 0f); + Main.spriteBatch.Draw(SkyTextureRefs.AstralSurfaceFrontGlow, new Vector2(bgStartX + bgWidthScaled * i, bgTopY + FrontBGYOffset), new Rectangle(0, 0, SkyTextureRefs.AstralSurfaceFrontGlow.Width, SkyTextureRefs.AstralSurfaceFrontGlow.Height), new Color(Color.White.R * 0.9f, Color.White.G * 0.9f, Color.White.B * 0.9f, COSBMAplha.A), 0f, default(Vector2), bgScale, SpriteEffects.None, 0f); } } } diff --git a/CalamityMod.cs b/CalamityMod.cs index 38530a26c3..8c371bf009 100644 --- a/CalamityMod.cs +++ b/CalamityMod.cs @@ -89,33 +89,6 @@ namespace CalamityMod public static Asset carpetOriginal; - // Astral Sky/BG - public static Texture2D AstralSky; - public static Texture2D AstralSurfaceFront; - public static Texture2D AstralSurfaceFrontGlow; - public static Texture2D AstralSurfaceClose; - public static Texture2D AstralSurfaceCloseGlow; - public static Texture2D AstralSurfaceMiddle; - public static Texture2D AstralSurfaceMiddleGlow; - - // Astral Desert Sky/BG - public static Texture2D AstralDesertSurfaceClose; - public static Texture2D AstralDesertSurfaceMiddle; - - // Astral Snow Sky/BG - public static Texture2D AstralSnowSurfaceMiddle; - - // Sulphur Sea Sky/BG - public static Texture2D SulphurSeaSky; - public static Texture2D SulphurSeaSkyFront; - public static Texture2D SulphurSeaSurface; - - // Destroyer glowmasks - public static Asset[] DestroyerGlowmasks = new Asset[3]; - - // Probe glowmask - public static Asset ProbeGlowmask; - // Holds the Texture Arrays for all the lava textures. // These are used for the lava styles. They are seperate from Textureasset.Instance._liquidTexture as they will conflict with ModWaterStyle // Can hold up to 255 lava styles (more than enough) (excluding the normal lava texture which is liquidTexture 1) @@ -131,14 +104,6 @@ namespace CalamityMod public static float[] lavaAlpha = new float[1]; - // Wall of Flesh glowmasks - public static Asset WallOfFleshEyeGlowmask; - public static Asset WallOfFleshDemonSickleTexture; - - // Master Rev+ Skeletron Prime - public static Asset ChadPrime; - public static Asset ChadPrimeEyeGlowmask; - // Boss Kill Time data structure public static SortedDictionary bossKillTimes; @@ -287,50 +252,13 @@ namespace CalamityMod private void LoadClient() { - // Astral Sky/BG - AstralSky = ModContent.Request("CalamityMod/Skies/AstralSky", AssetRequestMode.ImmediateLoad).Value; - AstralSurfaceFront = ModContent.Request("CalamityMod/Backgrounds/AstralSurfaceFront", AssetRequestMode.ImmediateLoad).Value; - AstralSurfaceFrontGlow = ModContent.Request("CalamityMod/Backgrounds/AstralSurfaceFrontGlow", AssetRequestMode.ImmediateLoad).Value; - AstralSurfaceClose = ModContent.Request("CalamityMod/Backgrounds/AstralSurfaceClose", AssetRequestMode.ImmediateLoad).Value; - AstralSurfaceCloseGlow = ModContent.Request("CalamityMod/Backgrounds/AstralSurfaceCloseGlow", AssetRequestMode.ImmediateLoad).Value; - AstralSurfaceMiddle = ModContent.Request("CalamityMod/Backgrounds/AstralSurfaceMiddle", AssetRequestMode.ImmediateLoad).Value; - AstralSurfaceMiddleGlow = ModContent.Request("CalamityMod/Backgrounds/AstralSurfaceMiddleGlow", AssetRequestMode.ImmediateLoad).Value; - - //Astral Desert Sky/BG - AstralDesertSurfaceClose = ModContent.Request("CalamityMod/Backgrounds/AstralDesertSurfaceClose", AssetRequestMode.ImmediateLoad).Value; - AstralDesertSurfaceMiddle = ModContent.Request("CalamityMod/Backgrounds/AstralDesertSurfaceMiddle", AssetRequestMode.ImmediateLoad).Value; - - //Astral Snow Sky/BG - AstralSnowSurfaceMiddle = ModContent.Request("CalamityMod/Backgrounds/AstralSnowSurfaceMiddle", AssetRequestMode.ImmediateLoad).Value; - - // Sulpher Sea Sky/BG - SulphurSeaSky = ModContent.Request("CalamityMod/Skies/SulphurSeaSky", AssetRequestMode.ImmediateLoad).Value; - SulphurSeaSkyFront = ModContent.Request("CalamityMod/Skies/SulphurSeaSkyFront", AssetRequestMode.ImmediateLoad).Value; - SulphurSeaSurface = ModContent.Request("CalamityMod/Skies/SulphurSeaSurface", AssetRequestMode.ImmediateLoad).Value; - - // Destroyer glowmasks - DestroyerGlowmasks[0] = ModContent.Request("CalamityMod/ExtraTextures/VanillaBossGlowmasks/DestroyerHeadGlow", AssetRequestMode.AsyncLoad); - DestroyerGlowmasks[1] = ModContent.Request("CalamityMod/ExtraTextures/VanillaBossGlowmasks/DestroyerBodyGlow", AssetRequestMode.AsyncLoad); - DestroyerGlowmasks[2] = ModContent.Request("CalamityMod/ExtraTextures/VanillaBossGlowmasks/DestroyerTailGlow", AssetRequestMode.AsyncLoad); - // Lava Texture LavaTextures.liquid[0] = LiquidRenderer.Instance._liquidTextures[1]; LavaTextures.slope[0] = TextureAssets.LiquidSlope[1]; LavaTextures.block[0] = TextureAssets.Liquid[1]; var waterfallTexture = (Asset[])typeof(WaterfallManager).GetField("waterfallTexture", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public).GetValue(Main.instance.waterfallManager); LavaTextures.fall[0] = waterfallTexture[1]; - - // Probe glowmask - ProbeGlowmask = ModContent.Request("CalamityMod/ExtraTextures/VanillaBossGlowmasks/ProbeGlow", AssetRequestMode.AsyncLoad); - - // Wall of Flesh glowmasks - WallOfFleshEyeGlowmask = ModContent.Request("CalamityMod/ExtraTextures/VanillaBossGlowmasks/WallOfFleshEyeTelegraphGlow", AssetRequestMode.AsyncLoad); - WallOfFleshDemonSickleTexture = ModContent.Request("CalamityMod/Projectiles/Melee/ForbiddenOathbladeProjectile", AssetRequestMode.AsyncLoad); - - // Master Rev+ Skeletron Prime textures - ChadPrime = ModContent.Request("CalamityMod/ExtraTextures/ChadPrime", AssetRequestMode.AsyncLoad); - ChadPrimeEyeGlowmask = ModContent.Request("CalamityMod/ExtraTextures/ChadPrimeHeadGlow", AssetRequestMode.AsyncLoad); - + CalamityShaders.LoadShaders(); // This must be done separately from immediate loading, as loading is now multithreaded. @@ -395,7 +323,6 @@ namespace CalamityMod varia = null; wikithis = null; - AstralSky = null; bossKillTimes?.Clear(); bossKillTimes = null; diff --git a/ExtraTextures/ExtraTextureRefs.cs b/ExtraTextures/ExtraTextureRefs.cs new file mode 100644 index 0000000000..f11a5c393d --- /dev/null +++ b/ExtraTextures/ExtraTextureRefs.cs @@ -0,0 +1,47 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria.ModLoader; + +namespace CalamityMod.ExtraTextures +{ + [Autoload(Side = ModSide.Client)] + internal sealed class ExtraTextureRefs : ModSystem + { + // Destroyer glowmasks + public static Asset[] DestroyerGlowmasks = new Asset[3]; + public static Asset ProbeGlowmask; + + // Master Rev+ Skeletron Prime + public static Asset ChadPrime; + public static Asset ChadPrimeEyeGlowmask; + + // WoF, These are not "exactly" the ExtraTextures. But + public static Asset WallOfFleshEyeGlowmask; + public static Asset WallOfFleshDemonSickleTexture; + + public override void Load() + { + DestroyerGlowmasks[0] = ModContent.Request("CalamityMod/ExtraTextures/VanillaBossGlowmasks/DestroyerHeadGlow", AssetRequestMode.AsyncLoad); + DestroyerGlowmasks[1] = ModContent.Request("CalamityMod/ExtraTextures/VanillaBossGlowmasks/DestroyerBodyGlow", AssetRequestMode.AsyncLoad); + DestroyerGlowmasks[2] = ModContent.Request("CalamityMod/ExtraTextures/VanillaBossGlowmasks/DestroyerTailGlow", AssetRequestMode.AsyncLoad); + + ProbeGlowmask = ModContent.Request("CalamityMod/ExtraTextures/VanillaBossGlowmasks/ProbeGlow", AssetRequestMode.AsyncLoad); + + ChadPrime = ModContent.Request("CalamityMod/ExtraTextures/ChadPrime", AssetRequestMode.AsyncLoad); + ChadPrimeEyeGlowmask = ModContent.Request("CalamityMod/ExtraTextures/ChadPrimeHeadGlow", AssetRequestMode.AsyncLoad); + + WallOfFleshEyeGlowmask = ModContent.Request("CalamityMod/ExtraTextures/VanillaBossGlowmasks/WallOfFleshEyeTelegraphGlow", AssetRequestMode.AsyncLoad); + WallOfFleshDemonSickleTexture = ModContent.Request("CalamityMod/Projectiles/Melee/ForbiddenOathbladeProjectile", AssetRequestMode.AsyncLoad); + } + + public override void Unload() + { + + } + } +} diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index ce5d318457..998057bee0 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -83,6 +83,9 @@ using Terraria.ModLoader.Utilities; using Terraria.UI.Chat; using Terraria.Utilities; using static Terraria.ModLoader.ModContent; +using CalamityMod.NPCs.SunkenSea; +using CalamityMod.Packets; +using CalamityMod.ExtraTextures; namespace CalamityMod.NPCs { @@ -7652,7 +7655,7 @@ namespace CalamityMod.NPCs } } - Texture2D glowTexture = CalamityClientConfig.Instance.NewVanillaTextures ? CalamityMod.DestroyerGlowmasks[0].Value : TextureAssets.Dest[0].Value; + Texture2D glowTexture = CalamityClientConfig.Instance.NewVanillaTextures ? ExtraTextureRefs.DestroyerGlowmasks[0].Value : TextureAssets.Dest[0].Value; switch (npc.type) { default: @@ -7660,11 +7663,11 @@ namespace CalamityMod.NPCs break; case NPCID.TheDestroyerBody: - glowTexture = CalamityClientConfig.Instance.NewVanillaTextures ? CalamityMod.DestroyerGlowmasks[1].Value : TextureAssets.Dest[1].Value; + glowTexture = CalamityClientConfig.Instance.NewVanillaTextures ? ExtraTextureRefs.DestroyerGlowmasks[1].Value : TextureAssets.Dest[1].Value; break; case NPCID.TheDestroyerTail: - glowTexture = CalamityClientConfig.Instance.NewVanillaTextures ? CalamityMod.DestroyerGlowmasks[2].Value : TextureAssets.Dest[2].Value; + glowTexture = CalamityClientConfig.Instance.NewVanillaTextures ? ExtraTextureRefs.DestroyerGlowmasks[2].Value : TextureAssets.Dest[2].Value; break; } @@ -7677,7 +7680,7 @@ namespace CalamityMod.NPCs else if (npc.type == NPCID.Probe && CalamityClientConfig.Instance.NewVanillaTextures) { float eyeTelegraphGateValue = (NPC.IsMechQueenUp ? DestroyerAI.ProbeLaserGateValue_Mechdusa : BossRushEvent.BossRushActive ? DestroyerAI.ProbeLaserGateValue_BossRush : revenge ? DestroyerAI.ProbeLaserGateValue_Rev : DestroyerAI.ProbeLaserGateValue) - DestroyerAI.ProbeLaserTelegraphTime; - Texture2D glowTexture = CalamityMod.ProbeGlowmask.Value; + Texture2D glowTexture = ExtraTextureRefs.ProbeGlowmask.Value; Vector2 halfSize = npc.frame.Size() / 2; SpriteEffects spriteEffects = SpriteEffects.None; if (npc.spriteDirection == -1) @@ -7988,7 +7991,7 @@ namespace CalamityMod.NPCs float eyeTelegraphGateValue = WallOfFleshAI.LaserShootGateValue - WallOfFleshAI.LaserShootTelegraphTime; if (npc.localAI[1] > eyeTelegraphGateValue || npc.localAI[2] > 0f || enraged) { - Texture2D glowTexture = CalamityClientConfig.Instance.NewVanillaTextures ? CalamityMod.WallOfFleshEyeGlowmask.Value : TextureAssets.Npc[npc.type].Value; + Texture2D glowTexture = CalamityClientConfig.Instance.NewVanillaTextures ? ExtraTextureRefs.WallOfFleshEyeGlowmask.Value : TextureAssets.Npc[npc.type].Value; Vector2 halfSize = npc.frame.Size() / 2; SpriteEffects spriteEffects = SpriteEffects.None; if (npc.spriteDirection == 1) @@ -8010,7 +8013,7 @@ namespace CalamityMod.NPCs // His afterimages I can't get to work, so fuck it else if (npc.type == NPCID.SkeletronPrime || npc.type == NPCType()) { - Texture2D npcTexture = (masterMode && revenge && npc.type == NPCID.SkeletronPrime) ? CalamityMod.ChadPrime.Value : TextureAssets.Npc[npc.type].Value; + Texture2D npcTexture = (masterMode && revenge && npc.type == NPCID.SkeletronPrime) ? ExtraTextureRefs.ChadPrime.Value : TextureAssets.Npc[npc.type].Value; int frameHeight = npcTexture.Height / Main.npcFrameCount[npc.type]; npc.frame.Y = (int)newAI[3]; @@ -8077,7 +8080,7 @@ namespace CalamityMod.NPCs { int alpha = 192; eyesColor = npc.type == NPCType() ? new Color(150, 100, 255, alpha) : new Color(255, 255, 0, alpha); - Texture2D glowTexture = npc.type == NPCID.SkeletronPrime ? CalamityMod.ChadPrimeEyeGlowmask.Value : SkeletronPrime2.EyeTexture.Value; + Texture2D glowTexture = npc.type == NPCID.SkeletronPrime ? ExtraTextureRefs.ChadPrimeEyeGlowmask.Value : SkeletronPrime2.EyeTexture.Value; spriteBatch.Draw(glowTexture, npc.Center - screenPos + new Vector2(0, npc.gfxOffY), npc.frame, eyesColor, npc.rotation, npc.frame.Size() / 2, npc.scale, spriteEffects, 0f); } else diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index 30ed8405b5..d2d63771fe 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -8,6 +8,7 @@ using CalamityMod.CalPlayer; using CalamityMod.Dusts; using CalamityMod.EntitySources; using CalamityMod.Events; +using CalamityMod.ExtraTextures; using CalamityMod.Items.Accessories; using CalamityMod.Items.Potions.Alcohol; using CalamityMod.NPCs; @@ -4570,7 +4571,7 @@ namespace CalamityMod.Projectiles if (Main.wofNPCIndex < 0 || !Main.npc[Main.wofNPCIndex].active || Main.npc[Main.wofNPCIndex].life <= 0 || projectile.tileCollide) return true; - Texture2D texture = CalamityMod.WallOfFleshDemonSickleTexture.Value; + Texture2D texture = ExtraTextureRefs.WallOfFleshDemonSickleTexture.Value; int frameHeight = texture.Height / Main.projFrames[projectile.type]; int frameY = frameHeight * projectile.frame; Rectangle rectangle = new Rectangle(0, frameY, texture.Width, frameHeight); diff --git a/Skies/AstralMonolithSky.cs b/Skies/AstralMonolithSky.cs index 11135236e0..4b94ddb22d 100644 --- a/Skies/AstralMonolithSky.cs +++ b/Skies/AstralMonolithSky.cs @@ -40,7 +40,7 @@ namespace CalamityMod.Skies float whateverTheFuckThisVariableIsSupposedToBe = 3.40282347E+38f; if (maxDepth >= whateverTheFuckThisVariableIsSupposedToBe && minDepth < whateverTheFuckThisVariableIsSupposedToBe) { - spriteBatch.Draw(CalamityMod.AstralSky, new Rectangle(0, 0, Main.screenWidth, Main.screenHeight), Color.White * opacity); + spriteBatch.Draw(SkyTextureRefs.AstralSky, new Rectangle(0, 0, Main.screenWidth, Main.screenHeight), Color.White * opacity); // Terraria's conditions. if (Main.netMode != NetmodeID.Server) diff --git a/Skies/AstralSky.cs b/Skies/AstralSky.cs index 7290303387..e2a14e830a 100644 --- a/Skies/AstralSky.cs +++ b/Skies/AstralSky.cs @@ -56,7 +56,7 @@ namespace CalamityMod.Skies float whateverTheFuckThisVariableIsSupposedToBe = 3.40282347E+38f; if (maxDepth >= whateverTheFuckThisVariableIsSupposedToBe && minDepth < whateverTheFuckThisVariableIsSupposedToBe) { - spriteBatch.Draw(CalamityMod.AstralSky, new Rectangle(0, 0, Main.screenWidth, Main.screenHeight), Color.White * opacity); + spriteBatch.Draw(SkyTextureRefs.AstralSky, new Rectangle(0, 0, Main.screenWidth, Main.screenHeight), Color.White * opacity); // Terraria's conditions. if (Main.netMode != NetmodeID.Server) diff --git a/Skies/SkyTextureRefs.cs b/Skies/SkyTextureRefs.cs new file mode 100644 index 0000000000..f5f99bf456 --- /dev/null +++ b/Skies/SkyTextureRefs.cs @@ -0,0 +1,80 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria.ModLoader; + +namespace CalamityMod.Skies +{ + [Autoload(Side = ModSide.Client)] + internal sealed class SkyTextureRefs : ModSystem + { + // Astral Sky/BG + public static Texture2D AstralSky; + public static Texture2D AstralSurfaceFront; + public static Texture2D AstralSurfaceFrontGlow; + public static Texture2D AstralSurfaceClose; + public static Texture2D AstralSurfaceCloseGlow; + public static Texture2D AstralSurfaceMiddle; + public static Texture2D AstralSurfaceMiddleGlow; + + // Astral Desert Sky/BG + public static Texture2D AstralDesertSurfaceClose; + public static Texture2D AstralDesertSurfaceMiddle; + + // Astral Snow Sky/BG + public static Texture2D AstralSnowSurfaceMiddle; + + // Sulphur Sea Sky/BG + public static Texture2D SulphurSeaSky; + public static Texture2D SulphurSeaSkyFront; + public static Texture2D SulphurSeaSurface; + + public override void Load() + { + // Astral Sky/BG + AstralSky = ModContent.Request("CalamityMod/Skies/AstralSky", AssetRequestMode.ImmediateLoad).Value; + AstralSurfaceFront = ModContent.Request("CalamityMod/Backgrounds/AstralSurfaceFront", AssetRequestMode.ImmediateLoad).Value; + AstralSurfaceFrontGlow = ModContent.Request("CalamityMod/Backgrounds/AstralSurfaceFrontGlow", AssetRequestMode.ImmediateLoad).Value; + AstralSurfaceClose = ModContent.Request("CalamityMod/Backgrounds/AstralSurfaceClose", AssetRequestMode.ImmediateLoad).Value; + AstralSurfaceCloseGlow = ModContent.Request("CalamityMod/Backgrounds/AstralSurfaceCloseGlow", AssetRequestMode.ImmediateLoad).Value; + AstralSurfaceMiddle = ModContent.Request("CalamityMod/Backgrounds/AstralSurfaceMiddle", AssetRequestMode.ImmediateLoad).Value; + AstralSurfaceMiddleGlow = ModContent.Request("CalamityMod/Backgrounds/AstralSurfaceMiddleGlow", AssetRequestMode.ImmediateLoad).Value; + + //Astral Desert Sky/BG + AstralDesertSurfaceClose = ModContent.Request("CalamityMod/Backgrounds/AstralDesertSurfaceClose", AssetRequestMode.ImmediateLoad).Value; + AstralDesertSurfaceMiddle = ModContent.Request("CalamityMod/Backgrounds/AstralDesertSurfaceMiddle", AssetRequestMode.ImmediateLoad).Value; + + //Astral Snow Sky/BG + AstralSnowSurfaceMiddle = ModContent.Request("CalamityMod/Backgrounds/AstralSnowSurfaceMiddle", AssetRequestMode.ImmediateLoad).Value; + + // Sulpher Sea Sky/BG + SulphurSeaSky = ModContent.Request("CalamityMod/Skies/SulphurSeaSky", AssetRequestMode.ImmediateLoad).Value; + SulphurSeaSkyFront = ModContent.Request("CalamityMod/Skies/SulphurSeaSkyFront", AssetRequestMode.ImmediateLoad).Value; + SulphurSeaSurface = ModContent.Request("CalamityMod/Skies/SulphurSeaSurface", AssetRequestMode.ImmediateLoad).Value; + } + + public override void Unload() + { + AstralSky = null; + AstralSurfaceFront = null; + AstralSurfaceFrontGlow = null; + AstralSurfaceClose = null; + AstralSurfaceCloseGlow = null; + AstralSurfaceMiddle = null; + AstralSurfaceMiddleGlow = null; + + AstralDesertSurfaceClose = null; + AstralDesertSurfaceMiddle = null; + + AstralSnowSurfaceMiddle = null; + + SulphurSeaSky = null; + SulphurSeaSkyFront = null; + SulphurSeaSurface = null; + } + } +} diff --git a/Skies/SulphurSeaSky.cs b/Skies/SulphurSeaSky.cs index bd8c4f1233..b639a28362 100644 --- a/Skies/SulphurSeaSky.cs +++ b/Skies/SulphurSeaSky.cs @@ -41,7 +41,7 @@ namespace CalamityMod.Skies public override void Draw(SpriteBatch spriteBatch, float minDepth, float maxDepth) { if (maxDepth >= 4f && minDepth < 4f) - spriteBatch.Draw(CalamityMod.SulphurSeaSky, new Rectangle(0, (int)(-Main.screenPosition.Y / 6f) + 1300, Main.screenWidth, Main.screenHeight), Color.Lerp(Main.ColorOfTheSkies, Color.LightSeaGreen, 0.33f) * 0.2f * opacity); + spriteBatch.Draw(SkyTextureRefs.SulphurSeaSky, new Rectangle(0, (int)(-Main.screenPosition.Y / 6f) + 1300, Main.screenWidth, Main.screenHeight), Color.Lerp(Main.ColorOfTheSkies, Color.LightSeaGreen, 0.33f) * 0.2f * opacity); // Small worlds, default draw height int sulphurSeaHeight = (World.SulphurousSea.YStart + (int)Main.worldSurface) / 2; @@ -58,7 +58,7 @@ namespace CalamityMod.Skies // This changes the speed of the parralax, the closer the layer to the player the faster it should be. if (maxDepth >= 1f && minDepth < 1f) { - Texture2D texture = CalamityMod.SulphurSeaSkyFront; + Texture2D texture = SkyTextureRefs.SulphurSeaSkyFront; // Keep in mind that y paralex should always be half of x's or it will feel odd compared to how terraria does it. // Keep in mind when you change screen parralax it affects the y offset for the bg in the world. @@ -84,7 +84,7 @@ namespace CalamityMod.Skies if (maxDepth >= 3f && minDepth < 3f) { - Texture2D texture = CalamityMod.SulphurSeaSurface; + Texture2D texture = SkyTextureRefs.SulphurSeaSurface; int x = (int)(Main.screenPosition.X * ScreenParralaxMultiplier); x %= (int)(texture.Width * Scale);