Code: Select all
version "4.3"
Class StatusBarMod : BaseStatusBar
{
DynamicValueInterpolator mHealthInterpolator;
HUDFont mAmmoFont;
HUDFont mAmmoFontS;
Override void Init()
{
Super.Init();
SetSize(0, 320, 200);
mAmmoFont = HUDFont.Create("AMMOFONT");
mAmmoFontS = HUDFont.Create("AMMOFONT_SMALL");
mHealthInterpolator = DynamicValueInterpolator.Create(0, 0.25, 1, 8);
}
Override void Tick()
{
Super.Tick();
mHealthInterpolator.Update(CPlayer.health); //Health bar interpolation
}
Override void Draw (int state, double TicFrac)
{
Super.Draw (state, TicFrac);
BeginStatusBar(true); //Force scale
DrawMainBar(); //Start drawing
}
void DrawMainBar()
{ //Ammo
Inventory ammotype1, ammotype2;
[ammotype1, ammotype2] = GetCurrentAmmo();
If(ammotype1!=null){DrawString(mAmmoFont, FormatNumber(ammotype1.Amount, 1, 3), (345, 160), DI_TEXT_ALIGN_RIGHT|DI_NOSHADOW,Font.CR_WHITE);}
If(ammotype2!=null){DrawString(mAmmoFontS, FormatNumber(ammotype2.Amount, 3, 3), (340, 180), DI_TEXT_ALIGN_RIGHT|DI_NOSHADOW,Font.CR_WHITE);}
//Armor
DrawImage("Vesticon", (-10,165), DI_ITEM_OFFSETS);
DrawString(mAmmoFont, FormatNumber(GetArmorAmount(), 1, 3), (10, 165), DI_TEXT_ALIGN_LEFT|DI_NOSHADOW,Font.CR_WHITE);
//Health
DrawImage("Plus", (-10,140), DI_ITEM_OFFSETS);
DrawString(mAmmoFont, FormatNumber(CPlayer.health, 1, 3), (11, 140), DI_TEXT_ALIGN_LEFT|DI_NOSHADOW,Font.CR_WHITE);
//Pills
DrawImage("PEALS", (34,123), DI_ITEM_OFFSETS);
Inventory Pillshere = CPlayer.mo.FindInventory("Pillshere");
If(Pillshere!=null){DrawString(mAmmoFontS, FormatNumber(Pillshere.Amount, 1, 3), (43, 123), DI_TEXT_ALIGN_LEFT|DI_NOSHADOW,Font.CR_WHITE);}
Else{DrawString(mAmmoFontS, FormatNumber(0, 1, 3), (43, 123), DI_TEXT_ALIGN_LEFT|DI_NOSHADOW,Font.CR_WHITE);}
//Health bar
int inthealth = mHealthInterpolator.GetValue();
DrawBar("A1","B1",inthealth,100,(-48,125),0,3,DI_ITEM_OFFSETS);
//Invulnerability
If(CPlayer.mo.FindInventory("PowerInvulnerable"))
{
DrawImage("E1", (-48,125), DI_ITEM_OFFSETS);
}
//Weapons
If(CPlayer.ReadyWeapon is "BerettaExceptTwo")
{
DrawImage("BERETTA2", (320,135), DI_ITEM_OFFSETS);
DrawImage("sInfinite", (305,165), DI_ITEM_OFFSETS);
}
If(CPlayer.ReadyWeapon is "Mac10")
{
DrawImage("MAC10", (320,130), DI_ITEM_OFFSETS);
}
If(CPlayer.ReadyWeapon is "BothOfThem")
{
DrawImage("MAC10s", (320,125), DI_ITEM_OFFSETS);
}
If(CPlayer.ReadyWeapon is "Remington870")
{
DrawImage("R870", (295,144), DI_ITEM_OFFSETS);
}
If(CPlayer.ReadyWeapon is "Kalashnikov")
{
DrawImage("AK47", (300,144), DI_ITEM_OFFSETS);
}
}
}