2017-03-25 20:40:17 +00:00
|
|
|
class DoomStatusBar : BaseStatusBar
|
|
|
|
{
|
2017-03-26 16:41:24 +00:00
|
|
|
HUDFont mHUDFont;
|
2017-03-26 20:04:58 +00:00
|
|
|
HUDFont mIndexFont;
|
2017-03-26 16:41:24 +00:00
|
|
|
//DrawInventoryBarParms diparms;
|
2017-03-25 20:40:17 +00:00
|
|
|
|
|
|
|
|
|
|
|
override void Init()
|
|
|
|
{
|
|
|
|
Super.Init();
|
|
|
|
SetSize(32, 320, 200);
|
2017-03-26 16:41:24 +00:00
|
|
|
|
|
|
|
// set up the inventory bar drawer.
|
|
|
|
/*
|
|
|
|
diparms.SetDefaults(HX_SHADOW);
|
|
|
|
diparms.SetTextures("SELECTBO", "ARTIBOX", "INVGEML1", "INVGEMR1");
|
|
|
|
diparms.SetLeftArrow("INVGEML1");
|
|
|
|
diparms.SetRightArrow("INVGEMR1");
|
|
|
|
*/
|
|
|
|
|
|
|
|
// Create the font used for the fullscreen HUD
|
|
|
|
Font fnt = "HUDFONT_DOOM";
|
|
|
|
mHUDFont = HUDFont.Create(fnt, fnt.GetCharWidth("0"), true, 1, 1);
|
2017-03-26 20:04:58 +00:00
|
|
|
fnt = "INDEXFONT_DOOM";
|
|
|
|
mIndexFont = HUDFont.Create(fnt, fnt.GetCharWidth("0"), true);
|
2017-03-25 20:40:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
override void NewGame ()
|
|
|
|
{
|
|
|
|
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 ();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
protected void DrawMainBar (double TicFrac)
|
|
|
|
{
|
2017-03-26 20:04:58 +00:00
|
|
|
DrawImage("STBAR", (0, 0), DI_ITEM_OFFSETS);
|
|
|
|
DrawImage("STTPRCNT", (90, 3), DI_ITEM_OFFSETS);
|
|
|
|
DrawImage("STTPRCNT", (221, 3), DI_ITEM_OFFSETS);
|
|
|
|
|
|
|
|
Inventory a1, a2;
|
|
|
|
int amt1;
|
|
|
|
[a1, a2, amt1] = GetCurrentAmmo();
|
|
|
|
DrawString(mHUDFont, FormatNumber(amt1, 3), (44, 3), DI_TEXT_ALIGN_RIGHT|DI_NOSHADOW);
|
|
|
|
DrawString(mHUDFont, FormatNumber(CPlayer.health, 3), (90, 3), DI_TEXT_ALIGN_RIGHT|DI_NOSHADOW);
|
|
|
|
DrawString(mHUDFont, FormatNumber(GetArmorAmount(), 3), (221, 3), DI_TEXT_ALIGN_RIGHT|DI_NOSHADOW);
|
|
|
|
|
|
|
|
bool locks[6];
|
|
|
|
String image;
|
|
|
|
for(int i = 0; i < 6; i++) locks[i] = CPlayer.mo.CheckKeys(i + 1, false, true);
|
|
|
|
// key 1
|
|
|
|
if (locks[1] && locks[4]) image = "STKEYS6";
|
|
|
|
else if (locks[1]) image = "STKEYS0";
|
|
|
|
else if (locks[4]) image = "STKEYS3";
|
|
|
|
DrawImage(image, (239, 3), DI_ITEM_OFFSETS);
|
|
|
|
// key 2
|
|
|
|
if (locks[2] && locks[5]) image = "STKEYS7";
|
|
|
|
else if (locks[2]) image = "STKEYS1";
|
|
|
|
else if (locks[5]) image = "STKEYS4";
|
|
|
|
else image = "";
|
|
|
|
DrawImage(image, (239, 13), DI_ITEM_OFFSETS);
|
|
|
|
// key 3
|
|
|
|
if (locks[0] && locks[3]) image = "STKEYS8";
|
|
|
|
else if (locks[0]) image = "STKEYS2";
|
|
|
|
else if (locks[3]) image = "STKEYS5";
|
|
|
|
else image = "";
|
|
|
|
DrawImage(image, (239, 23), DI_ITEM_OFFSETS);
|
|
|
|
|
|
|
|
int maxamt;
|
|
|
|
[amt1, maxamt] = GetAmount("Clip");
|
|
|
|
DrawString(mIndexFont, FormatNumber(amt1, 3), (288, 5), DI_TEXT_ALIGN_RIGHT);
|
|
|
|
DrawString(mIndexFont, FormatNumber(maxamt, 3), (314, 5), DI_TEXT_ALIGN_RIGHT);
|
|
|
|
|
|
|
|
[amt1, maxamt] = GetAmount("Shell");
|
|
|
|
DrawString(mIndexFont, FormatNumber(amt1, 3), (288, 11), DI_TEXT_ALIGN_RIGHT);
|
|
|
|
DrawString(mIndexFont, FormatNumber(maxamt, 3), (314, 11), DI_TEXT_ALIGN_RIGHT);
|
|
|
|
|
|
|
|
[amt1, maxamt] = GetAmount("RocketAmmo");
|
|
|
|
DrawString(mIndexFont, FormatNumber(amt1, 3), (288, 17), DI_TEXT_ALIGN_RIGHT);
|
|
|
|
DrawString(mIndexFont, FormatNumber(maxamt, 3), (314, 17), DI_TEXT_ALIGN_RIGHT);
|
2017-03-25 20:40:17 +00:00
|
|
|
|
2017-03-26 20:04:58 +00:00
|
|
|
[amt1, maxamt] = GetAmount("Cell");
|
|
|
|
DrawString(mIndexFont, FormatNumber(amt1, 3), (288, 23), DI_TEXT_ALIGN_RIGHT);
|
|
|
|
DrawString(mIndexFont, FormatNumber(maxamt, 3), (314, 23), DI_TEXT_ALIGN_RIGHT);
|
|
|
|
|
|
|
|
if (deathmatch || teamplay)
|
|
|
|
{
|
|
|
|
DrawString(mHUDFont, FormatNumber(CPlayer.FragCount, 3), (138, 3), DI_TEXT_ALIGN_RIGHT);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
DrawImage("STARMS", (104, 0), DI_ITEM_OFFSETS);
|
|
|
|
DrawImage(CPlayer.HasWeaponsInSlot(2)? "STYSNUM2" : "STGNUM2", (111, 3), DI_ITEM_OFFSETS);
|
|
|
|
DrawImage(CPlayer.HasWeaponsInSlot(3)? "STYSNUM3" : "STGNUM3", (123, 3), DI_ITEM_OFFSETS);
|
|
|
|
DrawImage(CPlayer.HasWeaponsInSlot(4)? "STYSNUM4" : "STGNUM4", (135, 3), DI_ITEM_OFFSETS);
|
|
|
|
DrawImage(CPlayer.HasWeaponsInSlot(5)? "STYSNUM5" : "STGNUM5", (111, 13), DI_ITEM_OFFSETS);
|
|
|
|
DrawImage(CPlayer.HasWeaponsInSlot(6)? "STYSNUM6" : "STGNUM6", (123, 13), DI_ITEM_OFFSETS);
|
|
|
|
DrawImage(CPlayer.HasWeaponsInSlot(7)? "STYSNUM7" : "STGNUM7", (135, 13), DI_ITEM_OFFSETS);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (multiplayer)
|
|
|
|
{
|
|
|
|
DrawImage("STFBANY", (143, 0), DI_ITEM_OFFSETS|DI_TRANSLATABLE);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (CPlayer.mo.InvSel != null)
|
|
|
|
{
|
|
|
|
//drawinventorybar Doom, 7, INDEXFONT, 50, 170;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
DrawTexture(GetMugShot(5), (143, 0), DI_ITEM_OFFSETS);
|
|
|
|
}
|
2017-03-25 20:40:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
protected void DrawFullScreenStuff ()
|
|
|
|
{
|
|
|
|
Vector2 iconbox = (40, 20);
|
|
|
|
// Draw health
|
|
|
|
let berserk = CPlayer.mo.FindInventory("PowerStrength");
|
2017-03-26 16:41:24 +00:00
|
|
|
DrawImage(berserk? "PSTRA0" : "MEDIA0", (20, -2));
|
|
|
|
DrawString(mHUDFont, FormatNumber(CPlayer.health, 3), (44, -20));
|
2017-03-25 20:40:17 +00:00
|
|
|
|
|
|
|
let armor = CPlayer.mo.FindInventory("BasicArmor");
|
|
|
|
if (armor != null)
|
|
|
|
{
|
2017-03-26 16:41:24 +00:00
|
|
|
DrawInventoryIcon(armor, (20, -22));
|
|
|
|
DrawString(mHUDFont, FormatNumber(armor.Amount, 3), (44, -40));
|
2017-03-25 20:40:17 +00:00
|
|
|
}
|
|
|
|
Inventory ammotype1, ammotype2;
|
2017-03-26 16:41:24 +00:00
|
|
|
[ammotype1, ammotype2] = GetCurrentAmmo();
|
2017-03-25 20:40:17 +00:00
|
|
|
int invY = -20;
|
|
|
|
if (ammotype1 != null)
|
|
|
|
{
|
2017-03-26 16:41:24 +00:00
|
|
|
DrawInventoryIcon(ammotype1, (-14, -4));
|
|
|
|
DrawString(mHUDFont, FormatNumber(ammotype1.Amount, 3), (-30, -20), DI_TEXT_ALIGN_RIGHT);
|
2017-03-25 20:40:17 +00:00
|
|
|
invY -= 20;
|
|
|
|
}
|
|
|
|
if (ammotype2 != null && ammotype2 != ammotype1)
|
|
|
|
{
|
2017-03-26 16:41:24 +00:00
|
|
|
DrawInventoryIcon(ammotype2, (-14, invY + 17));
|
|
|
|
DrawString(mHUDFont, FormatNumber(ammotype2.Amount, 3), (-30, invY), DI_TEXT_ALIGN_RIGHT);
|
2017-03-25 20:40:17 +00:00
|
|
|
invY -= 20;
|
|
|
|
}
|
|
|
|
if (CPlayer.inventorytics == 0 && CPlayer.mo.InvSel != null)
|
|
|
|
{
|
2017-03-26 16:41:24 +00:00
|
|
|
DrawInventoryIcon(CPlayer.mo.InvSel, (-14, invY + 17));
|
|
|
|
DrawString(mHUDFont, FormatNumber(CPlayer.mo.InvSel.Amount, 3), (-30, invY), DI_TEXT_ALIGN_RIGHT);
|
2017-03-25 20:40:17 +00:00
|
|
|
}
|
|
|
|
if (deathmatch)
|
|
|
|
{
|
2017-03-26 20:04:58 +00:00
|
|
|
DrawString(mHUDFont, FormatNumber(CPlayer.FragCount, 3), (-3, 1), DI_TEXT_ALIGN_RIGHT);
|
2017-03-25 22:43:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// 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())
|
|
|
|
{
|
2017-03-26 16:41:24 +00:00
|
|
|
DrawTexture(i.Icon, keypos, DI_SCREEN_RIGHT_TOP|DI_ITEM_LEFT_TOP);
|
2017-03-25 22:43:19 +00:00
|
|
|
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)
|
|
|
|
{
|
2017-03-26 16:41:24 +00:00
|
|
|
//DrawInventoryBar(diparms, (0, 0), 7, ALIGN_CENTER_BOTTOM, ALIGN_CENTER_BOTTOM);
|
2017-03-25 20:40:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|