SkyTextures now Loads Asyncronously

This commit is contained in:
Flowaria authored and Cameron Ewell committed 2024-09-30 03:37:06 -04:00
1 parent 15ce7dc89f
commit de6f206e03
7 files changed
+52 -52

No files matched your search

+4 -4
View File
@@ -81,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)SkyTextureRefs.AstralDesertSurfaceMiddle.Width * bgScale);
var bgWidthScaled = (int)((float)SkyTextureRefs.AstralDesertSurfaceMiddle.Value.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)
@@ -92,7 +92,7 @@ namespace CalamityMod.Backgrounds
{
for (int i = 0; i < bgLoops; i++)
{
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);
Main.spriteBatch.Draw(SkyTextureRefs.AstralDesertSurfaceMiddle.Value, new Vector2(bgStartX + bgWidthScaled * i, bgTopY + MiddleBGYOffset), new Rectangle(0, 0, SkyTextureRefs.AstralDesertSurfaceMiddle.Value.Width, SkyTextureRefs.AstralDesertSurfaceMiddle.Value.Height), ColorOfSurfaceBackgroundsModified, 0f, default(Vector2), bgScale, SpriteEffects.None, 0f);
}
}
@@ -100,7 +100,7 @@ namespace CalamityMod.Backgrounds
bgParallax = 0.43;
bgTopY = (int)(backgroundTopMagicNumber * 1950.0 + 1750.0) + (int)scAdj + pushBGTopHack;
bgScale *= bgGlobalScaleMultiplier;
bgWidthScaled = (int)((float)SkyTextureRefs.AstralDesertSurfaceClose.Width * bgScale);
bgWidthScaled = (int)((float)SkyTextureRefs.AstralDesertSurfaceClose.Value.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)
@@ -114,7 +114,7 @@ namespace CalamityMod.Backgrounds
{
for (int i = 0; i < bgLoops; i++)
{
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);
Main.spriteBatch.Draw(SkyTextureRefs.AstralDesertSurfaceClose.Value, new Vector2(bgStartX + bgWidthScaled * i, bgTopY + CloseBGYOffset), new Rectangle(0, 0, SkyTextureRefs.AstralDesertSurfaceClose.Value.Width, SkyTextureRefs.AstralDesertSurfaceClose.Value.Height), ColorOfSurfaceBackgroundsModified, 0f, default(Vector2), bgScale, SpriteEffects.None, 0f);
}
}
}
+8 -8
View File
@@ -83,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)SkyTextureRefs.AstralSnowSurfaceMiddle.Width * bgScale);
var bgWidthScaled = (int)((float)SkyTextureRefs.AstralSnowSurfaceMiddle.Value.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)
@@ -94,7 +94,7 @@ namespace CalamityMod.Backgrounds
{
for (int i = 0; i < bgLoops; i++)
{
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);
Main.spriteBatch.Draw(SkyTextureRefs.AstralSnowSurfaceMiddle.Value, new Vector2(bgStartX + bgWidthScaled * i, bgTopY + MiddleBGYOffset), new Rectangle(0, 0, SkyTextureRefs.AstralSnowSurfaceMiddle.Value.Width, SkyTextureRefs.AstralSnowSurfaceMiddle.Value.Height), ColorOfSurfaceBackgroundsModified, 0f, default(Vector2), bgScale, SpriteEffects.None, 0f);
}
}
@@ -102,7 +102,7 @@ namespace CalamityMod.Backgrounds
bgParallax = 0.43;
bgTopY = (int)(backgroundTopMagicNumber * 1950.0 + 1750.0) + (int)scAdj + pushBGTopHack;
bgScale *= bgGlobalScaleMultiplier;
bgWidthScaled = (int)((float)SkyTextureRefs.AstralSurfaceClose.Width * bgScale);
bgWidthScaled = (int)((float)SkyTextureRefs.AstralSurfaceClose.Value.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)
@@ -116,15 +116,15 @@ namespace CalamityMod.Backgrounds
{
for (int i = 0; i < bgLoops; i++)
{
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);
Main.spriteBatch.Draw(SkyTextureRefs.AstralSurfaceClose.Value, new Vector2(bgStartX + bgWidthScaled * i, bgTopY + CloseBGYOffset), new Rectangle(0, 0, SkyTextureRefs.AstralSurfaceClose.Value.Width, SkyTextureRefs.AstralSurfaceClose.Value.Height), ColorOfSurfaceBackgroundsModified, 0f, default(Vector2), bgScale, SpriteEffects.None, 0f);
Main.spriteBatch.Draw(SkyTextureRefs.AstralSurfaceCloseGlow.Value, new Vector2(bgStartX + bgWidthScaled * i, bgTopY + CloseBGYOffset), new Rectangle(0, 0, SkyTextureRefs.AstralSurfaceCloseGlow.Value.Width, SkyTextureRefs.AstralSurfaceCloseGlow.Value.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)(SkyTextureRefs.AstralSurfaceFront.Width * bgScale);
bgWidthScaled = (int)(SkyTextureRefs.AstralSurfaceFront.Value.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)
@@ -138,8 +138,8 @@ namespace CalamityMod.Backgrounds
{
for (int i = 0; i < bgLoops; i++)
{
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);
Main.spriteBatch.Draw(SkyTextureRefs.AstralSurfaceFront.Value, new Vector2(bgStartX + bgWidthScaled * i, bgTopY + FrontBGYOffset), new Rectangle(0, 0, SkyTextureRefs.AstralSurfaceFront.Value.Width, SkyTextureRefs.AstralSurfaceFront.Value.Height), ColorOfSurfaceBackgroundsModified, 0f, default(Vector2), bgScale, SpriteEffects.None, 0f);
Main.spriteBatch.Draw(SkyTextureRefs.AstralSurfaceFrontGlow.Value, new Vector2(bgStartX + bgWidthScaled * i, bgTopY + FrontBGYOffset), new Rectangle(0, 0, SkyTextureRefs.AstralSurfaceFrontGlow.Value.Width, SkyTextureRefs.AstralSurfaceFrontGlow.Value.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);
}
}
}
+9 -9
View File
@@ -87,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)SkyTextureRefs.AstralSurfaceMiddle.Width * bgScale); //The Width of the bg texture scaled to the correct size
var bgWidthScaled = (int)((float)SkyTextureRefs.AstralSurfaceMiddle.Value.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)
@@ -99,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(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);
Main.spriteBatch.Draw(SkyTextureRefs.AstralSurfaceMiddle.Value, new Vector2(bgStartX + bgWidthScaled * i, bgTopY + MiddleBGYOffset), new Rectangle(0, 0, SkyTextureRefs.AstralSurfaceMiddle.Value.Width, SkyTextureRefs.AstralSurfaceMiddle.Value.Height), ColorOfSurfaceBackgroundsModified, 0f, default(Vector2), bgScale, SpriteEffects.None, 0f);
Main.spriteBatch.Draw(SkyTextureRefs.AstralSurfaceMiddleGlow.Value, new Vector2(bgStartX + bgWidthScaled * i, bgTopY + MiddleBGYOffset), new Rectangle(0, 0, SkyTextureRefs.AstralSurfaceMiddleGlow.Value.Width, SkyTextureRefs.AstralSurfaceMiddleGlow.Value.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);
}
}
@@ -110,7 +110,7 @@ namespace CalamityMod.Backgrounds
bgParallax = 0.43;
bgTopY = (int)(backgroundTopMagicNumber * 1950.0 + 1750.0) + (int)scAdj + pushBGTopHack;
bgScale *= bgGlobalScaleMultiplier;
bgWidthScaled = (int)((float)SkyTextureRefs.AstralSurfaceClose.Width * bgScale);
bgWidthScaled = (int)((float)SkyTextureRefs.AstralSurfaceClose.Value.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)
@@ -124,8 +124,8 @@ namespace CalamityMod.Backgrounds
{
for (int i = 0; i < bgLoops; i++)
{
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);
Main.spriteBatch.Draw(SkyTextureRefs.AstralSurfaceClose.Value, new Vector2(bgStartX + bgWidthScaled * i, bgTopY + CloseBGYOffset), new Rectangle(0, 0, SkyTextureRefs.AstralSurfaceClose.Value.Width, SkyTextureRefs.AstralSurfaceClose.Value.Height), ColorOfSurfaceBackgroundsModified, 0f, default(Vector2), bgScale, SpriteEffects.None, 0f);
Main.spriteBatch.Draw(SkyTextureRefs.AstralSurfaceCloseGlow.Value, new Vector2(bgStartX + bgWidthScaled * i, bgTopY + CloseBGYOffset), new Rectangle(0, 0, SkyTextureRefs.AstralSurfaceCloseGlow.Value.Width, SkyTextureRefs.AstralSurfaceCloseGlow.Value.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);
}
}
@@ -135,7 +135,7 @@ namespace CalamityMod.Backgrounds
bgParallax = 0.49;
bgTopY = (int)(backgroundTopMagicNumber * 2100.0 + 2000.0) + (int)scAdj + pushBGTopHack;
bgScale *= bgGlobalScaleMultiplier;
bgWidthScaled = (int)(SkyTextureRefs.AstralSurfaceFront.Width * bgScale);
bgWidthScaled = (int)(SkyTextureRefs.AstralSurfaceFront.Value.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)
@@ -149,8 +149,8 @@ namespace CalamityMod.Backgrounds
{
for (int i = 0; i < bgLoops; i++)
{
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);
Main.spriteBatch.Draw(SkyTextureRefs.AstralSurfaceFront.Value, new Vector2(bgStartX + bgWidthScaled * i, bgTopY + FrontBGYOffset), new Rectangle(0, 0, SkyTextureRefs.AstralSurfaceFront.Value.Width, SkyTextureRefs.AstralSurfaceFront.Value.Height), ColorOfSurfaceBackgroundsModified, 0f, default(Vector2), bgScale, SpriteEffects.None, 0f);
Main.spriteBatch.Draw(SkyTextureRefs.AstralSurfaceFrontGlow.Value, new Vector2(bgStartX + bgWidthScaled * i, bgTopY + FrontBGYOffset), new Rectangle(0, 0, SkyTextureRefs.AstralSurfaceFrontGlow.Value.Width, SkyTextureRefs.AstralSurfaceFrontGlow.Value.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);
}
}
}
+1 -1
View File
@@ -40,7 +40,7 @@ namespace CalamityMod.Skies
float whateverTheFuckThisVariableIsSupposedToBe = 3.40282347E+38f;
if (maxDepth >= whateverTheFuckThisVariableIsSupposedToBe && minDepth < whateverTheFuckThisVariableIsSupposedToBe)
{
spriteBatch.Draw(SkyTextureRefs.AstralSky, new Rectangle(0, 0, Main.screenWidth, Main.screenHeight), Color.White * opacity);
spriteBatch.Draw(SkyTextureRefs.AstralSky.Value, new Rectangle(0, 0, Main.screenWidth, Main.screenHeight), Color.White * opacity);
// Terraria's conditions.
if (Main.netMode != NetmodeID.Server)
+1 -1
View File
@@ -56,7 +56,7 @@ namespace CalamityMod.Skies
float whateverTheFuckThisVariableIsSupposedToBe = 3.40282347E+38f;
if (maxDepth >= whateverTheFuckThisVariableIsSupposedToBe && minDepth < whateverTheFuckThisVariableIsSupposedToBe)
{
spriteBatch.Draw(SkyTextureRefs.AstralSky, new Rectangle(0, 0, Main.screenWidth, Main.screenHeight), Color.White * opacity);
spriteBatch.Draw(SkyTextureRefs.AstralSky.Value, new Rectangle(0, 0, Main.screenWidth, Main.screenHeight), Color.White * opacity);
// Terraria's conditions.
if (Main.netMode != NetmodeID.Server)
+26 -26
View File
@@ -13,48 +13,48 @@ namespace CalamityMod.Skies
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;
public static Asset<Texture2D> AstralSky;
public static Asset<Texture2D> AstralSurfaceFront;
public static Asset<Texture2D> AstralSurfaceFrontGlow;
public static Asset<Texture2D> AstralSurfaceClose;
public static Asset<Texture2D> AstralSurfaceCloseGlow;
public static Asset<Texture2D> AstralSurfaceMiddle;
public static Asset<Texture2D> AstralSurfaceMiddleGlow;
// Astral Desert Sky/BG
public static Texture2D AstralDesertSurfaceClose;
public static Texture2D AstralDesertSurfaceMiddle;
public static Asset<Texture2D> AstralDesertSurfaceClose;
public static Asset<Texture2D> AstralDesertSurfaceMiddle;
// Astral Snow Sky/BG
public static Texture2D AstralSnowSurfaceMiddle;
public static Asset<Texture2D> AstralSnowSurfaceMiddle;
// Sulphur Sea Sky/BG
public static Texture2D SulphurSeaSky;
public static Texture2D SulphurSeaSkyFront;
public static Texture2D SulphurSeaSurface;
public static Asset<Texture2D> SulphurSeaSky;
public static Asset<Texture2D> SulphurSeaSkyFront;
public static Asset<Texture2D> SulphurSeaSurface;
public override void OnModLoad()
{
// Astral Sky/BG
AstralSky = ModContent.Request<Texture2D>("CalamityMod/Skies/AstralSky", AssetRequestMode.ImmediateLoad).Value;
AstralSurfaceFront = ModContent.Request<Texture2D>("CalamityMod/Backgrounds/AstralSurfaceFront", AssetRequestMode.ImmediateLoad).Value;
AstralSurfaceFrontGlow = ModContent.Request<Texture2D>("CalamityMod/Backgrounds/AstralSurfaceFrontGlow", AssetRequestMode.ImmediateLoad).Value;
AstralSurfaceClose = ModContent.Request<Texture2D>("CalamityMod/Backgrounds/AstralSurfaceClose", AssetRequestMode.ImmediateLoad).Value;
AstralSurfaceCloseGlow = ModContent.Request<Texture2D>("CalamityMod/Backgrounds/AstralSurfaceCloseGlow", AssetRequestMode.ImmediateLoad).Value;
AstralSurfaceMiddle = ModContent.Request<Texture2D>("CalamityMod/Backgrounds/AstralSurfaceMiddle", AssetRequestMode.ImmediateLoad).Value;
AstralSurfaceMiddleGlow = ModContent.Request<Texture2D>("CalamityMod/Backgrounds/AstralSurfaceMiddleGlow", AssetRequestMode.ImmediateLoad).Value;
AstralSky = ModContent.Request<Texture2D>("CalamityMod/Skies/AstralSky");
AstralSurfaceFront = ModContent.Request<Texture2D>("CalamityMod/Backgrounds/AstralSurfaceFront");
AstralSurfaceFrontGlow = ModContent.Request<Texture2D>("CalamityMod/Backgrounds/AstralSurfaceFrontGlow");
AstralSurfaceClose = ModContent.Request<Texture2D>("CalamityMod/Backgrounds/AstralSurfaceClose");
AstralSurfaceCloseGlow = ModContent.Request<Texture2D>("CalamityMod/Backgrounds/AstralSurfaceCloseGlow");
AstralSurfaceMiddle = ModContent.Request<Texture2D>("CalamityMod/Backgrounds/AstralSurfaceMiddle");
AstralSurfaceMiddleGlow = ModContent.Request<Texture2D>("CalamityMod/Backgrounds/AstralSurfaceMiddleGlow");
//Astral Desert Sky/BG
AstralDesertSurfaceClose = ModContent.Request<Texture2D>("CalamityMod/Backgrounds/AstralDesertSurfaceClose", AssetRequestMode.ImmediateLoad).Value;
AstralDesertSurfaceMiddle = ModContent.Request<Texture2D>("CalamityMod/Backgrounds/AstralDesertSurfaceMiddle", AssetRequestMode.ImmediateLoad).Value;
AstralDesertSurfaceClose = ModContent.Request<Texture2D>("CalamityMod/Backgrounds/AstralDesertSurfaceClose");
AstralDesertSurfaceMiddle = ModContent.Request<Texture2D>("CalamityMod/Backgrounds/AstralDesertSurfaceMiddle");
//Astral Snow Sky/BG
AstralSnowSurfaceMiddle = ModContent.Request<Texture2D>("CalamityMod/Backgrounds/AstralSnowSurfaceMiddle", AssetRequestMode.ImmediateLoad).Value;
AstralSnowSurfaceMiddle = ModContent.Request<Texture2D>("CalamityMod/Backgrounds/AstralSnowSurfaceMiddle");
// Sulpher Sea Sky/BG
SulphurSeaSky = ModContent.Request<Texture2D>("CalamityMod/Skies/SulphurSeaSky", AssetRequestMode.ImmediateLoad).Value;
SulphurSeaSkyFront = ModContent.Request<Texture2D>("CalamityMod/Skies/SulphurSeaSkyFront", AssetRequestMode.ImmediateLoad).Value;
SulphurSeaSurface = ModContent.Request<Texture2D>("CalamityMod/Skies/SulphurSeaSurface", AssetRequestMode.ImmediateLoad).Value;
SulphurSeaSky = ModContent.Request<Texture2D>("CalamityMod/Skies/SulphurSeaSky");
SulphurSeaSkyFront = ModContent.Request<Texture2D>("CalamityMod/Skies/SulphurSeaSkyFront");
SulphurSeaSurface = ModContent.Request<Texture2D>("CalamityMod/Skies/SulphurSeaSurface");
}
public override void Unload()
+3 -3
View File
@@ -41,7 +41,7 @@ namespace CalamityMod.Skies
public override void Draw(SpriteBatch spriteBatch, float minDepth, float maxDepth)
{
if (maxDepth >= 4f && minDepth < 4f)
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);
spriteBatch.Draw(SkyTextureRefs.SulphurSeaSky.Value, 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 = SkyTextureRefs.SulphurSeaSkyFront;
Texture2D texture = SkyTextureRefs.SulphurSeaSkyFront.Value;
// 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 = SkyTextureRefs.SulphurSeaSurface;
Texture2D texture = SkyTextureRefs.SulphurSeaSurface.Value;
int x = (int)(Main.screenPosition.X * ScreenParralaxMultiplier);
x %= (int)(texture.Width * Scale);