The mode indicator has only one icon now

This commit is contained in:
Dominic authored and Cameron Ewell committed 2022-02-18 19:18:08 -05:00
1 parent 7fa5850def
commit d73bd42bbd
6 files changed
+42 -57

No files matched your search

Binary file not shown.

After

Width:  |  Height:  |  Size: 770 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 253 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 257 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 261 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 248 B

+42 -57
View File
@@ -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);
}
}
}