diff --git a/CalamityMod.cs b/CalamityMod.cs index b5bf045a5a..a2cd2a8496 100644 --- a/CalamityMod.cs +++ b/CalamityMod.cs @@ -108,6 +108,9 @@ namespace CalamityMod public static Texture2D SulphurSeaSkyFront; public static Texture2D SulphurSeaSurface; + //Destroyer glowmasks + public static Asset[] DestroyerGlowmasks = new Asset[3]; + // DR data structure public static SortedDictionary DRValues; @@ -286,6 +289,11 @@ namespace CalamityMod 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); + // TODO -- Sky shaders should probably be loaded in a ModSystem Filters.Scene["CalamityMod:DevourerofGodsHead"] = new Filter(new DoGScreenShaderData("FilterMiniTower").UseColor(0.4f, 0.1f, 1.0f).UseOpacity(0.5f), EffectPriority.VeryHigh); SkyManager.Instance["CalamityMod:DevourerofGodsHead"] = new DoGSky(); diff --git a/ILEditing/ILChangesLoading.cs b/ILEditing/ILChangesLoading.cs index cf53fdf790..763d2543b0 100644 --- a/ILEditing/ILChangesLoading.cs +++ b/ILEditing/ILChangesLoading.cs @@ -154,6 +154,9 @@ namespace CalamityMod.ILEditing // Fix vanilla not accounting for spritebatch modification in held projectile drawing On_PlayerDrawLayers.DrawHeldProj += FixHeldProjectileBlendState; + // Fix vanilla not accounting for multiple bobbers when fishing with truffle worm + IL_Player.ItemCheck_CheckFishingBobbers += FixTruffleWormFishing; + //Additional detours that are in their own item files given they are only relevant to these specific items: //Rover drive detours on Player.DrawInfernoRings to draw its shield //Wulfrum armor hooks on Player.KeyDoubleTap and DrawPendingMouseText to activate its set bonus and spoof the mouse text to display the stats of the activated weapon if shift is held diff --git a/ILEditing/VanillaBugfixingILChanges.cs b/ILEditing/VanillaBugfixingILChanges.cs index fa0e9ed2f6..bfd88a5bb7 100644 --- a/ILEditing/VanillaBugfixingILChanges.cs +++ b/ILEditing/VanillaBugfixingILChanges.cs @@ -6,6 +6,7 @@ using MonoMod.Cil; using Terraria; using Terraria.DataStructures; using Terraria.Graphics.Renderers; +using Terraria.ID; namespace CalamityMod.ILEditing { @@ -69,5 +70,52 @@ namespace CalamityMod.ILEditing } } #endregion + + #region Fix Vanilla Not Accounting For Multiple Bobbers When Fishing With Truffle Worm + private void FixTruffleWormFishing(ILContext il) + { + var cursor = new ILCursor(il); + + // Initialize a flag variable whether truffle worm was used. + il.Method.Body.Variables.Add(new VariableDefinition(il.Module.TypeSystem.Boolean)); + byte truffleWormUsed = (byte) (il.Method.Body.Variables.Count - 1); + cursor.Emit(OpCodes.Ldc_I4_0); + cursor.Emit(OpCodes.Stloc_S, truffleWormUsed); + + // Move after beq.s, which is before Player.ItemCheck_CheckFishingBobber_PickAndConsumeBait gets called + if (!cursor.TryGotoNext(MoveType.After, i => i.Match(OpCodes.Beq_S))) + { + LogFailure("FixTruffleWormFishing", "Could not locate beq.s before Player.ItemCheck_CheckFishingBobber_PickAndConsumeBait."); + return; + } + + // Skip if truffle worm was already used. + var loopEnd = il.DefineLabel(); + cursor.Emit(OpCodes.Ldloc_S, truffleWormUsed); + cursor.Emit(OpCodes.Brtrue_S, loopEnd); + + // Find the call to Player.ItemCheck_CheckFishingBobber_PickAndConsumeBait. + if (!cursor.TryGotoNext(MoveType.After, i => i.MatchCall("ItemCheck_CheckFishingBobber_PickAndConsumeBait"))) + { + LogFailure("FixTruffleWormFishing", "Could not locate the call to Player.ItemCheck_CheckFishingBobber_PickAndConsumeBait."); + return; + } + + // Retrive baitTypeUsed, compare with truffle worm, and save it. + cursor.Emit(OpCodes.Ldloc_S, (byte)4); + cursor.Emit(OpCodes.Ldc_I4, ItemID.TruffleWorm); + cursor.Emit(OpCodes.Ceq); + cursor.Emit(OpCodes.Stloc_S, truffleWormUsed); + + // Move before next ldloc.0, which is the end of the loop + if (!cursor.TryGotoNext(MoveType.Before, i => i.MatchLdloc0())) + { + LogFailure("FixTruffleWormFishing", "Could not find the end of the loop."); + return; + } + + cursor.MarkLabel(loopEnd); + } + #endregion } } diff --git a/NPCs/Abyss/BabyCannonballJellyfish.cs b/NPCs/Abyss/BabyCannonballJellyfish.cs index 9e37510053..d0e71f8c0f 100644 --- a/NPCs/Abyss/BabyCannonballJellyfish.cs +++ b/NPCs/Abyss/BabyCannonballJellyfish.cs @@ -140,10 +140,10 @@ namespace CalamityMod.NPCs.Abyss Vector2 center = new Vector2(NPC.Center.X, NPC.Center.Y); Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2)); Vector2 vector = center - screenPos; - vector -= new Vector2((float)ModContent.Request("CalamityMod/NPCs/Abyss/BabyCannonballJellyfishGlow").Value.Width, (float)(ModContent.Request("CalamityMod/NPCs/Abyss/BabyCannonballJellyfishGlow").Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; + vector -= new Vector2((float)TextureAssets.Npc[NPC.type].Value.Width, (float)(TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; vector += halfSizeTexture * 1f + new Vector2(0f, 4f + NPC.gfxOffY); Color color = new Color(127 - NPC.alpha, 127 - NPC.alpha, 127 - NPC.alpha, 0).MultiplyRGBA(new Color(67, 218, 166)); - Main.spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/Abyss/BabyCannonballJellyfishGlow").Value, vector, + Main.spriteBatch.Draw(TextureAssets.Npc[NPC.type].Value, vector, new Microsoft.Xna.Framework.Rectangle?(NPC.frame), color, NPC.rotation, halfSizeTexture, 1f, spriteEffects, 0f); } diff --git a/NPCs/Abyss/BabyCannonballJellyfishGlow.png b/NPCs/Abyss/BabyCannonballJellyfishGlow.png deleted file mode 100644 index dc393d1f84..0000000000 Binary files a/NPCs/Abyss/BabyCannonballJellyfishGlow.png and /dev/null differ diff --git a/NPCs/Abyss/CannonballJellyfish.cs b/NPCs/Abyss/CannonballJellyfish.cs index 1e1fdadaec..3985c19fbe 100644 --- a/NPCs/Abyss/CannonballJellyfish.cs +++ b/NPCs/Abyss/CannonballJellyfish.cs @@ -257,11 +257,11 @@ namespace CalamityMod.NPCs.Abyss var texture = TextureAssets.Npc[NPC.type]; Vector2 halfSizeTexture = new Vector2((float)(texture.Value.Width / 2), (float)(texture.Value.Height / Main.npcFrameCount[NPC.type] / 2)); Vector2 vector = center - screenPos; - var glowTexture = ModContent.Request("CalamityMod/NPCs/Abyss/CannonballJellyfishGlow"); + var glowTexture = TextureAssets.Npc[NPC.type]; vector -= new Vector2((float)glowTexture.Value.Width, (float)(glowTexture.Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; vector += halfSizeTexture * 1f + new Vector2(0f, 4f + NPC.gfxOffY); Color color = new Color(127 - NPC.alpha, 127 - NPC.alpha, 127 - NPC.alpha, 0).MultiplyRGBA(new Color(67, 218, 166)); - Main.spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/Abyss/CannonballJellyfishGlow").Value, vector, + Main.spriteBatch.Draw(TextureAssets.Npc[NPC.type].Value, vector, new Microsoft.Xna.Framework.Rectangle?(NPC.frame), color, NPC.rotation, halfSizeTexture, 1f, spriteEffects, 0f); } diff --git a/NPCs/Abyss/CannonballJellyfishGlow.png b/NPCs/Abyss/CannonballJellyfishGlow.png deleted file mode 100644 index 4c0fd135b7..0000000000 Binary files a/NPCs/Abyss/CannonballJellyfishGlow.png and /dev/null differ diff --git a/NPCs/Abyss/ChaoticPuffer.cs b/NPCs/Abyss/ChaoticPuffer.cs index 3bbebef51c..e508bee9e5 100644 --- a/NPCs/Abyss/ChaoticPuffer.cs +++ b/NPCs/Abyss/ChaoticPuffer.cs @@ -5,6 +5,7 @@ using CalamityMod.Items.Placeables.Ores; using CalamityMod.Projectiles.Enemy; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -22,10 +23,15 @@ namespace CalamityMod.NPCs.Abyss public bool unpuffing = false; public int puffTimer = 0; public int puffingTimer = 0; + public static Asset GlowTexture; public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 11; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -147,11 +153,9 @@ namespace CalamityMod.NPCs.Abyss { if (!NPC.IsABestiaryIconDummy) { - Texture2D tex = ModContent.Request("CalamityMod/NPCs/Abyss/ChaoticPufferGlow").Value; - var effects = NPC.direction == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; - Main.EntitySpriteDraw(tex, NPC.Center - Main.screenPosition + new Vector2(0, NPC.gfxOffY + 4), + Main.EntitySpriteDraw(GlowTexture.Value, NPC.Center - Main.screenPosition + new Vector2(0, NPC.gfxOffY + 4), NPC.frame, Color.White * 0.5f, NPC.rotation, NPC.frame.Size() / 2f, NPC.scale, effects, 0); } } diff --git a/NPCs/Abyss/Cuttlefish.cs b/NPCs/Abyss/Cuttlefish.cs index 072f602272..1770f6b684 100644 --- a/NPCs/Abyss/Cuttlefish.cs +++ b/NPCs/Abyss/Cuttlefish.cs @@ -5,6 +5,7 @@ using CalamityMod.Items.Placeables.Banners; using CalamityMod.Items.Potions; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.GameContent; using Terraria.GameContent.Bestiary; @@ -17,9 +18,14 @@ namespace CalamityMod.NPCs.Abyss { public class Cuttlefish : ModNPC { + public static Asset GlowTexture; public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 5; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -348,11 +354,9 @@ namespace CalamityMod.NPCs.Abyss { if (!NPC.IsABestiaryIconDummy) { - Texture2D tex = ModContent.Request("CalamityMod/NPCs/Abyss/CuttlefishGlow").Value; - var effects = NPC.direction == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; - Main.EntitySpriteDraw(tex, NPC.Center - Main.screenPosition + new Vector2(0, NPC.gfxOffY + 4), + Main.EntitySpriteDraw(GlowTexture.Value, NPC.Center - Main.screenPosition + new Vector2(0, NPC.gfxOffY + 4), NPC.frame, Color.White * 0.5f, NPC.rotation, NPC.frame.Size() / 2f, NPC.scale, effects, 0); } } diff --git a/NPCs/Abyss/DevilFish.cs b/NPCs/Abyss/DevilFish.cs index e4f3eb7c37..d8bb936e3b 100644 --- a/NPCs/Abyss/DevilFish.cs +++ b/NPCs/Abyss/DevilFish.cs @@ -9,6 +9,7 @@ using CalamityMod.Items.Placeables.Ores; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -24,6 +25,7 @@ namespace CalamityMod.NPCs.Abyss public bool brokenMask = false; public int hitCounter = 0; + public static Asset GlowTexture; public override void SetStaticDefaults() { @@ -34,6 +36,10 @@ namespace CalamityMod.NPCs.Abyss }; value.Position.X += 30f; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -286,11 +292,9 @@ namespace CalamityMod.NPCs.Abyss { if (!NPC.IsABestiaryIconDummy) { - Texture2D tex = ModContent.Request("CalamityMod/NPCs/Abyss/DevilFishGlow").Value; - var effects = NPC.direction == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; - Main.EntitySpriteDraw(tex, NPC.Center - Main.screenPosition + new Vector2(0, NPC.gfxOffY + 4), + Main.EntitySpriteDraw(GlowTexture.Value, NPC.Center - Main.screenPosition + new Vector2(0, NPC.gfxOffY + 4), NPC.frame, Color.White * 0.5f, NPC.rotation, NPC.frame.Size() / 2f, NPC.scale, effects, 0); } } diff --git a/NPCs/Abyss/DevilFishAlt.cs b/NPCs/Abyss/DevilFishAlt.cs index 847dadb2f4..607e863a20 100644 --- a/NPCs/Abyss/DevilFishAlt.cs +++ b/NPCs/Abyss/DevilFishAlt.cs @@ -6,6 +6,7 @@ using CalamityMod.Items.Placeables.Banners; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -19,11 +20,16 @@ namespace CalamityMod.NPCs.Abyss { public bool brokenMask = false; public int hitCounter = 0; + public static Asset GlowTexture; public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 16; this.HideFromBestiary(); + if (!Main.dedServ) + { + GlowTexture = ModContent.Request("CalamityMod/NPCs/Abyss/DevilFishGlowAlt", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -268,11 +274,9 @@ namespace CalamityMod.NPCs.Abyss { if (!NPC.IsABestiaryIconDummy) { - Texture2D tex = ModContent.Request("CalamityMod/NPCs/Abyss/DevilFishGlowAlt").Value; - var effects = NPC.direction == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; - Main.EntitySpriteDraw(tex, NPC.Center - Main.screenPosition + new Vector2(0, NPC.gfxOffY + 4), + Main.EntitySpriteDraw(GlowTexture.Value, NPC.Center - Main.screenPosition + new Vector2(0, NPC.gfxOffY + 4), NPC.frame, Color.White * 0.5f, NPC.rotation, NPC.frame.Size() / 2f, NPC.scale, effects, 0); } } diff --git a/NPCs/Abyss/EidolonWyrmBody.cs b/NPCs/Abyss/EidolonWyrmBody.cs index 76980e727e..de8d0bb5d9 100644 --- a/NPCs/Abyss/EidolonWyrmBody.cs +++ b/NPCs/Abyss/EidolonWyrmBody.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.GameContent; using Terraria.ID; @@ -11,9 +12,14 @@ namespace CalamityMod.NPCs.Abyss public class EidolonWyrmBody : ModNPC { public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.EidolonWyrmHead.DisplayName"); + public static Asset GlowTexture; public override void SetStaticDefaults() { this.HideFromBestiary(); + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -134,10 +140,10 @@ namespace CalamityMod.NPCs.Abyss Vector2 center = new Vector2(NPC.Center.X, NPC.Center.Y); Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2)); Vector2 vector = center - screenPos; - vector -= new Vector2((float)ModContent.Request("CalamityMod/NPCs/Abyss/EidolonWyrmBodyGlow").Value.Width, (float)(ModContent.Request("CalamityMod/NPCs/Abyss/EidolonWyrmBodyGlow").Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; + vector -= new Vector2((float)GlowTexture.Value.Width, (float)(GlowTexture.Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; vector += halfSizeTexture * 1f + new Vector2(0f, 4f + NPC.gfxOffY); Color color = new Color(127 - NPC.alpha, 127 - NPC.alpha, 127 - NPC.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.LightYellow); - Main.spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/Abyss/EidolonWyrmBodyGlow").Value, vector, + Main.spriteBatch.Draw(GlowTexture.Value, vector, new Microsoft.Xna.Framework.Rectangle?(NPC.frame), color, NPC.rotation, halfSizeTexture, 1f, spriteEffects, 0f); } diff --git a/NPCs/Abyss/EidolonWyrmBodyAlt.cs b/NPCs/Abyss/EidolonWyrmBodyAlt.cs index 85821afc52..c0a31646c9 100644 --- a/NPCs/Abyss/EidolonWyrmBodyAlt.cs +++ b/NPCs/Abyss/EidolonWyrmBodyAlt.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.GameContent; using Terraria.ID; @@ -11,9 +12,14 @@ namespace CalamityMod.NPCs.Abyss public class EidolonWyrmBodyAlt : ModNPC { public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.EidolonWyrmHead.DisplayName"); + public static Asset GlowTexture; public override void SetStaticDefaults() { this.HideFromBestiary(); + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -134,10 +140,10 @@ namespace CalamityMod.NPCs.Abyss Vector2 center = new Vector2(NPC.Center.X, NPC.Center.Y); Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2)); Vector2 vector = center - screenPos; - vector -= new Vector2((float)ModContent.Request("CalamityMod/NPCs/Abyss/EidolonWyrmBodyAltGlow").Value.Width, (float)(ModContent.Request("CalamityMod/NPCs/Abyss/EidolonWyrmBodyAltGlow").Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; + vector -= new Vector2((float)GlowTexture.Value.Width, (float)(GlowTexture.Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; vector += halfSizeTexture * 1f + new Vector2(0f, NPC.gfxOffY); Color color = new Color(127 - NPC.alpha, 127 - NPC.alpha, 127 - NPC.alpha, 0).MultiplyRGBA(Color.White); - Main.spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/Abyss/EidolonWyrmBodyAltGlow").Value, vector, + Main.spriteBatch.Draw(GlowTexture.Value, vector, new Microsoft.Xna.Framework.Rectangle?(NPC.frame), color, NPC.rotation, halfSizeTexture, 1f, spriteEffects, 0f); } diff --git a/NPCs/Abyss/EidolonWyrmHead.cs b/NPCs/Abyss/EidolonWyrmHead.cs index f6f6d89f55..04b2afeb47 100644 --- a/NPCs/Abyss/EidolonWyrmHead.cs +++ b/NPCs/Abyss/EidolonWyrmHead.cs @@ -14,6 +14,7 @@ using CalamityMod.Sounds; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -34,7 +35,7 @@ namespace CalamityMod.NPCs.Abyss public float speed = 5f; //10 public float turnSpeed = 0.1f; //0.15 bool TailSpawned = false; - + public static Asset GlowTexture; public override void SetStaticDefaults() { NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() @@ -44,6 +45,10 @@ namespace CalamityMod.NPCs.Abyss }; value.Position.X += 40; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -430,10 +435,10 @@ namespace CalamityMod.NPCs.Abyss Vector2 center = new Vector2(NPC.Center.X, NPC.Center.Y); Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2)); Vector2 vector = center - screenPos; - vector -= new Vector2((float)ModContent.Request("CalamityMod/NPCs/Abyss/EidolonWyrmHeadGlow").Value.Width, (float)(ModContent.Request("CalamityMod/NPCs/Abyss/EidolonWyrmHeadGlow").Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; + vector -= new Vector2((float)GlowTexture.Value.Width, (float)(GlowTexture.Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; vector += halfSizeTexture * 1f + new Vector2(0f, NPC.gfxOffY); Color color = new Color(127 - NPC.alpha, 127 - NPC.alpha, 127 - NPC.alpha, 0).MultiplyRGBA(Color.White); - Main.spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/Abyss/EidolonWyrmHeadGlow").Value, vector, + Main.spriteBatch.Draw(GlowTexture.Value, vector, new Microsoft.Xna.Framework.Rectangle?(NPC.frame), color, NPC.rotation, halfSizeTexture, 1f, spriteEffects, 0f); } diff --git a/NPCs/Abyss/EidolonWyrmTail.cs b/NPCs/Abyss/EidolonWyrmTail.cs index 4a4f992355..45ff9eb1da 100644 --- a/NPCs/Abyss/EidolonWyrmTail.cs +++ b/NPCs/Abyss/EidolonWyrmTail.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.GameContent; using Terraria.ID; @@ -11,9 +12,14 @@ namespace CalamityMod.NPCs.Abyss public class EidolonWyrmTail : ModNPC { public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.EidolonWyrmHead.DisplayName"); + public static Asset GlowTexture; public override void SetStaticDefaults() { this.HideFromBestiary(); + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -134,10 +140,10 @@ namespace CalamityMod.NPCs.Abyss Vector2 center = new Vector2(NPC.Center.X, NPC.Center.Y); Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2)); Vector2 vector = center - screenPos; - vector -= new Vector2((float)ModContent.Request("CalamityMod/NPCs/Abyss/EidolonWyrmTailGlow").Value.Width, (float)(ModContent.Request("CalamityMod/NPCs/Abyss/EidolonWyrmTailGlow").Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; + vector -= new Vector2((float)GlowTexture.Value.Width, (float)(GlowTexture.Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; vector += halfSizeTexture * 1f + new Vector2(0f, 4f + NPC.gfxOffY); Color color = new Color(127 - NPC.alpha, 127 - NPC.alpha, 127 - NPC.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.LightYellow); - Main.spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/Abyss/EidolonWyrmTailGlow").Value, vector, + Main.spriteBatch.Draw(GlowTexture.Value, vector, new Microsoft.Xna.Framework.Rectangle?(NPC.frame), color, NPC.rotation, halfSizeTexture, 1f, spriteEffects, 0f); } diff --git a/NPCs/Abyss/GiantSquid.cs b/NPCs/Abyss/GiantSquid.cs index 0b07b1dd7f..c6e40661f5 100644 --- a/NPCs/Abyss/GiantSquid.cs +++ b/NPCs/Abyss/GiantSquid.cs @@ -7,6 +7,7 @@ using CalamityMod.Items.Placeables.Banners; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.GameContent; using Terraria.GameContent.Bestiary; @@ -19,10 +20,15 @@ namespace CalamityMod.NPCs.Abyss public class GiantSquid : ModNPC { private bool hasBeenHit = false; + public static Asset GlowTexture; public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 5; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -222,11 +228,9 @@ namespace CalamityMod.NPCs.Abyss { if (!NPC.IsABestiaryIconDummy) { - Texture2D tex = ModContent.Request("CalamityMod/NPCs/Abyss/GiantSquidGlow").Value; - var effects = NPC.direction == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; - Main.EntitySpriteDraw(tex, NPC.Center - Main.screenPosition + new Vector2(0, NPC.gfxOffY + 4), + Main.EntitySpriteDraw(GlowTexture.Value, NPC.Center - Main.screenPosition + new Vector2(0, NPC.gfxOffY + 4), NPC.frame, Color.White * 0.5f, NPC.rotation, NPC.frame.Size() / 2f, NPC.scale, effects, 0); } } diff --git a/NPCs/Abyss/GulperEelBody.cs b/NPCs/Abyss/GulperEelBody.cs index 6171fc604a..e043327a62 100644 --- a/NPCs/Abyss/GulperEelBody.cs +++ b/NPCs/Abyss/GulperEelBody.cs @@ -2,6 +2,7 @@ using CalamityMod.Items.Placeables.Banners; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.GameContent; using Terraria.ID; @@ -13,9 +14,14 @@ namespace CalamityMod.NPCs.Abyss public class GulperEelBody : ModNPC { public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.GulperEelHead.DisplayName"); + public static Asset GlowTexture; public override void SetStaticDefaults() { this.HideFromBestiary(); + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -142,10 +148,10 @@ namespace CalamityMod.NPCs.Abyss Vector2 center = new Vector2(NPC.Center.X, NPC.Center.Y); Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2)); Vector2 vector = center - screenPos; - vector -= new Vector2((float)ModContent.Request("CalamityMod/NPCs/Abyss/GulperEelBodyGlow").Value.Width, (float)(ModContent.Request("CalamityMod/NPCs/Abyss/GulperEelBodyGlow").Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; + vector -= new Vector2((float)GlowTexture.Value.Width, (float)(GlowTexture.Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; vector += halfSizeTexture * 1f + new Vector2(0f, NPC.gfxOffY); Color color = new Color(127 - NPC.alpha, 127 - NPC.alpha, 127 - NPC.alpha, 0).MultiplyRGBA(Color.White); - Main.spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/Abyss/GulperEelBodyGlow").Value, vector, + Main.spriteBatch.Draw(GlowTexture.Value, vector, new Microsoft.Xna.Framework.Rectangle?(NPC.frame), color, NPC.rotation, halfSizeTexture, 1f, spriteEffects, 0f); } diff --git a/NPCs/Abyss/GulperEelBodyAlt.cs b/NPCs/Abyss/GulperEelBodyAlt.cs index b9077edc41..ce6ac572b1 100644 --- a/NPCs/Abyss/GulperEelBodyAlt.cs +++ b/NPCs/Abyss/GulperEelBodyAlt.cs @@ -2,6 +2,7 @@ using CalamityMod.Items.Placeables.Banners; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.GameContent; using Terraria.ID; @@ -13,9 +14,14 @@ namespace CalamityMod.NPCs.Abyss public class GulperEelBodyAlt : ModNPC { public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.GulperEelHead.DisplayName"); + public static Asset GlowTexture; public override void SetStaticDefaults() { this.HideFromBestiary(); + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -142,10 +148,10 @@ namespace CalamityMod.NPCs.Abyss Vector2 center = new Vector2(NPC.Center.X, NPC.Center.Y); Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2)); Vector2 vector = center - screenPos; - vector -= new Vector2((float)ModContent.Request("CalamityMod/NPCs/Abyss/GulperEelBodyAltGlow").Value.Width, (float)(ModContent.Request("CalamityMod/NPCs/Abyss/GulperEelBodyAltGlow").Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; + vector -= new Vector2((float)GlowTexture.Value.Width, (float)(GlowTexture.Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; vector += halfSizeTexture * 1f + new Vector2(0f, 4f + NPC.gfxOffY); Color color = new Color(127 - NPC.alpha, 127 - NPC.alpha, 127 - NPC.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.LightYellow); - Main.spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/Abyss/GulperEelBodyAltGlow").Value, vector, + Main.spriteBatch.Draw(GlowTexture.Value, vector, new Microsoft.Xna.Framework.Rectangle?(NPC.frame), color, NPC.rotation, halfSizeTexture, 1f, spriteEffects, 0f); } diff --git a/NPCs/Abyss/GulperEelHead.cs b/NPCs/Abyss/GulperEelHead.cs index 95ace8e260..1d09fd334f 100644 --- a/NPCs/Abyss/GulperEelHead.cs +++ b/NPCs/Abyss/GulperEelHead.cs @@ -6,6 +6,7 @@ using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.GameContent; using Terraria.GameContent.Bestiary; @@ -24,6 +25,7 @@ namespace CalamityMod.NPCs.Abyss public float speed = 5f; //10 public float turnSpeed = 0.075f; //0.15 bool TailSpawned = false; + public static Asset GlowTexture; public override void SetStaticDefaults() { @@ -37,6 +39,10 @@ namespace CalamityMod.NPCs.Abyss value.Position.X += 50; value.Position.Y += 20; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -351,10 +357,10 @@ namespace CalamityMod.NPCs.Abyss Vector2 center = new Vector2(NPC.Center.X, NPC.Center.Y); Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2)); Vector2 vector = center - screenPos; - vector -= new Vector2((float)ModContent.Request("CalamityMod/NPCs/Abyss/GulperEelHeadGlow").Value.Width, (float)(ModContent.Request("CalamityMod/NPCs/Abyss/GulperEelHeadGlow").Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; + vector -= new Vector2((float)GlowTexture.Value.Width, (float)(GlowTexture.Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; vector += halfSizeTexture * 1f + new Vector2(0f, 4f + NPC.gfxOffY); Color color = new Color(127 - NPC.alpha, 127 - NPC.alpha, 127 - NPC.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.LightYellow); - Main.spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/Abyss/GulperEelHeadGlow").Value, vector, + Main.spriteBatch.Draw(GlowTexture.Value, vector, new Microsoft.Xna.Framework.Rectangle?(NPC.frame), color, NPC.rotation, halfSizeTexture, 1f, spriteEffects, 0f); } diff --git a/NPCs/Abyss/GulperEelTail.cs b/NPCs/Abyss/GulperEelTail.cs index ebf82a587f..48748c15c8 100644 --- a/NPCs/Abyss/GulperEelTail.cs +++ b/NPCs/Abyss/GulperEelTail.cs @@ -2,6 +2,7 @@ using CalamityMod.Items.Placeables.Banners; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.GameContent; using Terraria.ID; @@ -13,9 +14,14 @@ namespace CalamityMod.NPCs.Abyss public class GulperEelTail : ModNPC { public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.GulperEelHead.DisplayName"); + public static Asset GlowTexture; public override void SetStaticDefaults() { this.HideFromBestiary(); + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -142,10 +148,10 @@ namespace CalamityMod.NPCs.Abyss Vector2 center = new Vector2(NPC.Center.X, NPC.Center.Y); Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2)); Vector2 vector = center - screenPos; - vector -= new Vector2((float)ModContent.Request("CalamityMod/NPCs/Abyss/GulperEelTailGlow").Value.Width, (float)(ModContent.Request("CalamityMod/NPCs/Abyss/GulperEelTailGlow").Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; + vector -= new Vector2((float)GlowTexture.Value.Width, (float)(GlowTexture.Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; vector += halfSizeTexture * 1f + new Vector2(0f, 4f + NPC.gfxOffY); Color color = new Color(127 - NPC.alpha, 127 - NPC.alpha, 127 - NPC.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.LightYellow); - Main.spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/Abyss/GulperEelTailGlow").Value, vector, + Main.spriteBatch.Draw(GlowTexture.Value, vector, new Microsoft.Xna.Framework.Rectangle?(NPC.frame), color, NPC.rotation, halfSizeTexture, 1f, spriteEffects, 0f); } diff --git a/NPCs/Abyss/Laserfish.cs b/NPCs/Abyss/Laserfish.cs index f00e904bd2..6a70bdf5c1 100644 --- a/NPCs/Abyss/Laserfish.cs +++ b/NPCs/Abyss/Laserfish.cs @@ -5,6 +5,7 @@ using CalamityMod.Items.Placeables.Banners; using CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.GameContent; using Terraria.GameContent.Bestiary; @@ -16,9 +17,14 @@ namespace CalamityMod.NPCs.Abyss { public class Laserfish : ModNPC { + public static Asset GlowTexture; public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 6; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -101,11 +107,9 @@ namespace CalamityMod.NPCs.Abyss { if (!NPC.IsABestiaryIconDummy) { - Texture2D tex = ModContent.Request("CalamityMod/NPCs/Abyss/LaserfishGlow").Value; - var effects = NPC.direction == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; - Main.EntitySpriteDraw(tex, NPC.Center - Main.screenPosition + new Vector2(0, NPC.gfxOffY + 4), + Main.EntitySpriteDraw(GlowTexture.Value, NPC.Center - Main.screenPosition + new Vector2(0, NPC.gfxOffY + 4), NPC.frame, Color.White * 0.5f, NPC.rotation, NPC.frame.Size() / 2f, NPC.scale, effects, 0); } } diff --git a/NPCs/Abyss/LuminousCorvina.cs b/NPCs/Abyss/LuminousCorvina.cs index 53f212879f..a729bdce48 100644 --- a/NPCs/Abyss/LuminousCorvina.cs +++ b/NPCs/Abyss/LuminousCorvina.cs @@ -9,6 +9,7 @@ using CalamityMod.Items.Placeables.Banners; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -21,6 +22,8 @@ namespace CalamityMod.NPCs.Abyss { public class LuminousCorvina : ModNPC { + public static Asset GlowTexture; + public static readonly SoundStyle ScreamSound = new("CalamityMod/Sounds/Custom/CorvinaScream"); private bool hasBeenHit = false; @@ -29,6 +32,10 @@ namespace CalamityMod.NPCs.Abyss public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 8; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -280,11 +287,9 @@ namespace CalamityMod.NPCs.Abyss { if (!NPC.IsABestiaryIconDummy) { - Texture2D tex = ModContent.Request("CalamityMod/NPCs/Abyss/LuminousCorvinaGlow").Value; - var effects = NPC.direction == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; - Main.EntitySpriteDraw(tex, NPC.Center - Main.screenPosition + new Vector2(0, NPC.gfxOffY + 4), + Main.EntitySpriteDraw(GlowTexture.Value, NPC.Center - Main.screenPosition + new Vector2(0, NPC.gfxOffY + 4), NPC.frame, Color.White * 0.5f, NPC.rotation, NPC.frame.Size() / 2f, NPC.scale, effects, 0); } } diff --git a/NPCs/Abyss/MirageJelly.cs b/NPCs/Abyss/MirageJelly.cs index 1982269410..c57b37a7d0 100644 --- a/NPCs/Abyss/MirageJelly.cs +++ b/NPCs/Abyss/MirageJelly.cs @@ -6,6 +6,7 @@ using CalamityMod.Items.Placeables.Banners; using CalamityMod.Items.Weapons.Magic; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.GameContent; using Terraria.GameContent.Bestiary; @@ -21,6 +22,7 @@ namespace CalamityMod.NPCs.Abyss private bool teleporting = false; private bool rephasing = false; private bool hasBeenHit = false; + public static Asset GlowTexture; public override void SetStaticDefaults() { @@ -31,6 +33,10 @@ namespace CalamityMod.NPCs.Abyss }; value.Position.Y += 30f; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -193,11 +199,9 @@ Block: { if (!NPC.IsABestiaryIconDummy) { - Texture2D tex = ModContent.Request("CalamityMod/NPCs/Abyss/MirageJellyGlow").Value; - var effects = NPC.direction == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; - Main.EntitySpriteDraw(tex, NPC.Center - Main.screenPosition + new Vector2(0, NPC.gfxOffY + 4), + Main.EntitySpriteDraw(GlowTexture.Value, NPC.Center - Main.screenPosition + new Vector2(0, NPC.gfxOffY + 4), NPC.frame, Color.White * 0.5f, NPC.rotation, NPC.frame.Size() / 2f, NPC.scale, effects, 0); } } diff --git a/NPCs/Abyss/ReaperShark.cs b/NPCs/Abyss/ReaperShark.cs index be757a7c8e..31f5187f31 100644 --- a/NPCs/Abyss/ReaperShark.cs +++ b/NPCs/Abyss/ReaperShark.cs @@ -23,6 +23,8 @@ namespace CalamityMod.NPCs.Abyss { public class ReaperShark : ModNPC { + public static Asset ManTexture; + public static readonly SoundStyle SearchRoarSound = new("CalamityMod/Sounds/Custom/ReaperSearchRoar"); public static readonly SoundStyle EnragedRoarSound = new("CalamityMod/Sounds/Custom/ReaperEnragedRoar"); @@ -33,6 +35,10 @@ namespace CalamityMod.NPCs.Abyss public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 4; + if (!Main.dedServ) + { + ManTexture = ModContent.Request(Texture + "Man", AssetRequestMode.ImmediateLoad); + } } public override void SetDefaults() @@ -688,7 +694,7 @@ namespace CalamityMod.NPCs.Abyss SpriteEffects spriteEffects = SpriteEffects.None; if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Asset npcTexture = Main.zenithWorld ? ModContent.Request("CalamityMod/NPCs/Abyss/ReaperSharkMan") : TextureAssets.Npc[NPC.type]; + Asset npcTexture = Main.zenithWorld ? ManTexture : TextureAssets.Npc[NPC.type]; Rectangle nframe = npcTexture.Frame(1, 4, 0, (int)NPC.frameCounter); Vector2 origin = new Vector2((float)(npcTexture.Value.Width / 2), (float)(npcTexture.Value.Height / Main.npcFrameCount[NPC.type] / 2)); Vector2 npcOffset = NPC.Center - screenPos; diff --git a/NPCs/Abyss/SlabCrab.cs b/NPCs/Abyss/SlabCrab.cs index 71f49671b7..f1be88ae90 100644 --- a/NPCs/Abyss/SlabCrab.cs +++ b/NPCs/Abyss/SlabCrab.cs @@ -6,6 +6,7 @@ using CalamityMod.Items.Placeables; using CalamityMod.Items.Placeables.Banners; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent.Bestiary; @@ -36,9 +37,14 @@ namespace CalamityMod.NPCs.Abyss public const int BaseDefense = 10; // the crab's defense while hostile public const int BaseAttack = 20; // the crab's damage while hostile public const float BaseKB = 1f; // the crab's knockback taken while hostile + public static Asset GlowTexture; public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 23; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -457,11 +463,9 @@ namespace CalamityMod.NPCs.Abyss { if (!NPC.IsABestiaryIconDummy) { - Texture2D tex = ModContent.Request("CalamityMod/NPCs/Abyss/SlabCrabGlow").Value; - var effects = NPC.spriteDirection != 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; - Main.EntitySpriteDraw(tex, NPC.Center - Main.screenPosition + new Vector2(0, NPC.gfxOffY + 4), + Main.EntitySpriteDraw(GlowTexture.Value, NPC.Center - Main.screenPosition + new Vector2(0, NPC.gfxOffY + 4), NPC.frame, Color.White * 0.5f, NPC.rotation, NPC.frame.Size() / 2f, NPC.scale, effects, 0); } } diff --git a/NPCs/Abyss/ToxicMinnow.cs b/NPCs/Abyss/ToxicMinnow.cs index 75fd78b6af..02efa40f7b 100644 --- a/NPCs/Abyss/ToxicMinnow.cs +++ b/NPCs/Abyss/ToxicMinnow.cs @@ -7,6 +7,7 @@ using CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs; using CalamityMod.Projectiles.Enemy; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -19,6 +20,7 @@ namespace CalamityMod.NPCs.Abyss { public class ToxicMinnow : ModNPC { + public static Asset GlowTexture; public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 4; @@ -27,6 +29,10 @@ namespace CalamityMod.NPCs.Abyss Scale = 0.8f, }; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -122,11 +128,9 @@ namespace CalamityMod.NPCs.Abyss { if (!NPC.IsABestiaryIconDummy) { - Texture2D tex = ModContent.Request("CalamityMod/NPCs/Abyss/ToxicMinnowGlow").Value; - var effects = NPC.direction == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; - Main.EntitySpriteDraw(tex, NPC.Center - Main.screenPosition + new Vector2(0, NPC.gfxOffY + 4), + Main.EntitySpriteDraw(GlowTexture.Value, NPC.Center - Main.screenPosition + new Vector2(0, NPC.gfxOffY + 4), NPC.frame, Color.White * 0.5f, NPC.rotation, NPC.frame.Size() / 2f, NPC.scale, effects, 0); } } diff --git a/NPCs/Abyss/Viperfish.cs b/NPCs/Abyss/Viperfish.cs index e7c2f3b0f5..f774286a91 100644 --- a/NPCs/Abyss/Viperfish.cs +++ b/NPCs/Abyss/Viperfish.cs @@ -6,6 +6,7 @@ using CalamityMod.Items.Placeables.Banners; using CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.GameContent; using Terraria.GameContent.Bestiary; @@ -17,6 +18,7 @@ namespace CalamityMod.NPCs.Abyss { public class Viperfish : ModNPC { + public static Asset GlowTexture; public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 4; @@ -26,6 +28,10 @@ namespace CalamityMod.NPCs.Abyss }; value.Position.X += 15; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -121,11 +127,9 @@ namespace CalamityMod.NPCs.Abyss { if (!NPC.IsABestiaryIconDummy) { - Texture2D tex = ModContent.Request("CalamityMod/NPCs/Abyss/ViperfishGlow").Value; - var effects = NPC.direction == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; - Main.EntitySpriteDraw(tex, NPC.Center - Main.screenPosition + new Vector2(0, NPC.gfxOffY + 4), + Main.EntitySpriteDraw(GlowTexture.Value, NPC.Center - Main.screenPosition + new Vector2(0, NPC.gfxOffY + 4), NPC.frame, Color.White * 0.5f, NPC.rotation, NPC.frame.Size() / 2f, NPC.scale, effects, 0); } } diff --git a/NPCs/AcidRain/AcidEel.cs b/NPCs/AcidRain/AcidEel.cs index 394258be56..56968b2b93 100644 --- a/NPCs/AcidRain/AcidEel.cs +++ b/NPCs/AcidRain/AcidEel.cs @@ -9,6 +9,7 @@ using CalamityMod.Items.Placeables.Banners; using CalamityMod.Items.Weapons.Magic; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent.Bestiary; @@ -22,6 +23,9 @@ namespace CalamityMod.NPCs.AcidRain public class AcidEel : ModNPC { public Player Target => Main.player[NPC.target]; + public static Asset BodyTexture; + public static Asset TailTexture; + public static Asset BestiaryTexture; public override void SetStaticDefaults() { @@ -34,6 +38,12 @@ namespace CalamityMod.NPCs.AcidRain }; value.Position.X += 15; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + if (!Main.dedServ) + { + BodyTexture = ModContent.Request(Texture + "Body", AssetRequestMode.ImmediateLoad); + TailTexture = ModContent.Request(Texture + "Tail", AssetRequestMode.AsyncLoad); + BestiaryTexture = ModContent.Request(Texture + "Bestiary", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -184,14 +194,14 @@ namespace CalamityMod.NPCs.AcidRain Vector2 headDrawPosition = NPC.Center - screenPos; if (NPC.IsABestiaryIconDummy) { - Texture2D texture = ModContent.Request("CalamityMod/NPCs/AcidRain/AcidEelBestiary").Value; + Texture2D texture = BestiaryTexture.Value; Rectangle eelArea = NPC.frame with { Width = 74 }; Main.EntitySpriteDraw(texture, headDrawPosition, eelArea, NPC.GetAlpha(Color.White), NPC.rotation, eelArea.Size() * 0.5f, NPC.scale, SpriteEffects.None, 0); return false; } Texture2D headTexture = ModContent.Request(Texture).Value; - Texture2D tailTexture = ModContent.Request("CalamityMod/NPCs/AcidRain/AcidEelTail").Value; + Texture2D tailTexture = TailTexture.Value; Vector2[] segmentPositions = (Vector2[])NPC.oldPos.Clone(); Vector2 segmentAreaTopLeft = Vector2.One * 999999f; @@ -221,7 +231,7 @@ namespace CalamityMod.NPCs.AcidRain float offsetAngle = (NPC.position - NPC.oldPos[1]).ToRotation(); Vector2 primitiveArea = (segmentAreaTopRight - segmentAreaTopLeft).RotatedBy(offsetAngle); Rectangle tailArea = NPC.frame with { Width = 28 }; - GameShaders.Misc["CalamityMod:PrimitiveTexture"].SetShaderTexture(ModContent.Request("CalamityMod/NPCs/AcidRain/AcidEelBody")); + GameShaders.Misc["CalamityMod:PrimitiveTexture"].SetShaderTexture(BodyTexture); GameShaders.Misc["CalamityMod:PrimitiveTexture"].Shader.Parameters["uPrimitiveSize"].SetValue(primitiveArea); GameShaders.Misc["CalamityMod:PrimitiveTexture"].Shader.Parameters["flipVertically"].SetValue(NPC.velocity.X > 0f); diff --git a/NPCs/AcidRain/CragmawMire.cs b/NPCs/AcidRain/CragmawMire.cs index cd9d1511ab..91d48249b1 100644 --- a/NPCs/AcidRain/CragmawMire.cs +++ b/NPCs/AcidRain/CragmawMire.cs @@ -9,8 +9,10 @@ using CalamityMod.Projectiles.Enemy; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; +using Terraria.GameContent; using Terraria.GameContent.Bestiary; using Terraria.GameContent.ItemDropRules; using Terraria.ID; @@ -51,11 +53,16 @@ namespace CalamityMod.NPCs.AcidRain return NPC.life / (float)NPC.lifeMax < phase2CeilingRatio && DownedBossSystem.downedPolterghast; } } + public static Asset Phase2Texture; public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 2; NPCID.Sets.BossBestiaryPriority.Add(Type); + if (!Main.dedServ) + { + Phase2Texture = ModContent.Request(Texture + "2", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -467,7 +474,7 @@ namespace CalamityMod.NPCs.AcidRain public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { - Texture2D texture = InPhase2 ? ModContent.Request("CalamityMod/NPCs/AcidRain/CragmawMire2").Value : ModContent.Request("CalamityMod/NPCs/AcidRain/CragmawMire").Value; + Texture2D texture = InPhase2 ? Phase2Texture.Value : TextureAssets.Npc[Type].Value; Main.EntitySpriteDraw(texture, NPC.Center - screenPos, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, NPC.frame.Size() * 0.5f, NPC.scale, 0, 0); return false; } diff --git a/NPCs/AcidRain/GammaSlime.cs b/NPCs/AcidRain/GammaSlime.cs index 5e01dc22f8..e137b8a80d 100644 --- a/NPCs/AcidRain/GammaSlime.cs +++ b/NPCs/AcidRain/GammaSlime.cs @@ -6,6 +6,7 @@ using CalamityMod.Items.Placeables.Banners; using CalamityMod.Projectiles.Enemy; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent.Bestiary; @@ -24,10 +25,15 @@ namespace CalamityMod.NPCs.AcidRain public float LaserTelegraphOpacity => MathHelper.Lerp(0.3f, 0.9f, LaserTelegraphPower); public ref float GammaAcidShootTimer => ref NPC.ai[0]; public ref float LaserShootCountdown => ref NPC.ai[1]; + public static Asset GlowTexture; public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 2; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -207,7 +213,7 @@ namespace CalamityMod.NPCs.AcidRain Vector2 laserTop = laserBottom - Vector2.UnitY * LaserTelegraphLength; Utils.DrawLine(spriteBatch, laserBottom, laserTop, Color.Lerp(Color.Lime, Color.Transparent, LaserTelegraphOpacity)); } - CalamityGlobalNPC.DrawGlowmask(NPC, spriteBatch, ModContent.Request(Texture + "Glow").Value); + CalamityGlobalNPC.DrawGlowmask(NPC, spriteBatch, GlowTexture.Value); } public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo) diff --git a/NPCs/AcidRain/IrradiatedSlime.cs b/NPCs/AcidRain/IrradiatedSlime.cs index f6df26a76f..0b2d0122ef 100644 --- a/NPCs/AcidRain/IrradiatedSlime.cs +++ b/NPCs/AcidRain/IrradiatedSlime.cs @@ -5,6 +5,7 @@ using CalamityMod.Dusts; using CalamityMod.Items.Placeables.Banners; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.GameContent.Bestiary; using Terraria.ID; @@ -14,10 +15,15 @@ namespace CalamityMod.NPCs.AcidRain public class IrradiatedSlime : ModNPC { public bool Falling = true; + public static Asset GlowTexture; public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 2; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -126,7 +132,7 @@ namespace CalamityMod.NPCs.AcidRain public override void PostDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { - CalamityGlobalNPC.DrawGlowmask(NPC, spriteBatch, ModContent.Request(Texture + "Glow").Value); + CalamityGlobalNPC.DrawGlowmask(NPC, spriteBatch, GlowTexture.Value); } public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo) diff --git a/NPCs/AcidRain/Mauler.cs b/NPCs/AcidRain/Mauler.cs index 7760f464ea..fa9a03aac0 100644 --- a/NPCs/AcidRain/Mauler.cs +++ b/NPCs/AcidRain/Mauler.cs @@ -8,6 +8,7 @@ using CalamityMod.Projectiles.Enemy; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -44,6 +45,8 @@ namespace CalamityMod.NPCs.AcidRain set => NPC.localAI[0] = value; } + public static Asset GlowTexture; + public static readonly SoundStyle RoarSound = new("CalamityMod/Sounds/Custom/MaulerRoar"); public override void SetStaticDefaults() @@ -58,6 +61,10 @@ namespace CalamityMod.NPCs.AcidRain }; value.Position.X += 10f; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glowmask", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -417,7 +424,7 @@ namespace CalamityMod.NPCs.AcidRain public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { Texture2D texture = TextureAssets.Npc[NPC.type].Value; - Texture2D glowmask = ModContent.Request("CalamityMod/NPCs/AcidRain/MaulerGlowmask").Value; + Texture2D glowmask = GlowTexture.Value; Vector2 drawPosition = NPC.Center - screenPos + Vector2.UnitY * NPC.gfxOffY; Vector2 origin = NPC.frame.Size() * 0.5f; SpriteEffects direction = NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; diff --git a/NPCs/AcidRain/NuclearToad.cs b/NPCs/AcidRain/NuclearToad.cs index 9d3d40e79e..4375effd0f 100644 --- a/NPCs/AcidRain/NuclearToad.cs +++ b/NPCs/AcidRain/NuclearToad.cs @@ -8,6 +8,7 @@ using CalamityMod.Items.Weapons.Summon; using CalamityMod.Projectiles.Enemy; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent.Bestiary; @@ -36,6 +37,8 @@ namespace CalamityMod.NPCs.AcidRain public const float ExplosionTelegraphTime = 120f; + public static Asset GlowTexture; + public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 5; @@ -43,6 +46,10 @@ namespace CalamityMod.NPCs.AcidRain value.Position.Y += 8; value.PortraitPositionYOverride = 28f; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -206,6 +213,6 @@ namespace CalamityMod.NPCs.AcidRain target.AddBuff(ModContent.BuffType(), 120); } - public override void PostDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) => CalamityGlobalNPC.DrawGlowmask(NPC, spriteBatch, ModContent.Request(Texture + "Glow").Value, true); + public override void PostDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) => CalamityGlobalNPC.DrawGlowmask(NPC, spriteBatch, GlowTexture.Value, true); } } diff --git a/NPCs/AcidRain/SulphurousSkater.cs b/NPCs/AcidRain/SulphurousSkater.cs index 93f362ae39..4e3755279f 100644 --- a/NPCs/AcidRain/SulphurousSkater.cs +++ b/NPCs/AcidRain/SulphurousSkater.cs @@ -9,6 +9,7 @@ using CalamityMod.Items.Weapons.Melee; using CalamityMod.Projectiles.Enemy; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.GameContent.Bestiary; using Terraria.GameContent.ItemDropRules; @@ -27,11 +28,17 @@ namespace CalamityMod.NPCs.AcidRain public const int JumpDelay = 64; + public static Asset GlowTexture; + public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 5; NPCID.Sets.TrailingMode[NPC.type] = 1; NPCID.Sets.TrailCacheLength[NPC.type] = 6; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -229,7 +236,7 @@ namespace CalamityMod.NPCs.AcidRain if (!NPC.IsABestiaryIconDummy) { CalamityGlobalNPC.DrawAfterimage(NPC, spriteBatch, drawColor, Color.Transparent, directioning: true, invertedDirection: true); - CalamityGlobalNPC.DrawGlowmask(NPC, spriteBatch, ModContent.Request(Texture + "Glow").Value, true); + CalamityGlobalNPC.DrawGlowmask(NPC, spriteBatch, GlowTexture.Value, true); } } diff --git a/NPCs/Astral/Aries.cs b/NPCs/Astral/Aries.cs index 19909ceb51..ce94a721d9 100644 --- a/NPCs/Astral/Aries.cs +++ b/NPCs/Astral/Aries.cs @@ -18,13 +18,13 @@ namespace CalamityMod.NPCs.Astral { public class Aries : ModNPC { - private static Texture2D glowmask; + public static Asset glowmask; public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 8; if (!Main.dedServ) - glowmask = ModContent.Request("CalamityMod/NPCs/Astral/AriesGlow", AssetRequestMode.ImmediateLoad).Value; + glowmask = ModContent.Request("CalamityMod/NPCs/Astral/AriesGlow", AssetRequestMode.AsyncLoad); } public override void SetDefaults() @@ -104,7 +104,7 @@ namespace CalamityMod.NPCs.Astral public override void PostDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { //draw glowmask - spriteBatch.Draw(glowmask, NPC.Center - screenPos, NPC.frame, Color.White * 0.6f, NPC.rotation, new Vector2(33, 31), 1f, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); + spriteBatch.Draw(glowmask.Value, NPC.Center - screenPos, NPC.frame, Color.White * 0.6f, NPC.rotation, new Vector2(33, 31), 1f, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); } public override float SpawnChance(NPCSpawnInfo spawnInfo) diff --git a/NPCs/Astral/AstralProbe.cs b/NPCs/Astral/AstralProbe.cs index 53d197d193..bce7d6cf7d 100644 --- a/NPCs/Astral/AstralProbe.cs +++ b/NPCs/Astral/AstralProbe.cs @@ -8,6 +8,7 @@ using CalamityMod.Sounds; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -19,6 +20,16 @@ namespace CalamityMod.NPCs.Astral { public class AstralProbe : ModNPC { + public static Asset GlowTexture; + + public override void SetStaticDefaults() + { + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } + } + public override void SetDefaults() { NPC.damage = 20; @@ -240,7 +251,7 @@ namespace CalamityMod.NPCs.Astral spriteBatch.Draw(texture2D15, drawPosition, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.Request("CalamityMod/NPCs/Astral/AstralProbeGlow").Value; + texture2D15 = GlowTexture.Value; spriteBatch.Draw(texture2D15, drawPosition, NPC.frame, Color.White * 0.6f, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); diff --git a/NPCs/Astral/AstralachneaGround.cs b/NPCs/Astral/AstralachneaGround.cs index 3932e26f5d..6037b4ad46 100644 --- a/NPCs/Astral/AstralachneaGround.cs +++ b/NPCs/Astral/AstralachneaGround.cs @@ -15,14 +15,14 @@ namespace CalamityMod.NPCs.Astral { public class AstralachneaGround : ModNPC { - private static Texture2D glowmask; + public static Asset glowmask; public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 5; if (!Main.dedServ) - glowmask = ModContent.Request("CalamityMod/NPCs/Astral/AstralachneaGroundGlow", AssetRequestMode.ImmediateLoad).Value; + glowmask = ModContent.Request("CalamityMod/NPCs/Astral/AstralachneaGroundGlow", AssetRequestMode.AsyncLoad); this.HideFromBestiary(); } @@ -136,7 +136,7 @@ namespace CalamityMod.NPCs.Astral public override void PostDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { Vector2 origin = new Vector2(40f, 21f); - spriteBatch.Draw(glowmask, NPC.Center - screenPos, NPC.frame, Color.White * 0.6f, NPC.rotation, origin, 1f, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); + spriteBatch.Draw(glowmask.Value, NPC.Center - screenPos, NPC.frame, Color.White * 0.6f, NPC.rotation, origin, 1f, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); } public override float SpawnChance(NPCSpawnInfo spawnInfo) diff --git a/NPCs/Astral/AstralachneaWall.cs b/NPCs/Astral/AstralachneaWall.cs index 8199136f8e..008bf67d41 100644 --- a/NPCs/Astral/AstralachneaWall.cs +++ b/NPCs/Astral/AstralachneaWall.cs @@ -21,14 +21,14 @@ namespace CalamityMod.NPCs.Astral { public class AstralachneaWall : ModNPC { - private static Texture2D glowmask; + public static Asset glowmask; public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.AstralachneaGround.DisplayName"); public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 4; if (!Main.dedServ) - glowmask = ModContent.Request("CalamityMod/NPCs/Astral/AstralachneaWallGlow", AssetRequestMode.ImmediateLoad).Value; + glowmask = ModContent.Request("CalamityMod/NPCs/Astral/AstralachneaWallGlow", AssetRequestMode.AsyncLoad); NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { Rotation = -MathHelper.PiOver2 }; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; } @@ -144,7 +144,7 @@ namespace CalamityMod.NPCs.Astral public override void PostDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { Vector2 origin = new Vector2(40f, 40f); - spriteBatch.Draw(glowmask, NPC.Center - screenPos - new Vector2(0, 8f), NPC.frame, Color.White * 0.6f, NPC.rotation, origin, 1f, SpriteEffects.None, 0); + spriteBatch.Draw(glowmask.Value, NPC.Center - screenPos - new Vector2(0, 8f), NPC.frame, Color.White * 0.6f, NPC.rotation, origin, 1f, SpriteEffects.None, 0); } public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo) diff --git a/NPCs/Astral/Atlas.cs b/NPCs/Astral/Atlas.cs index 9d421d381a..8f159e4f43 100644 --- a/NPCs/Astral/Atlas.cs +++ b/NPCs/Astral/Atlas.cs @@ -24,7 +24,7 @@ namespace CalamityMod.NPCs.Astral { //TODO -- draw 4 pixels lower than actual bottom position (arm overlaps tiles) - private static Texture2D glowmask; + public static Asset glowmask; //CONSTANTS private const int sheetHeight = 852; @@ -108,7 +108,7 @@ namespace CalamityMod.NPCs.Astral //also it's visuals are messed up on npc spawners etc. because the sheet is 3 wide. //not much we can do. looks fine in-game so /shrug if (!Main.dedServ) - glowmask = ModContent.Request("CalamityMod/NPCs/Astral/AtlasGlow", AssetRequestMode.ImmediateLoad).Value; + glowmask = ModContent.Request("CalamityMod/NPCs/Astral/AtlasGlow", AssetRequestMode.AsyncLoad); NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { PortraitPositionYOverride = -5 @@ -590,7 +590,7 @@ namespace CalamityMod.NPCs.Astral //draw glowmask spriteBatch.Draw( - glowmask, position, NPC.frame, + glowmask.Value, position, NPC.frame, Color.White * 0.65f, 0f, default, 1f, //color, rotation, origin, scale effect, 0f); //effect, drawlayer diff --git a/NPCs/Astral/FusionFeeder.cs b/NPCs/Astral/FusionFeeder.cs index 4bceb189e1..e5a53cbf34 100644 --- a/NPCs/Astral/FusionFeeder.cs +++ b/NPCs/Astral/FusionFeeder.cs @@ -20,7 +20,7 @@ namespace CalamityMod.NPCs.Astral { public class FusionFeeder : ModNPC { - private static Texture2D glowmask; + public static Asset glowmask; public Player Target => Main.player[NPC.target]; @@ -35,7 +35,7 @@ namespace CalamityMod.NPCs.Astral public override void SetStaticDefaults() { if (!Main.dedServ) - glowmask = ModContent.Request("CalamityMod/NPCs/Astral/FusionFeederGlow", AssetRequestMode.ImmediateLoad).Value; + glowmask = ModContent.Request("CalamityMod/NPCs/Astral/FusionFeederGlow", AssetRequestMode.AsyncLoad); NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { Scale = 0.5f, @@ -295,7 +295,7 @@ namespace CalamityMod.NPCs.Astral spriteBatch.Draw(TextureAssets.Npc[NPC.type].Value, NPC.Center - screenPos + offset, NPC.frame, drawColor, NPC.rotation, origin, 1f, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); //draw glowmask - spriteBatch.Draw(glowmask, NPC.Center - screenPos + offset, NPC.frame, Color.White * 0.6f, NPC.rotation, origin, 1f, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); + spriteBatch.Draw(glowmask.Value, NPC.Center - screenPos + offset, NPC.frame, Color.White * 0.6f, NPC.rotation, origin, 1f, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); return false; } diff --git a/NPCs/Astral/Hadarian.cs b/NPCs/Astral/Hadarian.cs index fdbea139a5..4ad21f25b4 100644 --- a/NPCs/Astral/Hadarian.cs +++ b/NPCs/Astral/Hadarian.cs @@ -22,12 +22,12 @@ namespace CalamityMod.NPCs.Astral { public class Hadarian : ModNPC { - private static Texture2D glowmask; + public static Asset glowmask; public override void SetStaticDefaults() { if (!Main.dedServ) - glowmask = ModContent.Request("CalamityMod/NPCs/Astral/HadarianGlow", AssetRequestMode.ImmediateLoad).Value; + glowmask = ModContent.Request("CalamityMod/NPCs/Astral/HadarianGlow", AssetRequestMode.AsyncLoad); NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(); value.Position.X += 10f; value.Position.Y += 10f; @@ -159,7 +159,7 @@ namespace CalamityMod.NPCs.Astral Rectangle src = new Rectangle(20, 34, 38, 42); spriteBatch.Draw(TextureAssets.Npc[NPC.type].Value, position - screenPos, src, drawColor, NPC.rotation, default, 1f, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); //draw glowmask - spriteBatch.Draw(glowmask, position - screenPos, src, Color.White * 0.6f, NPC.rotation, default, 1f, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); + spriteBatch.Draw(glowmask.Value, position - screenPos, src, Color.White * 0.6f, NPC.rotation, default, 1f, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); return false; } return true; @@ -172,7 +172,7 @@ namespace CalamityMod.NPCs.Astral Vector2 origin = new Vector2(41f, 39f); //draw glowmask - spriteBatch.Draw(glowmask, NPC.Center - screenPos - new Vector2(0f, 12f), NPC.frame, Color.White * 0.6f, NPC.rotation, origin, 1f, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); + spriteBatch.Draw(glowmask.Value, NPC.Center - screenPos - new Vector2(0f, 12f), NPC.frame, Color.White * 0.6f, NPC.rotation, origin, 1f, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); } } diff --git a/NPCs/Astral/HiveEnemy.cs b/NPCs/Astral/HiveEnemy.cs index 664ef0c51f..7529bb4fc6 100644 --- a/NPCs/Astral/HiveEnemy.cs +++ b/NPCs/Astral/HiveEnemy.cs @@ -19,12 +19,12 @@ namespace CalamityMod.NPCs.Astral { public class HiveEnemy : ModNPC { - private static Texture2D glowmask; + public static Asset glowmask; public override void SetStaticDefaults() { if (!Main.dedServ) - glowmask = ModContent.Request("CalamityMod/NPCs/Astral/HiveGlow", AssetRequestMode.ImmediateLoad).Value; + glowmask = ModContent.Request("CalamityMod/NPCs/Astral/HiveGlow", AssetRequestMode.AsyncLoad); Main.npcFrameCount[NPC.type] = 6; } @@ -109,7 +109,7 @@ namespace CalamityMod.NPCs.Astral public override void PostDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { // Draw glowmask. - spriteBatch.Draw(glowmask, NPC.Center - screenPos, NPC.frame, Color.White * 0.6f, NPC.rotation, new Vector2(19, 30), 1f, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); + spriteBatch.Draw(glowmask.Value, NPC.Center - screenPos, NPC.frame, Color.White * 0.6f, NPC.rotation, new Vector2(19, 30), 1f, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); } public override void HitEffect(NPC.HitInfo hit) diff --git a/NPCs/Astral/Hiveling.cs b/NPCs/Astral/Hiveling.cs index 900f56d6b9..8d57509795 100644 --- a/NPCs/Astral/Hiveling.cs +++ b/NPCs/Astral/Hiveling.cs @@ -17,12 +17,12 @@ namespace CalamityMod.NPCs.Astral { public class Hiveling : ModNPC { - private static Texture2D glowmask; + public static Asset glowmask; public override void SetStaticDefaults() { if (!Main.dedServ) - glowmask = ModContent.Request("CalamityMod/NPCs/Astral/HivelingGlow", AssetRequestMode.ImmediateLoad).Value; + glowmask = ModContent.Request("CalamityMod/NPCs/Astral/HivelingGlow", AssetRequestMode.AsyncLoad); Main.npcFrameCount[NPC.type] = 4; NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(); value.Position.Y -= 8; @@ -132,7 +132,7 @@ namespace CalamityMod.NPCs.Astral public override void PostDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { //draw glowmask - spriteBatch.Draw(glowmask, NPC.Center - screenPos + new Vector2(0, 12), NPC.frame, Color.White * 0.6f, NPC.rotation, new Vector2(15, 10), 1f, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); + spriteBatch.Draw(glowmask.Value, NPC.Center - screenPos + new Vector2(0, 12), NPC.frame, Color.White * 0.6f, NPC.rotation, new Vector2(15, 10), 1f, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); } public override void HitEffect(NPC.HitInfo hit) diff --git a/NPCs/Astral/Mantis.cs b/NPCs/Astral/Mantis.cs index 72fff54643..a1c1558071 100644 --- a/NPCs/Astral/Mantis.cs +++ b/NPCs/Astral/Mantis.cs @@ -21,7 +21,7 @@ namespace CalamityMod.NPCs.Astral { public class Mantis : ModNPC { - private static Texture2D glowmask; + public static Asset glowmask; public override void SetStaticDefaults() { @@ -33,7 +33,7 @@ namespace CalamityMod.NPCs.Astral value.Position.Y += 15; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; if (!Main.dedServ) - glowmask = ModContent.Request("CalamityMod/NPCs/Astral/MantisGlow", AssetRequestMode.ImmediateLoad).Value; + glowmask = ModContent.Request("CalamityMod/NPCs/Astral/MantisGlow", AssetRequestMode.AsyncLoad); } public override void SetDefaults() @@ -226,7 +226,7 @@ namespace CalamityMod.NPCs.Astral public override void PostDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { //draw glowmask - spriteBatch.Draw(glowmask, NPC.Center - screenPos - new Vector2(0, 8), NPC.frame, Color.White * 0.6f, NPC.rotation, new Vector2(70, 40), 1f, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); + spriteBatch.Draw(glowmask.Value, NPC.Center - screenPos - new Vector2(0, 8), NPC.frame, Color.White * 0.6f, NPC.rotation, new Vector2(70, 40), 1f, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); } public override float SpawnChance(NPCSpawnInfo spawnInfo) diff --git a/NPCs/Astral/Nova.cs b/NPCs/Astral/Nova.cs index 9a6b04a698..7869fe2cb7 100644 --- a/NPCs/Astral/Nova.cs +++ b/NPCs/Astral/Nova.cs @@ -23,7 +23,7 @@ namespace CalamityMod.NPCs.Astral { public class Nova : ModNPC { - private static Texture2D glowmask; + public static Asset glowmask; private float travelAcceleration = 0.2f; private float targetTime = 120f; @@ -36,7 +36,7 @@ namespace CalamityMod.NPCs.Astral Main.npcFrameCount[NPC.type] = 8; if (!Main.dedServ) - glowmask = ModContent.Request("CalamityMod/NPCs/Astral/NovaGlow", AssetRequestMode.ImmediateLoad).Value; + glowmask = ModContent.Request("CalamityMod/NPCs/Astral/NovaGlow", AssetRequestMode.AsyncLoad); NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { Scale = 0.64f, @@ -310,7 +310,7 @@ namespace CalamityMod.NPCs.Astral return; Vector2 drawPosition = NPC.Center - screenPos - new Vector2(0, NPC.scale * 4f); - spriteBatch.Draw(glowmask, drawPosition, NPC.frame, Color.White * 0.75f, NPC.rotation, new Vector2(57f, 37f), NPC.scale, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0f); + spriteBatch.Draw(glowmask.Value, drawPosition, NPC.frame, Color.White * 0.75f, NPC.rotation, new Vector2(57f, 37f), NPC.scale, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0f); } public override float SpawnChance(NPCSpawnInfo spawnInfo) diff --git a/NPCs/Astral/SightseerCollider.cs b/NPCs/Astral/SightseerCollider.cs index 1d3249cdd2..be6958cc53 100644 --- a/NPCs/Astral/SightseerCollider.cs +++ b/NPCs/Astral/SightseerCollider.cs @@ -19,14 +19,14 @@ namespace CalamityMod.NPCs.Astral { public class SightseerCollider : ModNPC { - private static Texture2D glowmask; + public static Asset glowmask; public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 4; if (!Main.dedServ) - glowmask = ModContent.Request("CalamityMod/NPCs/Astral/SightseerColliderGlow", AssetRequestMode.ImmediateLoad).Value; + glowmask = ModContent.Request("CalamityMod/NPCs/Astral/SightseerColliderGlow", AssetRequestMode.AsyncLoad); NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { PortraitPositionXOverride = 0 @@ -133,7 +133,7 @@ namespace CalamityMod.NPCs.Astral public override void PostDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { - spriteBatch.Draw(glowmask, NPC.Center - screenPos + new Vector2(0, 4f), new Rectangle(0, NPC.frame.Y, 80, NPC.frame.Height), Color.White * 0.75f, NPC.rotation, new Vector2(40f, 20f), NPC.scale, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0f); + spriteBatch.Draw(glowmask.Value, NPC.Center - screenPos + new Vector2(0, 4f), new Rectangle(0, NPC.frame.Y, 80, NPC.frame.Height), Color.White * 0.75f, NPC.rotation, new Vector2(40f, 20f), NPC.scale, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0f); } public override float SpawnChance(NPCSpawnInfo spawnInfo) diff --git a/NPCs/Astral/SightseerSpitter.cs b/NPCs/Astral/SightseerSpitter.cs index 7c705df289..9bc3205ed2 100644 --- a/NPCs/Astral/SightseerSpitter.cs +++ b/NPCs/Astral/SightseerSpitter.cs @@ -19,13 +19,13 @@ namespace CalamityMod.NPCs.Astral { public class SightseerSpitter : ModNPC { - private static Texture2D glowmask; + public static Asset glowmask; public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 4; if (!Main.dedServ) - glowmask = ModContent.Request("CalamityMod/NPCs/Astral/SightseerSpitterGlow", AssetRequestMode.ImmediateLoad).Value; + glowmask = ModContent.Request("CalamityMod/NPCs/Astral/SightseerSpitterGlow", AssetRequestMode.AsyncLoad); NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { Scale = 0.7f, @@ -162,7 +162,7 @@ namespace CalamityMod.NPCs.Astral public override void PostDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { if (!NPC.IsABestiaryIconDummy) - spriteBatch.Draw(glowmask, NPC.Center - screenPos + new Vector2(0, 4f), NPC.frame, Color.White * 0.75f, NPC.rotation, new Vector2(59f, 28f), NPC.scale, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0f); + spriteBatch.Draw(glowmask.Value, NPC.Center - screenPos + new Vector2(0, 4f), NPC.frame, Color.White * 0.75f, NPC.rotation, new Vector2(59f, 28f), NPC.scale, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0f); } public override float SpawnChance(NPCSpawnInfo spawnInfo) diff --git a/NPCs/Astral/StellarCulex.cs b/NPCs/Astral/StellarCulex.cs index 6d62c05ab8..87f8f9eebe 100644 --- a/NPCs/Astral/StellarCulex.cs +++ b/NPCs/Astral/StellarCulex.cs @@ -19,12 +19,12 @@ namespace CalamityMod.NPCs.Astral { public class StellarCulex : ModNPC { - private static Texture2D glowmask; + public static Asset glowmask; public override void SetStaticDefaults() { if (!Main.dedServ) - glowmask = ModContent.Request("CalamityMod/NPCs/Astral/StellarCulexGlow", AssetRequestMode.ImmediateLoad).Value; + glowmask = ModContent.Request("CalamityMod/NPCs/Astral/StellarCulexGlow", AssetRequestMode.AsyncLoad); Main.npcFrameCount[NPC.type] = 4; NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { @@ -111,7 +111,7 @@ namespace CalamityMod.NPCs.Astral public override void PostDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { Vector2 origin = new Vector2(50, 30f); - spriteBatch.Draw(glowmask, NPC.Center - screenPos, NPC.frame, Color.White * 0.6f, NPC.rotation, origin, 1f, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); + spriteBatch.Draw(glowmask.Value, NPC.Center - screenPos, NPC.frame, Color.White * 0.6f, NPC.rotation, origin, 1f, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); } public override float SpawnChance(NPCSpawnInfo spawnInfo) diff --git a/NPCs/AstrumAureus/AstrumAureus.cs b/NPCs/AstrumAureus/AstrumAureus.cs index f068232ae0..b280d632f0 100644 --- a/NPCs/AstrumAureus/AstrumAureus.cs +++ b/NPCs/AstrumAureus/AstrumAureus.cs @@ -22,6 +22,7 @@ using CalamityMod.NPCs.TownNPCs; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -43,6 +44,15 @@ namespace CalamityMod.NPCs.AstrumAureus public static readonly SoundStyle JumpSound = new("CalamityMod/Sounds/Custom/AstrumAureus/AureusJump"); public static readonly SoundStyle TeleportSound = new("CalamityMod/Sounds/Custom/AstrumAureus/AureusTeleport"); + public static Asset JumpTexture; + public static Asset RechargeTexture; + public static Asset StompTexture; + public static Asset WalkTexture; + public static Asset Texture_Glow; + public static Asset JumpTexture_Glow; + public static Asset StompTexture_Glow; + public static Asset WalkTexture_Glow; + private bool stomping = false; public int slimeProjCounter = 0; public int slimePhase = 0; @@ -61,6 +71,17 @@ namespace CalamityMod.NPCs.AstrumAureus value.Position.Y -= 20f; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; NPCID.Sets.MPAllowedEnemies[Type] = true; + if (!Main.dedServ) + { + Texture_Glow = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + JumpTexture = ModContent.Request(Texture + "Jump", AssetRequestMode.AsyncLoad); + RechargeTexture = ModContent.Request(Texture + "Recharge", AssetRequestMode.AsyncLoad); + StompTexture = ModContent.Request(Texture + "Stomp", AssetRequestMode.AsyncLoad); + WalkTexture = ModContent.Request(Texture + "Walk", AssetRequestMode.AsyncLoad); + JumpTexture_Glow = ModContent.Request(Texture + "JumpGlow", AssetRequestMode.AsyncLoad); + StompTexture_Glow = ModContent.Request(Texture + "StompGlow", AssetRequestMode.AsyncLoad); + WalkTexture_Glow = ModContent.Request(Texture + "WalkGlow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -237,33 +258,33 @@ namespace CalamityMod.NPCs.AstrumAureus if (NPC.ai[0] == 0f || (slimePhaseHP && Main.zenithWorld)) { NPCTexture = TextureAssets.Npc[NPC.type].Value; - GlowMaskTexture = ModContent.Request("CalamityMod/NPCs/AstrumAureus/AstrumAureusGlow").Value; + GlowMaskTexture = Texture_Glow.Value; } else if (NPC.ai[0] == 1f) //nothing special done here { - NPCTexture = ModContent.Request("CalamityMod/NPCs/AstrumAureus/AstrumAureusRecharge").Value; + NPCTexture = RechargeTexture.Value; } else if (NPC.ai[0] == 2f) //nothing special done here { - NPCTexture = ModContent.Request("CalamityMod/NPCs/AstrumAureus/AstrumAureusWalk").Value; - GlowMaskTexture = ModContent.Request("CalamityMod/NPCs/AstrumAureus/AstrumAureusWalkGlow").Value; + NPCTexture = WalkTexture.Value; + GlowMaskTexture = WalkTexture_Glow.Value; } else if (NPC.ai[0] == 3f || NPC.ai[0] == 4f) //needs to have an in-air frame { if (NPC.velocity.Y == 0f && NPC.ai[1] >= 0f && NPC.ai[0] == 3f) //idle before jump { NPCTexture = TextureAssets.Npc[NPC.type].Value; //idle frames - GlowMaskTexture = ModContent.Request("CalamityMod/NPCs/AstrumAureus/AstrumAureusGlow").Value; + GlowMaskTexture = Texture_Glow.Value; } else if (NPC.velocity.Y <= 0f || NPC.ai[1] < 0f) //jump frames if flying upward or if about to jump { - NPCTexture = ModContent.Request("CalamityMod/NPCs/AstrumAureus/AstrumAureusJump").Value; - GlowMaskTexture = ModContent.Request("CalamityMod/NPCs/AstrumAureus/AstrumAureusJumpGlow").Value; + NPCTexture = JumpTexture.Value; + GlowMaskTexture = JumpTexture_Glow.Value; } else //stomping { - NPCTexture = ModContent.Request("CalamityMod/NPCs/AstrumAureus/AstrumAureusStomp").Value; - GlowMaskTexture = ModContent.Request("CalamityMod/NPCs/AstrumAureus/AstrumAureusStompGlow").Value; + NPCTexture = StompTexture.Value; + GlowMaskTexture = StompTexture_Glow.Value; } } else if (NPC.ai[0] >= 5f) //needs to have an in-air frame @@ -271,12 +292,12 @@ namespace CalamityMod.NPCs.AstrumAureus if (NPC.velocity.Y == 0f) //idle before teleport { NPCTexture = TextureAssets.Npc[NPC.type].Value; //idle frames - GlowMaskTexture = ModContent.Request("CalamityMod/NPCs/AstrumAureus/AstrumAureusGlow").Value; + GlowMaskTexture = Texture_Glow.Value; } else //in-air frames { - NPCTexture = ModContent.Request("CalamityMod/NPCs/AstrumAureus/AstrumAureusJump").Value; - GlowMaskTexture = ModContent.Request("CalamityMod/NPCs/AstrumAureus/AstrumAureusJumpGlow").Value; + NPCTexture = JumpTexture.Value; + GlowMaskTexture = JumpTexture_Glow.Value; } } diff --git a/NPCs/AstrumAureus/AureusSpawn.cs b/NPCs/AstrumAureus/AureusSpawn.cs index 3c8439e0e4..ad356bcd8d 100644 --- a/NPCs/AstrumAureus/AureusSpawn.cs +++ b/NPCs/AstrumAureus/AureusSpawn.cs @@ -9,6 +9,7 @@ using CalamityMod.Sounds; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -19,11 +20,16 @@ namespace CalamityMod.NPCs.AstrumAureus { public class AureusSpawn : ModNPC { + public static Asset GlowTexture; public override void SetStaticDefaults() { this.HideFromBestiary(); Main.npcFrameCount[NPC.type] = 4; NPCID.Sets.TrailingMode[NPC.type] = 1; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -263,7 +269,7 @@ namespace CalamityMod.NPCs.AstrumAureus drawLocation += originalDrawSize * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, originalDrawSize, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.Request("CalamityMod/NPCs/AstrumAureus/AureusSpawnGlow").Value; + texture2D15 = GlowTexture.Value; Color afterimageColorLerp = Color.Lerp(Color.White, Color.Orange, 0.5f) * NPC.Opacity; if (CalamityConfig.Instance.Afterimages) diff --git a/NPCs/AstrumDeus/AstrumDeusBody.cs b/NPCs/AstrumDeus/AstrumDeusBody.cs index cee87a5536..eb38212ce6 100644 --- a/NPCs/AstrumDeus/AstrumDeusBody.cs +++ b/NPCs/AstrumDeus/AstrumDeusBody.cs @@ -6,6 +6,7 @@ using CalamityMod.NPCs.CalamityAIs.CalamityBossAIs; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.GameContent; using Terraria.ID; @@ -18,10 +19,28 @@ namespace CalamityMod.NPCs.AstrumDeus { public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.AstrumDeusHead.DisplayName"); + public static Asset AltTexture; + public static Asset TextureGlow1; + public static Asset TextureGlow2; + public static Asset TextureGlow3; + public static Asset TextureGlow4; + public static Asset TextureAltGlow1; + public static Asset TextureAltGlow2; + public override void SetStaticDefaults() { this.HideFromBestiary(); NPCID.Sets.TrailingMode[NPC.type] = 1; + if (!Main.dedServ) + { + AltTexture = ModContent.Request(Texture + "AltSpectral", AssetRequestMode.AsyncLoad); + TextureGlow1 = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + TextureGlow2 = ModContent.Request(Texture + "Glow2", AssetRequestMode.AsyncLoad); + TextureGlow3 = ModContent.Request(Texture + "Glow3", AssetRequestMode.AsyncLoad); + TextureGlow4 = ModContent.Request(Texture + "Glow4", AssetRequestMode.AsyncLoad); + TextureAltGlow1 = ModContent.Request(Texture + "AltGlow", AssetRequestMode.AsyncLoad); + TextureAltGlow2 = ModContent.Request(Texture + "AltGlow2", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -99,8 +118,8 @@ namespace CalamityMod.NPCs.AstrumDeus bool deathModeEnragePhase = Main.npc[(int)NPC.ai[2]].Calamity().newAI[0] == 3f; bool doubleWormPhase = NPC.Calamity().newAI[0] != 0f && !deathModeEnragePhase; - Texture2D mainWormTex = altBodyTextures ? ModContent.Request("CalamityMod/NPCs/AstrumDeus/AstrumDeusBodyAltSpectral").Value : TextureAssets.Npc[NPC.type].Value; - Texture2D secondWormTex = ModContent.Request("CalamityMod/NPCs/AstrumDeus/AstrumDeusBodyGlow2").Value; + Texture2D mainWormTex = altBodyTextures ? AltTexture.Value : TextureAssets.Npc[NPC.type].Value; + Texture2D secondWormTex = TextureGlow2.Value; Vector2 halfSizeTex = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / 2); Vector2 drawLocation = NPC.Center - screenPos; @@ -108,12 +127,12 @@ namespace CalamityMod.NPCs.AstrumDeus drawLocation += halfSizeTex * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(mainWormTex, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTex, NPC.scale, spriteEffects, 0f); - mainWormTex = altBodyTextures ? ModContent.Request("CalamityMod/NPCs/AstrumDeus/AstrumDeusBodyAltGlow").Value : ModContent.Request("CalamityMod/NPCs/AstrumDeus/AstrumDeusBodyGlow").Value; + mainWormTex = altBodyTextures ? TextureAltGlow1.Value : TextureGlow1.Value; Color phaseColor = drawCyan ? Color.Cyan : Color.Orange; if (doubleWormPhase) { - mainWormTex = drawCyan ? mainWormTex : (altBodyTextures ? ModContent.Request("CalamityMod/NPCs/AstrumDeus/AstrumDeusBodyAltGlow2").Value : ModContent.Request("CalamityMod/NPCs/AstrumDeus/AstrumDeusBodyGlow3").Value); - secondWormTex = drawCyan ? ModContent.Request("CalamityMod/NPCs/AstrumDeus/AstrumDeusBodyGlow4").Value : secondWormTex; + mainWormTex = drawCyan ? mainWormTex : (altBodyTextures ? TextureAltGlow2.Value : TextureGlow3.Value); + secondWormTex = drawCyan ? TextureGlow4.Value : secondWormTex; } Color mainWormColorLerp = Color.Lerp(Color.White, doubleWormPhase ? phaseColor : Color.Cyan, 0.5f) * (deathModeEnragePhase ? 1f : NPC.Opacity); Color secondWormColorLerp = Color.Lerp(Color.White, doubleWormPhase ? phaseColor : Color.Orange, 0.5f) * (deathModeEnragePhase ? 1f : NPC.Opacity); diff --git a/NPCs/AstrumDeus/AstrumDeusHead.cs b/NPCs/AstrumDeus/AstrumDeusHead.cs index 4916c13182..ba88318bd4 100644 --- a/NPCs/AstrumDeus/AstrumDeusHead.cs +++ b/NPCs/AstrumDeus/AstrumDeusHead.cs @@ -22,6 +22,7 @@ using CalamityMod.UI.VanillaBossBars; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -43,6 +44,11 @@ namespace CalamityMod.NPCs.AstrumDeus public static readonly SoundStyle HitSound = new("CalamityMod/Sounds/NPCHit/AstrumDeusHit", 2) { Volume = 1.25f }; public static readonly SoundStyle DeathSound = new("CalamityMod/Sounds/NPCKilled/AstrumDeusDeath"); + public static Asset TextureGlow1; + public static Asset TextureGlow2; + public static Asset TextureGlow3; + public static Asset TextureGlow4; + public override void SetStaticDefaults() { NPCID.Sets.TrailingMode[NPC.type] = 1; @@ -56,6 +62,13 @@ namespace CalamityMod.NPCs.AstrumDeus value.Position.X += 55f; value.Position.Y += 23f; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + if (!Main.dedServ) + { + TextureGlow1 = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + TextureGlow2 = ModContent.Request(Texture + "Glow2", AssetRequestMode.AsyncLoad); + TextureGlow3 = ModContent.Request(Texture + "Glow3", AssetRequestMode.AsyncLoad); + TextureGlow4 = ModContent.Request(Texture + "Glow4", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -153,7 +166,7 @@ namespace CalamityMod.NPCs.AstrumDeus bool doubleWormPhase = NPC.Calamity().newAI[0] != 0f && !deathModeEnragePhase; Texture2D mainWormTex = TextureAssets.Npc[NPC.type].Value; - Texture2D secondWormTex = ModContent.Request("CalamityMod/NPCs/AstrumDeus/AstrumDeusHeadGlow2").Value; + Texture2D secondWormTex = TextureGlow2.Value; Vector2 halfSizeTex = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / 2); Vector2 drawLocation = NPC.Center - screenPos; @@ -161,12 +174,12 @@ namespace CalamityMod.NPCs.AstrumDeus drawLocation += halfSizeTex * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(mainWormTex, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTex, NPC.scale, spriteEffects, 0f); - mainWormTex = ModContent.Request("CalamityMod/NPCs/AstrumDeus/AstrumDeusHeadGlow").Value; + mainWormTex = TextureGlow1.Value; Color phaseColor = drawCyan ? Color.Cyan : Color.Orange; if (doubleWormPhase) { - mainWormTex = drawCyan ? mainWormTex : ModContent.Request("CalamityMod/NPCs/AstrumDeus/AstrumDeusHeadGlow3").Value; - secondWormTex = drawCyan ? ModContent.Request("CalamityMod/NPCs/AstrumDeus/AstrumDeusHeadGlow4").Value : secondWormTex; + mainWormTex = drawCyan ? mainWormTex : TextureGlow3.Value; + secondWormTex = drawCyan ? TextureGlow4.Value : secondWormTex; } Color mainWormColorLerp = Color.Lerp(Color.White, doubleWormPhase ? phaseColor : Color.Cyan, 0.5f) * (deathModeEnragePhase ? 1f : NPC.Opacity); Color secondWormColorLerp = Color.Lerp(Color.White, doubleWormPhase ? phaseColor : Color.Orange, 0.5f) * (deathModeEnragePhase ? 1f : NPC.Opacity); diff --git a/NPCs/AstrumDeus/AstrumDeusTail.cs b/NPCs/AstrumDeus/AstrumDeusTail.cs index 881e8ee4f2..676018a646 100644 --- a/NPCs/AstrumDeus/AstrumDeusTail.cs +++ b/NPCs/AstrumDeus/AstrumDeusTail.cs @@ -6,6 +6,7 @@ using CalamityMod.NPCs.CalamityAIs.CalamityBossAIs; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.GameContent; using Terraria.ID; @@ -18,10 +19,18 @@ namespace CalamityMod.NPCs.AstrumDeus { public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.AstrumDeusHead.DisplayName"); + public static Asset GlowTexture; + public static Asset GlowTexture2; + public override void SetStaticDefaults() { this.HideFromBestiary(); NPCID.Sets.TrailingMode[NPC.type] = 1; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + GlowTexture2 = ModContent.Request(Texture + "Glow2", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -106,10 +115,10 @@ namespace CalamityMod.NPCs.AstrumDeus drawLocation += halfSizeTex * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(wormTexture, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTex, NPC.scale, spriteEffects, 0f); - wormTexture = ModContent.Request("CalamityMod/NPCs/AstrumDeus/AstrumDeusTailGlow").Value; + wormTexture = GlowTexture.Value; Color phaseColor = drawCyan ? Color.Cyan : Color.Orange; if (doubleWormPhase) - wormTexture = drawCyan ? ModContent.Request("CalamityMod/NPCs/AstrumDeus/AstrumDeusTailGlow2").Value : wormTexture; + wormTexture = drawCyan ? GlowTexture2.Value : wormTexture; Color wormColorLerp = Color.Lerp(Color.White, doubleWormPhase ? phaseColor : Color.Orange, 0.5f) * (deathModeEnragePhase ? 1f : NPC.Opacity); diff --git a/NPCs/Bumblebirb/Bumblefuck.cs b/NPCs/Bumblebirb/Bumblefuck.cs index f5e99357f6..e88ddfb475 100644 --- a/NPCs/Bumblebirb/Bumblefuck.cs +++ b/NPCs/Bumblebirb/Bumblefuck.cs @@ -20,6 +20,7 @@ using CalamityMod.Sounds; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -33,6 +34,7 @@ namespace CalamityMod.NPCs.Bumblebirb [AutoloadBossHead] public class Bumblefuck : ModNPC { + public static Asset GlowTexture; public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 6; @@ -48,6 +50,10 @@ namespace CalamityMod.NPCs.Bumblebirb value.Position.Y += 8f; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; NPCID.Sets.MPAllowedEnemies[Type] = true; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request("CalamityMod/NPCs/Bumblebirb/BirbGlow", AssetRequestMode.AsyncLoad); + } } public override string Texture => "CalamityMod/NPCs/Bumblebirb/Birb"; @@ -350,7 +356,7 @@ namespace CalamityMod.NPCs.Bumblebirb if (phase2) { - texture2D15 = ModContent.Request("CalamityMod/NPCs/Bumblebirb/BirbGlow").Value; + texture2D15 = GlowTexture.Value; Color glowmaskColor = Color.Lerp(Color.White, Color.Red, 0.5f); altColor = Color.Red; diff --git a/NPCs/CalClone/CalamitasClone.cs b/NPCs/CalClone/CalamitasClone.cs index e123069340..f6c5525086 100644 --- a/NPCs/CalClone/CalamitasClone.cs +++ b/NPCs/CalClone/CalamitasClone.cs @@ -20,6 +20,7 @@ using CalamityMod.Sounds; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -33,6 +34,8 @@ namespace CalamityMod.NPCs.CalClone [AutoloadBossHead] public class CalamitasClone : ModNPC { + public static Asset GlowTexture; + public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 6; @@ -46,6 +49,10 @@ namespace CalamityMod.NPCs.CalClone value.Position.Y -= 10f; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; NPCID.Sets.MPAllowedEnemies[Type] = true; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -155,7 +162,7 @@ namespace CalamityMod.NPCs.CalClone npcOffset += origin * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture, npcOffset, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, origin, NPC.scale, spriteEffects, 0f); - texture = ModContent.Request("CalamityMod/NPCs/CalClone/CalamitasCloneGlow").Value; + texture = GlowTexture.Value; Color color = Color.Lerp(Color.White, Color.Red, 0.5f); if (Main.zenithWorld) { diff --git a/NPCs/CalClone/Cataclysm.cs b/NPCs/CalClone/Cataclysm.cs index 05d344084b..0b00bdc6ab 100644 --- a/NPCs/CalClone/Cataclysm.cs +++ b/NPCs/CalClone/Cataclysm.cs @@ -8,6 +8,7 @@ using CalamityMod.NPCs.CalamityAIs.CalamityBossAIs; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.GameContent; using Terraria.GameContent.Bestiary; @@ -19,6 +20,8 @@ namespace CalamityMod.NPCs.CalClone [AutoloadBossHead] public class Cataclysm : ModNPC { + public static Asset GlowTexture; + public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 6; @@ -31,6 +34,10 @@ namespace CalamityMod.NPCs.CalClone PortraitPositionYOverride = 0 }; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -130,7 +137,7 @@ namespace CalamityMod.NPCs.CalClone drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.Request("CalamityMod/NPCs/CalClone/CataclysmGlow").Value; + texture2D15 = GlowTexture.Value; Color pinkLerp = Color.Lerp(Color.White, Color.Red, 0.5f); if (CalamityConfig.Instance.Afterimages) diff --git a/NPCs/CalClone/Catastrophe.cs b/NPCs/CalClone/Catastrophe.cs index 1e6f1df769..1ac00cfb92 100644 --- a/NPCs/CalClone/Catastrophe.cs +++ b/NPCs/CalClone/Catastrophe.cs @@ -8,6 +8,7 @@ using CalamityMod.NPCs.CalamityAIs.CalamityBossAIs; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.GameContent; using Terraria.GameContent.Bestiary; @@ -19,6 +20,8 @@ namespace CalamityMod.NPCs.CalClone [AutoloadBossHead] public class Catastrophe : ModNPC { + public static Asset GlowTexture; + public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 6; @@ -31,6 +34,10 @@ namespace CalamityMod.NPCs.CalClone }; value.Position.Y -= 10; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -130,7 +137,7 @@ namespace CalamityMod.NPCs.CalClone drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.Request("CalamityMod/NPCs/CalClone/CatastropheGlow").Value; + texture2D15 = GlowTexture.Value; Color pinkLerp = Color.Lerp(Color.White, Color.Red, 0.5f); if (CalamityConfig.Instance.Afterimages) diff --git a/NPCs/CalClone/SoulSeeker.cs b/NPCs/CalClone/SoulSeeker.cs index 7c5477d74e..a62ecfaf16 100644 --- a/NPCs/CalClone/SoulSeeker.cs +++ b/NPCs/CalClone/SoulSeeker.cs @@ -5,6 +5,7 @@ using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.GameContent; using Terraria.GameContent.Bestiary; @@ -17,12 +18,17 @@ namespace CalamityMod.NPCs.CalClone { private int timer = 0; private bool start = true; + public static Asset GlowTexture; public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 5; NPCID.Sets.TrailingMode[NPC.type] = 1; NPCID.Sets.BossBestiaryPriority.Add(Type); + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -212,7 +218,7 @@ namespace CalamityMod.NPCs.CalClone drawPos += origin * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture, drawPos, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, origin, NPC.scale, spriteEffects, 0f); - texture = ModContent.Request("CalamityMod/NPCs/CalClone/SoulSeekerGlow").Value; + texture = GlowTexture.Value; Color glow = Color.Lerp(Color.White, Color.Red, colorLerpAmt); if (CalamityConfig.Instance.Afterimages) diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index e67506dc4c..2b9ca6b40e 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -6833,7 +6833,7 @@ namespace CalamityMod.NPCs intensity *= intensityAndOpacityMult; opacity *= intensityAndOpacityMult; - Texture2D forcefieldTexture = Request("CalamityMod/NPCs/SupremeCalamitas/ForcefieldTexture").Value; + Texture2D forcefieldTexture = SupremeCalamitas.SupremeCalamitas.ForcefieldTexture.Value; if (npc.type == NPCID.CultistBoss) GameShaders.Misc["CalamityMod:SupremeShield"].SetShaderTexture(Request("CalamityMod/ExtraTextures/GreyscaleGradients/EternityStreak")); @@ -6993,7 +6993,7 @@ namespace CalamityMod.NPCs } } - Texture2D glowTexture = Request("CalamityMod/ExtraTextures/VanillaBossGlowmasks/DestroyerHeadGlow").Value; + Texture2D glowTexture = CalamityMod.DestroyerGlowmasks[0].Value; switch (npc.type) { default: @@ -7001,11 +7001,11 @@ namespace CalamityMod.NPCs break; case NPCID.TheDestroyerBody: - glowTexture = Request("CalamityMod/ExtraTextures/VanillaBossGlowmasks/DestroyerBodyGlow").Value; + glowTexture = CalamityMod.DestroyerGlowmasks[1].Value; break; case NPCID.TheDestroyerTail: - glowTexture = Request("CalamityMod/ExtraTextures/VanillaBossGlowmasks/DestroyerTailGlow").Value; + glowTexture = CalamityMod.DestroyerGlowmasks[2].Value; break; } @@ -7240,8 +7240,8 @@ namespace CalamityMod.NPCs if (masterMode && revenge) { int alpha = 192; - eyesColor = npc.type == ModContent.NPCType() ? new Color(150, 100, 255, alpha) : new Color(255, 255, 0, alpha); - Texture2D glowTexture = Request("CalamityMod/ExtraTextures/VanillaBossGlowmasks/SkeletronPrimeHeadGlow").Value; + eyesColor = npc.type == NPCType() ? new Color(150, 100, 255, alpha) : new Color(255, 255, 0, alpha); + Texture2D glowTexture = SkeletronPrime2.EyeTexture.Value; for (int i = 0; i < 3; i++) spriteBatch.Draw(glowTexture, npc.Center - screenPos + new Vector2(0, npc.gfxOffY), npc.frame, eyesColor, npc.rotation, npc.frame.Size() / 2, npc.scale, spriteEffects, 0f); } diff --git a/NPCs/CeaselessVoid/CeaselessVoid.cs b/NPCs/CeaselessVoid/CeaselessVoid.cs index a14db71292..1f6645692d 100644 --- a/NPCs/CeaselessVoid/CeaselessVoid.cs +++ b/NPCs/CeaselessVoid/CeaselessVoid.cs @@ -17,6 +17,7 @@ using CalamityMod.UI.VanillaBossBars; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -33,6 +34,8 @@ namespace CalamityMod.NPCs.CeaselessVoid public static readonly SoundStyle DeathSound = new("CalamityMod/Sounds/NPCKilled/CeaselessVoidDeath"); public static readonly SoundStyle BuildupSound = new("CalamityMod/Sounds/Custom/CeaselessVoidDeathBuild"); + public static Asset GlowTexture; + public bool playedbuildsound = false; public override void SetStaticDefaults() @@ -46,6 +49,10 @@ namespace CalamityMod.NPCs.CeaselessVoid }; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; NPCID.Sets.MPAllowedEnemies[Type] = true; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -169,7 +176,7 @@ namespace CalamityMod.NPCs.CeaselessVoid drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.Request("CalamityMod/NPCs/CeaselessVoid/CeaselessVoidGlow").Value; + texture2D15 = GlowTexture.Value; Color cyanLerp = Color.Lerp(Color.White, Color.Cyan, 0.5f); if (CalamityConfig.Instance.Afterimages) diff --git a/NPCs/CeaselessVoid/DarkEnergy.cs b/NPCs/CeaselessVoid/DarkEnergy.cs index 3c1a4827d6..202e8d1e86 100644 --- a/NPCs/CeaselessVoid/DarkEnergy.cs +++ b/NPCs/CeaselessVoid/DarkEnergy.cs @@ -5,6 +5,7 @@ using CalamityMod.Events; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.GameContent; using Terraria.GameContent.Bestiary; @@ -27,11 +28,17 @@ namespace CalamityMod.NPCs.CeaselessVoid public const int HitboxSize = 64; public const int FrameCount = 8; + public static Asset GlowTexture; + public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = FrameCount; NPCID.Sets.TrailingMode[NPC.type] = 1; NPCID.Sets.BossBestiaryPriority.Add(Type); + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -243,7 +250,7 @@ namespace CalamityMod.NPCs.CeaselessVoid if (NPC.dontTakeDamage) return false; - Texture2D glowTexture = ModContent.Request("CalamityMod/NPCs/CeaselessVoid/DarkEnergyGlow").Value; + Texture2D glowTexture = GlowTexture.Value; Color glowColor = Color.Lerp(Color.White, Color.Fuchsia, 0.5f) * NPC.Opacity; if (CalamityConfig.Instance.Afterimages) diff --git a/NPCs/Crabulon/CrabShroom.cs b/NPCs/Crabulon/CrabShroom.cs index 47b079b94b..fe2ecc6d04 100644 --- a/NPCs/Crabulon/CrabShroom.cs +++ b/NPCs/Crabulon/CrabShroom.cs @@ -2,9 +2,9 @@ using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.GameContent; -using Terraria.GameContent.Bestiary; using Terraria.ID; using Terraria.ModLoader; @@ -12,11 +12,17 @@ namespace CalamityMod.NPCs.Crabulon { public class CrabShroom : ModNPC { + public static Asset GlowTexture; + public override void SetStaticDefaults() { this.HideFromBestiary(); Main.npcFrameCount[NPC.type] = 4; NPCID.Sets.BossBestiaryPriority.Add(Type); + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -133,7 +139,7 @@ namespace CalamityMod.NPCs.Crabulon spriteEffects = SpriteEffects.FlipHorizontally; Texture2D texture = TextureAssets.Npc[NPC.type].Value; - Texture2D glow = ModContent.Request("CalamityMod/NPCs/Crabulon/CrabShroomGlow").Value; + Texture2D glow = GlowTexture.Value; Color colorToShift = Main.zenithWorld ? new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB) : Color.Cyan; Color glowColor = Color.Lerp(Color.White, colorToShift, 0.5f); diff --git a/NPCs/Crabulon/Crabulon.cs b/NPCs/Crabulon/Crabulon.cs index 2b7721a132..1d54dbc91c 100644 --- a/NPCs/Crabulon/Crabulon.cs +++ b/NPCs/Crabulon/Crabulon.cs @@ -19,6 +19,7 @@ using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -35,6 +36,12 @@ namespace CalamityMod.NPCs.Crabulon private int biomeEnrageTimer = CalamityGlobalNPC.biomeEnrageTimerMax; private bool stomping = false; + public static Asset AltTexture; + public static Asset AttackTexture; + public static Asset Texture_Glow; + public static Asset AltTexture_Glow; + public static Asset AttackTexture_Glow; + public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 6; @@ -48,6 +55,14 @@ namespace CalamityMod.NPCs.Crabulon value.Position.Y += 80f; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; NPCID.Sets.MPAllowedEnemies[Type] = true; + if (!Main.dedServ) + { + AltTexture = ModContent.Request(Texture + "Alt", AssetRequestMode.AsyncLoad); + AttackTexture = ModContent.Request(Texture + "Attack", AssetRequestMode.AsyncLoad); + Texture_Glow = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + AltTexture_Glow = ModContent.Request(Texture + "AltGlow", AssetRequestMode.AsyncLoad); + AttackTexture_Glow = ModContent.Request(Texture + "AttackGlow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -769,11 +784,11 @@ namespace CalamityMod.NPCs.Crabulon spriteEffects = SpriteEffects.FlipHorizontally; Texture2D textureIdle = TextureAssets.Npc[NPC.type].Value; - Texture2D glowIdle = ModContent.Request("CalamityMod/NPCs/Crabulon/CrabulonGlow").Value; - Texture2D textureWalk = ModContent.Request("CalamityMod/NPCs/Crabulon/CrabulonAlt").Value; - Texture2D glowWalk = ModContent.Request("CalamityMod/NPCs/Crabulon/CrabulonAltGlow").Value; - Texture2D textureAttack = ModContent.Request("CalamityMod/NPCs/Crabulon/CrabulonAttack").Value; - Texture2D glowAttack = ModContent.Request("CalamityMod/NPCs/Crabulon/CrabulonAttackGlow").Value; + Texture2D glowIdle = Texture_Glow.Value; + Texture2D textureWalk = AltTexture.Value; + Texture2D glowWalk = AltTexture_Glow.Value; + Texture2D textureAttack = AttackTexture.Value; + Texture2D glowAttack = AttackTexture_Glow.Value; Color colorToShift = Main.zenithWorld ? new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB) : Color.Cyan; Color glowColor = Color.Lerp(Color.White, colorToShift, 0.5f); diff --git a/NPCs/Crags/SoulSlurper.cs b/NPCs/Crags/SoulSlurper.cs index 3a9bdff309..0193e34739 100644 --- a/NPCs/Crags/SoulSlurper.cs +++ b/NPCs/Crags/SoulSlurper.cs @@ -8,6 +8,7 @@ using CalamityMod.Items.Placeables.Banners; using CalamityMod.Projectiles.Boss; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.GameContent; using Terraria.GameContent.Bestiary; @@ -18,9 +19,15 @@ namespace CalamityMod.NPCs.Crags { public class SoulSlurper : ModNPC { + public static Asset GlowTexture; + public override void SetStaticDefaults() { NPCID.Sets.TrailingMode[NPC.type] = 1; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -267,7 +274,7 @@ namespace CalamityMod.NPCs.Crags drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - texture = ModContent.Request("CalamityMod/NPCs/Crags/SoulSlurperGlow").Value; + texture = GlowTexture.Value; Color redGlow = Color.Lerp(Color.White, Color.Red, 0.5f); if (CalamityConfig.Instance.Afterimages) diff --git a/NPCs/Cryogen/Cryogen.cs b/NPCs/Cryogen/Cryogen.cs index 969ac7356f..d7314cc063 100644 --- a/NPCs/Cryogen/Cryogen.cs +++ b/NPCs/Cryogen/Cryogen.cs @@ -26,6 +26,7 @@ using CalamityMod.UI.VanillaBossBars; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -53,6 +54,12 @@ namespace CalamityMod.NPCs.Cryogen public static readonly SoundStyle ShieldRegenSound = new("CalamityMod/Sounds/Custom/CryogenShieldRegenerate"); public static readonly SoundStyle DeathSound = new("CalamityMod/Sounds/NPCKilled/CryogenDeath"); + public static Asset Phase2Texture; + public static Asset Phase3Texture; + public static Asset Phase4Texture; + public static Asset Phase5Texture; + public static Asset Phase6Texture; + public FireParticleSet FireDrawer = null; public static int cryoIconIndex; @@ -74,6 +81,14 @@ namespace CalamityMod.NPCs.Cryogen { NPCID.Sets.BossBestiaryPriority.Add(Type); NPCID.Sets.MPAllowedEnemies[Type] = true; + if (!Main.dedServ) + { + Phase2Texture = ModContent.Request("CalamityMod/NPCs/Cryogen/Cryogen_Phase2", AssetRequestMode.AsyncLoad); + Phase3Texture = ModContent.Request("CalamityMod/NPCs/Cryogen/Cryogen_Phase3", AssetRequestMode.AsyncLoad); + Phase4Texture = ModContent.Request("CalamityMod/NPCs/Cryogen/Cryogen_Phase4", AssetRequestMode.AsyncLoad); + Phase5Texture = ModContent.Request("CalamityMod/NPCs/Cryogen/Cryogen_Phase5", AssetRequestMode.AsyncLoad); + Phase6Texture = ModContent.Request("CalamityMod/NPCs/Cryogen/Cryogen_Phase6", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -1230,8 +1245,29 @@ Block: else FireDrawer = null; - string phase = "CalamityMod/NPCs/Cryogen/Cryogen_Phase" + currentPhase; - Texture2D texture = ModContent.Request(phase).Value; + + Texture2D texture = TextureAssets.Npc[NPC.type].Value; + switch (currentPhase) + { + case 2: + texture = Phase2Texture.Value; + break; + case 3: + texture = Phase3Texture.Value; + break; + case 4: + texture = Phase4Texture.Value; + break; + case 5: + texture = Phase5Texture.Value; + break; + case 6: + texture = Phase6Texture.Value; + break; + default: + texture = TextureAssets.Npc[NPC.type].Value; + break; + } SpriteEffects spriteEffects = SpriteEffects.None; if (NPC.spriteDirection == 1) diff --git a/NPCs/DevourerofGods/CosmicGuardianBody.cs b/NPCs/DevourerofGods/CosmicGuardianBody.cs index 22df16f5e1..e7190dd435 100644 --- a/NPCs/DevourerofGods/CosmicGuardianBody.cs +++ b/NPCs/DevourerofGods/CosmicGuardianBody.cs @@ -5,6 +5,7 @@ using CalamityMod.Events; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.GameContent; using Terraria.ID; @@ -16,9 +17,16 @@ namespace CalamityMod.NPCs.DevourerofGods { public int invinceTime = 180; public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.CosmicGuardianHead.DisplayName"); + + public static Asset GlowTexture; + public override void SetStaticDefaults() { this.HideFromBestiary(); + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -173,7 +181,7 @@ namespace CalamityMod.NPCs.DevourerofGods drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.Request("CalamityMod/NPCs/DevourerofGods/CosmicGuardianBodyGlow").Value; + texture2D15 = GlowTexture.Value; Color glowmaskColor = Color.Lerp(Color.White, Color.Fuchsia, 0.5f); spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, glowmaskColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); diff --git a/NPCs/DevourerofGods/CosmicGuardianHead.cs b/NPCs/DevourerofGods/CosmicGuardianHead.cs index d4d809eb7d..aea729dc4f 100644 --- a/NPCs/DevourerofGods/CosmicGuardianHead.cs +++ b/NPCs/DevourerofGods/CosmicGuardianHead.cs @@ -6,6 +6,7 @@ using CalamityMod.Events; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.GameContent; using Terraria.GameContent.Bestiary; @@ -21,6 +22,9 @@ namespace CalamityMod.NPCs.DevourerofGods private const int maxLength = 11; private int invinceTime = 180; + public static Asset GlowTexture; + public static Asset GlowTexture2; + public override void SetStaticDefaults() { NPCID.Sets.BossBestiaryPriority.Add(Type); @@ -35,6 +39,11 @@ namespace CalamityMod.NPCs.DevourerofGods value.Position.X += 62f; value.Position.Y += 35f; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + GlowTexture = ModContent.Request(Texture + "Glow2", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -362,12 +371,12 @@ namespace CalamityMod.NPCs.DevourerofGods distFromHead3 += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, distFromHead3, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.Request("CalamityMod/NPCs/DevourerofGods/CosmicGuardianHeadGlow").Value; + texture2D15 = GlowTexture.Value; Color glowmaskColor = Color.Lerp(Color.White, Color.Fuchsia, 0.5f); spriteBatch.Draw(texture2D15, distFromHead3, NPC.frame, glowmaskColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.Request("CalamityMod/NPCs/DevourerofGods/CosmicGuardianHeadGlow2").Value; + texture2D15 = GlowTexture2.Value; glowmaskColor = Color.Lerp(Color.White, Color.Cyan, 0.5f); spriteBatch.Draw(texture2D15, distFromHead3, NPC.frame, glowmaskColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); diff --git a/NPCs/DevourerofGods/CosmicGuardianTail.cs b/NPCs/DevourerofGods/CosmicGuardianTail.cs index 4308471905..1fd44f0e2b 100644 --- a/NPCs/DevourerofGods/CosmicGuardianTail.cs +++ b/NPCs/DevourerofGods/CosmicGuardianTail.cs @@ -5,6 +5,7 @@ using CalamityMod.Events; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.GameContent; using Terraria.ID; @@ -16,9 +17,16 @@ namespace CalamityMod.NPCs.DevourerofGods { public int invinceTime = 180; public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.CosmicGuardianHead.DisplayName"); + + public static Asset GlowTexture; + public override void SetStaticDefaults() { this.HideFromBestiary(); + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -170,7 +178,7 @@ namespace CalamityMod.NPCs.DevourerofGods drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.Request("CalamityMod/NPCs/DevourerofGods/CosmicGuardianTailGlow").Value; + texture2D15 = GlowTexture.Value; Color glowmaskColor = Color.Lerp(Color.White, Color.Cyan, 0.5f); spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, glowmaskColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); diff --git a/NPCs/DevourerofGods/DevourerofGodsBody.cs b/NPCs/DevourerofGods/DevourerofGodsBody.cs index ddbb093225..27c77a6b77 100644 --- a/NPCs/DevourerofGods/DevourerofGodsBody.cs +++ b/NPCs/DevourerofGods/DevourerofGodsBody.cs @@ -9,6 +9,7 @@ using CalamityMod.Projectiles.Melee.Yoyos; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -35,10 +36,24 @@ namespace CalamityMod.NPCs.DevourerofGods private bool setOpacity = false; private bool phase2Started = false; public int SegmentIndex; + + public static Asset Texture_Glow; + public static Asset Phase2Texture; + public static Asset Phase2Texture_Glow; + public static Asset Phase2Texture_Glow2; + public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.DevourerofGodsHead.DisplayName"); + public override void SetStaticDefaults() { this.HideFromBestiary(); + if (!Main.dedServ) + { + Texture_Glow = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + Phase2Texture = ModContent.Request(Texture + "S", AssetRequestMode.AsyncLoad); + Phase2Texture_Glow = ModContent.Request(Texture + "SGlow", AssetRequestMode.AsyncLoad); + Phase2Texture_Glow2 = ModContent.Request(Texture + "SGlow2", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -387,7 +402,7 @@ namespace CalamityMod.NPCs.DevourerofGods spriteEffects = SpriteEffects.FlipHorizontally; bool useOtherTextures = phase2Started && Main.npc[(int)NPC.ai[2]].localAI[2] <= 60f; - Texture2D texture2D15 = useOtherTextures ? ModContent.Request("CalamityMod/NPCs/DevourerofGods/DevourerofGodsBodyS").Value : TextureAssets.Npc[NPC.type].Value; + Texture2D texture2D15 = useOtherTextures ? Phase2Texture.Value : TextureAssets.Npc[NPC.type].Value; Vector2 halfSizeTexture = new Vector2(texture2D15.Width / 2, texture2D15.Height / 2); Vector2 drawLocation = NPC.Center - screenPos; @@ -399,13 +414,13 @@ namespace CalamityMod.NPCs.DevourerofGods { if (useOtherTextures) { - texture2D15 = ModContent.Request("CalamityMod/NPCs/DevourerofGods/DevourerofGodsBodySGlow").Value; + texture2D15 = Phase2Texture_Glow.Value; Color glowmaskColor = Color.Lerp(Color.White, Color.Fuchsia, 0.5f); spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, glowmaskColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } - texture2D15 = useOtherTextures ? ModContent.Request("CalamityMod/NPCs/DevourerofGods/DevourerofGodsBodySGlow2").Value : ModContent.Request("CalamityMod/NPCs/DevourerofGods/DevourerofGodsBodyGlow").Value; + texture2D15 = useOtherTextures ? Phase2Texture_Glow2.Value : Texture_Glow.Value; Color glowmaskColor2 = Color.Lerp(Color.White, Color.Cyan, 0.5f); spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, glowmaskColor2, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); diff --git a/NPCs/DevourerofGods/DevourerofGodsHead.cs b/NPCs/DevourerofGods/DevourerofGodsHead.cs index f04132ec01..fe0c84c05d 100644 --- a/NPCs/DevourerofGods/DevourerofGodsHead.cs +++ b/NPCs/DevourerofGods/DevourerofGodsHead.cs @@ -30,6 +30,7 @@ using CalamityMod.Sounds; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -48,6 +49,12 @@ namespace CalamityMod.NPCs.DevourerofGods public static int phase1IconIndex; public static int phase2IconIndex; + public static Asset Texture_Glow; + public static Asset Texture_Glow2; + public static Asset Phase2Texture; + public static Asset Phase2Texture_Glow; + public static Asset Phase2Texture_Glow2; + internal static void LoadHeadIcons() { string phase1IconPath = "CalamityMod/NPCs/DevourerofGods/DevourerofGodsHead_Head_Boss"; @@ -168,6 +175,14 @@ namespace CalamityMod.NPCs.DevourerofGods value.Position.Y += 38f; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; NPCID.Sets.MPAllowedEnemies[Type] = true; + if (!Main.dedServ) + { + Texture_Glow = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + Texture_Glow2 = ModContent.Request(Texture + "Glow2", AssetRequestMode.AsyncLoad); + Phase2Texture = ModContent.Request(Texture + "S", AssetRequestMode.AsyncLoad); + Phase2Texture_Glow = ModContent.Request(Texture + "SGlow", AssetRequestMode.AsyncLoad); + Phase2Texture_Glow2 = ModContent.Request(Texture + "SGlow2", AssetRequestMode.AsyncLoad); + } } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -551,7 +566,7 @@ namespace CalamityMod.NPCs.DevourerofGods } // Dialogue the moment the second phase starts - if (NPC.localAI[2] == 60f) + if (NPC.localAI[2] == 60f && !bossRush) { string key = "Mods.CalamityMod.Status.Boss.EdgyBossText5"; Color messageColor = Color.Cyan; @@ -727,9 +742,12 @@ namespace CalamityMod.NPCs.DevourerofGods calamityGlobalNPC.newAI[3] = 0f; // Anger message - string key = "Mods.CalamityMod.Status.Boss.EdgyBossText6"; - Color messageColor = Color.Cyan; - CalamityUtils.DisplayLocalizedText(key, messageColor); + if (!bossRush) + { + string key = "Mods.CalamityMod.Status.Boss.EdgyBossText6"; + Color messageColor = Color.Cyan; + CalamityUtils.DisplayLocalizedText(key, messageColor); + } // Summon Cosmic Guardians SoundEngine.PlaySound(AttackSound with { Pitch = AttackSound.Pitch + extrapitch }, player.Center); @@ -1578,9 +1596,12 @@ namespace CalamityMod.NPCs.DevourerofGods if (revenge) spawnDoGCountdown = 10; - string key = "Mods.CalamityMod.Status.Boss.EdgyBossText"; - Color messageColor = Color.Cyan; - CalamityUtils.DisplayLocalizedText(key, messageColor); + if (!bossRush) + { + string key = "Mods.CalamityMod.Status.Boss.EdgyBossText"; + Color messageColor = Color.Cyan; + CalamityUtils.DisplayLocalizedText(key, messageColor); + } NPC.TargetClosest(); spawnedGuardians = true; @@ -2606,7 +2627,7 @@ namespace CalamityMod.NPCs.DevourerofGods spriteEffects = SpriteEffects.FlipHorizontally; bool useOtherTextures = (Phase2Started && NPC.localAI[2] <= 60f) || NPC.IsABestiaryIconDummy; - Texture2D texture2D15 = useOtherTextures ? ModContent.Request("CalamityMod/NPCs/DevourerofGods/DevourerofGodsHeadS").Value : TextureAssets.Npc[NPC.type].Value; + Texture2D texture2D15 = useOtherTextures ? Phase2Texture.Value : TextureAssets.Npc[NPC.type].Value; Vector2 halfSizeTexture = new Vector2(texture2D15.Width / 2, texture2D15.Height / 2); if (NPC.IsABestiaryIconDummy) NPC.frame = texture2D15.Frame(); @@ -2618,12 +2639,12 @@ namespace CalamityMod.NPCs.DevourerofGods if (!NPC.dontTakeDamage) { - texture2D15 = useOtherTextures ? ModContent.Request("CalamityMod/NPCs/DevourerofGods/DevourerofGodsHeadSGlow").Value : ModContent.Request("CalamityMod/NPCs/DevourerofGods/DevourerofGodsHeadGlow").Value; + texture2D15 = useOtherTextures ? Phase2Texture_Glow.Value : Texture_Glow.Value; Color glowmaskLerp = Color.Lerp(Color.White, Color.Fuchsia, 0.5f); spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, glowmaskLerp, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - texture2D15 = useOtherTextures ? ModContent.Request("CalamityMod/NPCs/DevourerofGods/DevourerofGodsHeadSGlow2").Value : ModContent.Request("CalamityMod/NPCs/DevourerofGods/DevourerofGodsHeadGlow2").Value; + texture2D15 = useOtherTextures ? Phase2Texture_Glow2.Value : Texture_Glow2.Value; glowmaskLerp = Color.Lerp(Color.White, Color.Cyan, 0.5f); spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, glowmaskLerp, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); @@ -2885,7 +2906,7 @@ namespace CalamityMod.NPCs.DevourerofGods target.AddBuff(ModContent.BuffType(), 200, true); target.AddBuff(ModContent.BuffType(), 600, true); - if (target.Calamity().dogTextCooldown <= 0) + if (target.Calamity().dogTextCooldown <= 0 && !BossRushEvent.BossRushActive) { string text = Utils.SelectRandom(Main.rand, new string[] { diff --git a/NPCs/DevourerofGods/DevourerofGodsTail.cs b/NPCs/DevourerofGods/DevourerofGodsTail.cs index 1f51ff5ea0..1cac86041f 100644 --- a/NPCs/DevourerofGods/DevourerofGodsTail.cs +++ b/NPCs/DevourerofGods/DevourerofGodsTail.cs @@ -8,6 +8,7 @@ using CalamityMod.Sounds; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -23,6 +24,12 @@ namespace CalamityMod.NPCs.DevourerofGods public static int phase1IconIndex; public static int phase2IconIndex; + public static Asset Texture_Glow; + public static Asset Texture_Glow2; + public static Asset Phase2Texture; + public static Asset Phase2Texture_Glow; + public static Asset Phase2Texture_Glow2; + internal static void LoadHeadIcons() { string phase1IconPath = "CalamityMod/NPCs/DevourerofGods/DevourerofGodsTail_Head_Boss"; @@ -42,6 +49,14 @@ namespace CalamityMod.NPCs.DevourerofGods public override void SetStaticDefaults() { this.HideFromBestiary(); + if (!Main.dedServ) + { + Texture_Glow = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + Texture_Glow2 = ModContent.Request(Texture + "Glow2", AssetRequestMode.AsyncLoad); + Phase2Texture = ModContent.Request(Texture + "S", AssetRequestMode.AsyncLoad); + Phase2Texture_Glow = ModContent.Request(Texture + "SGlow", AssetRequestMode.AsyncLoad); + Phase2Texture_Glow2 = ModContent.Request(Texture + "SGlow2", AssetRequestMode.AsyncLoad); + } } internal void setInvulTime(int time) @@ -355,7 +370,7 @@ namespace CalamityMod.NPCs.DevourerofGods spriteEffects = SpriteEffects.FlipHorizontally; bool useOtherTextures = phase2Started && Main.npc[(int)NPC.ai[2]].localAI[2] <= 60f; - Texture2D texture2D15 = useOtherTextures ? ModContent.Request("CalamityMod/NPCs/DevourerofGods/DevourerofGodsTailS").Value : TextureAssets.Npc[NPC.type].Value; + Texture2D texture2D15 = useOtherTextures ? Phase2Texture.Value : TextureAssets.Npc[NPC.type].Value; Vector2 halfSizeTexture = new Vector2(texture2D15.Width / 2, texture2D15.Height / 2); Vector2 drawPosition = NPC.Center - screenPos; @@ -365,12 +380,12 @@ namespace CalamityMod.NPCs.DevourerofGods if (!NPC.dontTakeDamage) { - texture2D15 = useOtherTextures ? ModContent.Request("CalamityMod/NPCs/DevourerofGods/DevourerofGodsTailSGlow").Value : ModContent.Request("CalamityMod/NPCs/DevourerofGods/DevourerofGodsTailGlow").Value; + texture2D15 = useOtherTextures ? Phase2Texture_Glow.Value : Texture_Glow.Value; Color glowmaskColor = Color.Lerp(Color.White, Color.Fuchsia, 0.5f); spriteBatch.Draw(texture2D15, drawPosition, NPC.frame, glowmaskColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - texture2D15 = useOtherTextures ? ModContent.Request("CalamityMod/NPCs/DevourerofGods/DevourerofGodsTailSGlow2").Value : ModContent.Request("CalamityMod/NPCs/DevourerofGods/DevourerofGodsTailGlow2").Value; + texture2D15 = useOtherTextures ? Phase2Texture_Glow2.Value : Texture_Glow2.Value; glowmaskColor = Color.Lerp(Color.White, Color.Cyan, 0.5f); spriteBatch.Draw(texture2D15, drawPosition, NPC.frame, glowmaskColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); diff --git a/NPCs/DraedonLabThings/Androomba.cs b/NPCs/DraedonLabThings/Androomba.cs index b481f16d30..d867d59bc8 100644 --- a/NPCs/DraedonLabThings/Androomba.cs +++ b/NPCs/DraedonLabThings/Androomba.cs @@ -3,6 +3,7 @@ using CalamityMod.Items.Critters; using CalamityMod.Items.Placeables.Banners; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -14,7 +15,11 @@ namespace CalamityMod.NPCs.DraedonLabThings { public class Androomba : ModNPC { + + public static Asset GlowTexture; + public SoundStyle HurrySound = new("CalamityMod/Sounds/Custom/WulfrumDroidHurry", 2) { PitchVariance = 0.3f }; + public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 22; @@ -25,6 +30,10 @@ namespace CalamityMod.NPCs.DraedonLabThings value.Position.Y += 18; value.PortraitPositionYOverride = 38f; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "_Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -253,7 +262,7 @@ namespace CalamityMod.NPCs.DraedonLabThings public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { Texture2D critterTexture = TextureAssets.Npc[NPC.type].Value; - Texture2D glowmask = ModContent.Request("CalamityMod/NPCs/DraedonLabThings/Androomba_Glow").Value; + Texture2D glowmask = GlowTexture.Value; Vector2 drawPosition = NPC.Center - screenPos + Vector2.UnitY * NPC.gfxOffY; drawPosition.Y += DrawOffsetY; SpriteEffects direction = NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; diff --git a/NPCs/DraedonLabThings/Nanodroid.cs b/NPCs/DraedonLabThings/Nanodroid.cs index 9ad79bb4f1..5730109ccb 100644 --- a/NPCs/DraedonLabThings/Nanodroid.cs +++ b/NPCs/DraedonLabThings/Nanodroid.cs @@ -2,6 +2,7 @@ using CalamityMod.Items.Critters; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.GameContent; using Terraria.GameContent.Bestiary; @@ -12,11 +13,17 @@ namespace CalamityMod.NPCs.DraedonLabThings { public class Nanodroid : ModNPC { + public static Asset GlowTexture; + public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 8; NPCID.Sets.CountsAsCritter[NPC.type] = true; Main.npcCatchable[NPC.type] = true; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "_Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -65,7 +72,7 @@ namespace CalamityMod.NPCs.DraedonLabThings public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { Texture2D critterTexture = TextureAssets.Npc[NPC.type].Value; - Texture2D glowmask = ModContent.Request("CalamityMod/NPCs/DraedonLabThings/Nanodroid_Glow").Value; + Texture2D glowmask = GlowTexture.Value; Vector2 drawPosition = NPC.Center - screenPos + Vector2.UnitY * NPC.gfxOffY; SpriteEffects direction = NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; spriteBatch.Draw(critterTexture, drawPosition, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, NPC.frame.Size() * 0.5f, NPC.scale, direction, 0f); diff --git a/NPCs/DraedonLabThings/NanodroidDysfunctional.cs b/NPCs/DraedonLabThings/NanodroidDysfunctional.cs index e8c4c0fb5b..fba1017618 100644 --- a/NPCs/DraedonLabThings/NanodroidDysfunctional.cs +++ b/NPCs/DraedonLabThings/NanodroidDysfunctional.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.Critters; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.GameContent; using Terraria.ID; @@ -11,6 +12,7 @@ namespace CalamityMod.NPCs.DraedonLabThings { public class NanodroidDysfunctional : ModNPC { + public static Asset GlowTexture; public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.Nanodroid.DisplayName"); public override void SetStaticDefaults() { @@ -18,6 +20,10 @@ namespace CalamityMod.NPCs.DraedonLabThings Main.npcFrameCount[NPC.type] = 8; NPCID.Sets.CountsAsCritter[NPC.type] = true; Main.npcCatchable[NPC.type] = true; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "_Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -74,7 +80,7 @@ namespace CalamityMod.NPCs.DraedonLabThings public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { Texture2D critterTexture = TextureAssets.Npc[NPC.type].Value; - Texture2D glowmask = ModContent.Request("CalamityMod/NPCs/DraedonLabThings/NanodroidDysfunctional_Glow").Value; + Texture2D glowmask = GlowTexture.Value; Vector2 drawPosition = NPC.Center - screenPos + Vector2.UnitY * NPC.gfxOffY; SpriteEffects direction = NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; spriteBatch.Draw(critterTexture, drawPosition, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, NPC.frame.Size() * 0.5f, NPC.scale, direction, 0f); diff --git a/NPCs/DraedonLabThings/NanodroidPlagueGreen.cs b/NPCs/DraedonLabThings/NanodroidPlagueGreen.cs index 9dc7c90f79..9b7f651e01 100644 --- a/NPCs/DraedonLabThings/NanodroidPlagueGreen.cs +++ b/NPCs/DraedonLabThings/NanodroidPlagueGreen.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.Critters; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.GameContent; using Terraria.ID; @@ -11,6 +12,7 @@ namespace CalamityMod.NPCs.DraedonLabThings { public class NanodroidPlagueGreen : ModNPC { + public static Asset GlowTexture; public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.Nanodroid.DisplayName"); public override void SetStaticDefaults() { @@ -18,6 +20,10 @@ namespace CalamityMod.NPCs.DraedonLabThings Main.npcFrameCount[NPC.type] = 8; NPCID.Sets.CountsAsCritter[NPC.type] = true; Main.npcCatchable[NPC.type] = true; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "_Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -74,7 +80,7 @@ namespace CalamityMod.NPCs.DraedonLabThings public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { Texture2D critterTexture = TextureAssets.Npc[NPC.type].Value; - Texture2D glowmask = ModContent.Request("CalamityMod/NPCs/DraedonLabThings/NanodroidPlagueGreen_Glow").Value; + Texture2D glowmask = GlowTexture.Value; Vector2 drawPosition = NPC.Center - screenPos + Vector2.UnitY * NPC.gfxOffY; SpriteEffects direction = NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; spriteBatch.Draw(critterTexture, drawPosition, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, NPC.frame.Size() * 0.5f, NPC.scale, direction, 0f); diff --git a/NPCs/DraedonLabThings/NanodroidPlagueRed.cs b/NPCs/DraedonLabThings/NanodroidPlagueRed.cs index 46175edd3a..7473e4dd55 100644 --- a/NPCs/DraedonLabThings/NanodroidPlagueRed.cs +++ b/NPCs/DraedonLabThings/NanodroidPlagueRed.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.Critters; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.GameContent; using Terraria.ID; @@ -11,6 +12,7 @@ namespace CalamityMod.NPCs.DraedonLabThings { public class NanodroidPlagueRed : ModNPC { + public static Asset GlowTexture; public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.Nanodroid.DisplayName"); public override void SetStaticDefaults() { @@ -18,6 +20,10 @@ namespace CalamityMod.NPCs.DraedonLabThings Main.npcFrameCount[NPC.type] = 8; NPCID.Sets.CountsAsCritter[NPC.type] = true; Main.npcCatchable[NPC.type] = true; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "_Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -74,7 +80,7 @@ namespace CalamityMod.NPCs.DraedonLabThings public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { Texture2D critterTexture = TextureAssets.Npc[NPC.type].Value; - Texture2D glowmask = ModContent.Request("CalamityMod/NPCs/DraedonLabThings/NanodroidPlagueRed_Glow").Value; + Texture2D glowmask = GlowTexture.Value; Vector2 drawPosition = NPC.Center - screenPos + Vector2.UnitY * NPC.gfxOffY; SpriteEffects direction = NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; spriteBatch.Draw(critterTexture, drawPosition, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, NPC.frame.Size() * 0.5f, NPC.scale, direction, 0f); diff --git a/NPCs/DraedonLabThings/RepairUnitCritter.cs b/NPCs/DraedonLabThings/RepairUnitCritter.cs index a67d34da5c..b6a844db97 100644 --- a/NPCs/DraedonLabThings/RepairUnitCritter.cs +++ b/NPCs/DraedonLabThings/RepairUnitCritter.cs @@ -6,6 +6,7 @@ using CalamityMod.Items.DraedonMisc; using CalamityMod.Items.Placeables.Banners; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.GameContent; using Terraria.GameContent.Bestiary; @@ -50,6 +51,8 @@ namespace CalamityMod.NPCs.DraedonLabThings public const float Gravity = 0.4f; + public static Asset GlowTexture; + public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 17; @@ -61,6 +64,10 @@ namespace CalamityMod.NPCs.DraedonLabThings value.Position.Y += 12; value.PortraitPositionYOverride = 32f; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glowmask", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -367,7 +374,7 @@ namespace CalamityMod.NPCs.DraedonLabThings public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { Texture2D critterTexture = TextureAssets.Npc[NPC.type].Value; - Texture2D glowmask = ModContent.Request("CalamityMod/NPCs/DraedonLabThings/RepairUnitCritterGlowmask").Value; + Texture2D glowmask = GlowTexture.Value; Vector2 drawPosition = NPC.Center - screenPos + Vector2.UnitY * NPC.gfxOffY; SpriteEffects direction = NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; spriteBatch.Draw(critterTexture, drawPosition, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, NPC.frame.Size() * 0.5f, NPC.scale, direction, 0f); diff --git a/NPCs/ExoMechs/Apollo/Apollo.cs b/NPCs/ExoMechs/Apollo/Apollo.cs index 3eaa0195f8..2378e6b1f4 100644 --- a/NPCs/ExoMechs/Apollo/Apollo.cs +++ b/NPCs/ExoMechs/Apollo/Apollo.cs @@ -13,6 +13,7 @@ using CalamityMod.Sounds; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -29,6 +30,8 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo public static int phase1IconIndex; public static int phase2IconIndex; + public static Asset GlowTexture; + internal static void LoadHeadIcons() { string phase1IconPath = "CalamityMod/NPCs/ExoMechs/Apollo/ApolloHead"; @@ -135,6 +138,10 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo Rotation = -MathHelper.PiOver4 }; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -1596,7 +1603,7 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo } } - texture = ModContent.Request("CalamityMod/NPCs/ExoMechs/Apollo/ApolloGlow").Value; + texture = GlowTexture.Value; if (CalamityConfig.Instance.Afterimages && !NPC.IsABestiaryIconDummy) { for (int i = 1; i < numAfterimages; i += 2) diff --git a/NPCs/ExoMechs/Ares/AresBody.cs b/NPCs/ExoMechs/Ares/AresBody.cs index b9dc07c33f..6f12078636 100644 --- a/NPCs/ExoMechs/Ares/AresBody.cs +++ b/NPCs/ExoMechs/Ares/AresBody.cs @@ -28,6 +28,7 @@ using CalamityMod.UI.VanillaBossBars; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using ReLogic.Utilities; using Terraria; using Terraria.Audio; @@ -155,6 +156,30 @@ namespace CalamityMod.NPCs.ExoMechs.Ares public static readonly SoundStyle LaserLoopSound = new SoundStyle("CalamityMod/Sounds/Custom/ExoMechs/AresCircleLaserLoop") with { IsLooped = true }; public static readonly SoundStyle LaserEndSound = new("CalamityMod/Sounds/Custom/ExoMechs/AresCircleLaserEnd"); + + #region Textures + public static Asset GlowTexture; + public static Asset NeuronTexture; + public static Asset NeuronTexture_Glow; + + public static Asset ArmTopTexture; + public static Asset ArmTopTexture2; + public static Asset ArmSegmentTexture; + public static Asset ArmTopShoulderTexture; + public static Asset ArmBottomConnectorTexture; + public static Asset ArmBottomTexture; + public static Asset ArmBottomTexture2; + public static Asset ArmBottomShoulderTexture; + + public static Asset ArmTopTexture2_Glow; + public static Asset ArmSegmentTexture_Glow; + public static Asset ArmTopShoulderTexture_Glow; + public static Asset ArmBottomTexture_Glow; + public static Asset ArmBottomTexture2_Glow; + public static Asset ArmBottomShoulderTexture_Glow; + #endregion + + public override void SetStaticDefaults() { NPCID.Sets.TrailingMode[NPC.type] = 3; @@ -166,6 +191,29 @@ namespace CalamityMod.NPCs.ExoMechs.Ares Scale = 0.4f }; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + if (!Main.dedServ) + { + string AresPath = "CalamityMod/NPCs/ExoMechs/Ares/Ares"; + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + NeuronTexture = ModContent.Request("CalamityMod/NPCs/ExoMechs/AergiaNeuron", AssetRequestMode.AsyncLoad); + NeuronTexture_Glow = ModContent.Request("CalamityMod/NPCs/ExoMechs/AergiaNeuron_Glow", AssetRequestMode.AsyncLoad); + + ArmTopTexture = ModContent.Request(AresPath + "ArmTopPart1", AssetRequestMode.AsyncLoad); + ArmTopTexture2 = ModContent.Request(AresPath + "ArmTopPart2", AssetRequestMode.AsyncLoad); + ArmSegmentTexture = ModContent.Request(AresPath + "ArmTopSegment", AssetRequestMode.AsyncLoad); + ArmTopShoulderTexture = ModContent.Request(AresPath + "ArmTopShoulder", AssetRequestMode.AsyncLoad); + ArmBottomConnectorTexture = ModContent.Request(AresPath + "BottomArmConnector", AssetRequestMode.AsyncLoad); + ArmBottomTexture = ModContent.Request(AresPath + "BottomArmPart1", AssetRequestMode.AsyncLoad); + ArmBottomTexture2 = ModContent.Request(AresPath + "BottomArmPart2", AssetRequestMode.AsyncLoad); + ArmBottomShoulderTexture = ModContent.Request(AresPath + "BottomArmShoulder", AssetRequestMode.AsyncLoad); + + ArmTopTexture2_Glow = ModContent.Request(AresPath + "ArmTopPart2Glow", AssetRequestMode.AsyncLoad); + ArmSegmentTexture_Glow = ModContent.Request(AresPath + "ArmTopSegmentGlow", AssetRequestMode.AsyncLoad); + ArmTopShoulderTexture_Glow = ModContent.Request(AresPath + "ArmTopShoulderGlow", AssetRequestMode.AsyncLoad); + ArmBottomTexture_Glow = ModContent.Request(AresPath + "BottomArmPart1Glow", AssetRequestMode.AsyncLoad); + ArmBottomTexture2_Glow = ModContent.Request(AresPath + "BottomArmPart2Glow", AssetRequestMode.AsyncLoad); + ArmBottomShoulderTexture_Glow = ModContent.Request(AresPath + "BottomArmShoulderGlow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -1211,7 +1259,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares Vector2 center = NPC.Center - screenPos; spriteBatch.Draw(texture, center, frame, NPC.GetAlpha(drawColor), NPC.rotation, vector, NPC.scale, SpriteEffects.None, 0f); - texture = ModContent.Request("CalamityMod/NPCs/ExoMechs/Ares/AresBodyGlow").Value; + texture = GlowTexture.Value; if (CalamityConfig.Instance.Afterimages) { @@ -1283,14 +1331,14 @@ namespace CalamityMod.NPCs.ExoMechs.Ares // Draw back arms. if (backArm) { - Texture2D shoulderTexture = ModContent.Request("CalamityMod/NPCs/ExoMechs/Ares/AresArmTopShoulder").Value; - Texture2D armTexture1 = ModContent.Request("CalamityMod/NPCs/ExoMechs/Ares/AresArmTopPart1").Value; - Texture2D armSegmentTexture = ModContent.Request("CalamityMod/NPCs/ExoMechs/Ares/AresArmTopSegment").Value; - Texture2D armTexture2 = ModContent.Request("CalamityMod/NPCs/ExoMechs/Ares/AresArmTopPart2").Value; + Texture2D shoulderTexture = ArmTopShoulderTexture.Value; + Texture2D armTexture1 = ArmTopTexture.Value; + Texture2D armSegmentTexture = ArmSegmentTexture.Value; + Texture2D armTexture2 = ArmTopTexture2.Value; - Texture2D shoulderGlowmask = ModContent.Request("CalamityMod/NPCs/ExoMechs/Ares/AresArmTopShoulderGlow").Value; - Texture2D armSegmentGlowmask = ModContent.Request("CalamityMod/NPCs/ExoMechs/Ares/AresArmTopSegmentGlow").Value; - Texture2D armGlowmask2 = ModContent.Request("CalamityMod/NPCs/ExoMechs/Ares/AresArmTopPart2Glow").Value; + Texture2D shoulderGlowmask = ArmTopShoulderTexture_Glow.Value; + Texture2D armSegmentGlowmask = ArmSegmentTexture_Glow.Value; + Texture2D armGlowmask2 = ArmTopTexture2_Glow.Value; Vector2 shoulderDrawPosition = NPC.Center + NPC.scale * new Vector2(direction * 176f, -100f); Vector2 arm1DrawPosition = shoulderDrawPosition + NPC.scale * new Vector2(direction * (shoulderTexture.Width + 16f), 10f); @@ -1352,14 +1400,14 @@ namespace CalamityMod.NPCs.ExoMechs.Ares } else { - Texture2D shoulderTexture = ModContent.Request("CalamityMod/NPCs/ExoMechs/Ares/AresBottomArmShoulder").Value; - Texture2D connectorTexture = ModContent.Request("CalamityMod/NPCs/ExoMechs/Ares/AresBottomArmConnector").Value; - Texture2D armTexture1 = ModContent.Request("CalamityMod/NPCs/ExoMechs/Ares/AresBottomArmPart1").Value; - Texture2D armTexture2 = ModContent.Request("CalamityMod/NPCs/ExoMechs/Ares/AresBottomArmPart2").Value; + Texture2D shoulderTexture = ArmBottomShoulderTexture.Value; + Texture2D connectorTexture = ArmBottomConnectorTexture.Value; + Texture2D armTexture1 = ArmBottomTexture.Value; + Texture2D armTexture2 = ArmBottomTexture2.Value; - Texture2D shoulderGlowmask = ModContent.Request("CalamityMod/NPCs/ExoMechs/Ares/AresBottomArmShoulderGlow").Value; - Texture2D armTexture1Glowmask = ModContent.Request("CalamityMod/NPCs/ExoMechs/Ares/AresBottomArmPart1Glow").Value; - Texture2D armTexture2Glowmask = ModContent.Request("CalamityMod/NPCs/ExoMechs/Ares/AresBottomArmPart2Glow").Value; + Texture2D shoulderGlowmask = ArmBottomShoulderTexture_Glow.Value; + Texture2D armTexture1Glowmask = ArmBottomTexture_Glow.Value; + Texture2D armTexture2Glowmask = ArmBottomTexture2_Glow.Value; Vector2 shoulderDrawPosition = NPC.Center + NPC.scale * new Vector2(direction * 110f, -54f); Vector2 connectorDrawPosition = shoulderDrawPosition + NPC.scale * new Vector2(direction * 20f, 32f); diff --git a/NPCs/ExoMechs/Ares/AresGaussNuke.cs b/NPCs/ExoMechs/Ares/AresGaussNuke.cs index c85886d59f..b5f33cc337 100644 --- a/NPCs/ExoMechs/Ares/AresGaussNuke.cs +++ b/NPCs/ExoMechs/Ares/AresGaussNuke.cs @@ -8,6 +8,7 @@ using CalamityMod.Sounds; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using ReLogic.Utilities; using Terraria; using Terraria.Audio; @@ -70,11 +71,17 @@ namespace CalamityMod.NPCs.ExoMechs.Ares public static readonly SoundStyle NukeExplosionSound = new("CalamityMod/Sounds/Custom/ExoMechs/AresGaussNukeExplosion") { Volume = 1.45f }; + public static Asset GlowTexture; + public override void SetStaticDefaults() { this.HideFromBestiary(); NPCID.Sets.TrailingMode[NPC.type] = 3; NPCID.Sets.TrailCacheLength[NPC.type] = NPC.oldPos.Length; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -587,7 +594,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares spriteBatch.Draw(texture, center, frame, NPC.GetAlpha(drawColor), NPC.rotation, vector, NPC.scale, spriteEffects, 0f); - Texture2D glowTexture = ModContent.Request("CalamityMod/NPCs/ExoMechs/Ares/AresGaussNukeGlow").Value; + Texture2D glowTexture = GlowTexture.Value; if (CalamityConfig.Instance.Afterimages) { diff --git a/NPCs/ExoMechs/Ares/AresLaserCannon.cs b/NPCs/ExoMechs/Ares/AresLaserCannon.cs index 431a174cdb..2b6eaf0394 100644 --- a/NPCs/ExoMechs/Ares/AresLaserCannon.cs +++ b/NPCs/ExoMechs/Ares/AresLaserCannon.cs @@ -9,6 +9,7 @@ using CalamityMod.Sounds; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using ReLogic.Utilities; using Terraria; using Terraria.Audio; @@ -73,11 +74,17 @@ namespace CalamityMod.NPCs.ExoMechs.Ares public static readonly SoundStyle LaserbeamShootSound = new("CalamityMod/Sounds/Custom/ExoMechs/AresLaserArmShoot") { Volume = 1.1f }; + public static Asset GlowTexture; + public override void SetStaticDefaults() { this.HideFromBestiary(); NPCID.Sets.TrailingMode[NPC.type] = 3; NPCID.Sets.TrailCacheLength[NPC.type] = NPC.oldPos.Length; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -633,7 +640,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares spriteBatch.Draw(texture, center, frame, NPC.GetAlpha(drawColor), NPC.rotation, vector, NPC.scale, spriteEffects, 0f); - Texture2D glowTexture = ModContent.Request("CalamityMod/NPCs/ExoMechs/Ares/AresLaserCannonGlow").Value; + Texture2D glowTexture = GlowTexture.Value; if (CalamityConfig.Instance.Afterimages) { diff --git a/NPCs/ExoMechs/Ares/AresPlasmaFlamethrower.cs b/NPCs/ExoMechs/Ares/AresPlasmaFlamethrower.cs index b569a0c639..20d3d990cc 100644 --- a/NPCs/ExoMechs/Ares/AresPlasmaFlamethrower.cs +++ b/NPCs/ExoMechs/Ares/AresPlasmaFlamethrower.cs @@ -9,6 +9,7 @@ using CalamityMod.Sounds; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using ReLogic.Utilities; using Terraria; using Terraria.Audio; @@ -67,11 +68,17 @@ namespace CalamityMod.NPCs.ExoMechs.Ares // Telegraph sound. public static readonly SoundStyle TelSound = new("CalamityMod/Sounds/Custom/ExoMechs/AresPlasmaArmCharge"); + public static Asset GlowTexture; + public override void SetStaticDefaults() { this.HideFromBestiary(); NPCID.Sets.TrailingMode[NPC.type] = 3; NPCID.Sets.TrailCacheLength[NPC.type] = NPC.oldPos.Length; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -585,7 +592,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares spriteBatch.Draw(texture, center, frame, NPC.GetAlpha(drawColor), NPC.rotation, vector, NPC.scale, spriteEffects, 0f); - Texture2D glowTexture = ModContent.Request("CalamityMod/NPCs/ExoMechs/Ares/AresPlasmaFlamethrowerGlow").Value; + Texture2D glowTexture = GlowTexture.Value; if (CalamityConfig.Instance.Afterimages) { diff --git a/NPCs/ExoMechs/Ares/AresTeslaCannon.cs b/NPCs/ExoMechs/Ares/AresTeslaCannon.cs index 19eead6a22..aaa5c83b40 100644 --- a/NPCs/ExoMechs/Ares/AresTeslaCannon.cs +++ b/NPCs/ExoMechs/Ares/AresTeslaCannon.cs @@ -8,6 +8,7 @@ using CalamityMod.Sounds; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using ReLogic.Utilities; using Terraria; using Terraria.Audio; @@ -68,11 +69,17 @@ namespace CalamityMod.NPCs.ExoMechs.Ares public static readonly SoundStyle TeslaOrbShootSound = new("CalamityMod/Sounds/Custom/ExoMechs/TeslaShoot", 2) { Volume = 1.1f }; + public static Asset GlowTexture; + public override void SetStaticDefaults() { this.HideFromBestiary(); NPCID.Sets.TrailingMode[NPC.type] = 3; NPCID.Sets.TrailCacheLength[NPC.type] = NPC.oldPos.Length; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -579,7 +586,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares spriteBatch.Draw(texture, center, frame, NPC.GetAlpha(drawColor), NPC.rotation, vector, NPC.scale, spriteEffects, 0f); - Texture2D glowTexture = ModContent.Request("CalamityMod/NPCs/ExoMechs/Ares/AresTeslaCannonGlow").Value; + Texture2D glowTexture = GlowTexture.Value; if (CalamityConfig.Instance.Afterimages) { diff --git a/NPCs/ExoMechs/Artemis/Artemis.cs b/NPCs/ExoMechs/Artemis/Artemis.cs index d42f25aa28..53edf7dd66 100644 --- a/NPCs/ExoMechs/Artemis/Artemis.cs +++ b/NPCs/ExoMechs/Artemis/Artemis.cs @@ -13,6 +13,7 @@ using CalamityMod.UI.VanillaBossBars; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using ReLogic.Utilities; using Terraria; using Terraria.Audio; @@ -41,6 +42,8 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis public static readonly SoundStyle SpinLaserbeamSound = new("CalamityMod/Sounds/Custom/ExoMechs/ArtemisSpinLaserbeam") { Volume = 1.3f }; + public static Asset GlowTexture; + internal static void LoadHeadIcons() { string phase1IconPath = "CalamityMod/NPCs/ExoMechs/Artemis/ArtemisHead"; @@ -168,6 +171,10 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis Rotation = MathHelper.Pi - MathHelper.PiOver4 }; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -1491,7 +1498,7 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis } } - texture = ModContent.Request("CalamityMod/NPCs/ExoMechs/Artemis/ArtemisGlow").Value; + texture = GlowTexture.Value; if (CalamityConfig.Instance.Afterimages && !NPC.IsABestiaryIconDummy) { for (int i = 1; i < numAfterimages; i += 2) diff --git a/NPCs/ExoMechs/Draedon.cs b/NPCs/ExoMechs/Draedon.cs index 64fe6c80ea..623673c9f1 100644 --- a/NPCs/ExoMechs/Draedon.cs +++ b/NPCs/ExoMechs/Draedon.cs @@ -1,12 +1,14 @@ using System; using System.IO; using CalamityMod.Events; +using CalamityMod.Items.Weapons.DraedonsArsenal; using CalamityMod.NPCs.ExoMechs.Ares; using CalamityMod.NPCs.ExoMechs.Thanatos; using CalamityMod.Sounds; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -80,6 +82,11 @@ namespace CalamityMod.NPCs.ExoMechs public static readonly SoundStyle TeleportSound = new("CalamityMod/Sounds/Custom/DraedonTeleport"); public static readonly SoundStyle SelectionSound = new("CalamityMod/Sounds/Custom/Codebreaker/ExoMechsIconSelect"); + public static Asset Texture_Glow; + public static Asset HoloTexture; + public static Asset ProjectorTexture; + public static Asset ProjectorTexture_Glow; + public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 12; @@ -94,6 +101,13 @@ namespace CalamityMod.NPCs.ExoMechs NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; NPCID.Sets.ShouldBeCountedAsBoss[NPC.type] = true; NPCID.Sets.MustAlwaysDraw[NPC.type] = true; + if (!Main.dedServ) + { + Texture_Glow = ModContent.Request(Texture + "Glowmask", AssetRequestMode.AsyncLoad); + HoloTexture = ModContent.Request("CalamityMod/NPCs/ExoMechs/HologramDraedon", AssetRequestMode.AsyncLoad); + ProjectorTexture = ModContent.Request(Texture + "Projector", AssetRequestMode.AsyncLoad); + ProjectorTexture_Glow = ModContent.Request(Texture + "ProjectorGlowmask", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -834,11 +848,11 @@ namespace CalamityMod.NPCs.ExoMechs spriteBatch.EnterShaderRegion(); bool holo = HasBeenKilled && KillReappearDelay <= 0; bool leaving = HasBeenKilled && DefeatTimer > DelayBeforeDefeatStandup + TalkDelay * 8f + 200f; - Texture2D texture = HasBeenKilled && KillReappearDelay <= 0f ? ModContent.Request("CalamityMod/NPCs/ExoMechs/HologramDraedon").Value : TextureAssets.Npc[NPC.type].Value; - Texture2D glowmask = ModContent.Request("CalamityMod/NPCs/ExoMechs/DraedonGlowmask").Value; - Texture2D projector = ModContent.Request("CalamityMod/NPCs/ExoMechs/DraedonProjector").Value; - Texture2D projectorglow = ModContent.Request("CalamityMod/NPCs/ExoMechs/DraedonProjectorGlowmask").Value; - Texture2D gun = ModContent.Request("CalamityMod/Items/Weapons/DraedonsArsenal/PulseRifle").Value; + Texture2D texture = HasBeenKilled && KillReappearDelay <= 0f ? HoloTexture.Value : TextureAssets.Npc[NPC.type].Value; + Texture2D glowmask = Texture_Glow.Value; + Texture2D projector = ProjectorTexture.Value; + Texture2D projectorglow = ProjectorTexture_Glow.Value; + Texture2D gun = TextureAssets.Item[ModContent.ItemType()].Value; Rectangle frame = NPC.frame; Vector2 drawPosition = NPC.Center - screenPos - Vector2.UnitY * 38f; diff --git a/NPCs/ExoMechs/Thanatos/ThanatosBody1.cs b/NPCs/ExoMechs/Thanatos/ThanatosBody1.cs index f5f2f9721f..f436b20005 100644 --- a/NPCs/ExoMechs/Thanatos/ThanatosBody1.cs +++ b/NPCs/ExoMechs/Thanatos/ThanatosBody1.cs @@ -7,6 +7,7 @@ using CalamityMod.Sounds; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -50,10 +51,16 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.ThanatosHead.DisplayName"); + public static Asset GlowTexture; + public override void SetStaticDefaults() { this.HideFromBestiary(); Main.npcFrameCount[NPC.type] = 5; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -625,7 +632,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos center += vector * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture, center, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector, NPC.scale, spriteEffects, 0f); - texture = ModContent.Request("CalamityMod/NPCs/ExoMechs/Thanatos/ThanatosBody1Glow").Value; + texture = GlowTexture.Value; spriteBatch.Draw(texture, center, NPC.frame, Color.White * NPC.Opacity, NPC.rotation, vector, NPC.scale, spriteEffects, 0f); SmokeDrawer.DrawSet(NPC.Center); diff --git a/NPCs/ExoMechs/Thanatos/ThanatosBody2.cs b/NPCs/ExoMechs/Thanatos/ThanatosBody2.cs index 78170efcf5..342fbbd659 100644 --- a/NPCs/ExoMechs/Thanatos/ThanatosBody2.cs +++ b/NPCs/ExoMechs/Thanatos/ThanatosBody2.cs @@ -7,6 +7,7 @@ using CalamityMod.Sounds; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -47,11 +48,18 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos private const float timeToOpenAndFireLasers = 36f; private const float segmentCloseTimerDecrement = 0.2f; + + public static Asset GlowTexture; + public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.ThanatosHead.DisplayName"); public override void SetStaticDefaults() { this.HideFromBestiary(); Main.npcFrameCount[NPC.type] = 5; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -627,7 +635,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos center += vector * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture, center, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector, NPC.scale, spriteEffects, 0f); - texture = ModContent.Request("CalamityMod/NPCs/ExoMechs/Thanatos/ThanatosBody2Glow").Value; + texture = GlowTexture.Value; spriteBatch.Draw(texture, center, NPC.frame, Color.White * NPC.Opacity, NPC.rotation, vector, NPC.scale, spriteEffects, 0f); SmokeDrawer.DrawSet(NPC.Center); diff --git a/NPCs/ExoMechs/Thanatos/ThanatosHead.cs b/NPCs/ExoMechs/Thanatos/ThanatosHead.cs index 90e97b6a35..f11e347359 100644 --- a/NPCs/ExoMechs/Thanatos/ThanatosHead.cs +++ b/NPCs/ExoMechs/Thanatos/ThanatosHead.cs @@ -11,6 +11,7 @@ using CalamityMod.UI.VanillaBossBars; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using ReLogic.Utilities; using Terraria; using Terraria.Audio; @@ -36,6 +37,15 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos public SlotId LaserSoundSlot; + public static Asset GlowTexture; + public static Asset AuraTexture; + public static Asset ReticleLeftTexture; + public static Asset ReticleRightTexture; + public static Asset ReticleProngLeftTexture; + public static Asset ReticleProngRightTexture; + public static Asset ReticleTopTexture; + public static Asset ReticleBottomTexture; + internal static void LoadHeadIcons() { string normalIconPath = "CalamityMod/NPCs/ExoMechs/Thanatos/ThanatosNormalHead"; @@ -139,6 +149,17 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos value.Position.X += 52f; value.Position.Y += 16f; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + ReticleLeftTexture = ModContent.Request("CalamityMod/NPCs/ExoMechs/Thanatos/ThanatosReticleLeft", AssetRequestMode.AsyncLoad); + ReticleRightTexture = ModContent.Request("CalamityMod/NPCs/ExoMechs/Thanatos/ThanatosReticleRight", AssetRequestMode.AsyncLoad); + ReticleTopTexture = ModContent.Request("CalamityMod/NPCs/ExoMechs/Thanatos/ThanatosReticleTop", AssetRequestMode.AsyncLoad); + ReticleBottomTexture = ModContent.Request("CalamityMod/NPCs/ExoMechs/Thanatos/ThanatosReticleHead", AssetRequestMode.AsyncLoad); + ReticleProngRightTexture = ModContent.Request("CalamityMod/NPCs/ExoMechs/Thanatos/ThanatosReticleProngLeft", AssetRequestMode.AsyncLoad); + ReticleProngLeftTexture = ModContent.Request("CalamityMod/NPCs/ExoMechs/Thanatos/ThanatosReticleProngRight", AssetRequestMode.AsyncLoad); + AuraTexture = ModContent.Request("CalamityMod/NPCs/ExoMechs/Thanatos/THanosAura", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -1103,7 +1124,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos center += vector * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture, center, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector, NPC.scale, spriteEffects, 0f); - texture = ModContent.Request("CalamityMod/NPCs/ExoMechs/Thanatos/ThanatosHeadGlow").Value; + texture = GlowTexture.Value; Color glowmaskColor = vulnerable ? ((AIState == (int)Phase.Deathray && SecondaryAIState != (int)SecondaryPhase.PassiveAndImmune) ? Color.Lerp(new Color(255, 64, 64), Color.CornflowerBlue, NPC.Calamity().newAI[2] / deathrayTelegraphDuration) : new Color(255, 64, 64)) : Color.White; spriteBatch.Draw(texture, center, NPC.frame, glowmaskColor * NPC.Opacity, NPC.rotation, vector, NPC.scale, spriteEffects, 0f); @@ -1117,7 +1138,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos spriteBatch.SetBlendState(BlendState.Additive); // A large, faded circle. Is rescaled to fit the radius of the slowdown area. - Texture2D auraTexture = ModContent.Request("CalamityMod/NPCs/ExoMechs/Thanatos/THanosAura").Value; + Texture2D auraTexture = AuraTexture.Value; float lifeRatio = NPC.life / (float)NPC.lifeMax; @@ -1152,12 +1173,12 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos Player target = Main.player[NPC.target]; - Texture2D leftReticleTexture = ModContent.Request("CalamityMod/NPCs/ExoMechs/Thanatos/ThanatosReticleLeft").Value; - Texture2D rightReticleTexture = ModContent.Request("CalamityMod/NPCs/ExoMechs/Thanatos/ThanatosReticleRight").Value; - Texture2D topReticleTexture = ModContent.Request("CalamityMod/NPCs/ExoMechs/Thanatos/ThanatosReticleTop").Value; - Texture2D bottomReticleTexture = ModContent.Request("CalamityMod/NPCs/ExoMechs/Thanatos/ThanatosReticleHead").Value; - Texture2D leftReticleProngTexture = ModContent.Request("CalamityMod/NPCs/ExoMechs/Thanatos/ThanatosReticleProngLeft").Value; - Texture2D rightReticleProngTexture = ModContent.Request("CalamityMod/NPCs/ExoMechs/Thanatos/ThanatosReticleProngRight").Value; + Texture2D leftReticleTexture = ReticleLeftTexture.Value; + Texture2D rightReticleTexture = ReticleRightTexture.Value; + Texture2D topReticleTexture = ReticleTopTexture.Value; + Texture2D bottomReticleTexture = ReticleBottomTexture.Value; + Texture2D leftReticleProngTexture = ReticleProngLeftTexture.Value; + Texture2D rightReticleProngTexture = ReticleProngRightTexture.Value; // The reticle fades away and moves farther away from the target the closer they are to the aura. // Once far away, the reticle will flash between red and white as an indicator. diff --git a/NPCs/ExoMechs/Thanatos/ThanatosTail.cs b/NPCs/ExoMechs/Thanatos/ThanatosTail.cs index 6d1ed1dcab..b541aedd9e 100644 --- a/NPCs/ExoMechs/Thanatos/ThanatosTail.cs +++ b/NPCs/ExoMechs/Thanatos/ThanatosTail.cs @@ -7,6 +7,7 @@ using CalamityMod.Sounds; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -47,11 +48,18 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos private const float timeToOpenAndFireLasers = 36f; private const float segmentCloseTimerDecrement = 0.2f; + + public static Asset GlowTexture; + public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.ThanatosHead.DisplayName"); public override void SetStaticDefaults() { this.HideFromBestiary(); Main.npcFrameCount[NPC.type] = 5; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -625,7 +633,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos center += vector * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture, center, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector, NPC.scale, spriteEffects, 0f); - texture = ModContent.Request("CalamityMod/NPCs/ExoMechs/Thanatos/ThanatosTailGlow").Value; + texture = GlowTexture.Value; spriteBatch.Draw(texture, center, NPC.frame, Color.White * NPC.Opacity, NPC.rotation, vector, NPC.scale, spriteEffects, 0f); SmokeDrawer.DrawSet(NPC.Center); diff --git a/NPCs/HiveMind/HiveMind.cs b/NPCs/HiveMind/HiveMind.cs index 3b39e4740a..cad9c74a2c 100644 --- a/NPCs/HiveMind/HiveMind.cs +++ b/NPCs/HiveMind/HiveMind.cs @@ -19,6 +19,7 @@ using CalamityMod.Tiles.Ores; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent.Bestiary; @@ -87,6 +88,8 @@ namespace CalamityMod.NPCs.HiveMind public static readonly SoundStyle RoarSound = new("CalamityMod/Sounds/Custom/HiveMindRoar"); public static readonly SoundStyle FastRoarSound = new("CalamityMod/Sounds/Custom/HiveMindRoarFast"); + public static Asset Phase2Texture; + public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 16; @@ -101,6 +104,10 @@ namespace CalamityMod.NPCs.HiveMind value.Position.Y += 3f; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; NPCID.Sets.MPAllowedEnemies[Type] = true; + if (!Main.dedServ) + { + Phase2Texture = ModContent.Request(Texture + "P2", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -287,7 +294,7 @@ namespace CalamityMod.NPCs.HiveMind if (phase2) { SpriteEffects spriteEffects = NPC.direction == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - Texture2D texture = ModContent.Request("CalamityMod/NPCs/HiveMind/HiveMindP2").Value; + Texture2D texture = Phase2Texture.Value; Rectangle frame = new Rectangle(NPC.width * frameX, NPC.height * frameY, NPC.width, NPC.height); Vector2 vector = new Vector2(NPC.width / 2, NPC.height / 2); Color afterimageBaseColor = Color.White; diff --git a/NPCs/Leviathan/Anahita.cs b/NPCs/Leviathan/Anahita.cs index 8693260cbf..bcb498a341 100644 --- a/NPCs/Leviathan/Anahita.cs +++ b/NPCs/Leviathan/Anahita.cs @@ -7,6 +7,7 @@ using CalamityMod.UI.VanillaBossBars; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -24,6 +25,7 @@ namespace CalamityMod.NPCs.Leviathan private bool forceChargeFrames = false; private int frameUsed = 0; public bool HasBegunSummoningLeviathan = false; + public static Asset ChargeTexture; public bool WaitingForLeviathan { get @@ -46,6 +48,10 @@ namespace CalamityMod.NPCs.Leviathan Scale = 0.5f }; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + if (!Main.dedServ) + { + ChargeTexture = ModContent.Request("CalamityMod/NPCs/Leviathan/AnahitaStabbing", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -885,7 +891,7 @@ namespace CalamityMod.NPCs.Leviathan texture = TextureAssets.Npc[NPC.type].Value; break; case 1: - texture = ModContent.Request("CalamityMod/NPCs/Leviathan/AnahitaStabbing").Value; + texture = ChargeTexture.Value; break; } diff --git a/NPCs/Leviathan/Leviathan.cs b/NPCs/Leviathan/Leviathan.cs index 2e60793188..b509ef5470 100644 --- a/NPCs/Leviathan/Leviathan.cs +++ b/NPCs/Leviathan/Leviathan.cs @@ -41,7 +41,7 @@ namespace CalamityMod.NPCs.Leviathan private bool gfbAnaSummoned = false; private int soundDelay = 0; private float extrapitch = 0; - public static Texture2D AttackTexture = null; + public static Asset AttackTexture = null; public static readonly SoundStyle RoarMeteorSound = new("CalamityMod/Sounds/Custom/LeviathanRoarMeteor"); public static readonly SoundStyle RoarChargeSound = new("CalamityMod/Sounds/Custom/LeviathanRoarCharge"); @@ -52,7 +52,7 @@ namespace CalamityMod.NPCs.Leviathan Main.npcFrameCount[NPC.type] = 3; NPCID.Sets.BossBestiaryPriority.Add(Type); if (!Main.dedServ) - AttackTexture = ModContent.Request("CalamityMod/NPCs/Leviathan/LeviathanAttack", AssetRequestMode.ImmediateLoad).Value; + AttackTexture = ModContent.Request("CalamityMod/NPCs/Leviathan/LeviathanAttack", AssetRequestMode.AsyncLoad); } public override void SetDefaults() @@ -919,7 +919,7 @@ namespace CalamityMod.NPCs.Leviathan public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { - Texture2D texture = AttackTexture; + Texture2D texture = AttackTexture.Value; if (NPC.ai[0] == 1f || NPC.Calamity().newAI[3] < 180f) { texture = TextureAssets.Npc[NPC.type].Value; diff --git a/NPCs/Leviathan/LeviathanStart.cs b/NPCs/Leviathan/LeviathanStart.cs index 07f3b0cec0..f53a972388 100644 --- a/NPCs/Leviathan/LeviathanStart.cs +++ b/NPCs/Leviathan/LeviathanStart.cs @@ -3,6 +3,7 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.Accessories; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.GameContent; using Terraria.GameContent.Bestiary; @@ -13,6 +14,9 @@ namespace CalamityMod.NPCs.Leviathan { public class LeviathanStart : ModNPC { + + public static Asset GlowTexture; + public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 6; @@ -25,6 +29,10 @@ namespace CalamityMod.NPCs.Leviathan PortraitScale = 0.75f }; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -116,7 +124,7 @@ namespace CalamityMod.NPCs.Leviathan if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D drawTex = Main.zenithWorld ? ModContent.Request("CalamityMod/NPCs/Leviathan/Leviathan").Value : TextureAssets.Npc[NPC.type].Value; + Texture2D drawTex = Main.zenithWorld ? TextureAssets.Npc[ModContent.NPCType()].Value : TextureAssets.Npc[NPC.type].Value; Rectangle frame = Main.zenithWorld ? drawTex.Frame(2, 3, 0, 0) : NPC.frame; Vector2 origin = new Vector2(drawTex.Width / 2, drawTex.Height / 2); @@ -136,7 +144,7 @@ namespace CalamityMod.NPCs.Leviathan if (!Main.zenithWorld) { - drawTex = ModContent.Request("CalamityMod/NPCs/Leviathan/LeviathanStartGlow").Value; + drawTex = GlowTexture.Value; spriteBatch.Draw(drawTex, drawPos, frame, Color.White, NPC.rotation, origin, NPC.scale, spriteEffects, 0f); } diff --git a/NPCs/NormalNPCs/ProfanedEnergyLantern.cs b/NPCs/NormalNPCs/ProfanedEnergyLantern.cs index 47a9e497cc..96f0ffcbf5 100644 --- a/NPCs/NormalNPCs/ProfanedEnergyLantern.cs +++ b/NPCs/NormalNPCs/ProfanedEnergyLantern.cs @@ -3,6 +3,7 @@ using CalamityMod.Dusts; using CalamityMod.Projectiles.Boss; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.ID; using Terraria.Localization; @@ -12,11 +13,18 @@ namespace CalamityMod.NPCs.NormalNPCs { public class ProfanedEnergyLantern : ModNPC { + public static Asset ChainTexture; + public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.ProfanedEnergyBody.DisplayName"); + public override void SetStaticDefaults() { this.HideFromBestiary(); Main.npcFrameCount[NPC.type] = 6; + if (!Main.dedServ) + { + ChainTexture = ModContent.Request("CalamityMod/NPCs/NormalNPCs/ProfanedEnergySegment", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -218,7 +226,7 @@ namespace CalamityMod.NPCs.NormalNPCs drawPositionY = Main.npc[CalamityGlobalNPC.energyFlame].Center.Y - center.Y; drawPositionY -= 10f; Color color = Lighting.GetColor((int)center.X / 16, (int)(center.Y / 16f)); - Texture2D chain = ModContent.Request("CalamityMod/NPCs/NormalNPCs/ProfanedEnergySegment").Value; + Texture2D chain = ChainTexture.Value; Main.spriteBatch.Draw(chain, new Vector2(center.X - screenPos.X, center.Y - screenPos.Y), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, 0, chain.Width, chain.Height)), color, rotation, new Vector2((float)chain.Width * 0.5f, (float)chain.Height * 0.5f), 1f, SpriteEffects.None, 0f); diff --git a/NPCs/NormalNPCs/SkeletronPrime2.cs b/NPCs/NormalNPCs/SkeletronPrime2.cs index fee91ac879..fdf627d52f 100644 --- a/NPCs/NormalNPCs/SkeletronPrime2.cs +++ b/NPCs/NormalNPCs/SkeletronPrime2.cs @@ -6,6 +6,8 @@ using CalamityMod.DataStructures; using CalamityMod.Events; using CalamityMod.World; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent.Bestiary; @@ -19,11 +21,17 @@ namespace CalamityMod.NPCs.NormalNPCs public override string Texture => $"Terraria/Images/NPC_{NPCID.SkeletronPrime}"; public override string BossHeadTexture => $"Terraria/Images/NPC_Head_Boss_18"; + public static Asset EyeTexture; + public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 6; NPCID.Sets.NPCBestiaryDrawModifiers bestiaryData = new NPCID.Sets.NPCBestiaryDrawModifiers() { Hide = true }; NPCID.Sets.NPCBestiaryDrawOffset.Add(Type, bestiaryData); + if (!Main.dedServ) + { + EyeTexture = ModContent.Request("CalamityMod/ExtraTextures/VanillaBossGlowmasks/SkeletronPrimeHeadGlow"); + } } public override void SetDefaults() diff --git a/NPCs/NormalNPCs/ThiccWaifu.cs b/NPCs/NormalNPCs/ThiccWaifu.cs index 2d7520f1fa..f0c7452571 100644 --- a/NPCs/NormalNPCs/ThiccWaifu.cs +++ b/NPCs/NormalNPCs/ThiccWaifu.cs @@ -8,8 +8,10 @@ using CalamityMod.Projectiles.Enemy; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; +using Terraria.GameContent; using Terraria.GameContent.Bestiary; using Terraria.ID; using Terraria.ModLoader; @@ -44,6 +46,9 @@ namespace CalamityMod.NPCs.NormalNPCs } public bool Phase2 => NPC.life < NPC.lifeMax * 0.5f; public ref float AttackTimer => ref NPC.ai[1]; + + public static Asset AttackTexture; + public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 8; @@ -56,6 +61,10 @@ namespace CalamityMod.NPCs.NormalNPCs PortraitPositionYOverride = 2f }; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + if (!Main.dedServ) + { + AttackTexture = ModContent.Request(Texture + "Attack", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -406,13 +415,13 @@ namespace CalamityMod.NPCs.NormalNPCs public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { - Texture2D texture = ModContent.Request("CalamityMod/NPCs/NormalNPCs/ThiccWaifuAttack").Value; + Texture2D texture = AttackTexture.Value; SpriteEffects direction = NPC.spriteDirection == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; if (CurrentAttackState != AttackState.Hover) Main.EntitySpriteDraw(texture, NPC.Center - screenPos, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, NPC.frame.Size() * 0.5f, NPC.scale, direction, 0); else { - texture = ModContent.Request(Texture).Value; + texture = TextureAssets.Npc[NPC.type].Value; Main.EntitySpriteDraw(texture, NPC.Center - screenPos, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, NPC.frame.Size() * 0.5f, NPC.scale, direction, 0); } if (Main.zenithWorld) diff --git a/NPCs/OldDuke/OldDuke.cs b/NPCs/OldDuke/OldDuke.cs index d1cf93c6a6..6186e5c0d2 100644 --- a/NPCs/OldDuke/OldDuke.cs +++ b/NPCs/OldDuke/OldDuke.cs @@ -22,6 +22,7 @@ using CalamityMod.NPCs.TownNPCs; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using ReLogic.Utilities; using Terraria; using Terraria.Audio; @@ -42,6 +43,8 @@ namespace CalamityMod.NPCs.OldDuke public SlotId RoarSoundSlot; + public static Asset GlowTexture; + public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 7; @@ -54,6 +57,10 @@ namespace CalamityMod.NPCs.OldDuke }; value.Position.X += 14f; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -327,7 +334,7 @@ namespace CalamityMod.NPCs.OldDuke if (NPC.ai[0] >= 4f && NPC.Calamity().newAI[1] != 1f) { - texture2D15 = ModContent.Request("CalamityMod/NPCs/OldDuke/OldDukeGlow").Value; + texture2D15 = GlowTexture.Value; Color yellowLerpColor = Color.Lerp(Color.White, Color.Yellow, 0.5f); drawLerpColor = Color.Yellow; diff --git a/NPCs/Other/THELORDE.cs b/NPCs/Other/THELORDE.cs index e13a9a8242..79d2d2542a 100644 --- a/NPCs/Other/THELORDE.cs +++ b/NPCs/Other/THELORDE.cs @@ -8,6 +8,7 @@ using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.DataStructures; @@ -37,6 +38,8 @@ namespace CalamityMod.NPCs.Other public static readonly SoundStyle DeathSound = new("CalamityMod/Sounds/NPCKilled/Lordeath"); + public static Asset DeathAnimationTexture; + public override void SetStaticDefaults() { NPCID.Sets.MPAllowedEnemies[Type] = true; @@ -44,6 +47,10 @@ namespace CalamityMod.NPCs.Other NPCID.Sets.ShouldBeCountedAsBoss[Type] = true; this.HideFromBestiary(); Main.npcFrameCount[NPC.type] = 7; + if (!Main.dedServ) + { + DeathAnimationTexture = ModContent.Request(Texture + "DEATH", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -425,7 +432,7 @@ namespace CalamityMod.NPCs.Other if (Dying) { // death animation - texture = ModContent.Request("CalamityMod/NPCs/Other/THELORDEDEATH").Value; + texture = DeathAnimationTexture.Value; int xFrame = 0; int yFrame = frameToUse; if (frameToUse > 13) diff --git a/NPCs/Perforator/PerforatorBodyLarge.cs b/NPCs/Perforator/PerforatorBodyLarge.cs index c5a2f6056c..01fb9ffb94 100644 --- a/NPCs/Perforator/PerforatorBodyLarge.cs +++ b/NPCs/Perforator/PerforatorBodyLarge.cs @@ -3,6 +3,7 @@ using CalamityMod.Events; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -17,10 +18,21 @@ namespace CalamityMod.NPCs.Perforator public static readonly SoundStyle HitSound = new("CalamityMod/Sounds/NPCHit/PerfLargeHit", 3); public static readonly SoundStyle DeathSound = new("CalamityMod/Sounds/NPCKilled/PerfLargeDeath"); + public static Asset AltTexture; + public static Asset Texture_Glow; + public static Asset AltTexture_Glow; + + public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.PerforatorHeadLarge.DisplayName"); public override void SetStaticDefaults() { this.HideFromBestiary(); + if (!Main.dedServ) + { + AltTexture = ModContent.Request(Texture + "Alt", AssetRequestMode.AsyncLoad); + AltTexture_Glow = ModContent.Request(Texture + "AltGlow", AssetRequestMode.AsyncLoad); + Texture_Glow = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -172,7 +184,7 @@ namespace CalamityMod.NPCs.Perforator if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture2D15 = NPC.localAI[3] == 1f ? ModContent.Request("CalamityMod/NPCs/Perforator/PerforatorBodyLargeAlt").Value : TextureAssets.Npc[NPC.type].Value; + Texture2D texture2D15 = NPC.localAI[3] == 1f ? AltTexture.Value : TextureAssets.Npc[NPC.type].Value; Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / 2)); Vector2 drawLocation = NPC.Center - screenPos; @@ -180,7 +192,7 @@ namespace CalamityMod.NPCs.Perforator drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - texture2D15 = NPC.localAI[3] == 1f ? ModContent.Request("CalamityMod/NPCs/Perforator/PerforatorBodyLargeAltGlow").Value : ModContent.Request("CalamityMod/NPCs/Perforator/PerforatorBodyLargeGlow").Value; + texture2D15 = NPC.localAI[3] == 1f ? AltTexture_Glow.Value : Texture_Glow.Value; Color glowmaskColor = Color.Lerp(Color.White, Color.Yellow, 0.5f); spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, glowmaskColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); diff --git a/NPCs/Perforator/PerforatorBodyMedium.cs b/NPCs/Perforator/PerforatorBodyMedium.cs index 88c2e048e3..ef764fa9f1 100644 --- a/NPCs/Perforator/PerforatorBodyMedium.cs +++ b/NPCs/Perforator/PerforatorBodyMedium.cs @@ -5,6 +5,7 @@ using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -19,10 +20,16 @@ namespace CalamityMod.NPCs.Perforator public static readonly SoundStyle HitSound = new("CalamityMod/Sounds/NPCHit/PerfMediumHit", 3); public static readonly SoundStyle DeathSound = new("CalamityMod/Sounds/NPCKilled/PerfMediumDeath"); + public static Asset GlowTexture; + public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.PerforatorHeadMedium.DisplayName"); public override void SetStaticDefaults() { this.HideFromBestiary(); + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -209,7 +216,7 @@ namespace CalamityMod.NPCs.Perforator drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.Request("CalamityMod/NPCs/Perforator/PerforatorBodyMediumGlow").Value; + texture2D15 = GlowTexture.Value; Color glowmaskColor = Color.Lerp(Color.White, Color.Yellow, 0.5f); spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, glowmaskColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); diff --git a/NPCs/Perforator/PerforatorBodySmall.cs b/NPCs/Perforator/PerforatorBodySmall.cs index 580b82d6f7..edbe9583e2 100644 --- a/NPCs/Perforator/PerforatorBodySmall.cs +++ b/NPCs/Perforator/PerforatorBodySmall.cs @@ -3,6 +3,7 @@ using CalamityMod.Events; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -17,10 +18,16 @@ namespace CalamityMod.NPCs.Perforator public static readonly SoundStyle HitSound = new("CalamityMod/Sounds/NPCHit/PerfSmallHit", 3); public static readonly SoundStyle DeathSound = new("CalamityMod/Sounds/NPCKilled/PerfSmallDeath"); + public static Asset GlowTexture; + public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.PerforatorHeadSmall.DisplayName"); public override void SetStaticDefaults() { this.HideFromBestiary(); + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -181,7 +188,7 @@ namespace CalamityMod.NPCs.Perforator drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.Request("CalamityMod/NPCs/Perforator/PerforatorBodySmallGlow").Value; + texture2D15 = GlowTexture.Value; Color glowmaskColor = Color.Lerp(Color.White, Color.Yellow, 0.5f); spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, glowmaskColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); diff --git a/NPCs/Perforator/PerforatorCyst.cs b/NPCs/Perforator/PerforatorCyst.cs index dda2bdd2e4..eaf3858d0e 100644 --- a/NPCs/Perforator/PerforatorCyst.cs +++ b/NPCs/Perforator/PerforatorCyst.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -13,6 +14,8 @@ namespace CalamityMod.NPCs.Perforator { public static readonly SoundStyle HiveSpawn = new("CalamityMod/Sounds/Custom/Perforator/PerfHiveSpawn"); + public static Asset GlowTexture; + public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 4; @@ -20,6 +23,10 @@ namespace CalamityMod.NPCs.Perforator NPCID.Sets.BossBestiaryPriority.Add(Type); NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(); NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -74,7 +81,7 @@ namespace CalamityMod.NPCs.Perforator vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.Request("CalamityMod/NPCs/Perforator/PerforatorCystGlow").Value; + texture2D15 = GlowTexture.Value; Color color37 = Color.Lerp(Color.White, Color.Yellow, 0.5f); spriteBatch.Draw(texture2D15, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); diff --git a/NPCs/Perforator/PerforatorHeadLarge.cs b/NPCs/Perforator/PerforatorHeadLarge.cs index f1531e8358..95dd7fde47 100644 --- a/NPCs/Perforator/PerforatorHeadLarge.cs +++ b/NPCs/Perforator/PerforatorHeadLarge.cs @@ -6,6 +6,7 @@ using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -21,6 +22,8 @@ namespace CalamityMod.NPCs.Perforator public static readonly SoundStyle HitSound = new("CalamityMod/Sounds/NPCHit/PerfLargeHit", 3); public static readonly SoundStyle DeathSound = new("CalamityMod/Sounds/NPCKilled/PerfLargeDeath"); + public static Asset GlowTexture; + private int biomeEnrageTimer = CalamityGlobalNPC.biomeEnrageTimerMax; private bool TailSpawned = false; @@ -38,6 +41,10 @@ namespace CalamityMod.NPCs.Perforator value.Position.X += 70; value.Position.Y += 40; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -545,7 +552,7 @@ namespace CalamityMod.NPCs.Perforator drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.Request("CalamityMod/NPCs/Perforator/PerforatorHeadLargeGlow").Value; + texture2D15 = GlowTexture.Value; Color glowmaskColor = Color.Lerp(Color.White, Color.Yellow, 0.5f); spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, glowmaskColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); diff --git a/NPCs/Perforator/PerforatorHeadMedium.cs b/NPCs/Perforator/PerforatorHeadMedium.cs index 1fa31758bf..4170cfdc34 100644 --- a/NPCs/Perforator/PerforatorHeadMedium.cs +++ b/NPCs/Perforator/PerforatorHeadMedium.cs @@ -5,6 +5,7 @@ using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -20,6 +21,8 @@ namespace CalamityMod.NPCs.Perforator public static readonly SoundStyle HitSound = new("CalamityMod/Sounds/NPCHit/PerfMediumHit", 3); public static readonly SoundStyle DeathSound = new("CalamityMod/Sounds/NPCKilled/PerfMediumDeath"); + public static Asset GlowTexture; + public override void SetStaticDefaults() { NPCID.Sets.BossBestiaryPriority.Add(Type); @@ -34,6 +37,10 @@ namespace CalamityMod.NPCs.Perforator value.Position.X += 60; value.Position.Y += 40; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -466,7 +473,7 @@ namespace CalamityMod.NPCs.Perforator drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.Request("CalamityMod/NPCs/Perforator/PerforatorHeadMediumGlow").Value; + texture2D15 = GlowTexture.Value; Color glowmaskColor = Color.Lerp(Color.White, Color.Yellow, 0.5f); spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, glowmaskColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); diff --git a/NPCs/Perforator/PerforatorHeadSmall.cs b/NPCs/Perforator/PerforatorHeadSmall.cs index d7f6e98b84..8d341da595 100644 --- a/NPCs/Perforator/PerforatorHeadSmall.cs +++ b/NPCs/Perforator/PerforatorHeadSmall.cs @@ -5,6 +5,7 @@ using CalamityMod.Events; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -20,6 +21,8 @@ namespace CalamityMod.NPCs.Perforator public static readonly SoundStyle HitSound = new("CalamityMod/Sounds/NPCHit/PerfSmallHit", 3); public static readonly SoundStyle DeathSound = new("CalamityMod/Sounds/NPCKilled/PerfSmallDeath"); + public static Asset GlowTexture; + private int biomeEnrageTimer = CalamityGlobalNPC.biomeEnrageTimerMax; private const int MsgType = 23; private bool TailSpawned = false; @@ -38,6 +41,10 @@ namespace CalamityMod.NPCs.Perforator value.Position.X += 60; value.Position.Y += 50; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -503,7 +510,7 @@ namespace CalamityMod.NPCs.Perforator glowmaskDrawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, glowmaskDrawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.Request("CalamityMod/NPCs/Perforator/PerforatorHeadSmallGlow").Value; + texture2D15 = GlowTexture.Value; Color glowmaskColor = Color.Lerp(Color.White, Color.Yellow, 0.5f); spriteBatch.Draw(texture2D15, glowmaskDrawLocation, NPC.frame, glowmaskColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); diff --git a/NPCs/Perforator/PerforatorHive.cs b/NPCs/Perforator/PerforatorHive.cs index 502c3ee746..c9014254b2 100644 --- a/NPCs/Perforator/PerforatorHive.cs +++ b/NPCs/Perforator/PerforatorHive.cs @@ -19,10 +19,10 @@ using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Items.Weapons.Summon; using CalamityMod.Projectiles.Boss; -using CalamityMod.Tiles.Ores; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -42,6 +42,8 @@ namespace CalamityMod.NPCs.Perforator public static readonly SoundStyle HitSound = new("CalamityMod/Sounds/NPCHit/PerfHiveHit", 3); public static readonly SoundStyle DeathSound = new("CalamityMod/Sounds/NPCKilled/PerfHiveDeath"); + public static Asset GlowTexture; + private int biomeEnrageTimer = CalamityGlobalNPC.biomeEnrageTimerMax; private bool small = false; private bool medium = false; @@ -55,6 +57,10 @@ namespace CalamityMod.NPCs.Perforator NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(); NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; NPCID.Sets.MPAllowedEnemies[Type] = true; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -518,7 +524,7 @@ namespace CalamityMod.NPCs.Perforator drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.Request("CalamityMod/NPCs/Perforator/PerforatorHiveGlow").Value; + texture2D15 = GlowTexture.Value; Color glowmaskColor = Color.Lerp(Color.White, Color.Yellow, 0.5f); spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, glowmaskColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); diff --git a/NPCs/Perforator/PerforatorTailLarge.cs b/NPCs/Perforator/PerforatorTailLarge.cs index a66ffd806b..df4536e71a 100644 --- a/NPCs/Perforator/PerforatorTailLarge.cs +++ b/NPCs/Perforator/PerforatorTailLarge.cs @@ -3,6 +3,7 @@ using CalamityMod.Events; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -17,10 +18,16 @@ namespace CalamityMod.NPCs.Perforator public static readonly SoundStyle HitSound = new("CalamityMod/Sounds/NPCHit/PerfLargeHit", 3); public static readonly SoundStyle DeathSound = new("CalamityMod/Sounds/NPCKilled/PerfLargeDeath"); + public static Asset GlowTexture; + public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.PerforatorHeadLarge.DisplayName"); public override void SetStaticDefaults() { this.HideFromBestiary(); + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -181,7 +188,7 @@ namespace CalamityMod.NPCs.Perforator drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.Request("CalamityMod/NPCs/Perforator/PerforatorTailLargeGlow").Value; + texture2D15 = GlowTexture.Value; Color glowmaskColor = Color.Lerp(Color.White, Color.Yellow, 0.5f); spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, glowmaskColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); diff --git a/NPCs/Perforator/PerforatorTailMedium.cs b/NPCs/Perforator/PerforatorTailMedium.cs index 39a8984455..6880426acc 100644 --- a/NPCs/Perforator/PerforatorTailMedium.cs +++ b/NPCs/Perforator/PerforatorTailMedium.cs @@ -5,6 +5,7 @@ using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -19,10 +20,16 @@ namespace CalamityMod.NPCs.Perforator public static readonly SoundStyle HitSound = new("CalamityMod/Sounds/NPCHit/PerfMediumHit", 3); public static readonly SoundStyle DeathSound = new("CalamityMod/Sounds/NPCKilled/PerfMediumDeath"); + public static Asset GlowTexture; + public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.PerforatorHeadMedium.DisplayName"); public override void SetStaticDefaults() { this.HideFromBestiary(); + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -180,7 +187,7 @@ namespace CalamityMod.NPCs.Perforator drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.Request("CalamityMod/NPCs/Perforator/PerforatorTailMediumGlow").Value; + texture2D15 = GlowTexture.Value; Color glowmaskColor = Color.Lerp(Color.White, Color.Yellow, 0.5f); spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, glowmaskColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); diff --git a/NPCs/Perforator/PerforatorTailSmall.cs b/NPCs/Perforator/PerforatorTailSmall.cs index 6a0df33e00..7f5d26a183 100644 --- a/NPCs/Perforator/PerforatorTailSmall.cs +++ b/NPCs/Perforator/PerforatorTailSmall.cs @@ -3,6 +3,7 @@ using CalamityMod.Events; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -17,10 +18,16 @@ namespace CalamityMod.NPCs.Perforator public static readonly SoundStyle HitSound = new("CalamityMod/Sounds/NPCHit/PerfSmallHit", 3); public static readonly SoundStyle DeathSound = new("CalamityMod/Sounds/NPCKilled/PerfSmallDeath"); + public static Asset GlowTexture; + public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.PerforatorHeadSmall.DisplayName"); public override void SetStaticDefaults() { this.HideFromBestiary(); + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -182,7 +189,7 @@ namespace CalamityMod.NPCs.Perforator drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.Request("CalamityMod/NPCs/Perforator/PerforatorTailSmallGlow").Value; + texture2D15 = GlowTexture.Value; Color glowmaskColor = Color.Lerp(Color.White, Color.Yellow, 0.5f); spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, glowmaskColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); diff --git a/NPCs/PlagueEnemies/PlagueCharger.cs b/NPCs/PlagueEnemies/PlagueCharger.cs index 1c04b6fbaf..1f79c757cc 100644 --- a/NPCs/PlagueEnemies/PlagueCharger.cs +++ b/NPCs/PlagueEnemies/PlagueCharger.cs @@ -5,6 +5,7 @@ using CalamityMod.Items.Placeables.Banners; using CalamityMod.Sounds; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -18,10 +19,16 @@ namespace CalamityMod.NPCs.PlagueEnemies { public class PlagueCharger : ModNPC { + public static Asset GlowTexture; + public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 4; NPCID.Sets.TrailingMode[NPC.type] = 1; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -90,7 +97,7 @@ namespace CalamityMod.NPCs.PlagueEnemies drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.Request("CalamityMod/NPCs/PlagueEnemies/PlagueChargerGlow").Value; + texture2D15 = GlowTexture.Value; Color redEyeColor = Color.Lerp(Color.White, Color.Red, 0.5f); if (CalamityConfig.Instance.Afterimages) diff --git a/NPCs/PlaguebringerGoliath/PlagueHomingMissile.cs b/NPCs/PlaguebringerGoliath/PlagueHomingMissile.cs index ca383549b6..a0f39e5e2a 100644 --- a/NPCs/PlaguebringerGoliath/PlagueHomingMissile.cs +++ b/NPCs/PlaguebringerGoliath/PlagueHomingMissile.cs @@ -6,6 +6,7 @@ using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -16,11 +17,16 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath { public class PlagueHomingMissile : ModNPC { + public static Asset GlowTexture; public override void SetStaticDefaults() { this.HideFromBestiary(); Main.npcFrameCount[NPC.type] = 4; NPCID.Sets.TrailingMode[NPC.type] = 1; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request("CalamityMod/NPCs/PlaguebringerGoliath/PlagueHomingMissileGlow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -185,7 +191,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.Request("CalamityMod/NPCs/PlaguebringerGoliath/PlagueHomingMissileGlow").Value; + texture2D15 = GlowTexture.Value; Color redLerpColor = Color.Lerp(Color.White, Color.Red, 0.5f); if (CalamityConfig.Instance.Afterimages) diff --git a/NPCs/PlaguebringerGoliath/PlagueMine.cs b/NPCs/PlaguebringerGoliath/PlagueMine.cs index 2d2f1d0164..1f6b639fb0 100644 --- a/NPCs/PlaguebringerGoliath/PlagueMine.cs +++ b/NPCs/PlaguebringerGoliath/PlagueMine.cs @@ -5,6 +5,7 @@ using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -15,10 +16,15 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath { public class PlagueMine : ModNPC { + public static Asset GlowTexture; public override void SetStaticDefaults() { this.HideFromBestiary(); Main.npcFrameCount[NPC.type] = 4; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request("CalamityMod/NPCs/PlaguebringerGoliath/PlagueMineGlow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -125,7 +131,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.Request("CalamityMod/NPCs/PlaguebringerGoliath/PlagueMineGlow").Value; + texture2D15 = GlowTexture.Value; Color redLerpColor = Color.Lerp(Color.White, Color.Red, 0.5f); spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, redLerpColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); diff --git a/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs b/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs index 77507ba8f1..7398b37954 100644 --- a/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs +++ b/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs @@ -22,6 +22,7 @@ using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -47,6 +48,10 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath private bool flyingFrame2 = false; private int curTex = 1; + public static Asset ChargeTexture; + public static Asset Texture_Glow; + public static Asset ChargeTexture_Glow; + public static readonly SoundStyle NukeWarningSound = new("CalamityMod/Sounds/Custom/PlagueSounds/PBGNukeWarning"); public static readonly SoundStyle AttackSwitchSound = new("CalamityMod/Sounds/Custom/PlagueSounds/PBGAttackSwitch", 2); public static readonly SoundStyle DashSound = new("CalamityMod/Sounds/Custom/PlagueSounds/PBGDash"); @@ -68,6 +73,12 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath value.Position.X -= 48f; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; NPCID.Sets.MPAllowedEnemies[Type] = true; + if (!Main.dedServ) + { + ChargeTexture = ModContent.Request("CalamityMod/NPCs/PlaguebringerGoliath/PlaguebringerGoliathChargeTex", AssetRequestMode.AsyncLoad); + Texture_Glow = ModContent.Request("CalamityMod/NPCs/PlaguebringerGoliath/PlaguebringerGoliathGlow", AssetRequestMode.AsyncLoad); + ChargeTexture_Glow = ModContent.Request("CalamityMod/NPCs/PlaguebringerGoliath/PlaguebringerGoliathChargeTexGlow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -1232,7 +1243,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { Texture2D texture = TextureAssets.Npc[NPC.type].Value; - Texture2D glowTexture = ModContent.Request("CalamityMod/NPCs/PlaguebringerGoliath/PlaguebringerGoliathGlow").Value; + Texture2D glowTexture = Texture_Glow.Value; if (curTex != (charging ? 2 : 1)) { NPC.frame.X = 0; @@ -1241,8 +1252,8 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath if (charging) { curTex = 2; - texture = ModContent.Request("CalamityMod/NPCs/PlaguebringerGoliath/PlaguebringerGoliathChargeTex").Value; - glowTexture = ModContent.Request("CalamityMod/NPCs/PlaguebringerGoliath/PlaguebringerGoliathChargeTexGlow").Value; + texture = ChargeTexture.Value; + glowTexture = ChargeTexture_Glow.Value; } else curTex = 1; diff --git a/NPCs/Polterghast/Polterghast.cs b/NPCs/Polterghast/Polterghast.cs index 0f8ab6baeb..b9d04d9019 100644 --- a/NPCs/Polterghast/Polterghast.cs +++ b/NPCs/Polterghast/Polterghast.cs @@ -24,6 +24,7 @@ using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -62,6 +63,9 @@ namespace CalamityMod.NPCs.Polterghast public static readonly SoundStyle SpawnSound = new("CalamityMod/Sounds/Custom/Polterghast/PolterghastSpawn"); public static readonly SoundStyle PhantomSound = new("CalamityMod/Sounds/Custom/Polterghast/PolterghastPhantomSpawn"); + public static Asset Texture_Glow; + public static Asset Texture_Glow2; + public static List creepySounds = new List { NPCs.DevourerofGods.DevourerofGodsHead.AttackSound, @@ -95,6 +99,11 @@ namespace CalamityMod.NPCs.Polterghast NPCID.Sets.TrailingMode[NPC.type] = 1; NPCID.Sets.BossBestiaryPriority.Add(Type); NPCID.Sets.MPAllowedEnemies[Type] = true; + if (!Main.dedServ) + { + Texture_Glow = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + Texture_Glow2 = ModContent.Request(Texture + "Glow2", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -1151,7 +1160,7 @@ namespace CalamityMod.NPCs.Polterghast spriteEffects = SpriteEffects.FlipHorizontally; Texture2D texture2D15 = TextureAssets.Npc[NPC.type].Value; - Texture2D texture2D16 = ModContent.Request("CalamityMod/NPCs/Polterghast/PolterghastGlow2").Value; + Texture2D texture2D16 = Texture_Glow2.Value; Vector2 halfSizeTexture = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2); int afterimageAmt = 7; @@ -1176,7 +1185,7 @@ namespace CalamityMod.NPCs.Polterghast Color c = NPC.IsABestiaryIconDummy ? Color.White : NPC.GetAlpha(drawColor); spriteBatch.Draw(texture2D15, vector43, NPC.frame, c, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.Request("CalamityMod/NPCs/Polterghast/PolterghastGlow").Value; + texture2D15 = Texture_Glow.Value; Color secondColorLerp = Color.Lerp(Color.White, Color.Cyan, 0.5f); Color lightRed = new Color(255, 100, 100, 255); diff --git a/NPCs/Polterghast/PolterghastHook.cs b/NPCs/Polterghast/PolterghastHook.cs index ccb7371328..d208ecba32 100644 --- a/NPCs/Polterghast/PolterghastHook.cs +++ b/NPCs/Polterghast/PolterghastHook.cs @@ -5,6 +5,7 @@ using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.GameContent; using Terraria.ID; @@ -16,11 +17,19 @@ namespace CalamityMod.NPCs.Polterghast private int despawnTimer = 300; private bool phase2 = false; + public static Asset GlowTexture; + public static Asset ChainTexture; + public override void SetStaticDefaults() { this.HideFromBestiary(); Main.npcFrameCount[NPC.type] = 2; NPCID.Sets.TrailingMode[NPC.type] = 1; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + ChainTexture = ModContent.Request("CalamityMod/NPCs/Polterghast/PolterghastChain", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -352,9 +361,9 @@ namespace CalamityMod.NPCs.Polterghast if (Main.npc[CalamityGlobalNPC.ghostBoss].Calamity().newAI[0] > changeColorGateValue) cyanLerpColor = Color.Lerp(cyanLerpColor, lightRed, MathHelper.Clamp((Main.npc[CalamityGlobalNPC.ghostBoss].Calamity().newAI[0] - changeColorGateValue) / timeToReachFullColor, 0f, 1f)); - Main.spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/Polterghast/PolterghastChain").Value, new Vector2(center.X - screenPos.X, center.Y - screenPos.Y), - new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, 0, ModContent.Request("CalamityMod/NPCs/Polterghast/PolterghastChain").Value.Width, chainWidth)), cyanLerpColor, chainRotation, - new Vector2(ModContent.Request("CalamityMod/NPCs/Polterghast/PolterghastChain").Value.Width * 0.5f, ModContent.Request("CalamityMod/NPCs/Polterghast/PolterghastChain").Value.Height * 0.5f), 1f, SpriteEffects.None, 0f); + Main.spriteBatch.Draw(ChainTexture.Value, new Vector2(center.X - screenPos.X, center.Y - screenPos.Y), + new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, 0, ChainTexture.Value.Width, chainWidth)), cyanLerpColor, chainRotation, + new Vector2(ChainTexture.Value.Width * 0.5f, ChainTexture.Value.Height * 0.5f), 1f, SpriteEffects.None, 0f); } } @@ -386,7 +395,7 @@ namespace CalamityMod.NPCs.Polterghast drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.Request("CalamityMod/NPCs/Polterghast/PolterghastHookGlow").Value; + texture2D15 = GlowTexture.Value; Color cyanLerp2 = Color.Lerp(Color.White, Color.Cyan, 0.5f); if (Main.npc[CalamityGlobalNPC.ghostBoss].Calamity().newAI[0] > changeColorGateValue) diff --git a/NPCs/PrimordialWyrm/PrimordialWyrmBody.cs b/NPCs/PrimordialWyrm/PrimordialWyrmBody.cs index 3cbfc9aee7..8a8fb1aa1d 100644 --- a/NPCs/PrimordialWyrm/PrimordialWyrmBody.cs +++ b/NPCs/PrimordialWyrm/PrimordialWyrmBody.cs @@ -3,6 +3,7 @@ using System.IO; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.GameContent; using Terraria.ID; @@ -13,10 +14,17 @@ namespace CalamityMod.NPCs.PrimordialWyrm { public class PrimordialWyrmBody : ModNPC { + public static Asset GlowTexture; + public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.PrimordialWyrmHead.DisplayName"); + public override void SetStaticDefaults() { this.HideFromBestiary(); + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -177,7 +185,7 @@ namespace CalamityMod.NPCs.PrimordialWyrm center += vector * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture, center, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector, NPC.scale, spriteEffects, 0f); - texture = ModContent.Request("CalamityMod/NPCs/PrimordialWyrm/PrimordialWyrmBodyGlow").Value; + texture = GlowTexture.Value; spriteBatch.Draw(texture, center, NPC.frame, Color.White * NPC.Opacity, NPC.rotation, vector, NPC.scale, spriteEffects, 0f); return false; diff --git a/NPCs/PrimordialWyrm/PrimordialWyrmBodyAlt.cs b/NPCs/PrimordialWyrm/PrimordialWyrmBodyAlt.cs index 935a594f6a..fa061524e4 100644 --- a/NPCs/PrimordialWyrm/PrimordialWyrmBodyAlt.cs +++ b/NPCs/PrimordialWyrm/PrimordialWyrmBodyAlt.cs @@ -3,6 +3,7 @@ using System.IO; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.GameContent; using Terraria.ID; @@ -13,10 +14,16 @@ namespace CalamityMod.NPCs.PrimordialWyrm { public class PrimordialWyrmBodyAlt : ModNPC { + public static Asset GlowTexture; + public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.PrimordialWyrmHead.DisplayName"); public override void SetStaticDefaults() { this.HideFromBestiary(); + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -177,7 +184,7 @@ namespace CalamityMod.NPCs.PrimordialWyrm center += vector * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture, center, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector, NPC.scale, spriteEffects, 0f); - texture = ModContent.Request("CalamityMod/NPCs/PrimordialWyrm/PrimordialWyrmBodyAltGlow").Value; + texture = GlowTexture.Value; spriteBatch.Draw(texture, center, NPC.frame, Color.White * NPC.Opacity, NPC.rotation, vector, NPC.scale, spriteEffects, 0f); return false; diff --git a/NPCs/PrimordialWyrm/PrimordialWyrmHead.cs b/NPCs/PrimordialWyrm/PrimordialWyrmHead.cs index 9916e9c6c7..1fce49ffae 100644 --- a/NPCs/PrimordialWyrm/PrimordialWyrmHead.cs +++ b/NPCs/PrimordialWyrm/PrimordialWyrmHead.cs @@ -17,6 +17,7 @@ using CalamityMod.Sounds; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -81,6 +82,8 @@ namespace CalamityMod.NPCs.PrimordialWyrm public static readonly SoundStyle ChargeSound = new("CalamityMod/Sounds/Custom/PrimordialWyrmCharge"); public static readonly SoundStyle DeathSound = new("CalamityMod/Sounds/NPCKilled/PrimordialWyrmDeath"); + public static Asset GlowTexture; + public override void SetStaticDefaults() { NPCID.Sets.BossBestiaryPriority.Add(Type); @@ -94,6 +97,10 @@ namespace CalamityMod.NPCs.PrimordialWyrm value.Position.X += 55; value.Position.Y += 5; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -1434,7 +1441,7 @@ namespace CalamityMod.NPCs.PrimordialWyrm center += vector * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture, center, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector, NPC.scale, spriteEffects, 0f); - texture = ModContent.Request("CalamityMod/NPCs/PrimordialWyrm/PrimordialWyrmHeadGlow").Value; + texture = GlowTexture.Value; spriteBatch.Draw(texture, center, NPC.frame, Color.White * NPC.Opacity, NPC.rotation, vector, NPC.scale, spriteEffects, 0f); return false; diff --git a/NPCs/PrimordialWyrm/PrimordialWyrmTail.cs b/NPCs/PrimordialWyrm/PrimordialWyrmTail.cs index 782ac805ba..e192350bad 100644 --- a/NPCs/PrimordialWyrm/PrimordialWyrmTail.cs +++ b/NPCs/PrimordialWyrm/PrimordialWyrmTail.cs @@ -2,6 +2,7 @@ using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.GameContent; using Terraria.ID; @@ -12,10 +13,16 @@ namespace CalamityMod.NPCs.PrimordialWyrm { public class PrimordialWyrmTail : ModNPC { + public static Asset GlowTexture; + public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.PrimordialWyrmHead.DisplayName"); public override void SetStaticDefaults() { this.HideFromBestiary(); + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -139,7 +146,7 @@ namespace CalamityMod.NPCs.PrimordialWyrm center += vector * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture, center, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector, NPC.scale, spriteEffects, 0f); - texture = ModContent.Request("CalamityMod/NPCs/PrimordialWyrm/PrimordialWyrmTailGlow").Value; + texture = GlowTexture.Value; spriteBatch.Draw(texture, center, NPC.frame, Color.White * NPC.Opacity, NPC.rotation, vector, NPC.scale, spriteEffects, 0f); return false; diff --git a/NPCs/ProfanedGuardians/ProfanedGuardianCommander.cs b/NPCs/ProfanedGuardians/ProfanedGuardianCommander.cs index 7de9c2035d..d85a7326d6 100644 --- a/NPCs/ProfanedGuardians/ProfanedGuardianCommander.cs +++ b/NPCs/ProfanedGuardians/ProfanedGuardianCommander.cs @@ -16,6 +16,7 @@ using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -38,6 +39,9 @@ namespace CalamityMod.NPCs.ProfanedGuardians public static readonly SoundStyle DashSound = new("CalamityMod/Sounds/Custom/ProfanedGuardians/GuardianDash"); public static readonly SoundStyle ShieldDeathSound = new("CalamityMod/Sounds/Custom/ProfanedGuardians/GuardianShieldDeactivate"); + public static Asset Texture_Glow; + public static Asset TextureNight_Glow; + public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 10; @@ -53,6 +57,11 @@ namespace CalamityMod.NPCs.ProfanedGuardians value.Position.Y += 15; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; NPCID.Sets.MPAllowedEnemies[Type] = true; + if (!Main.dedServ) + { + Texture_Glow = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + TextureNight_Glow = ModContent.Request(Texture + "GlowNight", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -1037,11 +1046,11 @@ namespace CalamityMod.NPCs.ProfanedGuardians drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY) + drawOffset; spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, colorOverride ?? NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.Request("CalamityMod/NPCs/ProfanedGuardians/ProfanedGuardianCommanderGlow").Value; + texture2D15 = Texture_Glow.Value; Color timeBasedColorLerp = Color.Lerp(Color.White, Color.Yellow, 0.5f); if (Main.remixWorld) { - texture2D15 = ModContent.Request("CalamityMod/NPCs/ProfanedGuardians/ProfanedGuardianCommanderGlowNight").Value; + texture2D15 = TextureNight_Glow.Value; timeBasedColorLerp = Color.Cyan; } if (colorOverride != null) diff --git a/NPCs/ProfanedGuardians/ProfanedGuardianDefender.cs b/NPCs/ProfanedGuardians/ProfanedGuardianDefender.cs index d0217c4cbd..dc0fba164b 100644 --- a/NPCs/ProfanedGuardians/ProfanedGuardianDefender.cs +++ b/NPCs/ProfanedGuardians/ProfanedGuardianDefender.cs @@ -30,6 +30,9 @@ namespace CalamityMod.NPCs.ProfanedGuardians public static readonly SoundStyle RockShieldSpawnSound = new("CalamityMod/Sounds/Custom/ProfanedGuardians/GuardianRockShieldActivate"); public static readonly SoundStyle ShieldDeathSound = new("CalamityMod/Sounds/Custom/ProfanedGuardians/GuardianShieldDeactivate"); + public static Asset Texture_Glow; + public static Asset TextureNight_Glow; + public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 10; @@ -44,6 +47,11 @@ namespace CalamityMod.NPCs.ProfanedGuardians value.Position.X += 25; value.Position.Y += 15; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + if (!Main.dedServ) + { + Texture_Glow = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + TextureNight_Glow = ModContent.Request(Texture + "GlowNight", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -763,11 +771,11 @@ namespace CalamityMod.NPCs.ProfanedGuardians drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY) + drawOffset; spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, colorOverride ?? NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.Request("CalamityMod/NPCs/ProfanedGuardians/ProfanedGuardianDefenderGlow").Value; + texture2D15 = Texture_Glow.Value; Color timeBasedGlowColor = Color.Lerp(Color.White, Color.Yellow, 0.5f); if (Main.remixWorld) { - texture2D15 = ModContent.Request("CalamityMod/NPCs/ProfanedGuardians/ProfanedGuardianDefenderGlowNight").Value; + texture2D15 = TextureNight_Glow.Value; timeBasedGlowColor = Color.Cyan; } if (colorOverride != null) diff --git a/NPCs/ProfanedGuardians/ProfanedGuardianHealer.cs b/NPCs/ProfanedGuardians/ProfanedGuardianHealer.cs index 7354c06280..cfc275078d 100644 --- a/NPCs/ProfanedGuardians/ProfanedGuardianHealer.cs +++ b/NPCs/ProfanedGuardians/ProfanedGuardianHealer.cs @@ -8,6 +8,7 @@ using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -40,6 +41,10 @@ namespace CalamityMod.NPCs.ProfanedGuardians private int biomeEnrageTimer = CalamityGlobalNPC.biomeEnrageTimerMax; + public static Asset Texture_Glow; + public static Asset Texture_Glow2; + public static Asset TextureNight_Glow; + public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 10; @@ -54,6 +59,12 @@ namespace CalamityMod.NPCs.ProfanedGuardians value.Position.X += 25; value.Position.Y += 15; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + if (!Main.dedServ) + { + Texture_Glow = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + Texture_Glow2 = ModContent.Request(Texture + "Glow2", AssetRequestMode.AsyncLoad); + TextureNight_Glow = ModContent.Request(Texture + "GlowNight", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -438,7 +449,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians spriteEffects = SpriteEffects.FlipHorizontally; Texture2D texture2D15 = TextureAssets.Npc[NPC.type].Value; - Texture2D texture2D16 = ModContent.Request("CalamityMod/NPCs/ProfanedGuardians/ProfanedGuardianHealerGlow2").Value; + Texture2D texture2D16 = Texture_Glow2.Value; Vector2 halfSizeTexture = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2); int afterimageAmt = 5; @@ -465,11 +476,11 @@ namespace CalamityMod.NPCs.ProfanedGuardians drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY) + drawOffset; spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, colorOverride ?? NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.Request("CalamityMod/NPCs/ProfanedGuardians/ProfanedGuardianHealerGlow").Value; + texture2D15 = Texture_Glow.Value; Color timeBasedDrawColor = Color.Lerp(Color.White, Color.Yellow, 0.5f); if (Main.remixWorld) { - texture2D15 = ModContent.Request("CalamityMod/NPCs/ProfanedGuardians/ProfanedGuardianHealerGlowNight").Value; + texture2D15 = TextureNight_Glow.Value; timeBasedDrawColor = Color.Cyan; } Color overrideColor = Color.Lerp(Color.White, Color.Violet, 0.5f); diff --git a/NPCs/ProfanedGuardians/ProfanedRocks.cs b/NPCs/ProfanedGuardians/ProfanedRocks.cs index 4320634dcd..9ef42786b6 100644 --- a/NPCs/ProfanedGuardians/ProfanedRocks.cs +++ b/NPCs/ProfanedGuardians/ProfanedRocks.cs @@ -6,6 +6,7 @@ using CalamityMod.Events; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -23,10 +24,19 @@ namespace CalamityMod.NPCs.ProfanedGuardians public const int MaxHP = 8000; public const int MaxBossRushHP = 20000; + public static Asset[] Textures = new Asset[6]; + public override void SetStaticDefaults() { this.HideFromBestiary(); NPCID.Sets.TrailingMode[NPC.type] = 1; + if (!Main.dedServ) + { + for (int i = 0; i < 6; i++) + { + Textures[i] = ModContent.Request(Texture + (i + 1), AssetRequestMode.AsyncLoad); + } + } } public override void SetDefaults() @@ -314,7 +324,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { int npcType = (int)MathHelper.Clamp(NPC.ai[2], 1f, 6f); - Texture2D texture = ModContent.Request("CalamityMod/NPCs/ProfanedGuardians/ProfanedRocks" + npcType.ToString()).Value; + Texture2D texture = Textures[npcType - 1].Value; Vector2 drawOrigin = new Vector2(texture.Width / 2, texture.Height / 2); Vector2 drawPos = NPC.Center - screenPos; drawPos -= new Vector2(texture.Width, texture.Height) * NPC.scale / 2f; diff --git a/NPCs/Providence/ProvSpawnDefense.cs b/NPCs/Providence/ProvSpawnDefense.cs index c461cfb7e3..0e2e9a8d0d 100644 --- a/NPCs/Providence/ProvSpawnDefense.cs +++ b/NPCs/Providence/ProvSpawnDefense.cs @@ -1,6 +1,7 @@ using System; using CalamityMod.Dusts; using CalamityMod.Events; +using CalamityMod.NPCs.ProfanedGuardians; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -141,7 +142,7 @@ namespace CalamityMod.NPCs.Providence vector43 += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.Request("CalamityMod/NPCs/ProfanedGuardians/ProfanedGuardianDefenderGlow").Value; + texture2D15 = ProfanedGuardianDefender.Texture_Glow.Value; Color yellowLerp = Color.Lerp(Color.White, Color.Yellow, 0.5f); if (CalamityConfig.Instance.Afterimages) diff --git a/NPCs/Providence/ProvSpawnHealer.cs b/NPCs/Providence/ProvSpawnHealer.cs index 2eb3d39ecc..9d1aa49894 100644 --- a/NPCs/Providence/ProvSpawnHealer.cs +++ b/NPCs/Providence/ProvSpawnHealer.cs @@ -1,6 +1,7 @@ using System; using CalamityMod.Dusts; using CalamityMod.Events; +using CalamityMod.NPCs.ProfanedGuardians; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -117,7 +118,7 @@ namespace CalamityMod.NPCs.Providence spriteEffects = SpriteEffects.FlipHorizontally; Texture2D texture2D15 = TextureAssets.Npc[NPC.type].Value; - Texture2D texture2D16 = ModContent.Request("CalamityMod/NPCs/ProfanedGuardians/ProfanedGuardianHealerGlow2").Value; + Texture2D texture2D16 = ProfanedGuardianHealer.Texture_Glow2.Value; Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2)); int afterimageAmt = 5; @@ -141,7 +142,7 @@ namespace CalamityMod.NPCs.Providence drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.Request("CalamityMod/NPCs/ProfanedGuardians/ProfanedGuardianHealerGlow").Value; + texture2D15 = ProfanedGuardianHealer.Texture_Glow.Value; Color yellowLerp = Color.Lerp(Color.White, Color.Yellow, 0.5f); Color violetLerp = Color.Lerp(Color.White, Color.Violet, 0.5f); diff --git a/NPCs/Providence/ProvSpawnOffense.cs b/NPCs/Providence/ProvSpawnOffense.cs index 055acf1bf4..faa67a7dfa 100644 --- a/NPCs/Providence/ProvSpawnOffense.cs +++ b/NPCs/Providence/ProvSpawnOffense.cs @@ -1,6 +1,7 @@ using System; using CalamityMod.Dusts; using CalamityMod.Events; +using CalamityMod.NPCs.ProfanedGuardians; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -143,7 +144,7 @@ namespace CalamityMod.NPCs.Providence drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.Request("CalamityMod/NPCs/ProfanedGuardians/ProfanedGuardianCommanderGlow").Value; + texture2D15 = ProfanedGuardianCommander.Texture_Glow.Value; Color yellowLerpColor = Color.Lerp(Color.White, Color.Yellow, 0.5f); if (CalamityConfig.Instance.Afterimages) diff --git a/NPCs/Providence/Providence.cs b/NPCs/Providence/Providence.cs index b965df0767..7a3b07d462 100644 --- a/NPCs/Providence/Providence.cs +++ b/NPCs/Providence/Providence.cs @@ -30,6 +30,7 @@ using CalamityMod.Tiles.Ores; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using ReLogic.Utilities; using Terraria; using Terraria.Audio; @@ -114,6 +115,46 @@ namespace CalamityMod.NPCs.Providence private const float TimeForStarDespawn = 120f; private const float TimeForShieldDespawn = 120f; + // Every single one of Providence's sprites, both night and day, and their glowmasks + #region Textures + public static Asset TextureAlt; + public static Asset TextureAltNight; + public static Asset TextureAttack; + public static Asset TextureAttackNight; + public static Asset TextureAttackAlt; + public static Asset TextureAttackAltNight; + public static Asset TextureDefense; + public static Asset TextureDefenseNight; + public static Asset TextureDefenseAlt; + public static Asset TextureDefenseAltNight; + public static Asset TextureNight; + + public static Asset Texture_Glow; + public static Asset TextureAlt_Glow; + public static Asset TextureAltNight_Glow; + public static Asset TextureAttack_Glow; + public static Asset TextureAttackNight_Glow; + public static Asset TextureAttackAlt_Glow; + public static Asset TextureAttackAltNight_Glow; + public static Asset TextureDefense_Glow; + public static Asset TextureDefenseNight_Glow; + public static Asset TextureDefenseAlt_Glow; + public static Asset TextureDefenseAltNight_Glow; + public static Asset TextureNight_Glow; + public static Asset Texture_Glow_2; + public static Asset TextureAlt_Glow_2; + public static Asset TextureAltNight_Glow_2; + public static Asset TextureAttack_Glow_2; + public static Asset TextureAttackNight_Glow_2; + public static Asset TextureAttackAlt_Glow_2; + public static Asset TextureAttackAltNight_Glow_2; + public static Asset TextureDefense_Glow_2; + public static Asset TextureDefenseNight_Glow_2; + public static Asset TextureDefenseAlt_Glow_2; + public static Asset TextureDefenseAltNight_Glow_2; + public static Asset TextureNight_Glow_2; + #endregion + public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 3; @@ -128,6 +169,55 @@ namespace CalamityMod.NPCs.Providence value.Position.Y += 6f; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; NPCID.Sets.MPAllowedEnemies[Type] = true; + + #region Texture Loading + if (!Main.dedServ) + { + string ProviPath = "CalamityMod/NPCs/Providence/Providence"; + string GlowPath = "CalamityMod/NPCs/Providence/Glowmasks/Providence"; + + // Normal textures + TextureAlt = ModContent.Request(ProviPath + "Alt", AssetRequestMode.AsyncLoad); + TextureAltNight = ModContent.Request(ProviPath + "AltNight", AssetRequestMode.AsyncLoad); + TextureAttack = ModContent.Request(ProviPath + "Attack", AssetRequestMode.AsyncLoad); + TextureAttackNight = ModContent.Request(ProviPath + "AttackNight", AssetRequestMode.AsyncLoad); + TextureAttackAlt = ModContent.Request(ProviPath + "AttackAlt", AssetRequestMode.AsyncLoad); + TextureAttackAltNight = ModContent.Request(ProviPath + "AttackAltNight", AssetRequestMode.AsyncLoad); + TextureDefense = ModContent.Request(ProviPath + "Defense", AssetRequestMode.AsyncLoad); + TextureDefenseNight = ModContent.Request(ProviPath + "DefenseNight", AssetRequestMode.AsyncLoad); + TextureDefenseAlt = ModContent.Request(ProviPath + "DefenseAlt", AssetRequestMode.AsyncLoad); + TextureDefenseAltNight = ModContent.Request(ProviPath + "DefenseAltNight", AssetRequestMode.AsyncLoad); + TextureNight = ModContent.Request(ProviPath + "Night", AssetRequestMode.AsyncLoad); + + // Fire glowmasks + Texture_Glow = ModContent.Request(GlowPath + "Glow", AssetRequestMode.AsyncLoad); + TextureAlt_Glow = ModContent.Request(GlowPath + "AltGlow", AssetRequestMode.AsyncLoad); + TextureAltNight_Glow = ModContent.Request(GlowPath + "AltGlowNight", AssetRequestMode.AsyncLoad); + TextureAttack_Glow = ModContent.Request(GlowPath + "AttackGlow", AssetRequestMode.AsyncLoad); + TextureAttackNight_Glow = ModContent.Request(GlowPath + "AttackGlowNight", AssetRequestMode.AsyncLoad); + TextureAttackAlt_Glow = ModContent.Request(GlowPath + "AttackAltGlow", AssetRequestMode.AsyncLoad); + TextureAttackAltNight_Glow = ModContent.Request(GlowPath + "AttackAltGlowNight", AssetRequestMode.AsyncLoad); + TextureDefense_Glow = ModContent.Request(GlowPath + "DefenseGlow", AssetRequestMode.AsyncLoad); + TextureDefenseNight_Glow = ModContent.Request(GlowPath + "DefenseGlowNight", AssetRequestMode.AsyncLoad); + TextureDefenseAlt_Glow = ModContent.Request(GlowPath + "DefenseAltGlow", AssetRequestMode.AsyncLoad); + TextureDefenseAltNight_Glow = ModContent.Request(GlowPath + "DefenseAltGlowNight", AssetRequestMode.AsyncLoad); + TextureNight_Glow = ModContent.Request(GlowPath + "GlowNight", AssetRequestMode.AsyncLoad); + + // Crystal glowmasks + Texture_Glow_2 = ModContent.Request(GlowPath + "Glow2", AssetRequestMode.AsyncLoad); + TextureAlt_Glow_2 = ModContent.Request(GlowPath + "AltGlow2", AssetRequestMode.AsyncLoad); + TextureAltNight_Glow_2 = ModContent.Request(GlowPath + "AltGlow2Night", AssetRequestMode.AsyncLoad); + TextureAttack_Glow_2 = ModContent.Request(GlowPath + "AttackGlow2", AssetRequestMode.AsyncLoad); + TextureAttackNight_Glow_2 = ModContent.Request(GlowPath + "AttackGlow2Night", AssetRequestMode.AsyncLoad); + TextureAttackAlt_Glow_2 = ModContent.Request(GlowPath + "AttackAltGlow2", AssetRequestMode.AsyncLoad); + TextureAttackAltNight_Glow_2 = ModContent.Request(GlowPath + "AttackAltGlow2Night", AssetRequestMode.AsyncLoad); + TextureDefense_Glow_2 = ModContent.Request(GlowPath + "DefenseGlow2", AssetRequestMode.AsyncLoad); + TextureDefenseNight_Glow_2 = ModContent.Request(GlowPath + "DefenseGlow2Night", AssetRequestMode.AsyncLoad); + TextureDefenseAlt_Glow_2 = ModContent.Request(GlowPath + "DefenseAltGlow2", AssetRequestMode.AsyncLoad); + TextureDefenseAltNight_Glow_2 = ModContent.Request(GlowPath + "DefenseAltGlow2Night", AssetRequestMode.AsyncLoad); + TextureNight_Glow_2 = ModContent.Request(GlowPath + "Glow2Night", AssetRequestMode.AsyncLoad); + } + #endregion } public override void SetDefaults() @@ -2060,50 +2150,45 @@ namespace CalamityMod.NPCs.Providence string baseTextureString = "CalamityMod/NPCs/Providence/"; string baseGlowTextureString = baseTextureString + "Glowmasks/"; - string getTextureString = baseTextureString + "Providence"; - string getTextureGlowString = baseGlowTextureString + "ProvidenceGlow"; - string getTextureGlow2String = baseGlowTextureString + "ProvidenceGlow2"; + Texture2D texture = offColor ? TextureNight.Value : TextureAssets.Npc[Type].Value; + Texture2D textureGlow = offColor ? TextureNight_Glow.Value : Texture_Glow.Value; + Texture2D textureGlow2 = offColor ? TextureNight_Glow_2.Value : Texture_Glow_2.Value; if (AIState == (int)Phase.FlameCocoon || AIState == (int)Phase.SpearCocoon) { if (!useDefenseFrames) { - getTextureString = baseTextureString + "ProvidenceDefense"; - getTextureGlowString = baseGlowTextureString + "ProvidenceDefenseGlow"; - getTextureGlow2String = baseGlowTextureString + "ProvidenceDefenseGlow2"; + texture = offColor ? TextureDefenseNight.Value : TextureDefense.Value; + textureGlow = offColor ? TextureDefenseNight_Glow.Value : TextureDefense_Glow.Value; + textureGlow2 = offColor ? TextureDefenseNight_Glow_2.Value : TextureDefense_Glow_2.Value; } else { - getTextureString = baseTextureString + "ProvidenceDefenseAlt"; - getTextureGlowString = baseGlowTextureString + "ProvidenceDefenseAltGlow"; - getTextureGlow2String = baseGlowTextureString + "ProvidenceDefenseAltGlow2"; + texture = offColor ? TextureDefenseAltNight.Value : TextureDefenseAlt.Value; + textureGlow = offColor ? TextureDefenseAltNight_Glow.Value : TextureDefenseAlt_Glow.Value; + textureGlow2 = offColor ? TextureDefenseAltNight_Glow_2.Value : TextureDefenseAlt_Glow_2.Value; } } else { switch (frameUsed) { - case 0: - getTextureGlowString = baseGlowTextureString + "ProvidenceGlow"; - getTextureGlow2String = baseGlowTextureString + "ProvidenceGlow2"; - break; - case 1: - getTextureString = baseTextureString + "ProvidenceAlt"; - getTextureGlowString = baseGlowTextureString + "ProvidenceAltGlow"; - getTextureGlow2String = baseGlowTextureString + "ProvidenceAltGlow2"; + texture = offColor ? TextureAltNight.Value : TextureAlt.Value; + textureGlow = offColor ? TextureAltNight_Glow.Value : TextureAlt_Glow.Value; + textureGlow2 = offColor ? TextureAltNight_Glow_2.Value : TextureAlt_Glow_2.Value; break; case 2: - getTextureString = baseTextureString + "ProvidenceAttack"; - getTextureGlowString = baseGlowTextureString + "ProvidenceAttackGlow"; - getTextureGlow2String = baseGlowTextureString + "ProvidenceAttackGlow2"; + texture = offColor ? TextureAttackNight.Value : TextureAttack.Value; + textureGlow = offColor ? TextureAttackNight_Glow.Value : TextureAttack_Glow.Value; + textureGlow2 = offColor ? TextureAttackNight_Glow_2.Value : TextureAttack_Glow_2.Value; break; case 3: - getTextureString = baseTextureString + "ProvidenceAttackAlt"; - getTextureGlowString = baseGlowTextureString + "ProvidenceAttackAltGlow"; - getTextureGlow2String = baseGlowTextureString + "ProvidenceAttackAltGlow2"; + texture = offColor ? TextureAttackAltNight.Value : TextureAttackAlt.Value; + textureGlow = offColor ? TextureAttackAltNight_Glow.Value : TextureAttackAlt_Glow.Value; + textureGlow2 = offColor ? TextureAttackAltNight_Glow_2.Value : TextureAttackAlt_Glow_2.Value; break; default: @@ -2111,17 +2196,6 @@ namespace CalamityMod.NPCs.Providence } } - if (offColor) - { - getTextureString += "Night"; - getTextureGlowString += "Night"; - getTextureGlow2String += "Night"; - } - - Texture2D texture = ModContent.Request(getTextureString).Value; - Texture2D textureGlow = ModContent.Request(getTextureGlowString).Value; - Texture2D textureGlow2 = ModContent.Request(getTextureGlow2String).Value; - SpriteEffects spriteEffects = SpriteEffects.None; if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; diff --git a/NPCs/Ravager/FlamePillar.cs b/NPCs/Ravager/FlamePillar.cs index 61e958a4e2..d91408d85d 100644 --- a/NPCs/Ravager/FlamePillar.cs +++ b/NPCs/Ravager/FlamePillar.cs @@ -3,6 +3,7 @@ using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -14,10 +15,16 @@ namespace CalamityMod.NPCs.Ravager public class FlamePillar : ModNPC { public static readonly SoundStyle HitSound = new("CalamityMod/Sounds/NPCHit/RavagerRockPillarHit", 3); + public static Asset GlowTexture; + public override void SetStaticDefaults() { this.HideFromBestiary(); Main.npcFrameCount[NPC.type] = 4; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -153,7 +160,7 @@ namespace CalamityMod.NPCs.Ravager spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.Request("CalamityMod/NPCs/Ravager/FlamePillarGlow").Value; + texture2D15 = GlowTexture.Value; Color flameBlue = Color.Lerp(Color.White, Color.Cyan, 0.5f); spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, flameBlue, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); diff --git a/NPCs/Ravager/RavagerBody.cs b/NPCs/Ravager/RavagerBody.cs index 7307db07e0..777688c471 100644 --- a/NPCs/Ravager/RavagerBody.cs +++ b/NPCs/Ravager/RavagerBody.cs @@ -22,6 +22,7 @@ using CalamityMod.UI.VanillaBossBars; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -45,6 +46,9 @@ namespace CalamityMod.NPCs.Ravager public static readonly SoundStyle PillarSound = new("CalamityMod/Sounds/Custom/Ravager/RavagerPillarSummon"); public static readonly SoundStyle MissileSound = new("CalamityMod/Sounds/Custom/Ravager/RavagerMissileLaunch"); + public static Asset GlowTexture; + public static Asset ChainTexture; + public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 7; @@ -58,6 +62,11 @@ namespace CalamityMod.NPCs.Ravager value.Position.Y -= 50f; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; NPCID.Sets.MPAllowedEnemies[Type] = true; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + GlowTexture = ModContent.Request("CalamityMod/NPCs/Ravager/RavagerChain", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -850,11 +859,11 @@ namespace CalamityMod.NPCs.Ravager Vector2 center = new Vector2(NPC.Center.X, NPC.Center.Y); if (NPC.IsABestiaryIconDummy) { - spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/Ravager/RavagerClawLeft").Value, new Vector2(center.X - screenPos.X - NPC.scale * 180, center.Y - screenPos.Y + 50), - new Rectangle?(new Rectangle(0, 0, ModContent.Request("CalamityMod/NPCs/Ravager/RavagerClawLeft").Value.Width, ModContent.Request("CalamityMod/NPCs/Ravager/RavagerClawLeft").Value.Height)), + spriteBatch.Draw(TextureAssets.Npc[ModContent.NPCType()].Value, new Vector2(center.X - screenPos.X - NPC.scale * 180, center.Y - screenPos.Y + 50), + new Rectangle?(new Rectangle(0, 0, TextureAssets.Npc[ModContent.NPCType()].Value.Width, TextureAssets.Npc[ModContent.NPCType()].Value.Height)), Color.White, 0f, default, NPC.scale, SpriteEffects.None, 0f); - spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/Ravager/RavagerClawRight").Value, new Vector2(center.X - screenPos.X + NPC.scale * 110, center.Y - screenPos.Y + 50), - new Rectangle?(new Rectangle(0, 0, ModContent.Request("CalamityMod/NPCs/Ravager/RavagerClawRight").Value.Width, ModContent.Request("CalamityMod/NPCs/Ravager/RavagerClawRight").Value.Height)), + spriteBatch.Draw(TextureAssets.Npc[ModContent.NPCType()].Value, new Vector2(center.X - screenPos.X + NPC.scale * 110, center.Y - screenPos.Y + 50), + new Rectangle?(new Rectangle(0, 0, TextureAssets.Npc[ModContent.NPCType()].Value.Width, TextureAssets.Npc[ModContent.NPCType()].Value.Height)), Color.White, 0f, default, NPC.scale, SpriteEffects.None, 0f); } return true; @@ -870,10 +879,10 @@ namespace CalamityMod.NPCs.Ravager Vector2 center = new Vector2(NPC.Center.X, NPC.Center.Y); Vector2 halfSizeTexture = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2); Vector2 glowmaskPosition = center - screenPos; - glowmaskPosition -= new Vector2(ModContent.Request("CalamityMod/NPCs/Ravager/RavagerBodyGlow").Value.Width, ModContent.Request("CalamityMod/NPCs/Ravager/RavagerBodyGlow").Value.Height / Main.npcFrameCount[NPC.type]) * 1f / 2f; + glowmaskPosition -= new Vector2(GlowTexture.Value.Width, GlowTexture.Value.Height / Main.npcFrameCount[NPC.type]) * 1f / 2f; glowmaskPosition += halfSizeTexture * 1f + new Vector2(0f, 4f + NPC.gfxOffY); Color glowmaskColor = new Color(127 - NPC.alpha, 127 - NPC.alpha, 127 - NPC.alpha, 0).MultiplyRGBA(Color.Blue); - spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/Ravager/RavagerBodyGlow").Value, glowmaskPosition, + spriteBatch.Draw(GlowTexture.Value, glowmaskPosition, NPC.frame, glowmaskColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); float legOffset = 20f; @@ -886,16 +895,16 @@ namespace CalamityMod.NPCs.Ravager headOffset = 0f; } - spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/Ravager/RavagerLegRight").Value, new Vector2(center.X - screenPos.X + NPC.scale * 28f, center.Y - screenPos.Y + legOffset), //72 - new Rectangle?(new Rectangle(0, 0, ModContent.Request("CalamityMod/NPCs/Ravager/RavagerLegRight").Value.Width, ModContent.Request("CalamityMod/NPCs/Ravager/RavagerLegRight").Value.Height)), + spriteBatch.Draw(TextureAssets.Npc[ModContent.NPCType()].Value, new Vector2(center.X - screenPos.X + NPC.scale * 28f, center.Y - screenPos.Y + legOffset), //72 + new Rectangle?(new Rectangle(0, 0, TextureAssets.Npc[ModContent.NPCType()].Value.Width, TextureAssets.Npc[ModContent.NPCType()].Value.Height)), drawLighting, 0f, default, NPC.scale, SpriteEffects.None, 0f); - spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/Ravager/RavagerLegLeft").Value, new Vector2(center.X - screenPos.X - NPC.scale * 112f, center.Y - screenPos.Y + legOffset), //72 - new Rectangle?(new Rectangle(0, 0, ModContent.Request("CalamityMod/NPCs/Ravager/RavagerLegLeft").Value.Width, ModContent.Request("CalamityMod/NPCs/Ravager/RavagerLegLeft").Value.Height)), + spriteBatch.Draw(TextureAssets.Npc[ModContent.NPCType()].Value, new Vector2(center.X - screenPos.X - NPC.scale * 112f, center.Y - screenPos.Y + legOffset), //72 + new Rectangle?(new Rectangle(0, 0, TextureAssets.Npc[ModContent.NPCType()].Value.Width, TextureAssets.Npc[ModContent.NPCType()].Value.Height)), drawLighting, 0f, default, NPC.scale, SpriteEffects.None, 0f); if (NPC.AnyNPCs(ModContent.NPCType()) || NPC.IsABestiaryIconDummy) { - spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/Ravager/RavagerHead").Value, new Vector2(center.X - screenPos.X - NPC.scale * 70f, center.Y - screenPos.Y - NPC.scale * headOffset), - new Rectangle?(new Rectangle(0, 0, ModContent.Request("CalamityMod/NPCs/Ravager/RavagerHead").Value.Width, ModContent.Request("CalamityMod/NPCs/Ravager/RavagerHead").Value.Height)), + spriteBatch.Draw(TextureAssets.Npc[ModContent.NPCType()].Value, new Vector2(center.X - screenPos.X - NPC.scale * 70f, center.Y - screenPos.Y - NPC.scale * headOffset), + new Rectangle?(new Rectangle(0, 0, TextureAssets.Npc[ModContent.NPCType()].Value.Width, TextureAssets.Npc[ModContent.NPCType()].Value.Height)), drawLighting, 0f, default, NPC.scale, SpriteEffects.None, 0f); } } diff --git a/NPCs/Ravager/RavagerClawLeft.cs b/NPCs/Ravager/RavagerClawLeft.cs index a801996201..218826ba88 100644 --- a/NPCs/Ravager/RavagerClawLeft.cs +++ b/NPCs/Ravager/RavagerClawLeft.cs @@ -295,9 +295,9 @@ namespace CalamityMod.NPCs.Ravager drawPositionY += 12f; drawPositionX -= 28f; Color color = Lighting.GetColor((int)center.X / 16, (int)(center.Y / 16f)); - spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/Ravager/RavagerChain").Value, new Vector2(center.X - screenPos.X, center.Y - screenPos.Y), - new Rectangle?(new Rectangle(0, 0, ModContent.Request("CalamityMod/NPCs/Ravager/RavagerChain").Value.Width, ModContent.Request("CalamityMod/NPCs/Ravager/RavagerChain").Value.Height)), color, rotation, - new Vector2(ModContent.Request("CalamityMod/NPCs/Ravager/RavagerChain").Value.Width * 0.5f, ModContent.Request("CalamityMod/NPCs/Ravager/RavagerChain").Value.Height * 0.5f), 1f, SpriteEffects.None, 0f); + spriteBatch.Draw(RavagerBody.ChainTexture.Value, new Vector2(center.X - screenPos.X, center.Y - screenPos.Y), + new Rectangle?(new Rectangle(0, 0, RavagerBody.ChainTexture.Value.Width, RavagerBody.ChainTexture.Value.Height)), color, rotation, + new Vector2(RavagerBody.ChainTexture.Value.Width * 0.5f, RavagerBody.ChainTexture.Value.Height * 0.5f), 1f, SpriteEffects.None, 0f); } } return true; diff --git a/NPCs/Ravager/RavagerClawRight.cs b/NPCs/Ravager/RavagerClawRight.cs index 83f9bfe777..360d61c8a6 100644 --- a/NPCs/Ravager/RavagerClawRight.cs +++ b/NPCs/Ravager/RavagerClawRight.cs @@ -296,9 +296,9 @@ namespace CalamityMod.NPCs.Ravager drawPositionY += 12f; drawPositionX += 28f; Color color = Lighting.GetColor((int)center.X / 16, (int)(center.Y / 16f)); - spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/Ravager/RavagerChain").Value, new Vector2(center.X - screenPos.X, center.Y - screenPos.Y), - new Rectangle?(new Rectangle(0, 0, ModContent.Request("CalamityMod/NPCs/Ravager/RavagerChain").Value.Width, ModContent.Request("CalamityMod/NPCs/Ravager/RavagerChain").Value.Height)), color, rotation, - new Vector2(ModContent.Request("CalamityMod/NPCs/Ravager/RavagerChain").Value.Width * 0.5f, ModContent.Request("CalamityMod/NPCs/Ravager/RavagerChain").Value.Height * 0.5f), 1f, SpriteEffects.None, 0f); + spriteBatch.Draw(RavagerBody.ChainTexture.Value, new Vector2(center.X - screenPos.X, center.Y - screenPos.Y), + new Rectangle?(new Rectangle(0, 0, RavagerBody.ChainTexture.Value.Width, RavagerBody.ChainTexture.Value.Height)), color, rotation, + new Vector2(RavagerBody.ChainTexture.Value.Width * 0.5f, RavagerBody.ChainTexture.Value.Height * 0.5f), 1f, SpriteEffects.None, 0f); } } return true; diff --git a/NPCs/Signus/CosmicLantern.cs b/NPCs/Signus/CosmicLantern.cs index 8118069eda..b3ba7cb89d 100644 --- a/NPCs/Signus/CosmicLantern.cs +++ b/NPCs/Signus/CosmicLantern.cs @@ -4,6 +4,7 @@ using CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.GameContent; using Terraria.GameContent.Bestiary; @@ -13,11 +14,17 @@ namespace CalamityMod.NPCs.Signus { public class CosmicLantern : ModNPC { + public static Asset GlowTexture; + public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 4; NPCID.Sets.TrailingMode[NPC.type] = 1; NPCID.Sets.BossBestiaryPriority.Add(Type); + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -146,7 +153,7 @@ namespace CalamityMod.NPCs.Signus drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.Request("CalamityMod/NPCs/Signus/CosmicLanternGlow").Value; + texture2D15 = GlowTexture.Value; Color cyanLerp = Color.Lerp(Color.White, Color.Cyan, 0.5f); if (CalamityConfig.Instance.Afterimages) diff --git a/NPCs/Signus/Signus.cs b/NPCs/Signus/Signus.cs index 6580066581..d147dba5a8 100644 --- a/NPCs/Signus/Signus.cs +++ b/NPCs/Signus/Signus.cs @@ -18,6 +18,7 @@ using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -37,6 +38,12 @@ namespace CalamityMod.NPCs.Signus private int lifeToAlpha = 0; private int stealthTimer = 0; + public static Asset AltTexture; + public static Asset AltTexture2; + public static Asset Texture_Glow; + public static Asset AltTexture_Glow; + public static Asset AltTexture2_Glow; + public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 6; @@ -52,6 +59,14 @@ namespace CalamityMod.NPCs.Signus value.Position.Y += 10f; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; NPCID.Sets.MPAllowedEnemies[Type] = true; + if (!Main.dedServ) + { + Texture_Glow = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + AltTexture_Glow = ModContent.Request(Texture + "AltGlow", AssetRequestMode.AsyncLoad); + AltTexture2_Glow = ModContent.Request(Texture + "Alt2Glow", AssetRequestMode.AsyncLoad); + AltTexture = ModContent.Request(Texture + "Alt", AssetRequestMode.AsyncLoad); + AltTexture2 = ModContent.Request(Texture + "Alt2", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -794,7 +809,7 @@ namespace CalamityMod.NPCs.Signus public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { Texture2D NPCTexture = TextureAssets.Npc[NPC.type].Value; - Texture2D glowMaskTexture = ModContent.Request("CalamityMod/NPCs/Signus/SignusGlow").Value; + Texture2D glowMaskTexture = Texture_Glow.Value; SpriteEffects spriteEffects = SpriteEffects.None; if (NPC.spriteDirection == 1) @@ -806,8 +821,8 @@ namespace CalamityMod.NPCs.Signus if (NPC.ai[0] == 4f) { - NPCTexture = ModContent.Request("CalamityMod/NPCs/Signus/SignusAlt2").Value; - glowMaskTexture = ModContent.Request("CalamityMod/NPCs/Signus/SignusAlt2Glow").Value; + NPCTexture = AltTexture2.Value; + glowMaskTexture = AltTexture2_Glow.Value; afterimageAmt = 10; int frameY = 94 * (int)(NPC.frameCounter / 12.0); if (frameY >= 94 * 6) @@ -816,14 +831,14 @@ namespace CalamityMod.NPCs.Signus } else if (NPC.ai[0] == 3f) { - NPCTexture = ModContent.Request("CalamityMod/NPCs/Signus/SignusAlt").Value; - glowMaskTexture = ModContent.Request("CalamityMod/NPCs/Signus/SignusAltGlow").Value; + NPCTexture = AltTexture.Value; + glowMaskTexture = AltTexture_Glow.Value; afterimageAmt = 7; } else { NPCTexture = TextureAssets.Npc[NPC.type].Value; - glowMaskTexture = ModContent.Request("CalamityMod/NPCs/Signus/SignusGlow").Value; + glowMaskTexture = Texture_Glow.Value; } Vector2 halfSizeTexture = new Vector2(NPCTexture.Width / 2, NPCTexture.Height / frameCount / 2); diff --git a/NPCs/SlimeGod/SlimeGodCore.cs b/NPCs/SlimeGod/SlimeGodCore.cs index d4bfb8d592..5d056efafb 100644 --- a/NPCs/SlimeGod/SlimeGodCore.cs +++ b/NPCs/SlimeGod/SlimeGodCore.cs @@ -22,6 +22,7 @@ using CalamityMod.UI.VanillaBossBars; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -43,10 +44,16 @@ namespace CalamityMod.NPCs.SlimeGod public static readonly SoundStyle ShotSound = new("CalamityMod/Sounds/Custom/SlimeGodShot", 2); public static readonly SoundStyle BigShotSound = new("CalamityMod/Sounds/Custom/SlimeGodBigShot", 2); + public static Asset EyeTexture; + public override void SetStaticDefaults() { NPCID.Sets.BossBestiaryPriority.Add(Type); NPCID.Sets.MPAllowedEnemies[Type] = true; + if (!Main.dedServ) + { + EyeTexture = ModContent.Request("CalamityMod/NPCs/SlimeGod/SlimeGodEyes", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -549,7 +556,7 @@ namespace CalamityMod.NPCs.SlimeGod Color drawColorAlpha = NPC.GetAlpha(drawColor); Color colorLightingArea = Lighting.GetColor((int)((double)NPC.position.X + (double)NPC.width * 0.5) / 16, (int)(((double)NPC.position.Y + (double)NPC.height * 0.5) / 16.0)); Texture2D texture2D3 = TextureAssets.Npc[NPC.type].Value; - Texture2D pog = ModContent.Request("CalamityMod/NPCs/SlimeGod/SlimeGodEyes").Value; + Texture2D pog = EyeTexture.Value; int frameTexture = TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type]; int y3 = frameTexture * (int)NPC.frameCounter; Rectangle rectangle = new Rectangle(0, y3, texture2D3.Width, frameTexture); diff --git a/NPCs/StormWeaver/StormWeaverBody.cs b/NPCs/StormWeaver/StormWeaverBody.cs index 6b5b8895af..aa04081067 100644 --- a/NPCs/StormWeaver/StormWeaverBody.cs +++ b/NPCs/StormWeaver/StormWeaverBody.cs @@ -5,6 +5,7 @@ using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.GameContent; using Terraria.ID; @@ -15,12 +16,18 @@ namespace CalamityMod.NPCs.StormWeaver { public class StormWeaverBody : ModNPC { + public static Asset Phase2Texture; + public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.StormWeaverHead.DisplayName"); public override void SetStaticDefaults() { this.HideFromBestiary(); NPCID.Sets.TrailingMode[NPC.type] = 1; + if (!Main.dedServ) + { + Phase2Texture = ModContent.Request(Texture + "Naked", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -277,7 +284,7 @@ namespace CalamityMod.NPCs.StormWeaver if (!phase3) chargePhaseGateValue *= 0.5f; - Texture2D texture = phase2 ? ModContent.Request("CalamityMod/NPCs/StormWeaver/StormWeaverBodyNaked").Value : TextureAssets.Npc[NPC.type].Value; + Texture2D texture = phase2 ? Phase2Texture.Value : TextureAssets.Npc[NPC.type].Value; Vector2 halfSizeTexture = new Vector2(texture.Width / 2, texture.Height / 2); float chargeTelegraphTime = 120f; float chargeTelegraphGateValue = chargePhaseGateValue - chargeTelegraphTime; diff --git a/NPCs/StormWeaver/StormWeaverHead.cs b/NPCs/StormWeaver/StormWeaverHead.cs index e84abd9662..da887174c3 100644 --- a/NPCs/StormWeaver/StormWeaverHead.cs +++ b/NPCs/StormWeaver/StormWeaverHead.cs @@ -20,6 +20,7 @@ using CalamityMod.Sounds; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -55,6 +56,8 @@ namespace CalamityMod.NPCs.StormWeaver private float lightningDecay = 1f; private float lightningSpeed = 0f; + public static Asset Phase2Texture; + public override void SetStaticDefaults() { NPCID.Sets.TrailingMode[NPC.type] = 1; @@ -71,6 +74,10 @@ namespace CalamityMod.NPCs.StormWeaver value.Position.Y += 55; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; NPCID.Sets.MPAllowedEnemies[Type] = true; + if (!Main.dedServ) + { + Phase2Texture = ModContent.Request(Texture + "Naked", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -838,7 +845,7 @@ namespace CalamityMod.NPCs.StormWeaver if (!phase3) chargePhaseGateValue *= 0.5f; - Texture2D texture = phase2 ? ModContent.Request("CalamityMod/NPCs/StormWeaver/StormWeaverHeadNaked").Value : TextureAssets.Npc[NPC.type].Value; + Texture2D texture = phase2 ? Phase2Texture.Value : TextureAssets.Npc[NPC.type].Value; Vector2 halfSizeTexture = new Vector2(texture.Width / 2, texture.Height / 2); float chargeTelegraphTime = 120f; float chargeTelegraphGateValue = chargePhaseGateValue - chargeTelegraphTime; diff --git a/NPCs/StormWeaver/StormWeaverTail.cs b/NPCs/StormWeaver/StormWeaverTail.cs index 8dc73957d0..c92a9af2cf 100644 --- a/NPCs/StormWeaver/StormWeaverTail.cs +++ b/NPCs/StormWeaver/StormWeaverTail.cs @@ -4,6 +4,7 @@ using CalamityMod.Events; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.GameContent; using Terraria.ID; @@ -16,12 +17,20 @@ namespace CalamityMod.NPCs.StormWeaver { private int invinceTime = 180; + public static Asset Phase2Texture; + public static Asset GlowTexture; + public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.StormWeaverHead.DisplayName"); public override void SetStaticDefaults() { this.HideFromBestiary(); NPCID.Sets.TrailingMode[NPC.type] = 1; + if (!Main.dedServ) + { + Phase2Texture = ModContent.Request(Texture + "Naked", AssetRequestMode.AsyncLoad); + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -271,7 +280,7 @@ namespace CalamityMod.NPCs.StormWeaver if (!phase3) chargePhaseGateValue *= 0.5f; - Texture2D texture = phase2 ? ModContent.Request("CalamityMod/NPCs/StormWeaver/StormWeaverTailNaked").Value : TextureAssets.Npc[NPC.type].Value; + Texture2D texture = phase2 ? Phase2Texture.Value : TextureAssets.Npc[NPC.type].Value; Vector2 halfSizeTexture = new Vector2(texture.Width / 2, texture.Height / 2); float chargeTelegraphTime = 120f; float chargeTelegraphGateValue = chargePhaseGateValue - chargeTelegraphTime; @@ -290,7 +299,7 @@ namespace CalamityMod.NPCs.StormWeaver if (!phase2) { - texture = ModContent.Request("CalamityMod/NPCs/StormWeaver/StormWeaverTailGlow").Value; + texture = GlowTexture.Value; Color rainbowBecauseWhyTheFuckNot = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB); Color drawColorAlpha37 = Color.Lerp(Color.White, rainbowBecauseWhyTheFuckNot, 0.5f); spriteBatch.Draw(texture, drawLocation, NPC.frame, drawColorAlpha37, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); diff --git a/NPCs/SunkenSea/BabyGhostBell.cs b/NPCs/SunkenSea/BabyGhostBell.cs index 1bd4185f5c..812fa36cc2 100644 --- a/NPCs/SunkenSea/BabyGhostBell.cs +++ b/NPCs/SunkenSea/BabyGhostBell.cs @@ -5,6 +5,7 @@ using CalamityMod.Items.Fishing.SunkenSeaCatches; using CalamityMod.Items.Placeables.Banners; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.GameContent; using Terraria.GameContent.Bestiary; @@ -17,11 +18,17 @@ namespace CalamityMod.NPCs.SunkenSea { public bool hasBeenHit = false; + public static Asset GlowTexture; + public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 4; Main.npcCatchable[NPC.type] = true; NPCID.Sets.CountsAsCritter[NPC.type] = true; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -144,10 +151,10 @@ namespace CalamityMod.NPCs.SunkenSea Vector2 center = new Vector2(NPC.Center.X, NPC.Center.Y); Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2)); Vector2 vector = center - screenPos; - vector -= new Vector2((float)ModContent.Request("CalamityMod/NPCs/SunkenSea/BabyGhostBellGlow").Value.Width, (float)(ModContent.Request("CalamityMod/NPCs/SunkenSea/BabyGhostBellGlow").Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; + vector -= new Vector2((float)GlowTexture.Value.Width, (float)(GlowTexture.Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; vector += halfSizeTexture * 1f + new Vector2(0f, 4f + NPC.gfxOffY); Color color = new Color(127 - NPC.alpha, 127 - NPC.alpha, 127 - NPC.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.LightBlue); - Main.spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/SunkenSea/BabyGhostBellGlow").Value, vector, + Main.spriteBatch.Draw(GlowTexture.Value, vector, new Microsoft.Xna.Framework.Rectangle?(NPC.frame), color, NPC.rotation, halfSizeTexture, 1f, spriteEffects, 0f); } diff --git a/NPCs/SunkenSea/BlindedAngler.cs b/NPCs/SunkenSea/BlindedAngler.cs index f94f36cdb3..d07b9c9fe4 100644 --- a/NPCs/SunkenSea/BlindedAngler.cs +++ b/NPCs/SunkenSea/BlindedAngler.cs @@ -6,6 +6,7 @@ using CalamityMod.Items.Weapons.Melee; using CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.GameContent; using Terraria.GameContent.Bestiary; @@ -16,9 +17,15 @@ namespace CalamityMod.NPCs.SunkenSea { public class BlindedAngler : ModNPC { + public static Asset GlowTexture; + public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 6; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -92,10 +99,10 @@ namespace CalamityMod.NPCs.SunkenSea Vector2 center = new Vector2(NPC.Center.X, NPC.Center.Y); Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2)); Vector2 vector = center - screenPos; - vector -= new Vector2((float)ModContent.Request("CalamityMod/NPCs/SunkenSea/BlindedAnglerGlow").Value.Width, (float)(ModContent.Request("CalamityMod/NPCs/SunkenSea/BlindedAnglerGlow").Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; + vector -= new Vector2((float)GlowTexture.Value.Width, (float)(GlowTexture.Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; vector += halfSizeTexture * 1f + new Vector2(0f, 4f + NPC.gfxOffY); Color color = new Color(127 - NPC.alpha, 127 - NPC.alpha, 127 - NPC.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.LightBlue); - Main.spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/SunkenSea/BlindedAnglerGlow").Value, vector, + Main.spriteBatch.Draw(GlowTexture.Value, vector, new Microsoft.Xna.Framework.Rectangle?(NPC.frame), color, NPC.rotation, halfSizeTexture, 1f, spriteEffects, 0f); } diff --git a/NPCs/SunkenSea/EutrophicRay.cs b/NPCs/SunkenSea/EutrophicRay.cs index d4ba2fc0ea..285dec213a 100644 --- a/NPCs/SunkenSea/EutrophicRay.cs +++ b/NPCs/SunkenSea/EutrophicRay.cs @@ -4,6 +4,7 @@ using CalamityMod.Items.Placeables.Banners; using CalamityMod.Items.Weapons.Melee; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.GameContent; using Terraria.GameContent.Bestiary; @@ -16,12 +17,18 @@ namespace CalamityMod.NPCs.SunkenSea { public bool hasBeenHit = false; + public static Asset GlowTexture; + public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 5; NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(); value.Position.X += 24f; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -184,10 +191,10 @@ namespace CalamityMod.NPCs.SunkenSea Vector2 center = new Vector2(NPC.Center.X, NPC.Center.Y); Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2)); Vector2 vector = center - screenPos; - vector -= new Vector2((float)ModContent.Request("CalamityMod/NPCs/SunkenSea/EutrophicRayGlow").Value.Width, (float)(ModContent.Request("CalamityMod/NPCs/SunkenSea/EutrophicRayGlow").Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; + vector -= new Vector2((float)GlowTexture.Value.Width, (float)(GlowTexture.Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; vector += halfSizeTexture * 1f + new Vector2(0f, 4f + NPC.gfxOffY); Color color = new Color(127 - NPC.alpha, 127 - NPC.alpha, 127 - NPC.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.LightBlue); - Main.spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/SunkenSea/EutrophicRayGlow").Value, vector, + Main.spriteBatch.Draw(GlowTexture.Value, vector, new Microsoft.Xna.Framework.Rectangle?(NPC.frame), color, NPC.rotation, halfSizeTexture, 1f, spriteEffects, 0f); } diff --git a/NPCs/SunkenSea/GhostBell.cs b/NPCs/SunkenSea/GhostBell.cs index 414e9c4f72..0022e332fd 100644 --- a/NPCs/SunkenSea/GhostBell.cs +++ b/NPCs/SunkenSea/GhostBell.cs @@ -4,6 +4,7 @@ using CalamityMod.Items.Accessories; using CalamityMod.Items.Placeables.Banners; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.GameContent; using Terraria.GameContent.Bestiary; @@ -18,9 +19,15 @@ namespace CalamityMod.NPCs.SunkenSea { public bool hasBeenHit = false; + public static Asset GlowTexture; + public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 6; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -145,10 +152,10 @@ namespace CalamityMod.NPCs.SunkenSea Vector2 center = new Vector2(NPC.Center.X, NPC.Center.Y); Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2)); Vector2 vector = center - screenPos; - vector -= new Vector2((float)ModContent.Request("CalamityMod/NPCs/SunkenSea/GhostBellGlow").Value.Width, (float)(ModContent.Request("CalamityMod/NPCs/SunkenSea/GhostBellGlow").Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; + vector -= new Vector2((float)GlowTexture.Value.Width, (float)(GlowTexture.Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; vector += halfSizeTexture * 1f + new Vector2(0f, 4f + NPC.gfxOffY); Color color = new Color(127 - NPC.alpha, 127 - NPC.alpha, 127 - NPC.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.LightBlue); - Main.spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/SunkenSea/GhostBellGlow").Value, vector, + Main.spriteBatch.Draw(GlowTexture.Value, vector, new Microsoft.Xna.Framework.Rectangle?(NPC.frame), color, NPC.rotation, halfSizeTexture, 1f, spriteEffects, 0f); } diff --git a/NPCs/SunkenSea/GiantClam.cs b/NPCs/SunkenSea/GiantClam.cs index 35a7693690..0200fdffbe 100644 --- a/NPCs/SunkenSea/GiantClam.cs +++ b/NPCs/SunkenSea/GiantClam.cs @@ -16,10 +16,10 @@ using CalamityMod.Projectiles.Enemy; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent.Bestiary; -using Terraria.GameContent.ItemDropRules; using Terraria.ID; using Terraria.ModLoader; using Terraria.ModLoader.Utilities; @@ -37,6 +37,8 @@ namespace CalamityMod.NPCs.SunkenSea private bool hasBeenHit = false; private bool hide = false; + public static Asset GlowTexture; + public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 12; @@ -47,6 +49,10 @@ namespace CalamityMod.NPCs.SunkenSea }; value.Position.Y += 40f; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -515,7 +521,7 @@ namespace CalamityMod.NPCs.SunkenSea public override void PostDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { Texture2D texture = ModContent.Request(Texture).Value; - Texture2D glowmask = ModContent.Request("CalamityMod/NPCs/SunkenSea/GiantClamGlow").Value; + Texture2D glowmask = GlowTexture.Value; SpriteEffects spriteEffects = SpriteEffects.None; Vector2 center = new Vector2(NPC.Center.X, NPC.Center.Y); Vector2 halfSizeTexture = new Vector2((float)(texture.Width / 2), (float)(texture.Height / Main.npcFrameCount[NPC.type] / 2)); diff --git a/NPCs/SunkenSea/PrismBack.cs b/NPCs/SunkenSea/PrismBack.cs index 0bb2eb10b8..037b2c6d94 100644 --- a/NPCs/SunkenSea/PrismBack.cs +++ b/NPCs/SunkenSea/PrismBack.cs @@ -14,10 +14,14 @@ using Terraria.GameContent.ItemDropRules; using Terraria.ID; using Terraria.ModLoader; using Terraria.ModLoader.Utilities; +using ReLogic.Content; + namespace CalamityMod.NPCs.SunkenSea { public class PrismBack : ModNPC { + public static Asset GlowTexture; + public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 5; @@ -27,6 +31,10 @@ namespace CalamityMod.NPCs.SunkenSea }; value.Position.X += 15; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -138,10 +146,10 @@ namespace CalamityMod.NPCs.SunkenSea Vector2 center = new Vector2(NPC.Center.X, NPC.Center.Y); Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2)); Vector2 vector = center - screenPos; - vector -= new Vector2((float)ModContent.Request("CalamityMod/NPCs/SunkenSea/PrismBackGlow").Value.Width, (float)(ModContent.Request("CalamityMod/NPCs/SunkenSea/PrismBackGlow").Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; + vector -= new Vector2((float)GlowTexture.Value.Width, (float)(GlowTexture.Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; vector += halfSizeTexture * 1f + new Vector2(0f, 4f + NPC.gfxOffY); Color color = new Color(127 - NPC.alpha, 127 - NPC.alpha, 127 - NPC.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.Blue); - Main.spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/SunkenSea/PrismBackGlow").Value, vector, + Main.spriteBatch.Draw(GlowTexture.Value, vector, new Microsoft.Xna.Framework.Rectangle?(NPC.frame), color, NPC.rotation, halfSizeTexture, 1f, spriteEffects, 0f); } diff --git a/NPCs/SupremeCalamitas/SepulcherArm.cs b/NPCs/SupremeCalamitas/SepulcherArm.cs index 10eebb093d..0897d65b50 100644 --- a/NPCs/SupremeCalamitas/SepulcherArm.cs +++ b/NPCs/SupremeCalamitas/SepulcherArm.cs @@ -2,6 +2,7 @@ using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.GameContent; using Terraria.ID; @@ -59,10 +60,19 @@ namespace CalamityMod.NPCs.SupremeCalamitas } public Player Target => Main.player[NPC.target]; public SepulcherArmLimb[] Limbs = new SepulcherArmLimb[4]; + + public static Asset HandTexture; + public static Asset ForearmTexture; + public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.SepulcherHead.DisplayName"); public override void SetStaticDefaults() { this.HideFromBestiary(); + if (!Main.dedServ) + { + HandTexture = ModContent.Request("CalamityMod/NPCs/SupremeCalamitas/SepulcherHand", AssetRequestMode.AsyncLoad); + ForearmTexture = ModContent.Request("CalamityMod/NPCs/SupremeCalamitas/SepulcherForearm", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -177,8 +187,8 @@ namespace CalamityMod.NPCs.SupremeCalamitas public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor_Unused) { Texture2D armTexture = TextureAssets.Npc[NPC.type].Value; - Texture2D foreArmTexture = ModContent.Request("CalamityMod/NPCs/SupremeCalamitas/SepulcherForearm").Value; - Texture2D handTexture = ModContent.Request("CalamityMod/NPCs/SupremeCalamitas/SepulcherHand").Value; + Texture2D foreArmTexture = ForearmTexture.Value; + Texture2D handTexture = HandTexture.Value; Vector2 forearmDrawPosition = Limbs[0].Center - screenPos; Color drawColor = Lighting.GetColor((int)(Limbs[0].Center.X / 16), (int)(Limbs[0].Center.Y / 16)); diff --git a/NPCs/SupremeCalamitas/SepulcherBody.cs b/NPCs/SupremeCalamitas/SepulcherBody.cs index 050a3bd6cb..a5be1ff57c 100644 --- a/NPCs/SupremeCalamitas/SepulcherBody.cs +++ b/NPCs/SupremeCalamitas/SepulcherBody.cs @@ -2,6 +2,7 @@ using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.GameContent; using Terraria.ID; @@ -16,9 +17,16 @@ namespace CalamityMod.NPCs.SupremeCalamitas public NPC AheadSegment => Main.npc[(int)NPC.ai[1]]; public NPC HeadSegment => Main.npc[(int)NPC.ai[2]]; public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.SepulcherHead.DisplayName"); + + public static Asset AltTexture; + public override void SetStaticDefaults() { this.HideFromBestiary(); + if (!Main.dedServ) + { + AltTexture = ModContent.Request(Texture + "Alt", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -121,7 +129,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture2D15 = NPC.localAI[3] / 2f % 2f == 0f ? ModContent.Request("CalamityMod/NPCs/SupremeCalamitas/SepulcherBodyAlt").Value : TextureAssets.Npc[NPC.type].Value; + Texture2D texture2D15 = NPC.localAI[3] / 2f % 2f == 0f ? AltTexture.Value : TextureAssets.Npc[NPC.type].Value; Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / 2)); Vector2 drawLocation = NPC.Center - screenPos; diff --git a/NPCs/SupremeCalamitas/SoulSeekerSupreme.cs b/NPCs/SupremeCalamitas/SoulSeekerSupreme.cs index 02d1da79fe..b605bf3142 100644 --- a/NPCs/SupremeCalamitas/SoulSeekerSupreme.cs +++ b/NPCs/SupremeCalamitas/SoulSeekerSupreme.cs @@ -5,6 +5,7 @@ using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -29,6 +30,8 @@ namespace CalamityMod.NPCs.SupremeCalamitas public const float NormalDR = 0.25f; + public static Asset GlowTexture; + public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 6; @@ -43,6 +46,10 @@ namespace CalamityMod.NPCs.SupremeCalamitas value.Position.X += 12f; value.Position.Y -= 4f; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -245,7 +252,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.Request("CalamityMod/NPCs/SupremeCalamitas/SoulSeekerSupremeGlow").Value; + texture2D15 = GlowTexture.Value; Color redLerp = Color.Lerp(Color.White, Color.Red, 0.5f); if (CalamityConfig.Instance.Afterimages) diff --git a/NPCs/SupremeCalamitas/SupremeCalamitas.cs b/NPCs/SupremeCalamitas/SupremeCalamitas.cs index e235fdafe6..878472656a 100644 --- a/NPCs/SupremeCalamitas/SupremeCalamitas.cs +++ b/NPCs/SupremeCalamitas/SupremeCalamitas.cs @@ -31,6 +31,7 @@ using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -193,6 +194,13 @@ namespace CalamityMod.NPCs.SupremeCalamitas public static readonly SoundStyle HellblastSound = new("CalamityMod/Sounds/Custom/SCalSounds/BrimstoneHellblastSound"); public static readonly SoundStyle HurtSound = new("CalamityMod/Sounds/NPCHit/ShieldHit", 3); + public static Asset HoodedTexture; + public static Asset CirrusTexture; + public static Asset CirrusTexture2; + public static Asset ShieldTopTexture; + public static Asset ShieldBottomTexture; + public static Asset ForcefieldTexture; + // TODO -- This is cumbersome. Change it to be better in 1.4. internal static void LoadHeadIcons() { @@ -225,6 +233,15 @@ namespace CalamityMod.NPCs.SupremeCalamitas }; value.Position.Y += 14f; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + if (!Main.dedServ) + { + HoodedTexture = ModContent.Request(Texture + "Hooded", AssetRequestMode.AsyncLoad); + CirrusTexture = ModContent.Request("CalamityMod/NPCs/SupremeCalamitas/SupremeCirrus", AssetRequestMode.AsyncLoad); + CirrusTexture2 = ModContent.Request("CalamityMod/NPCs/SupremeCalamitas/SupremeCirrus_Shimmered", AssetRequestMode.AsyncLoad); + ShieldTopTexture = ModContent.Request("CalamityMod/NPCs/SupremeCalamitas/SupremeShieldTop", AssetRequestMode.AsyncLoad); + ShieldBottomTexture = ModContent.Request("CalamityMod/NPCs/SupremeCalamitas/SupremeShieldBottom", AssetRequestMode.AsyncLoad); + ForcefieldTexture = ModContent.Request("CalamityMod/NPCs/SupremeCalamitas/ForcefieldTexture", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -3180,12 +3197,12 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture2D15 = DownedBossSystem.downedCalamitas && !BossRushEvent.BossRushActive ? TextureAssets.Npc[NPC.type].Value : ModContent.Request("CalamityMod/NPCs/SupremeCalamitas/SupremeCalamitasHooded").Value; + Texture2D texture2D15 = DownedBossSystem.downedCalamitas && !BossRushEvent.BossRushActive ? TextureAssets.Npc[NPC.type].Value : HoodedTexture.Value; Texture2D pony = ModContent.Request("CalamityMod/Items/Mounts/AlicornMount_Front").Value; bool inPhase2 = NPC.ai[0] >= 3f && (NPC.life > NPC.lifeMax * 0.01 || cirrus); if (cirrus) - texture2D15 = inPhase2 ? ModContent.Request("CalamityMod/NPCs/SupremeCalamitas/SupremeCirrus_Shimmered").Value : ModContent.Request("CalamityMod/NPCs/SupremeCalamitas/SupremeCirrus").Value; + texture2D15 = inPhase2 ? CirrusTexture2.Value : CirrusTexture.Value; Vector2 halfSizeTexture = new Vector2(texture2D15.Width / 2f, texture2D15.Height / Main.npcFrameCount[NPC.type] / 2f); Vector2 ponyOrigin = new Vector2(pony.Width / 2f, pony.Height / 30f); @@ -3289,7 +3306,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas intensity *= 0.75f; opacity *= 0.75f; - Texture2D forcefieldTexture = ModContent.Request("CalamityMod/NPCs/SupremeCalamitas/ForcefieldTexture").Value; + Texture2D forcefieldTexture = ForcefieldTexture.Value; GameShaders.Misc["CalamityMod:SupremeShield"].UseImage1("Images/Misc/Perlin"); Color forcefieldColor = Color.DarkViolet; @@ -3329,8 +3346,8 @@ namespace CalamityMod.NPCs.SupremeCalamitas jawRotationOffset += MathHelper.Lerp(0.04f, -0.82f, (float)Math.Sin(Main.GlobalTimeWrappedHourly * 17.2f) * 0.5f + 0.5f); Color shieldColor = Color.White * shieldOpacity; - Texture2D shieldSkullTexture = ModContent.Request("CalamityMod/NPCs/SupremeCalamitas/SupremeShieldTop").Value; - Texture2D shieldJawTexture = ModContent.Request("CalamityMod/NPCs/SupremeCalamitas/SupremeShieldBottom").Value; + Texture2D shieldSkullTexture = ShieldTopTexture.Value; + Texture2D shieldJawTexture = ShieldBottomTexture.Value; Vector2 drawPosition = NPC.Center + shieldRotation.ToRotationVector2() * 24f - Main.screenPosition; Vector2 jawDrawPosition = drawPosition; SpriteEffects direction = Math.Cos(shieldRotation) > 0 ? SpriteEffects.None : SpriteEffects.FlipVertically; diff --git a/NPCs/SupremeCalamitas/SupremeCataclysm.cs b/NPCs/SupremeCalamitas/SupremeCataclysm.cs index ebd375f378..472e635619 100644 --- a/NPCs/SupremeCalamitas/SupremeCataclysm.cs +++ b/NPCs/SupremeCalamitas/SupremeCataclysm.cs @@ -8,6 +8,7 @@ using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -40,6 +41,8 @@ namespace CalamityMod.NPCs.SupremeCalamitas public ref float ElapsedVerticalDistance => ref NPC.ai[3]; public ref float AttackDelayTimer => ref NPC.localAI[0]; + public static Asset GlowTexture; + public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 9; @@ -51,6 +54,10 @@ namespace CalamityMod.NPCs.SupremeCalamitas PortraitPositionYOverride = 36f, }; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -277,7 +284,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas Vector2 mainDrawPosition = NPC.Center - screenPos; spriteBatch.Draw(texture, mainDrawPosition, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, origin, NPC.scale, spriteEffects, 0f); - texture = ModContent.Request("CalamityMod/NPCs/SupremeCalamitas/SupremeCataclysmGlow").Value; + texture = GlowTexture.Value; Color primarycolor = Main.zenithWorld ? Color.Blue : Color.Red; // why? because blue fire is awesome!! Color baseGlowmaskColor = NPC.IsABestiaryIconDummy ? Color.White : Color.Lerp(Color.White, primarycolor, 0.5f); diff --git a/NPCs/SupremeCalamitas/SupremeCatastrophe.cs b/NPCs/SupremeCalamitas/SupremeCatastrophe.cs index 7e25215421..2edbbc31ff 100644 --- a/NPCs/SupremeCalamitas/SupremeCatastrophe.cs +++ b/NPCs/SupremeCalamitas/SupremeCatastrophe.cs @@ -8,6 +8,7 @@ using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -32,6 +33,8 @@ namespace CalamityMod.NPCs.SupremeCalamitas public ref float ElapsedVerticalDistance => ref NPC.ai[3]; public ref float AttackDelayTimer => ref NPC.localAI[0]; + public static Asset GlowTexture; + public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 8; @@ -43,6 +46,10 @@ namespace CalamityMod.NPCs.SupremeCalamitas PortraitPositionYOverride = 56f, }; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -272,7 +279,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas Vector2 mainDrawPosition = NPC.Center - screenPos; spriteBatch.Draw(texture, mainDrawPosition, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, origin, NPC.scale, spriteEffects, 0f); - texture = ModContent.Request("CalamityMod/NPCs/SupremeCalamitas/SupremeCatastropheGlow").Value; + texture = GlowTexture.Value; Color baseGlowmaskColor = Color.Lerp(Color.White, Color.Cyan, 0.35f); if (CalamityConfig.Instance.Afterimages) diff --git a/NPCs/TownNPCs/AndroombaFriendly.cs b/NPCs/TownNPCs/AndroombaFriendly.cs index b981429ce4..83c3990e31 100644 --- a/NPCs/TownNPCs/AndroombaFriendly.cs +++ b/NPCs/TownNPCs/AndroombaFriendly.cs @@ -5,6 +5,7 @@ using CalamityMod.Items.Critters; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -16,6 +17,8 @@ namespace CalamityMod.NPCs.TownNPCs { public class AndroombaFriendly : ModNPC { + public static Asset[] FaceTextures = new Asset[9]; + public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 9; @@ -26,6 +29,18 @@ namespace CalamityMod.NPCs.TownNPCs value.PortraitPositionYOverride = 36f; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; NPCID.Sets.ShimmerTownTransform[Type] = false; + if (!Main.dedServ) + { + FaceTextures[0] = ModContent.Request(Texture + "_Pure", AssetRequestMode.AsyncLoad); + FaceTextures[1] = ModContent.Request(Texture + "_Corruption", AssetRequestMode.AsyncLoad); + FaceTextures[2] = ModContent.Request(Texture + "_Hallow", AssetRequestMode.AsyncLoad); + FaceTextures[3] = ModContent.Request(Texture + "_Mushroom", AssetRequestMode.AsyncLoad); + FaceTextures[4] = ModContent.Request(Texture + "_Crimson", AssetRequestMode.AsyncLoad); + FaceTextures[5] = ModContent.Request(Texture + "_Desert", AssetRequestMode.AsyncLoad); + FaceTextures[6] = ModContent.Request(Texture + "_Snow", AssetRequestMode.AsyncLoad); + FaceTextures[7] = ModContent.Request(Texture + "_Forest", AssetRequestMode.AsyncLoad); + FaceTextures[8] = ModContent.Request(Texture + "_Astral", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -236,41 +251,11 @@ namespace CalamityMod.NPCs.TownNPCs Dust.NewDustDirect(NPC.position, NPC.width, NPC.height, DustID.Electric); } + // TODO: Add compatability for crossmod solutions public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { Texture2D critterTexture = TextureAssets.Npc[NPC.type].Value; - string pathextenstion = "Pure"; - switch (NPC.ai[3]) - { - case 0: - pathextenstion = "Pure"; - break; - case 1: - pathextenstion = "Corruption"; - break; - case 2: - pathextenstion = "Hallow"; - break; - case 3: - pathextenstion = "Mushroom"; - break; - case 4: - pathextenstion = "Crimson"; - break; - case 5: - pathextenstion = "Desert"; - break; - case 6: - pathextenstion = "Snow"; - break; - case 7: - pathextenstion = "Forest"; - break; - case 8: - pathextenstion = "Astral"; - break; - } - Texture2D glowmask = ModContent.Request("CalamityMod/NPCs/TownNPCs/AndroombaFriendly_" + pathextenstion).Value; + Texture2D glowmask = FaceTextures[(int)NPC.ai[3]].Value; Vector2 drawPosition = NPC.Center - screenPos + Vector2.UnitY * NPC.gfxOffY; drawPosition.Y += DrawOffsetY; SpriteEffects direction = NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; diff --git a/NPCs/TownNPCs/FAP.cs b/NPCs/TownNPCs/FAP.cs index ce57e3b7a1..43bc9b2541 100644 --- a/NPCs/TownNPCs/FAP.cs +++ b/NPCs/TownNPCs/FAP.cs @@ -10,6 +10,7 @@ using CalamityMod.Projectiles.Summon; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.DataStructures; @@ -28,6 +29,8 @@ namespace CalamityMod.NPCs.TownNPCs [AutoloadHead] public class FAP : ModNPC { + public static Asset AltTexture; + public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 27; @@ -56,6 +59,10 @@ namespace CalamityMod.NPCs.TownNPCs Velocity = 1f // Draws the NPC in the bestiary as if its walking +1 tiles in the x direction }; NPCID.Sets.NPCBestiaryDrawOffset.Add(NPC.type, drawModifiers); + if (!Main.dedServ) + { + AltTexture = ModContent.Request(Texture + "Alt", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -817,7 +824,7 @@ namespace CalamityMod.NPCs.TownNPCs public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { var something = NPC.direction == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; - spriteBatch.Draw(ModContent.Request(Texture + (BirthdayParty.PartyIsUp ? "Alt" : "")).Value, NPC.Center - screenPos + new Vector2(0, NPC.gfxOffY) - new Vector2(0f, 6f), NPC.frame, drawColor, NPC.rotation, NPC.frame.Size() / 2, NPC.scale, something, 0); + spriteBatch.Draw(BirthdayParty.PartyIsUp ? AltTexture.Value : TextureAssets.Npc[NPC.type].Value, NPC.Center - screenPos + new Vector2(0, NPC.gfxOffY) - new Vector2(0f, 6f), NPC.frame, drawColor, NPC.rotation, NPC.frame.Size() / 2, NPC.scale, something, 0); return false; } diff --git a/NPCs/TownNPCs/THIEF.cs b/NPCs/TownNPCs/THIEF.cs index b5ea348286..b4500f0395 100644 --- a/NPCs/TownNPCs/THIEF.cs +++ b/NPCs/TownNPCs/THIEF.cs @@ -7,8 +7,10 @@ using CalamityMod.Projectiles.Rogue; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; +using Terraria.GameContent; using Terraria.GameContent.Bestiary; using Terraria.GameContent.Events; using Terraria.GameContent.Personalities; @@ -22,6 +24,8 @@ namespace CalamityMod.NPCs.TownNPCs [AutoloadHead] public class THIEF : ModNPC { + public static Asset AltTexture; + public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 23; @@ -42,6 +46,10 @@ namespace CalamityMod.NPCs.TownNPCs Velocity = 1f // Draws the NPC in the bestiary as if its walking +1 tiles in the x direction }; NPCID.Sets.NPCBestiaryDrawOffset.Add(NPC.type, drawModifiers); + if (!Main.dedServ) + { + AltTexture = ModContent.Request(Texture + "Alt", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -237,7 +245,7 @@ namespace CalamityMod.NPCs.TownNPCs public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { var something = NPC.direction == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; - spriteBatch.Draw(ModContent.Request(Texture + (BirthdayParty.PartyIsUp ? "Alt" : "")).Value, NPC.Center - screenPos + new Vector2(0, NPC.gfxOffY) - new Vector2(0f, 6f), NPC.frame, drawColor, NPC.rotation, NPC.frame.Size() / 2, NPC.scale, something, 0); + spriteBatch.Draw(BirthdayParty.PartyIsUp ? AltTexture.Value : TextureAssets.Npc[NPC.type].Value, NPC.Center - screenPos + new Vector2(0, NPC.gfxOffY) - new Vector2(0f, 6f), NPC.frame, drawColor, NPC.rotation, NPC.frame.Size() / 2, NPC.scale, something, 0); return false; } diff --git a/NPCs/Yharon/Yharon.cs b/NPCs/Yharon/Yharon.cs index baf617125e..08f2fa9881 100644 --- a/NPCs/Yharon/Yharon.cs +++ b/NPCs/Yharon/Yharon.cs @@ -28,6 +28,7 @@ using CalamityMod.Tiles.Ores; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using ReLogic.Utilities; using Terraria; using Terraria.Audio; @@ -70,6 +71,10 @@ namespace CalamityMod.NPCs.Yharon public SlotId RoarSoundSlot; + public static Asset GlowTextureGreen; + public static Asset GlowTextureOrange; + public static Asset GlowTexturePurple; + public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 7; @@ -86,6 +91,12 @@ namespace CalamityMod.NPCs.Yharon value.Position.Y -= 14f; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; NPCID.Sets.MPAllowedEnemies[Type] = true; + if (!Main.dedServ) + { + GlowTextureGreen = ModContent.Request(Texture + "GlowGreen", AssetRequestMode.AsyncLoad); + GlowTextureOrange = ModContent.Request(Texture + "GlowOrange", AssetRequestMode.AsyncLoad); + GlowTexturePurple = ModContent.Request(Texture + "GlowPurple", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -2844,15 +2855,15 @@ namespace CalamityMod.NPCs.Yharon if (enteredSubphase2 || NPC.ai[0] == 4f || startSecondAI) { - texture = ModContent.Request("CalamityMod/NPCs/Yharon/YharonGlowOrange").Value; + texture = GlowTextureOrange.Value; Color orangeGlowColor = Color.Lerp(Color.White, invincible ? invincibleColor : Color.Orange, 0.5f) * NPC.Opacity; lerpEndColor = invincible ? invincibleColor : Color.Orange; - Texture2D texture2 = ModContent.Request("CalamityMod/NPCs/Yharon/YharonGlowGreen").Value; + Texture2D texture2 = GlowTextureGreen.Value; Color greenGlowColorOpacity = Color.Lerp(Color.White, invincible ? invincibleColor : Color.Chartreuse, 0.5f) * NPC.Opacity; Color greenGlowColor = invincible ? invincibleColor : Color.Chartreuse; - Texture2D texture3 = ModContent.Request("CalamityMod/NPCs/Yharon/YharonGlowPurple").Value; + Texture2D texture3 = GlowTexturePurple.Value; Color blueGlowColorOpacity = Color.Lerp(Color.White, invincible ? invincibleColor : Color.BlueViolet, 0.5f) * NPC.Opacity; Color blueGlowColor = invincible ? invincibleColor : Color.BlueViolet;