Placeholder Timeless Shores BG
This commit is contained in:
1 parent
6e0f2e7bc9
commit
c4770cb231
6 files changed
+93
-2
No files matched your search
@@ -73,6 +73,7 @@ namespace CalamityMod.Backgrounds
|
||||
// Leaving this here for other programmers, in case I don't get to doing this myself.
|
||||
Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.None, Main.Rasterizer, null, CalamityUtils.BackgroundMatrix);
|
||||
|
||||
DrawShoresBG();
|
||||
DrawBurrowsBG();
|
||||
|
||||
Main.spriteBatch.End();
|
||||
@@ -97,6 +98,7 @@ namespace CalamityMod.Backgrounds
|
||||
// rendering code if that setting is on.
|
||||
if (Main.WaveQuality > 0 || !CalamityClientConfig.Instance.SunkenSeaBackgroundDistortion)
|
||||
{
|
||||
DrawShoresBG();
|
||||
DrawBurrowsBG();
|
||||
}
|
||||
else
|
||||
@@ -123,14 +125,103 @@ namespace CalamityMod.Backgrounds
|
||||
}
|
||||
|
||||
public static float Transparency;
|
||||
|
||||
public static float TransitionSpeed => 0.02f;
|
||||
|
||||
private static void DrawShoresBG()
|
||||
{
|
||||
if (Main.LocalPlayer.InModBiome(ModContent.GetInstance<BiomeManagers.TimelessShoresBiome>()))
|
||||
{
|
||||
Transparency += 1f;
|
||||
|
||||
if (Transparency > 1f)
|
||||
Transparency = 1f;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Make transparency immediately go down so it doesnt look weird, since vanilla underground backgrounds dont have the fade-in effect this background has.
|
||||
Transparency -= 1f;
|
||||
|
||||
if (Transparency < 0f)
|
||||
Transparency = 0f;
|
||||
}
|
||||
|
||||
// Don't bother running any of the background drawing if the transparency is zero (meaning the background isnt actually active).
|
||||
// Also do not run any of the background drawing if you have the vanilla background config option turned off.
|
||||
if (Transparency > 0f && Main.BackgroundEnabled)
|
||||
{
|
||||
Vector2 vector = Main.screenPosition + new Vector2((Main.screenWidth >> 1), (Main.screenHeight >> 1));
|
||||
float num = (Main.GameViewMatrix.Zoom.Y - 1f) * 0.5f * 200f;
|
||||
float Scale = 1.5f;
|
||||
float playerDrawPosition = ((Main.LocalPlayer.Center.Y / 16f) - 90) * 16f;
|
||||
|
||||
for (int Layers = 4; Layers >= 0; Layers--)
|
||||
{
|
||||
// Get each background texture.
|
||||
Texture2D BGTexture = ModContent.Request<Texture2D>("CalamityMod/Backgrounds/SunkenSeaShoresBG" + Layers).Value;
|
||||
|
||||
Vector2 vector2 = new Vector2(BGTexture.Width, BGTexture.Height) * 0.5f;
|
||||
float num2 = (Layers * 2 + 3f);
|
||||
Vector2 vector3 = new Vector2(1f / num2);
|
||||
Rectangle rectangle = new Rectangle(0, 0, BGTexture.Width, BGTexture.Height);
|
||||
Vector2 zero = Vector2.Zero;
|
||||
|
||||
switch (Layers)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
zero.Y += 200f;
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
zero.Y += 0f;
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
zero.Y += 0f;
|
||||
break;
|
||||
}
|
||||
case 3:
|
||||
{
|
||||
zero.Y += 0f;
|
||||
break;
|
||||
}
|
||||
case 4:
|
||||
{
|
||||
zero.Y += 0f;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
vector2 *= Scale;
|
||||
|
||||
zero.Y -= num;
|
||||
float LoopWidth = Scale * rectangle.Width;
|
||||
float LoopHeight = Scale * rectangle.Height;
|
||||
int LoopX = (int)((vector.X * vector3.X - vector2.X + zero.X - (Main.screenWidth >> 1)) / LoopWidth);
|
||||
int LoopY = (int)((vector.Y * vector3.Y - vector2.Y + zero.Y - (Main.screenWidth >> 1)) / LoopWidth);
|
||||
|
||||
for (int i = LoopY - 2; i < LoopY + 4 + (int)(Main.screenWidth / LoopHeight); i++)
|
||||
{
|
||||
for (int j = LoopX - 2; j < LoopX + 4 + (int)(Main.screenWidth / LoopWidth); j++)
|
||||
{
|
||||
Vector2 drawPosition = (new Vector2(j * Scale * (rectangle.Width / vector3.X), playerDrawPosition) + vector2 - vector) * vector3 + vector - Main.screenPosition - vector2 + zero;
|
||||
|
||||
var frame = rectangle;
|
||||
var color = Color.White * Transparency;
|
||||
|
||||
Main.spriteBatch.Draw(BGTexture, drawPosition, frame, color, 0f, Vector2.Zero, Scale, SpriteEffects.None, 0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
private static void DrawBurrowsBG()
|
||||
{
|
||||
if (Main.LocalPlayer.InModBiome(ModContent.GetInstance<BiomeManagers.GleamingBurrowsBiome>()))
|
||||
{
|
||||
Transparency += TransitionSpeed;
|
||||
Transparency += 1f;
|
||||
|
||||
if (Transparency > 1f)
|
||||
Transparency = 1f;
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 47 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 58 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 24 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 38 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 4.6 KiB |
Reference in new issue
Block a user