mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-23 04:22:34 +00:00
- fixed: Harmony requires special scaling treatment for the fullscreen HUD's icons.
This commit is contained in:
parent
7bc5573baa
commit
42e62d9005
5 changed files with 120 additions and 3 deletions
|
@ -39,7 +39,7 @@ IWad
|
|||
Autoname = "harmony"
|
||||
Game = "Doom"
|
||||
Config = "Harmony"
|
||||
Mapinfo = "mapinfo/hacxharm.txt"
|
||||
Mapinfo = "mapinfo/harmony.txt"
|
||||
MustContain = "MAP01", "0HAWK01", "0CARA3", "0NOSE1"
|
||||
BannerColors = "6e b4 d6", "45 4f 7e"
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ IWad
|
|||
Game = "Doom"
|
||||
Config = "Hacx"
|
||||
Autoname = "hacx.hacx2"
|
||||
Mapinfo = "mapinfo/hacxharm.txt"
|
||||
Mapinfo = "mapinfo/hacx.txt"
|
||||
MustContain = "MAP01", "HACX-E"
|
||||
BannerColors = "ff ff ff", "00 88 22"
|
||||
}
|
||||
|
@ -61,7 +61,7 @@ IWad
|
|||
Game = "Doom"
|
||||
Config = "Hacx"
|
||||
Autoname = "hacx.hacx1"
|
||||
Mapinfo = "mapinfo/hacxharm.txt"
|
||||
Mapinfo = "mapinfo/hacx.txt"
|
||||
MustContain = "MAP01", "HACX-R"
|
||||
BannerColors = "00 00 a8", "a8 a8 a8"
|
||||
}
|
||||
|
|
8
wadsrc/static/mapinfo/harmony.txt
Normal file
8
wadsrc/static/mapinfo/harmony.txt
Normal file
|
@ -0,0 +1,8 @@
|
|||
include "mapinfo/doom2.txt"
|
||||
|
||||
gameinfo
|
||||
{
|
||||
cursorpic = "cursor"
|
||||
statusbarclass = "HarmonyStatusBar"
|
||||
}
|
||||
|
|
@ -37,6 +37,7 @@ version "2.5"
|
|||
#include "zscript/statusbar/heretic_sbar.txt"
|
||||
#include "zscript/statusbar/hexen_sbar.txt"
|
||||
#include "zscript/statusbar/strife_sbar.txt"
|
||||
#include "zscript/statusbar/harm_sbar.txt"
|
||||
#include "zscript/statusbar/sbarinfowrapper.txt"
|
||||
|
||||
#include "zscript/inventory/inventory.txt"
|
||||
|
|
108
wadsrc/static/zscript/statusbar/harm_sbar.txt
Normal file
108
wadsrc/static/zscript/statusbar/harm_sbar.txt
Normal file
|
@ -0,0 +1,108 @@
|
|||
class HarmonyStatusBar : DoomStatusBar
|
||||
{
|
||||
int scalestate;
|
||||
|
||||
override void Init()
|
||||
{
|
||||
Super.Init();
|
||||
|
||||
// This is for detecting the DECORATEd version of the mod which sets proper scaling for the HUD related textures.
|
||||
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;
|
||||
}
|
||||
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)
|
||||
{
|
||||
BeginStatusBar();
|
||||
DrawMainBar (TicFrac);
|
||||
}
|
||||
else if (state == HUD_Fullscreen)
|
||||
{
|
||||
BeginHUD();
|
||||
DrawFullScreenStuff ();
|
||||
}
|
||||
}
|
||||
|
||||
protected void DrawFullScreenStuff ()
|
||||
{
|
||||
Vector2 iconbox = (40, 20);
|
||||
// Draw health
|
||||
DrawImage("MEDIA0", (20, -2), scale:(0.3, 0.3));
|
||||
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));
|
||||
DrawString(mHUDFont, FormatNumber(armor.Amount, 3), (44, -40));
|
||||
}
|
||||
Inventory ammotype1, ammotype2;
|
||||
[ammotype1, ammotype2] = GetCurrentAmmo();
|
||||
int invY = -20;
|
||||
if (ammotype1 != null)
|
||||
{
|
||||
DrawInventoryIcon(ammotype1, (-14, -4), scale:(0.3, 0.3));
|
||||
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));
|
||||
DrawString(mHUDFont, FormatNumber(ammotype2.Amount, 3), (-30, invY), DI_TEXT_ALIGN_RIGHT);
|
||||
invY -= 20;
|
||||
}
|
||||
if (!isInventoryBarVisible() && !level.NoInventoryBar && CPlayer.mo.InvSel != null)
|
||||
{
|
||||
DrawInventoryIcon(CPlayer.mo.InvSel, (-14, invY + 17));
|
||||
DrawString(mHUDFont, FormatNumber(CPlayer.mo.InvSel.Amount, 3), (-30, invY), DI_TEXT_ALIGN_RIGHT);
|
||||
}
|
||||
if (deathmatch)
|
||||
{
|
||||
DrawString(mHUDFont, FormatNumber(CPlayer.FragCount, 3), (-3, 1), DI_TEXT_ALIGN_RIGHT, Font.CR_GOLD);
|
||||
}
|
||||
|
||||
// Draw the keys. This does not use a special draw function like SBARINFO because the specifics will be different for each mod
|
||||
// so it's easier to copy or reimplement the following piece of code instead of trying to write a complicated all-encompassing solution.
|
||||
Vector2 keypos = (-10, 2);
|
||||
int rowc = 0;
|
||||
double roww = 0;
|
||||
for(let i = CPlayer.mo.Inv; i != null; i = i.Inv)
|
||||
{
|
||||
if (i is "Key" && i.Icon.IsValid())
|
||||
{
|
||||
DrawTexture(i.Icon, keypos, DI_SCREEN_RIGHT_TOP|DI_ITEM_LEFT_TOP);
|
||||
Vector2 size = TexMan.GetScaledSize(i.Icon);
|
||||
keypos.Y += size.Y + 2;
|
||||
roww = max(roww, size.X);
|
||||
if (++rowc == 3)
|
||||
{
|
||||
keypos.Y = 2;
|
||||
keypos.X -= roww + 2;
|
||||
roww = 0;
|
||||
rowc = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isInventoryBarVisible())
|
||||
{
|
||||
DrawInventoryBar(diparms, (0, 0), 7, DI_SCREEN_CENTER_BOTTOM, HX_SHADOW);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue