From d73bd42bbd51bb54660d86ea11fd4b450cb9c93a Mon Sep 17 00:00:00 2001 From: Dominic Date: Fri, 18 Feb 2022 15:24:37 -0600 Subject: [PATCH] The mode indicator has only one icon now --- ExtraTextures/UI/ModeIndicator.png | Bin 0 -> 770 bytes ExtraTextures/UI/ModeIndicatorArma.png | Bin 253 -> 0 bytes ExtraTextures/UI/ModeIndicatorDeath.png | Bin 257 -> 0 bytes ExtraTextures/UI/ModeIndicatorMalice.png | Bin 261 -> 0 bytes ExtraTextures/UI/ModeIndicatorRev.png | Bin 248 -> 0 bytes UI/ModeIndicatorUI.cs | 99 ++++++++++------------- 6 files changed, 42 insertions(+), 57 deletions(-) create mode 100644 ExtraTextures/UI/ModeIndicator.png delete mode 100644 ExtraTextures/UI/ModeIndicatorArma.png delete mode 100644 ExtraTextures/UI/ModeIndicatorDeath.png delete mode 100644 ExtraTextures/UI/ModeIndicatorMalice.png delete mode 100644 ExtraTextures/UI/ModeIndicatorRev.png diff --git a/ExtraTextures/UI/ModeIndicator.png b/ExtraTextures/UI/ModeIndicator.png new file mode 100644 index 0000000000000000000000000000000000000000..82cfc906fb13c328817dca9722b99ed6a49d1fc3 GIT binary patch literal 770 zcmeAS@N?(olHy`uVBq!ia0vp^azH$TgBeI3VP6>vq!^2X+?^QKos)S9+XwiBxat|&`iIA-<`yX^=sLLhi;2oPs%TBnuu8FWy=-c_HgDtqA2(t= zLUxqK6c}nw_H}-;yy5@LLlsepa|;uIX4r8=+yYXfB|(0{|FHlD?VGi)fC@MZJR*x3 z82Ao@Fyrz36)6l1Oxm693#nhTJ~%OXnibWG}=1XRjxp zd|c%sGixcwhBb2h)4pZ;ZV(ARvFF)_zQiW;L zqS}j951P$VZMM$qc^3N5C*6vBTG0z1{jGYv8LZwDFP(ZNpf`P4=IwWmx6RHzJ@jnP ztO9)lt;>enbj4rnh_Sza+C=)*t}j3rygj;M%h8%Bbqz5;!Tx6!ADvVLBxJ2FN3Z3a zmc%vly3DsJNdgm%3Nk!2mmOHmI8kKE3uV=)?c4lW*1H94`JbF_HGj9?d>6jCFPA>M z@VZ~AtKspPH_=m5Opkuw_BF+Nve<*`)5RVxv`#7QslC6gcKzd^vzr#2UF~8VvM_q{ z4FA_hJOumy-Ka8(627+u=o7qN{yTea=b`^^>x&ON6x^Ai_U=qu1thvt6>z<&IRz)(I;m)aWFZn2y3449S}JYD@<);T3K F0RWYKWnKUP literal 0 HcmV?d00001 diff --git a/ExtraTextures/UI/ModeIndicatorArma.png b/ExtraTextures/UI/ModeIndicatorArma.png deleted file mode 100644 index 619f29b4a2beff55eda3871d668aa5e75be5386c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 253 zcmeAS@N?(olHy`uVBq!ia0vp^azL!W!3-pg=2`dxDaPU;cPEB*=VV?2IV|apzK#qG z8~eHcB(eheLIFM@uFFjyTuuF6X1M3k#yjr1eL!K8cZ)v)DYlXzzu^BMz_5A$lKnst z&H|6fVg?4jgCNYfV`BDOpkR`xi(`m||I-Q9dhGu(|1!YZnPVWNR#^CAd=d#Wzp$P!X##`S2 diff --git a/ExtraTextures/UI/ModeIndicatorDeath.png b/ExtraTextures/UI/ModeIndicatorDeath.png deleted file mode 100644 index cdf63aea5415e8d6d4a0655d91b5867e905f8b98..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 257 zcmeAS@N?(olHy`uVBq!ia0vp^azL!W!3-pg=2`dxDaPU;cPEB*=VV?2IV|apzK#qG z8~eHcB(ehe`~f~8u9rO8(%O`fV03O zvY3H^Z$Ah#TCfJI00px=T^vI!{GU!d$k(92<9vPN|Nm((CE8XfetmGV{NPtfje|+2 z)PkevV{!W)p=gFX>lF`+REVR>gTe~DWM4fh@)Mb diff --git a/ExtraTextures/UI/ModeIndicatorMalice.png b/ExtraTextures/UI/ModeIndicatorMalice.png deleted file mode 100644 index c19e5c029eea70909052ed4069715676fcd366ed..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 261 zcmeAS@N?(olHy`uVBq!ia0vp^azL!W!3-pg=2`dxDaPU;cPEB*=VV?2IV|apzK#qG z8~eHcB(eheLIFM@t~*L&3Jf(T`#L{a-thnBA)xSw*Wca)DYlXzzu^BMz_5A$lKnst z&H|6fVg?32Ae(PLqXlcQ3Q#c1)5S5w!vF0=N3H`3JS^qOfBsK@owdN}=rQMfS%XJ? z5*;g|>-MHx%9yZ9&}7pssRI#dg3C%@&giv0v}IZW`<+rvAYGy!I(_fxC`G1)b3s^_!?*{gQu&X%Q~loCID$YU!4E| diff --git a/ExtraTextures/UI/ModeIndicatorRev.png b/ExtraTextures/UI/ModeIndicatorRev.png deleted file mode 100644 index 6086ff88b74f8591b3b16b0b3c0042fa4b82e61d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 248 zcmeAS@N?(olHy`uVBq!ia0vp^azL!W!3-pg=2`dxDaPU;cPEB*=VV?2IV|apzK#qG z8~eHcB(eheJOMr-t`jt@E}NRJ&D#hRP~&Qp0;wwr@(cd||38C+*2*tHK4*bPWHAE+ z-vJP2%(~Xe2^38Aba4!^@P9hdo3FuugEjD7eY!ELOY-9Lt=j1q`7iIebmh;q`V8qO zX$!J8r!MbbG3%36!c^Bt;fS@q@9VBS7Yy-r-V##0AWO-)bjz~GmMq0jA_7f9a$+XB lMl#R8#C7k5wtUui-rjqhkvnaYRe=^Vc)I$ztaD0e0syO}QYrud diff --git a/UI/ModeIndicatorUI.cs b/UI/ModeIndicatorUI.cs index 5967268016..2d2f300f52 100644 --- a/UI/ModeIndicatorUI.cs +++ b/UI/ModeIndicatorUI.cs @@ -6,67 +6,52 @@ using Terraria.ModLoader; namespace CalamityMod.UI { - public class ModeIndicatorUI - { - public static readonly Vector2 OffsetToAreaCenter = new Vector2(0f, 4f); - public static Vector2 DifficultyIconOffset => new Vector2(0f, -13f); - public static Vector2 ArmageddonIconOffset => new Vector2(12f, 7f); - public static Vector2 MaliceIconOffset => new Vector2(-12f, 7f); - public static void Draw(SpriteBatch spriteBatch) - { - // The mode indicator should only be displayed when the inventory is open, to prevent obstruction. - if (!Main.playerInventory) - return; + public class ModeIndicatorUI + { + public static void Draw(SpriteBatch spriteBatch) + { + // The mode indicator should only be displayed when the inventory is open, to prevent obstruction. + if (!Main.playerInventory) + return; - Texture2D outerAreaTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/ModeIndicatorArea"); - Texture2D revengeanceIconTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/ModeIndicatorRev"); - Texture2D deathIconTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/ModeIndicatorDeath"); - Texture2D armageddonIconTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/ModeIndicatorArma"); - Texture2D maliceIconTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/ModeIndicatorMalice"); + Texture2D indicatorTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/ModeIndicator"); + int indicatorFrame = 0; + if (CalamityWorld.revenge) + indicatorFrame = 1; + if (CalamityWorld.death) + indicatorFrame = 2; + if (CalamityWorld.malice) + indicatorFrame = 3; - Rectangle mouseRectangle = Utils.CenteredRectangle(Main.MouseScreen, Vector2.One * 2f); + Rectangle mouseRectangle = Utils.CenteredRectangle(Main.MouseScreen, Vector2.One * 2f); + Rectangle indicatorFrameArea = indicatorTexture.Frame(1, 4, 0, indicatorFrame); + Vector2 drawCenter = new Vector2(Main.screenWidth - 400f, 72f) + indicatorFrameArea.Size() * 0.5f; - Vector2 drawCenter = new Vector2(Main.screenWidth - 400f, 72f) + outerAreaTexture.Size() * 0.5f; + spriteBatch.Draw(indicatorTexture, drawCenter, indicatorFrameArea, Color.White, 0f, indicatorFrameArea.Size() * 0.5f, 1f, SpriteEffects.None, 0f); - spriteBatch.Draw(outerAreaTexture, drawCenter, null, Color.White, 0f, outerAreaTexture.Size() * 0.5f, 1f, SpriteEffects.None, 0f); + // Draw active indication text. + bool renderingText = false; + if (mouseRectangle.Intersects(Utils.CenteredRectangle(drawCenter, indicatorFrameArea.Size()))) + { + string modeToDisplay = "Revengeance"; + bool modeIsActive = CalamityWorld.revenge; + if (CalamityWorld.death) + { + modeToDisplay = "Death"; + modeIsActive = CalamityWorld.death; + } + if (CalamityWorld.malice) + { + modeToDisplay = "Malice"; + modeIsActive = CalamityWorld.malice; + } - Texture2D difficultyIconToUse = CalamityWorld.death ? deathIconTexture : revengeanceIconTexture; - bool modeIsActive = CalamityWorld.revenge; - bool renderingText = false; - if (CalamityWorld.revenge) - spriteBatch.Draw(difficultyIconToUse, drawCenter + DifficultyIconOffset, null, Color.White, 0f, difficultyIconToUse.Size() * 0.5f, 1f, SpriteEffects.None, 0f); + Main.instance.MouseText($"{modeToDisplay} Mode is {(modeIsActive ? "active" : "not active")}."); + renderingText = true; + } - // Rev/Death active text. - if (mouseRectangle.Intersects(Utils.CenteredRectangle(drawCenter + DifficultyIconOffset, difficultyIconToUse.Size()))) - { - Main.instance.MouseText($"{(CalamityWorld.death ? "Death" : "Revengeance")} Mode is {(modeIsActive ? "active" : "not active")}."); - renderingText = true; - } - - if (CalamityWorld.armageddon) - { - spriteBatch.Draw(armageddonIconTexture, drawCenter + ArmageddonIconOffset, null, Color.White, 0f, armageddonIconTexture.Size() * 0.5f, 1f, SpriteEffects.None, 0f); - } - - // Armageddon active text. - if (!renderingText && mouseRectangle.Intersects(Utils.CenteredRectangle(drawCenter + ArmageddonIconOffset, armageddonIconTexture.Size()))) - { - Main.instance.MouseText($"Armageddon is {(CalamityWorld.armageddon ? "active" : "not active")}."); - renderingText = true; - } - - if (CalamityWorld.malice) - spriteBatch.Draw(maliceIconTexture, drawCenter + MaliceIconOffset, null, Color.White, 0f, maliceIconTexture.Size() * 0.5f, 1f, SpriteEffects.None, 0f); - - // Malice active text. - if (!renderingText && mouseRectangle.Intersects(Utils.CenteredRectangle(drawCenter + MaliceIconOffset, armageddonIconTexture.Size()))) - { - Main.instance.MouseText($"Malice Mode is {(CalamityWorld.malice ? "active" : "not active")}."); - renderingText = true; - } - - if (renderingText) - Main.instance.MouseTextHackZoom(string.Empty); - } - } + if (renderingText) + Main.instance.MouseTextHackZoom(string.Empty); + } + } }