From bac464f2b7766b9a6b3aa6e7b125cb319b49f85f Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 27 Mar 2017 21:29:31 +0200 Subject: [PATCH] - added the inventory bar on Heretic's status bar. --- .../static/zscript/statusbar/heretic_sbar.txt | 5 ++- wadsrc/static/zscript/statusbar/statusbar.txt | 37 ++++++++++++++----- 2 files changed, 31 insertions(+), 11 deletions(-) diff --git a/wadsrc/static/zscript/statusbar/heretic_sbar.txt b/wadsrc/static/zscript/statusbar/heretic_sbar.txt index 4c97a16be..d5191b99a 100644 --- a/wadsrc/static/zscript/statusbar/heretic_sbar.txt +++ b/wadsrc/static/zscript/statusbar/heretic_sbar.txt @@ -5,6 +5,7 @@ class HereticStatusBar : BaseStatusBar HUDFont mIndexFont; HUDFont mBigFont; InventoryBarState diparms; + InventoryBarState diparms_sbar; override void Init() @@ -20,6 +21,7 @@ class HereticStatusBar : BaseStatusBar fnt = "BIGFONT"; mBigFont = HUDFont.Create(fnt, fnt.GetCharWidth("0"), true, 2, 2); diparms = InventoryBarState.Create(mIndexFont); + diparms_sbar = InventoryBarState.CreateNoBox(mIndexFont, boxsize:(31, 31), arrowoffs:(0,-10)); mHealthInterpolator = DynamicValueInterpolator.Create(0, 0.25, 1, 8); } @@ -120,12 +122,11 @@ class HereticStatusBar : BaseStatusBar DrawString(mIndexFont, FormatNumber(CPlayer.mo.InvSel.Amount, 3), (209, 182), DI_TEXT_ALIGN_RIGHT); } } - } else { DrawImage("INVBAR", (34, 160), DI_ITEM_OFFSETS); - //drawinventorybar Heretic, noartibox, 7, INDEXFONT_RAVEN, 50, 160, 77, 182, untranslated; + DrawInventoryBar(diparms_sbar, (49, 160), 7, DI_ITEM_LEFT_TOP, HX_SHADOW); } } diff --git a/wadsrc/static/zscript/statusbar/statusbar.txt b/wadsrc/static/zscript/statusbar/statusbar.txt index 3d6c4fe86..7219d7d55 100644 --- a/wadsrc/static/zscript/statusbar/statusbar.txt +++ b/wadsrc/static/zscript/statusbar/statusbar.txt @@ -39,17 +39,9 @@ class InventoryBarState ui int cr; int flags; - // The default settings here are what SBARINFO is using. - static InventoryBarState Create(HUDFont indexfont = null, int cr = Font.CR_UNTRANSLATED, double itemalpha = 1., - String boxgfx = "ARTIBOX", String selgfx = "SELECTBO", Vector2 innersize = (0, 0), - String leftgfx = "INVGEML1", String rightgfx = "INVGEMR1", Vector2 arrowoffs = (0, 0), int flags = 0) + private static void Init(InventoryBarState me, HUDFont indexfont, int cr, double itemalpha, Vector2 innersize, String leftgfx, String rightgfx, Vector2 arrowoffs, int flags) { - let me = new ("InventoryBarState"); me.itemalpha = itemalpha; - me.box = TexMan.CheckForTexture(boxgfx, TexMan.TYPE_MiscPatch); - me.selector = TexMan.CheckForTexture(selgfx, TexMan.TYPE_MiscPatch); - if (me.box.IsValid() || me.selector.IsValid()) me.boxsize = TexMan.GetScaledSize(me.box.IsValid()? me.box : me.selector); - else me.boxsize = (32., 32.); if (innersize == (0, 0)) { me.boxofs = (2, 2); @@ -72,8 +64,35 @@ class InventoryBarState ui else me.amountfont = indexfont; me.cr = cr; me.flags = flags; + } + + // The default settings here are what SBARINFO is using. + static InventoryBarState Create(HUDFont indexfont = null, int cr = Font.CR_UNTRANSLATED, double itemalpha = 1., + String boxgfx = "ARTIBOX", String selgfx = "SELECTBO", Vector2 innersize = (0, 0), + String leftgfx = "INVGEML1", String rightgfx = "INVGEMR1", Vector2 arrowoffs = (0, 0), int flags = 0) + { + let me = new ("InventoryBarState"); + me.box = TexMan.CheckForTexture(boxgfx, TexMan.TYPE_MiscPatch); + me.selector = TexMan.CheckForTexture(selgfx, TexMan.TYPE_MiscPatch); + if (me.box.IsValid() || me.selector.IsValid()) me.boxsize = TexMan.GetScaledSize(me.box.IsValid()? me.box : me.selector); + else me.boxsize = (32., 32.); + Init(me, indexfont, cr, itemalpha, innersize, leftgfx, rightgfx, arrowoffs, flags); return me; } + + // The default settings here are what SBARINFO is using. + static InventoryBarState CreateNoBox(HUDFont indexfont = null, int cr = Font.CR_UNTRANSLATED, double itemalpha = 1., + Vector2 boxsize = (32, 32), String selgfx = "SELECTBO", Vector2 innersize = (0, 0), + String leftgfx = "INVGEML1", String rightgfx = "INVGEMR1", Vector2 arrowoffs = (0, 0), int flags = 0) + { + let me = new ("InventoryBarState"); + me.box.SetInvalid(); + me.selector = TexMan.CheckForTexture(selgfx, TexMan.TYPE_MiscPatch); + me.boxsize = boxsize; + Init(me, indexfont, cr, itemalpha, innersize, leftgfx, rightgfx, arrowoffs, flags); + return me; + } + }