Okay I gave it a shot.
Here's the code to the SBARINFO for comparison's sake:
Code: Select all
height 0;
CompleteBorder True;
Resolution 1024,768;
InterpolateHealth false, 20;
InterpolateArmor false, 20;
//================================================================================================
//================================================================================================
// This version HAS the weapon bar and ammo counter
//================================================================================================
//================================================================================================
statusbar Normal, forcescaled
{
// Powerups
// Go first because otherwise they obscure HUD elements
inInventory PowerD4QuadDamage { drawimage "Shade2Ma", -171, 0; }
inInventory PowerD4Regen { drawimage "Shade2Cy", -171, 0; }
inInventory PowerD4Haste { drawimage "Shade2Ye", -171, 0; }
inInventory PowerD4Money { drawimage "Shade2Gr", -171, 0; }
// UAC Doomguy collectible uses
InInventory DollUses,1
{ drawimage "Ddoll", 1060,727; }
InInventory DollUses,2
{ drawimage "Ddoll", 1030,727; }
InInventory DollUses,3
{ drawimage "Ddoll", 1000,727; }
InInventory DollUses,4
{ drawimage "Ddoll", 970,727; }
InInventory DollUses,5
{ drawimage "Ddoll", 940,727; }
InInventory DollUses,6
{ drawimage "Ddoll", 910,727; }
InInventory DollUses,7
{ drawimage "Ddoll", 880,727; }
InInventory DollUses,8
{ drawimage "Ddoll", 850,727; }
InInventory DollUses,9
{ drawimage "Ddoll", 820,727; }
// The Usual
drawimage "BODYBAR0", -69,669;
// ...
}
And here's my current translation to zscript.
Code: Select all
Class Doom4StatusBar : BaseStatusBar
{
DynamicValueInterpolator mHealthInterpolator;
DynamicValueInterpolator mHealthInterpolator2;
HUDFont mHUDFont;
HUDFont mIndexFont;
HUDFont mBigFont;
InventoryBarState diparms;
InventoryBarState diparms_sbar;
override void Init()
{
Super.Init();
SetSize(0, 1024, 768);
CompleteBorder = true;
// Create the font used for the fullscreen HUD
Font fnt = "HUDFONT_DOOM";
mHUDFont = HUDFont.Create(fnt, fnt.GetCharWidth("0") + 1, true, 1, 1);
fnt = "INDEXFONT_DOOM";
mIndexFont = HUDFont.Create(fnt, fnt.GetCharWidth("0"), true);
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);
mHealthInterpolator2 = DynamicValueInterpolator.Create(0, 0.25, 1, 6); // the chain uses a maximum of 6, not 8.
}
override void NewGame ()
{
Super.NewGame();
mHealthInterpolator.Reset (0);
mHealthInterpolator2.Reset (0);
}
override void Tick()
{
Super.Tick();
mHealthInterpolator.Update(CPlayer.health);
}
override void Draw (int state, double TicFrac)
{
Super.Draw (state, TicFrac);
if (state == HUD_StatusBar)
{
BeginStatusBar(true);
DrawMainBar (TicFrac);
}
else if (state == HUD_Fullscreen)
{
BeginHUD(1.0, true);
DrawFullScreenStuff();
}
}
protected void DrawMainBar (double TicFrac)
{
}
protected void DrawFullScreenStuff ()
{
int imageAlignment = 0;
if (GetAmountOnly("PowerD4QuadDamage")) DrawImage("Shade2Ma", (-171, 0), imageAlignment);
if (GetAmountOnly("PowerD4Regen")) DrawImage("Shade2Cy", (-171, 0), imageAlignment);
if (GetAmountOnly("PowerD4Haste")) DrawImage("Shade2Ye", (-171, 0), imageAlignment);
if (GetAmountOnly("PowerD4Money")) DrawImage("Shade2Gr", (-171, 0), imageAlignment);
/* For comparison's sake.
inInventory PowerD4QuadDamage { drawimage "Shade2Ma", -171, 0; }
inInventory PowerD4Regen { drawimage "Shade2Cy", -171, 0; }
inInventory PowerD4Haste { drawimage "Shade2Ye", -171, 0; }
inInventory PowerD4Money { drawimage "Shade2Gr", -171, 0; }
*/
int DoomDollMax, DoomDollCount;
[DoomDollCount, DoomDollMax] = GetAmount("DollUses");
DoomDollCount = Min(DoomDollCount, DoomDollMax);
if (DoomDollCount > 0)
{
for (int i = 0; i < DoomDollCount; i++)
{
int DollX = 1060 - (30 * i);
DrawImage("Ddoll", (DollX, 727), imageAlignment);
}
}
DrawImage ("BODYBAR0", (-69, 669), imageAlignment);
/* UAC Doomguy collectible uses
InInventory DollUses,1
{ drawimage "Ddoll", 1060,727; }
InInventory DollUses,2
{ drawimage "Ddoll", 1030,727; }
InInventory DollUses,3
{ drawimage "Ddoll", 1000,727; }
InInventory DollUses,4
{ drawimage "Ddoll", 970,727; }
InInventory DollUses,5
{ drawimage "Ddoll", 940,727; }
InInventory DollUses,6
{ drawimage "Ddoll", 910,727; }
InInventory DollUses,7
{ drawimage "Ddoll", 880,727; }
InInventory DollUses,8
{ drawimage "Ddoll", 850,727; }
InInventory DollUses,9
{ drawimage "Ddoll", 820,727; }
*/
}
}
extend class Doom4StatusBar
{
int GetAmountOnly(class<Inventory> item)
{
let it = CPlayer.mo.FindInventory(item);
return (it ? it.Amount : 0);
}
}
Am I forgetting to do something that's causing this alignment to go out of whack? Or do we basically need to reposition it to the new system?