From f140fbc48940cefab029d0ca60bc5654f54abed6 Mon Sep 17 00:00:00 2001 From: Tymon Simonides Date: Sat, 6 Aug 2022 02:32:41 +0200 Subject: [PATCH] Fix Exo Mechs portrait scaling Changed rect.X/Y + rect.Width / Height to rect.Center.X/Y --- ModSupport/WeakReferenceSupport.cs | 37 +++++++++++++++--------------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/ModSupport/WeakReferenceSupport.cs b/ModSupport/WeakReferenceSupport.cs index 9c5712139f..a0ad4e5fcd 100644 --- a/ModSupport/WeakReferenceSupport.cs +++ b/ModSupport/WeakReferenceSupport.cs @@ -281,7 +281,7 @@ namespace CalamityMod string despawn = CalamityUtils.ColorMessage("The scourge of the desert delved back into the sand.", new Color(0xEE, 0xE8, 0xAA)); var portrait = (SpriteBatch sb, Rectangle rect, Color color) => { Texture2D texture = ModContent.Request("CalamityMod/NPCs/DesertScourge/DesertScourge_BossChecklist").Value; - Vector2 centered = new Vector2(rect.X + (rect.Width / 2) - (texture.Width / 2), rect.Y + (rect.Height / 2) - (texture.Height / 2)); + Vector2 centered = new Vector2(rect.Center.X - (texture.Width / 2), rect.Center.Y - (texture.Height / 2)); sb.Draw(texture, centered, color); }; string bossHeadTex = "CalamityMod/NPCs/DesertScourge/DesertScourgeHead_Head_Boss"; @@ -365,7 +365,7 @@ namespace CalamityMod string bossLogTex = "CalamityMod/NPCs/AquaticScourge/AquaticScourgeHead_Head_Boss"; var portrait = (SpriteBatch sb, Rectangle rect, Color color) => { Texture2D texture = ModContent.Request("CalamityMod/NPCs/AquaticScourge/AquaticScourge_BossChecklist").Value; - Vector2 centered = new Vector2(rect.X + (rect.Width / 2) - (texture.Width / 2), rect.Y + (rect.Height / 2) - (texture.Height / 2)); + Vector2 centered = new Vector2(rect.Center.X - (texture.Width / 2), rect.Center.Y - (texture.Height / 2)); sb.Draw(texture, centered, color); }; AddBoss(bossChecklist, calamity, "Aquatic Scourge", order, segments, DownedAquaticScourge, summon, collection, instructions, despawn, () => true, portrait, bossLogTex); @@ -416,7 +416,7 @@ namespace CalamityMod var portrait = (SpriteBatch sb, Rectangle rect, Color color) => { Texture2D texture = ModContent.Request("CalamityMod/NPCs/Leviathan/AnahitaLevi_BossChecklist").Value; - Vector2 centered = new Vector2(rect.X + (rect.Width / 2) - (texture.Width / 2), rect.Y + (rect.Height / 2) - (texture.Height / 2)); + Vector2 centered = new Vector2(rect.Center.X - (texture.Width / 2), rect.Center.Y - (texture.Height / 2)); sb.Draw(texture, centered, color); }; AddBoss(bossChecklist, calamity, "Leviathan", order, bosses, DownedLeviathan, null, collection, instructions, despawn, () => true, portrait); @@ -446,7 +446,7 @@ namespace CalamityMod var portrait = (SpriteBatch sb, Rectangle rect, Color color) => { Texture2D texture = ModContent.Request("CalamityMod/NPCs/PlaguebringerGoliath/PlaguebringerGoliath_BossChecklist").Value; - Vector2 centered = new Vector2(rect.X + (rect.Width / 2) - (texture.Width / 2), rect.Y + (rect.Height / 2) - (texture.Height / 2)); + Vector2 centered = new Vector2(rect.Center.X - (texture.Width / 2), rect.Center.Y - (texture.Height / 2)); sb.Draw(texture, centered, color); }; AddBoss(bossChecklist, calamity, "Plaguebringer Goliath", order, type, DownedPBG, summon, collection, instructions, despawn, () => true, portrait, bossLogTex); @@ -464,7 +464,7 @@ namespace CalamityMod var portrait = (SpriteBatch sb, Rectangle rect, Color color) => { Texture2D texture = ModContent.Request("CalamityMod/NPCs/Ravager/Ravager_BossChecklist").Value; - Vector2 centered = new Vector2(rect.X + (rect.Width / 2) - (texture.Width / 2), rect.Y + (rect.Height / 2) - (texture.Height / 2)); + Vector2 centered = new Vector2(rect.Center.X - (texture.Width / 2), rect.Center.Y - (texture.Height / 2)); sb.Draw(texture, centered, color); }; AddBoss(bossChecklist, calamity, "Ravager", order, segments, DownedRavager, summon, collection, instructions, despawn, () => true, portrait, bossLogTex); @@ -485,7 +485,7 @@ namespace CalamityMod var portrait = (SpriteBatch sb, Rectangle rect, Color color) => { Texture2D texture = ModContent.Request("CalamityMod/NPCs/AstrumDeus/AstrumDeus_BossChecklist").Value; - Vector2 centered = new Vector2(rect.X + (rect.Width / 2) - (texture.Width / 2), rect.Y + (rect.Height / 2) - (texture.Height / 2)); + Vector2 centered = new Vector2(rect.Center.X - (texture.Width / 2), rect.Center.Y - (texture.Height / 2)); sb.Draw(texture, centered, color); }; @@ -504,7 +504,7 @@ namespace CalamityMod var portrait = (SpriteBatch sb, Rectangle rect, Color color) => { Texture2D texture = ModContent.Request("CalamityMod/NPCs/ProfanedGuardians/ProfanedGuardians_BossChecklist").Value; - Vector2 centered = new Vector2(rect.X + (rect.Width / 2) - (texture.Width / 2), rect.Y + (rect.Height / 2) - (texture.Height / 2)); + Vector2 centered = new Vector2(rect.Center.X - (texture.Width / 2), rect.Center.Y - (texture.Height / 2)); sb.Draw(texture, centered, color); }; AddBoss(bossChecklist, calamity, "Profaned Guardians", order, type, DownedGuardians, summon, collection, instructions, despawn, () => true, portrait, bossLogTex); @@ -533,7 +533,7 @@ namespace CalamityMod var portrait = (SpriteBatch sb, Rectangle rect, Color color) => { Texture2D texture = ModContent.Request("CalamityMod/NPCs/Providence/Providence_BossChecklist").Value; - Vector2 centered = new Vector2(rect.X + (rect.Width / 2) - (texture.Width / 2), rect.Y + (rect.Height / 2) - (texture.Height / 2)); + Vector2 centered = new Vector2(rect.Center.X - (texture.Width / 2), rect.Center.Y - (texture.Height / 2)); sb.Draw(texture, centered, color); }; AddBoss(bossChecklist, calamity, "Providence", order, type, DownedProvidence, summon, collection, instructions, despawn, () => true, portrait, bossLogTex); @@ -561,7 +561,7 @@ namespace CalamityMod string bossLogTex = "CalamityMod/NPCs/StormWeaver/StormWeaverHead_Head_Boss"; var portrait = (SpriteBatch sb, Rectangle rect, Color color) => { Texture2D texture = ModContent.Request("CalamityMod/NPCs/StormWeaver/StormWeaver_BossChecklist").Value; - Vector2 centered = new Vector2(rect.X + (rect.Width / 2) - (texture.Width / 2), rect.Y + (rect.Height / 2) - (texture.Height / 2)); + Vector2 centered = new Vector2(rect.Center.X - (texture.Width / 2), rect.Center.Y - (texture.Height / 2)); sb.Draw(texture, centered, color); }; AddBoss(bossChecklist, calamity, "Storm Weaver", order, segments, DownedStormWeaver, summon, collection, instructions, despawn, () => true, portrait, bossLogTex); @@ -611,7 +611,7 @@ namespace CalamityMod string bossHeadTex = "CalamityMod/NPCs/DevourerofGods/DevourerofGodsHead_Head_Boss"; var portrait = (SpriteBatch sb, Rectangle rect, Color color) => { Texture2D texture = ModContent.Request("CalamityMod/NPCs/DevourerofGods/DevourerofGods_BossChecklist").Value; - Vector2 centered = new Vector2(rect.X + (rect.Width / 2) - (texture.Width / 2), rect.Y + (rect.Height / 2) - (texture.Height / 2)); + Vector2 centered = new Vector2(rect.Center.X - (texture.Width / 2), rect.Center.Y - (texture.Height / 2)); sb.Draw(texture, centered, color); }; AddBoss(bossChecklist, calamity, "Devourer of Gods", order, type, DownedDoG, summon, collection, instructions, despawn, () => true, portrait, bossHeadTex); @@ -640,12 +640,11 @@ namespace CalamityMod string instructions = "By using a high-tech computer"; string despawn = CalamityUtils.ColorMessage("An imperfection after all... what a shame.", new Color(0x7F, 0xFF, 0xD4)); - //TODO: Fix the portrait scaling/sizing var portrait = (SpriteBatch sb, Rectangle rect, Color color) => { - Texture2D texture = ModContent.Request("CalamityMod/NPCs/ExoMechs/ExoMechs_BossChecklist").Value; - Vector2 centered = new Vector2(rect.X + (rect.Width / 2) , rect.Y + (rect.Height / 2)); - //sb.Draw(texture, centered, color); - sb.Draw(texture, centered, null, color, 0f, texture.Size() / 1.6f, 0.8f, SpriteEffects.None, 0f); + Texture2D texture = Request("CalamityMod/NPCs/ExoMechs/ExoMechs_BossChecklist").Value; + float scale = 0.7f; + Vector2 centered = new Vector2(rect.Center.X - texture.Width * scale / 2, rect.Center.Y - texture.Height * scale / 2); + sb.Draw(texture, centered, null, color, 0f, Vector2.Zero, scale, SpriteEffects.None, 0f); }; AddBoss(bossChecklist, calamity, "Exo Mechs", order, bosses, DownedExoMechs, null, collection, instructions, despawn, () => true, portrait); @@ -678,7 +677,7 @@ namespace CalamityMod var portrait = (SpriteBatch sb, Rectangle rect, Color color) => { Texture2D texture = ModContent.Request("CalamityMod/NPCs/AdultEidolonWyrm/AdultEidolonWyrm_BossChecklist").Value; - Vector2 centered = new Vector2(rect.X + (rect.Width / 2) - (texture.Width / 2), rect.Y + (rect.Height / 2) - (texture.Height / 2)); + Vector2 centered = new Vector2(rect.Center.X - (texture.Width / 2), rect.Center.Y - (texture.Height / 2)); sb.Draw(texture, centered, color); }; AddBoss(bossChecklist, calamity, "Adult Eidolon Wyrm", order, type, DownedAdultEidolonWyrm, summon, collection, instructions, despawn, () => true, portrait, bossLogTex); @@ -698,7 +697,7 @@ namespace CalamityMod //TODO: Fix the portrait scaling/sizing var portrait = (SpriteBatch sb, Rectangle rect, Color color) => { Texture2D texture = ModContent.Request("CalamityMod/Events/AcidRainT1_BossChecklist").Value; - Vector2 centered = new Vector2(rect.X + (rect.Width / 2) - (texture.Width / 2), rect.Y + (rect.Height / 2) - (texture.Height / 2)); + Vector2 centered = new Vector2(rect.Center.X - (texture.Width / 2), rect.Center.Y - (texture.Height / 2)); sb.Draw(texture, centered, color); }; AddInvasion(bossChecklist, calamity, "Acid Rain", order, enemies, DownedAcidRainInitial, summon, collection, instructions, () => true, portrait, iconTexture); @@ -716,7 +715,7 @@ namespace CalamityMod //TODO: Fix the portrait scaling/sizing var portrait = (SpriteBatch sb, Rectangle rect, Color color) => { Texture2D texture = ModContent.Request("CalamityMod/Events/AcidRainT2_BossChecklist").Value; - Vector2 centered = new Vector2(rect.X + (rect.Width / 2) - (texture.Width / 2), rect.Y + (rect.Height / 2) - (texture.Height / 2)); + Vector2 centered = new Vector2(rect.Center.X - (texture.Width / 2), rect.Center.Y - (texture.Height / 2)); sb.Draw(texture, centered, color); }; AddInvasion(bossChecklist, calamity, "Acid Rain (Post-AS)", order, enemies, DownedAcidRainHardmode, summons, collection, instructions, () => true, portrait, iconTexture); @@ -733,7 +732,7 @@ namespace CalamityMod //TODO: Fix the portrait scaling/sizing var portrait = (SpriteBatch sb, Rectangle rect, Color color) => { Texture2D texture = ModContent.Request("CalamityMod/Events/AcidRainT3_BossChecklist").Value; - Vector2 centered = new Vector2(rect.X + (rect.Width / 2) - (texture.Width / 2), rect.Y + (rect.Height / 2) - (texture.Height / 2)); + Vector2 centered = new Vector2(rect.Center.X - (texture.Width / 2), rect.Center.Y - (texture.Height / 2)); sb.Draw(texture, centered, color); }; AddInvasion(bossChecklist, calamity, "Acid Rain (Post-Polter)", order, enemies, DownedBoomerDuke, summons, collection, instructions, () => true, portrait, iconTexture);