diff --git a/NPCs/Providence/Providence.cs b/NPCs/Providence/Providence.cs index 3d82442871..239086645c 100644 --- a/NPCs/Providence/Providence.cs +++ b/NPCs/Providence/Providence.cs @@ -76,6 +76,7 @@ namespace CalamityMod.NPCs.Providence Blue = 5, Violet = 6 } + public static Color BackglowColor => new Color(20, 0, 30, 80); public int currentMode = (int)BossMode.Day; public int colorShiftTimer = -1; diff --git a/Projectiles/Boss/HolyBlast.cs b/Projectiles/Boss/HolyBlast.cs index 439e36b7dd..f3fcfea27a 100644 --- a/Projectiles/Boss/HolyBlast.cs +++ b/Projectiles/Boss/HolyBlast.cs @@ -1,7 +1,5 @@ -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.NPCs; +using CalamityMod.NPCs; using CalamityMod.NPCs.Providence; -using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; @@ -99,6 +97,8 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { + Projectile.DrawBackglow(Providence.BackglowColor, 6f); + Texture2D texture = (Projectile.maxPenetrate != (int)Providence.BossMode.Day) ? ModContent.Request(Texture).Value : ModContent.Request("CalamityMod/Projectiles/Boss/HolyBlastNight").Value; int num214 = texture.Height / Main.projFrames[Projectile.type]; int y6 = num214 * Projectile.frame; diff --git a/Projectiles/Boss/HolyBomb.cs b/Projectiles/Boss/HolyBomb.cs index 8976aee093..fd91896cc4 100644 --- a/Projectiles/Boss/HolyBomb.cs +++ b/Projectiles/Boss/HolyBomb.cs @@ -101,6 +101,8 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { + Projectile.DrawBackglow(Providence.BackglowColor, 4f); + Texture2D texture = (Projectile.maxPenetrate == (int)Providence.BossMode.Day) ? ModContent.Request(Texture).Value : ModContent.Request("CalamityMod/Projectiles/Boss/HolyBombNight").Value; int num214 = texture.Height / Main.projFrames[Projectile.type]; int y6 = num214 * Projectile.frame; diff --git a/Projectiles/Boss/HolyFire.cs b/Projectiles/Boss/HolyFire.cs index 139ebecc82..9dcb35606f 100644 --- a/Projectiles/Boss/HolyFire.cs +++ b/Projectiles/Boss/HolyFire.cs @@ -72,6 +72,8 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { + Projectile.DrawBackglow(Providence.BackglowColor, 4f); + Texture2D texture = (Projectile.maxPenetrate == (int)Providence.BossMode.Day) ? ModContent.Request(Texture).Value : ModContent.Request("CalamityMod/Projectiles/Boss/HolyFireNight").Value; int num214 = texture.Height / Main.projFrames[Projectile.type]; int y6 = num214 * Projectile.frame; diff --git a/Projectiles/Boss/HolyFire2.cs b/Projectiles/Boss/HolyFire2.cs index 71a0cdb38c..f9db03baab 100644 --- a/Projectiles/Boss/HolyFire2.cs +++ b/Projectiles/Boss/HolyFire2.cs @@ -85,6 +85,8 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { + Projectile.DrawBackglow(Providence.BackglowColor, 4f); + Texture2D texture = (Projectile.maxPenetrate == (int)Providence.BossMode.Day) ? ModContent.Request(Texture).Value : ModContent.Request("CalamityMod/Projectiles/Boss/HolyFire2Night").Value; int num214 = texture.Height / Main.projFrames[Projectile.type]; int y6 = num214 * Projectile.frame; diff --git a/Projectiles/Boss/HolyFlare.cs b/Projectiles/Boss/HolyFlare.cs index 612d0a338f..16b1e1ce0a 100644 --- a/Projectiles/Boss/HolyFlare.cs +++ b/Projectiles/Boss/HolyFlare.cs @@ -89,6 +89,8 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { + Projectile.DrawBackglow(Providence.BackglowColor, 4f); + Texture2D texture = Projectile.maxPenetrate == (int)Providence.BossMode.Day ? ModContent.Request(Texture).Value : ModContent.Request("CalamityMod/Projectiles/Boss/HolyFlareNight").Value; int num214 = texture.Height / Main.projFrames[Projectile.type]; int y6 = num214 * Projectile.frame; diff --git a/Projectiles/Boss/MoltenBlast.cs b/Projectiles/Boss/MoltenBlast.cs index 0ac2656a4d..81ba995573 100644 --- a/Projectiles/Boss/MoltenBlast.cs +++ b/Projectiles/Boss/MoltenBlast.cs @@ -113,6 +113,8 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { + Projectile.DrawBackglow(Providence.BackglowColor, 4f); + Texture2D texture2D13 = (Projectile.maxPenetrate == (int)Providence.BossMode.Day) ? ModContent.Request(Texture).Value : ModContent.Request("CalamityMod/Projectiles/Boss/MoltenBlastNight").Value; int num214 = ModContent.Request(Texture).Value.Height / Main.projFrames[Projectile.type]; int y6 = num214 * Projectile.frame; diff --git a/Projectiles/Boss/MoltenBlob.cs b/Projectiles/Boss/MoltenBlob.cs index d76cbd0558..cb01023e72 100644 --- a/Projectiles/Boss/MoltenBlob.cs +++ b/Projectiles/Boss/MoltenBlob.cs @@ -80,6 +80,8 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { + Projectile.DrawBackglow(Providence.BackglowColor, 4f); + Texture2D texture2D13 = (Projectile.maxPenetrate == (int)Providence.BossMode.Day) ? ModContent.Request(Texture).Value : ModContent.Request("CalamityMod/Projectiles/Boss/MoltenBlobNight").Value; int num214 = ModContent.Request(Texture).Value.Height / Main.projFrames[Projectile.type]; int y6 = num214 * Projectile.frame; diff --git a/Projectiles/Pets/GoldiePet.cs b/Projectiles/Pets/GoldiePet.cs index fd466e1f42..d1fa811b01 100644 --- a/Projectiles/Pets/GoldiePet.cs +++ b/Projectiles/Pets/GoldiePet.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Projectiles.Pets { public Player Owner => Main.player[Projectile.owner]; - public ref float MovementTimer => ref Projectile.ai[0]; + public ref float RotationTimer => ref Projectile.ai[0]; public ref float SparkleTimer => ref Projectile.ai[1]; public float MaxBloomTime = 30f; public float MaxSparkleTime = 150f; @@ -90,15 +90,14 @@ namespace CalamityMod.Projectiles.Pets //Chase after coins if (foundCoin) { - float itemDist = Vector2.Distance(targetLocation, Projectile.Center); Vector2 destination = Projectile.SafeDirectionTo(targetLocation); destination *= 12f; Projectile.velocity = (Projectile.velocity * 40f + destination) / 41f; Projectile.rotation = Projectile.velocity.X * 0.05f; - MovementTimer = -1f; + RotationTimer = -1f; } //Return to resting position - else if (MovementTimer == -1f) + else if (RotationTimer == -1f) { Vector2 restingSpot = Owner.Center + Vector2.UnitY * -80f; Projectile.velocity = (restingSpot - Projectile.Center) / 15f; @@ -106,15 +105,15 @@ namespace CalamityMod.Projectiles.Pets //Start spinning again when rested if (Vector2.Distance(restingSpot, Projectile.Center) <= 2f) - MovementTimer++; + RotationTimer++; } //Rotate else { Vector2 playerDist = Owner.Center - Projectile.Center; Projectile.rotation = playerDist.ToRotation() - MathHelper.PiOver2; - Projectile.Center = Owner.Center + Vector2.UnitY.RotatedBy(MovementTimer) * -80f; - MovementTimer += MathHelper.ToRadians(4f); + Projectile.Center = Owner.Center + Vector2.UnitY.RotatedBy(RotationTimer) * -80f; + RotationTimer += MathHelper.ToRadians(4f); if (Main.rand.NextBool(150) && SparkleTimer <= MaxBloomTime) SparkleTimer = MaxSparkleTime * 0.6f; //Slight sparkle randomly @@ -151,14 +150,12 @@ namespace CalamityMod.Projectiles.Pets if (bloomPercent > 0f) { - Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + Main.spriteBatch.EnterShaderRegion(BlendState.Additive); Main.EntitySpriteDraw(bloomTex, Projectile.Center - Main.screenPosition, null, GoldColor * bloomPercent * 0.2f, Projectile.rotation, bloomTex.Size() / 2f, bloomPercent * Projectile.scale * 0.3f, SpriteEffects.None, 0); Main.EntitySpriteDraw(shineTex, Projectile.Center - Main.screenPosition, null, GoldColor * shinePercent, Projectile.rotation, shineTex.Size() / 2f, shineScale * Projectile.scale, SpriteEffects.None, 0); - Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + Main.spriteBatch.ExitShaderRegion(); } return true;