diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson index 36a6cecebb..a68fd56784 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson @@ -541,6 +541,11 @@ Metastasis: { He was arrogant, disrespectful and shady. If you hadn't killed him, I would've. I made my Sepulcher as a mockery of his arrogance, but it seems the insult fell flat. You can add "slime-brained" to his list of fabricated titles.' ''' + GFB: + ''' + 'I Pulled up to Yharim's palace and saw this asshole serpent. + Told him to eat shit and die. Now we're here. + ''' } MidnightSunBeacon: { diff --git a/MainMenu/CalamityMainMenu.cs b/MainMenu/CalamityClassicMainMenu.cs similarity index 97% rename from MainMenu/CalamityMainMenu.cs rename to MainMenu/CalamityClassicMainMenu.cs index 88c1b1737f..6dadf4ec00 100644 --- a/MainMenu/CalamityMainMenu.cs +++ b/MainMenu/CalamityClassicMainMenu.cs @@ -9,7 +9,7 @@ using Terraria.ModLoader; namespace CalamityMod.MainMenu { - public class CalamityMainMenu : ModMenu + public class CalamityClassicMainMenu : ModMenu { public class Cinder { @@ -40,7 +40,7 @@ namespace CalamityMod.MainMenu } = new(); public float remixLogoRotation = 0f; - public override string DisplayName => "Calamity Style"; + public override string DisplayName => "Calamity Style - Classic"; public override Asset Logo => ModContent.Request("CalamityMod/MainMenu/Logo"); public override Asset SunTexture => ModContent.Request("CalamityMod/Backgrounds/BlankPixel"); @@ -53,7 +53,7 @@ namespace CalamityMod.MainMenu // Before drawing the logo, draw the entire Calamity background. This way, the typical parallax background is skipped entirely. public override bool PreDrawLogo(SpriteBatch spriteBatch, ref Vector2 logoDrawCenter, ref float logoRotation, ref float logoScale, ref Color drawColor) { - Texture2D texture = ModContent.Request("CalamityMod/MainMenu/MenuBackground").Value; + Texture2D texture = ModContent.Request("CalamityMod/MainMenu/ClassicMenuBackground").Value; // Calculate the draw position offset and scale in the event that someone is using a non-16:9 monitor Vector2 drawOffset = Vector2.Zero; diff --git a/MainMenu/CalamityModernMainMenu.cs b/MainMenu/CalamityModernMainMenu.cs new file mode 100644 index 0000000000..e7c16f8c70 --- /dev/null +++ b/MainMenu/CalamityModernMainMenu.cs @@ -0,0 +1,159 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.MainMenu +{ + public class CalamityModernMainMenu : ModMenu + { + public class Cinder + { + public int Time; + public int Lifetime; + public int IdentityIndex; + public float Scale; + public float Depth; + public Color DrawColor; + public Vector2 Velocity; + public Vector2 Center; + + public Cinder(int lifetime, int identity, float depth, Color color, Vector2 startingPosition, Vector2 startingVelocity) + { + Lifetime = lifetime; + IdentityIndex = identity; + Depth = depth; + DrawColor = color; + Center = startingPosition; + Velocity = startingVelocity; + } + } + + public static List Cinders + { + get; + internal set; + } = new(); + + public float remixLogoRotation = 0f; + public override string DisplayName => "Calamity Style - Modern"; + + public override Asset Logo => ModContent.Request("CalamityMod/MainMenu/Logo"); + public override Asset SunTexture => ModContent.Request("CalamityMod/Backgrounds/BlankPixel"); + public override Asset MoonTexture => ModContent.Request("CalamityMod/Backgrounds/BlankPixel"); + + public override int Music => CalamityMod.Instance.GetMusicFromMusicMod("CalamityTitle") ?? MusicID.Title; + + public override ModSurfaceBackgroundStyle MenuBackgroundStyle => ModContent.GetInstance(); + + // Before drawing the logo, draw the entire Calamity background. This way, the typical parallax background is skipped entirely. + public override bool PreDrawLogo(SpriteBatch spriteBatch, ref Vector2 logoDrawCenter, ref float logoRotation, ref float logoScale, ref Color drawColor) + { + Texture2D texture = ModContent.Request("CalamityMod/MainMenu/ModernMenuBackground").Value; + + // Calculate the draw position offset and scale in the event that someone is using a non-16:9 monitor + Vector2 drawOffset = Vector2.Zero; + float xScale = (float)Main.screenWidth / texture.Width; + float yScale = (float)Main.screenHeight / texture.Height; + float scale = xScale; + + // if someone's monitor isn't in wacky dimensions, no calculations need to be performed at all + if (xScale != yScale) + { + // If someone's monitor is tall, it needs to be shifted to the left so that it's still centered on screen + // Additionally the Y scale is used so that it still covers the entire screen + if (yScale > xScale) + { + scale = yScale; + drawOffset.X -= (texture.Width * scale - Main.screenWidth) * 0.5f; + } + else + // The opposite is true if someone's monitor is widescreen + drawOffset.Y -= (texture.Height * scale - Main.screenHeight) * 0.5f; + } + + spriteBatch.Draw(texture, drawOffset, null, Color.White, 0f, Vector2.Zero, scale, SpriteEffects.None, 0f); + + static Color selectCinderColor() + { + return Color.Lerp(Color.Lerp(Color.Crimson, Color.PaleVioletRed, 0.3f), Color.Lerp(Color.PaleGoldenrod, Color.LightSalmon, Main.rand.NextFloat()), Main.rand.NextFloat()); + } + + // Randomly add cinders. + for (int i = 0; i < 5; i++) + { + if (Main.rand.NextBool(4)) + { + int lifetime = Main.rand.Next(200, 300); + float depth = Main.rand.NextFloat(1.8f, 5f); + Vector2 startingPosition = new Vector2(Main.screenWidth * Main.rand.NextFloat(-0.1f, 1.1f), Main.screenHeight * 1.05f); + Vector2 startingVelocity = -Vector2.UnitY.RotatedBy(Main.rand.NextFloat(-0.9f, 0.9f)) * 4f; + Color cinderColor = selectCinderColor(); + Cinders.Add(new Cinder(lifetime, Cinders.Count, depth, cinderColor, startingPosition, startingVelocity)); + } + } + + // Update all cinders. + for (int i = 0; i < Cinders.Count; i++) + { + Cinders[i].Scale = Utils.GetLerpValue(Cinders[i].Lifetime, Cinders[i].Lifetime / 3, Cinders[i].Time, true); + Cinders[i].Scale *= MathHelper.Lerp(0.6f, 0.9f, Cinders[i].IdentityIndex % 6f / 6f); + if (Cinders[i].IdentityIndex % 13 == 12) + Cinders[i].Scale *= 2f; + + float flySpeed = MathHelper.Lerp(3.2f, 14f, Cinders[i].IdentityIndex % 21f / 21f); + Vector2 idealVelocity = -Vector2.UnitY.RotatedBy(MathHelper.Lerp(-0.44f, 0.44f, (float)Math.Sin(Cinders[i].Time / 16f + Cinders[i].IdentityIndex) * 0.5f + 0.5f)); + idealVelocity = (idealVelocity + Vector2.UnitX).SafeNormalize(Vector2.UnitY) * flySpeed; + + float movementInterpolant = MathHelper.Lerp(0.01f, 0.08f, Utils.GetLerpValue(45f, 145f, Cinders[i].Time, true)); + Cinders[i].Velocity = Vector2.Lerp(Cinders[i].Velocity, idealVelocity, movementInterpolant); + + Cinders[i].Time++; + Cinders[i].Center += Cinders[i].Velocity; + } + + // Clear away all dead cinders. + Cinders.RemoveAll(c => c.Time >= c.Lifetime); + + // Draw cinders. + Texture2D cinderTexture = ModContent.Request("CalamityMod/Skies/CalamitasCinder").Value; + for (int i = 0; i < Cinders.Count; i++) + { + Vector2 drawPosition = Cinders[i].Center; + spriteBatch.Draw(cinderTexture, drawPosition, null, Cinders[i].DrawColor, 0f, cinderTexture.Size() * 0.5f, Cinders[i].Scale, 0, 0f); + } + + // Set the logo draw color to be white and the time to be noon + // This is because there is not a day/night cycle in this menu, and changing colors would look bad + drawColor = Color.White; + Main.time = 27000; + Main.dayTime = true; + + // Adjust rotation based on secret seeds; only Drunk world and Remix touch this, with GFB leeching off those two + // Standard rotation is none; Drunk world makes it spin out, so it can use the vanilla rotation due to disappearing + // Remix makes it flip upside down, and in GFB it will spin forever + if (WorldGen.remixWorldGen) + { + remixLogoRotation += MathHelper.Pi / 50f; + if (remixLogoRotation >= MathHelper.Pi && !WorldGen.everythingWorldGen) + remixLogoRotation = MathHelper.Pi; + } + else + remixLogoRotation = 0f; + float rotationSecretSeedAdjusted = WorldGen.remixWorldGen ? remixLogoRotation : WorldGen.drunkWorldGen ? logoRotation : 0f; + + // Draw the logo using a different spritebatch blending setting so it doesn't have a horrible yellow glow + Vector2 drawPos = new Vector2(Main.screenWidth / 2f, 100f); + spriteBatch.End(); + spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied, SamplerState.LinearClamp, DepthStencilState.None, Main.Rasterizer, null, Main.UIScaleMatrix); + spriteBatch.Draw(Logo.Value, drawPos, null, drawColor, rotationSecretSeedAdjusted, Logo.Value.Size() * 0.5f, WorldGen.drunkWorldGen ? logoScale : 1f, SpriteEffects.None, 0f); + spriteBatch.End(); + spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.None, Main.Rasterizer, null, Main.UIScaleMatrix); + return false; + } + } +} diff --git a/MainMenu/MenuBackground.png b/MainMenu/ClassicMenuBackground.png similarity index 100% rename from MainMenu/MenuBackground.png rename to MainMenu/ClassicMenuBackground.png diff --git a/MainMenu/Logo.png b/MainMenu/Logo.png index 8cf6fe8c08..a4a84ac6ed 100644 Binary files a/MainMenu/Logo.png and b/MainMenu/Logo.png differ diff --git a/MainMenu/ModernMenuBackground.png b/MainMenu/ModernMenuBackground.png new file mode 100644 index 0000000000..8ddb82bf1b Binary files /dev/null and b/MainMenu/ModernMenuBackground.png differ