mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-24 21:21:04 +00:00
- handle the Harmony status bar icon scaling a bit more robustly.
Considering that the physical texture size should be abstracted away from modding this needs to be done differently. Doing any calculations with physical texture sizes on the mod side is only going to cause errors so this had been changed to always return scaled size.
This commit is contained in:
parent
a4d61e6fb1
commit
d500dc99ea
1 changed files with 7 additions and 15 deletions
|
@ -1,6 +1,6 @@
|
|||
class HarmonyStatusBar : DoomStatusBar
|
||||
{
|
||||
int scalestate;
|
||||
double scaleFactor;
|
||||
|
||||
override void Init()
|
||||
{
|
||||
|
@ -10,22 +10,14 @@ class HarmonyStatusBar : DoomStatusBar
|
|||
let tex = TexMan.CheckForTexture("MEDIA0", TexMan.Type_Sprite);
|
||||
if (tex.isValid())
|
||||
{
|
||||
int size = TexMan.GetSize(tex);
|
||||
Vector2 ssize = TexMan.GetScaledSize(tex);
|
||||
if (ssize.X ~== size) scalestate = 1;
|
||||
else scalestate = 0;
|
||||
Vector2 facs = (ssize.X / 31, ssize.Y / 18);
|
||||
scaleFactor = min(facs.X, facs.Y, 1);
|
||||
}
|
||||
else scalestate = 1;
|
||||
}
|
||||
|
||||
override void Draw (int state, double TicFrac)
|
||||
{
|
||||
if (!scalestate)
|
||||
{
|
||||
Super.Draw(state, TicFrac);
|
||||
return;
|
||||
}
|
||||
|
||||
BaseStatusBar.Draw (state, TicFrac);
|
||||
|
||||
if (state == HUD_StatusBar)
|
||||
|
@ -44,13 +36,13 @@ class HarmonyStatusBar : DoomStatusBar
|
|||
{
|
||||
Vector2 iconbox = (40, 20);
|
||||
// Draw health
|
||||
DrawImage("MEDIA0", (20, -2), scale:(0.3, 0.3));
|
||||
DrawImage("MEDIA0", (20, -2), scale(scaleFactor, scaleFactor));
|
||||
DrawString(mHUDFont, FormatNumber(CPlayer.health, 3), (44, -20));
|
||||
|
||||
let armor = CPlayer.mo.FindInventory("BasicArmor");
|
||||
if (armor != null && armor.Amount > 0)
|
||||
{
|
||||
DrawInventoryIcon(armor, (20, -22), scale:(0.3, 0.3));
|
||||
DrawInventoryIcon(armor, (20, -22), scale(scaleFactor, scaleFactor));
|
||||
DrawString(mHUDFont, FormatNumber(armor.Amount, 3), (44, -40));
|
||||
}
|
||||
Inventory ammotype1, ammotype2;
|
||||
|
@ -58,13 +50,13 @@ class HarmonyStatusBar : DoomStatusBar
|
|||
int invY = -20;
|
||||
if (ammotype1 != null)
|
||||
{
|
||||
DrawInventoryIcon(ammotype1, (-14, -4), scale:(0.3, 0.3));
|
||||
DrawInventoryIcon(ammotype1, (-14, -4), scale(scaleFactor, scaleFactor));
|
||||
DrawString(mHUDFont, FormatNumber(ammotype1.Amount, 3), (-30, -20), DI_TEXT_ALIGN_RIGHT);
|
||||
invY -= 20;
|
||||
}
|
||||
if (ammotype2 != null && ammotype2 != ammotype1)
|
||||
{
|
||||
DrawInventoryIcon(ammotype2, (-14, invY + 17), scale:(0.3, 0.3));
|
||||
DrawInventoryIcon(ammotype2, (-14, invY + 17), scale(scaleFactor, scaleFactor));
|
||||
DrawString(mHUDFont, FormatNumber(ammotype2.Amount, 3), (-30, invY), DI_TEXT_ALIGN_RIGHT);
|
||||
invY -= 20;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue