2017-03-25 20:40:17 +00:00
|
|
|
class DoomStatusBar : BaseStatusBar
|
|
|
|
{
|
|
|
|
// it is not really needed to precache all textures but should be good practice to reduce execution time.
|
|
|
|
enum eImg
|
|
|
|
{
|
|
|
|
imgMEDIA0,
|
|
|
|
imgPSTRA0,
|
|
|
|
imgSTBAR,
|
|
|
|
imgSTTPRCNT,
|
|
|
|
imgSTKEYS0,
|
|
|
|
imgSTKEYS1,
|
|
|
|
imgSTKEYS2,
|
|
|
|
imgSTKEYS3,
|
|
|
|
imgSTKEYS4,
|
|
|
|
imgSTKEYS5,
|
|
|
|
imgSTKEYS6,
|
|
|
|
imgSTKEYS7,
|
|
|
|
imgSTKEYS8,
|
|
|
|
imgSTARMS,
|
|
|
|
imgSTGNUM2,
|
|
|
|
imgSTGNUM3,
|
|
|
|
imgSTGNUM4,
|
|
|
|
imgSTGNUM5,
|
|
|
|
imgSTGNUM6,
|
|
|
|
imgSTGNUM7,
|
|
|
|
imgSTYSNUM2,
|
|
|
|
imgSTYSNUM3,
|
|
|
|
imgSTYSNUM4,
|
|
|
|
imgSTYSNUM5,
|
|
|
|
imgSTYSNUM6,
|
|
|
|
imgSTYSNUM7,
|
|
|
|
imgSTFBANY,
|
|
|
|
|
|
|
|
NUMIMG
|
|
|
|
}
|
|
|
|
|
|
|
|
TextureID Images[NUMIMG];
|
|
|
|
int HUDFontSpacing;
|
|
|
|
|
|
|
|
|
|
|
|
override void Init()
|
|
|
|
{
|
|
|
|
Super.Init();
|
|
|
|
SetSize(32, 320, 200);
|
|
|
|
DoCommonInit();
|
|
|
|
}
|
|
|
|
|
|
|
|
override void NewGame ()
|
|
|
|
{
|
|
|
|
DoCommonInit ();
|
|
|
|
if (CPlayer != NULL)
|
|
|
|
{
|
|
|
|
AttachToPlayer (CPlayer);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
override void Draw (int state, double TicFrac)
|
|
|
|
{
|
|
|
|
Super.Draw (state, TicFrac);
|
|
|
|
|
|
|
|
if (state == HUD_StatusBar)
|
|
|
|
{
|
|
|
|
BeginStatusBar(320, 200, 32);
|
|
|
|
DrawMainBar (TicFrac);
|
|
|
|
}
|
|
|
|
else if (state == HUD_Fullscreen)
|
|
|
|
{
|
|
|
|
BeginHUD(320, 200, 1., false);
|
|
|
|
DrawFullScreenStuff ();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void DoCommonInit ()
|
|
|
|
{
|
|
|
|
static const String LumpNames[] =
|
|
|
|
{
|
|
|
|
"MEDIA0", "PSTRA0", "STBAR", "STTPRCNT", "STKEYS0",
|
|
|
|
"STKEYS1", "STKEYS2", "STKEYS3", "STKEYS4", "STKEYS5", "STKEYS6", "STKEYS7", "STKEYS8",
|
|
|
|
"STARMS",
|
|
|
|
"STGNUM2", "STGNUM3", "STGNUM4", "STGNUM5", "STGNUM6", "STGNUM7",
|
|
|
|
"STYSNUM2", "STYSNUM3", "STYSNUM4", "STYSNUM5", "STYSNUM6", "STYSNUM7",
|
|
|
|
"STFBANY"
|
|
|
|
};
|
|
|
|
|
|
|
|
for(int i = 0; i < NUMIMG; i++)
|
|
|
|
{
|
|
|
|
Images[i] = TexMan.CheckForTexture(LumpNames[i], TexMan.TYPE_MiscPatch);
|
|
|
|
}
|
|
|
|
|
|
|
|
Font fnt = "HUDFONT_DOOM";
|
|
|
|
if (fnt != null) HudFontSpacing = fnt.GetCharWidth("0");
|
|
|
|
}
|
|
|
|
|
|
|
|
protected void DrawMainBar (double TicFrac)
|
|
|
|
{
|
|
|
|
//DrawTexture(Images[imgINVBACK], (0, 0), true, 1.0, itemAlign:ALIGN_OFFSETS);
|
|
|
|
//DrawTexture(Images[imgINVTOP], (0, -8), true, 1.0, itemAlign:ALIGN_OFFSETS);
|
|
|
|
|
|
|
|
// Health
|
|
|
|
//DrawString("Indexfont_Strife_Green", FormatNumber(CPlayer.health, 3, 5, 0), (86, -6), 1.0, Font.CR_UNTRANSLATED, TEXT_RIGHT, 0, 7, true, 1, 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
protected void DrawFullScreenStuff ()
|
|
|
|
{
|
|
|
|
Vector2 iconbox = (40, 20);
|
|
|
|
// Draw health
|
|
|
|
let berserk = CPlayer.mo.FindInventory("PowerStrength");
|
2017-03-25 22:43:19 +00:00
|
|
|
DrawTexture(Images[berserk? imgPSTRA0 : imgMEDIA0], (20, -2), true, 1.0, ALIGN_BOTTOM|ALIGN_LEFT, iconbox, ALIGN_BOTTOM|ALIGN_HCENTER);
|
|
|
|
DrawString("HUDFONT_DOOM", FormatNumber(CPlayer.health, 3, 0, 0), (44, -20), 1., Font.CR_UNTRANSLATED, TEXT_LEFT, ALIGN_LEFT|ALIGN_BOTTOM, HUdFontSpacing, true, 1, 1);
|
2017-03-25 20:40:17 +00:00
|
|
|
|
|
|
|
let armor = CPlayer.mo.FindInventory("BasicArmor");
|
|
|
|
if (armor != null)
|
|
|
|
{
|
2017-03-25 22:43:19 +00:00
|
|
|
DrawInventoryIcon(armor, (20, -22), true, 1.0, ALIGN_BOTTOM|ALIGN_LEFT, iconbox, ALIGN_BOTTOM|ALIGN_HCENTER);
|
|
|
|
DrawString("HUDFONT_DOOM", FormatNumber(armor.Amount, 3, 0, 0), (44, -40), 1., Font.CR_UNTRANSLATED, TEXT_LEFT, ALIGN_LEFT|ALIGN_BOTTOM, HUdFontSpacing, true, 1, 1);
|
2017-03-25 20:40:17 +00:00
|
|
|
}
|
|
|
|
Inventory ammotype1, ammotype2;
|
|
|
|
int ammoamount1, ammoamount2;
|
|
|
|
[ammotype1, ammotype2, ammoamount1, ammoamount2] = GetCurrentAmmo();
|
|
|
|
int invY = -20;
|
|
|
|
if (ammotype1 != null)
|
|
|
|
{
|
2017-03-25 22:43:19 +00:00
|
|
|
DrawInventoryIcon(ammotype1, (-14, -4), true, 1.0, ALIGN_BOTTOM|ALIGN_RIGHT, iconbox, ALIGN_BOTTOM|ALIGN_HCENTER);
|
|
|
|
DrawString("HUDFONT_DOOM", FormatNumber(ammoamount1, 3, 0, 0), (-25, -20), 1., Font.CR_UNTRANSLATED, TEXT_RIGHT, ALIGN_RIGHT|ALIGN_BOTTOM, HUdFontSpacing, true, 1, 1);
|
2017-03-25 20:40:17 +00:00
|
|
|
invY -= 20;
|
|
|
|
}
|
|
|
|
if (ammotype2 != null && ammotype2 != ammotype1)
|
|
|
|
{
|
2017-03-25 22:43:19 +00:00
|
|
|
DrawInventoryIcon(ammotype2, (-14, invY + 17), true, 1.0, ALIGN_BOTTOM|ALIGN_RIGHT, iconbox, ALIGN_BOTTOM|ALIGN_HCENTER);
|
|
|
|
DrawString("HUDFONT_DOOM", FormatNumber(ammoamount2, 3, 0, 0), (-25, invY), 1., Font.CR_UNTRANSLATED, TEXT_RIGHT, ALIGN_RIGHT|ALIGN_BOTTOM, HUdFontSpacing, true, 1, 1);
|
2017-03-25 20:40:17 +00:00
|
|
|
invY -= 20;
|
|
|
|
}
|
|
|
|
if (CPlayer.inventorytics == 0 && CPlayer.mo.InvSel != null)
|
|
|
|
{
|
2017-03-25 22:43:19 +00:00
|
|
|
DrawInventoryIcon(CPlayer.mo.InvSel, (-14, invY + 17), true, 1.0, ALIGN_BOTTOM|ALIGN_RIGHT, iconbox, ALIGN_BOTTOM|ALIGN_HCENTER);
|
|
|
|
DrawString("HUDFONT_DOOM", FormatNumber(CPlayer.mo.InvSel.Amount, 3, 0, 0), (-25, invY), 1., Font.CR_UNTRANSLATED, TEXT_RIGHT, ALIGN_RIGHT|ALIGN_BOTTOM, HUdFontSpacing, true, 1, 1);
|
2017-03-25 20:40:17 +00:00
|
|
|
}
|
|
|
|
if (deathmatch)
|
|
|
|
{
|
2017-03-25 22:43:19 +00:00
|
|
|
DrawString("HUDFONT_DOOM", FormatNumber(CPlayer.fragSum(), 3, 0, 0), (-3, -1), 1., Font.CR_UNTRANSLATED, TEXT_RIGHT, ALIGN_RIGHT|ALIGN_TOP, HUdFontSpacing, true, 1, 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
// 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, true, 1., ALIGN_TOP|ALIGN_RIGHT, (-1,-1), ALIGN_TOP|ALIGN_LEFT);
|
|
|
|
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 (CPlayer.inventorytics != 0)
|
|
|
|
{
|
|
|
|
//DrawInventoryBar("A
|
|
|
|
//drawinventorybar Doom, translucent, 7, INDEXFONT, -106+center, -31;
|
2017-03-25 20:40:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
statusbar normal // Standard Doom Status bar
|
|
|
|
{
|
|
|
|
drawimage "STBAR", 0, 168;
|
|
|
|
drawimage "STTPRCNT", 90, 171;
|
|
|
|
drawimage "STTPRCNT", 221, 171;
|
|
|
|
drawnumber 3, HUDFONT_DOOM, untranslated, ammo1, 44, 171;
|
|
|
|
drawnumber 3, HUDFONT_DOOM, untranslated, health, 90, 171;
|
|
|
|
drawnumber 3, HUDFONT_DOOM, untranslated, armor, 221, 171;
|
|
|
|
|
|
|
|
//keys
|
|
|
|
drawswitchableimage keyslot 2 && 5, "nullimage", "STKEYS0", "STKEYS3", "STKEYS6", 239, 171;
|
|
|
|
drawswitchableimage keyslot 3 && 6, "nullimage", "STKEYS1", "STKEYS4", "STKEYS7", 239, 181;
|
|
|
|
drawswitchableimage keyslot 1 && 4, "nullimage", "STKEYS2", "STKEYS5", "STKEYS8", 239, 191;
|
|
|
|
|
|
|
|
drawnumber 3, INDEXFONT_DOOM, untranslated, ammo(Clip), 288, 173;
|
|
|
|
drawnumber 3, INDEXFONT_DOOM, untranslated, ammo(Shell), 288, 179;
|
|
|
|
drawnumber 3, INDEXFONT_DOOM, untranslated, ammo(RocketAmmo), 288, 185;
|
|
|
|
drawnumber 3, INDEXFONT_DOOM, untranslated, ammo(Cell), 288, 191;
|
|
|
|
|
|
|
|
drawnumber 3, INDEXFONT_DOOM, untranslated, ammocapacity(Clip), 314, 173;
|
|
|
|
drawnumber 3, INDEXFONT_DOOM, untranslated, ammocapacity(Shell), 314, 179;
|
|
|
|
drawnumber 3, INDEXFONT_DOOM, untranslated, ammocapacity(RocketAmmo), 314, 185;
|
|
|
|
drawnumber 3, INDEXFONT_DOOM, untranslated, ammocapacity(Cell), 314, 191;
|
|
|
|
gamemode deathmatch, teamgame
|
|
|
|
{
|
|
|
|
drawnumber 2, HUDFONT_DOOM, untranslated, frags, 138, 171;
|
|
|
|
}
|
|
|
|
gamemode cooperative, singleplayer
|
|
|
|
{
|
|
|
|
drawimage "STARMS", 104, 168;
|
|
|
|
drawswitchableimage weaponslot 2, "STGNUM2", "STYSNUM2", 111, 172;
|
|
|
|
drawswitchableimage weaponslot 3, "STGNUM3", "STYSNUM3", 123, 172;
|
|
|
|
drawswitchableimage weaponslot 4, "STGNUM4", "STYSNUM4", 135, 172;
|
|
|
|
drawswitchableimage weaponslot 5, "STGNUM5", "STYSNUM5", 111, 182;
|
|
|
|
drawswitchableimage weaponslot 6, "STGNUM6", "STYSNUM6", 123, 182;
|
|
|
|
drawswitchableimage weaponslot 7, "STGNUM7", "STYSNUM7", 135, 182;
|
|
|
|
}
|
|
|
|
gamemode cooperative, deathmatch, teamgame
|
|
|
|
{
|
|
|
|
drawimage translatable "STFBANY", 143, 169;
|
|
|
|
}
|
|
|
|
drawselectedinventory alternateonempty, INDEXFONT, 143, 168
|
|
|
|
{
|
|
|
|
drawmugshot "STF", 5, 143, 168;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
statusbar inventory // Standard bar overlay (ZDoom Addition)
|
|
|
|
{
|
|
|
|
drawinventorybar Doom, 7, INDEXFONT, 50, 170;
|
|
|
|
}
|
|
|
|
|
|
|
|
statusbar inventoryfullscreen, fullscreenoffsets // ZDoom HUD overlay.
|
|
|
|
{
|
|
|
|
}
|
|
|
|
*/
|