- made most of AltHud class functions virtual

This allows arbitrary customization of alternative HUD
This commit is contained in:
alexey.lysiuk 2019-11-26 12:02:19 +02:00
parent a7f2df4fef
commit e21c9e0ef8
1 changed files with 18 additions and 18 deletions

View File

@ -142,7 +142,7 @@ class AltHud ui
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void DrawTimeString(Font fnt, int color, int timer, int x, int y, double trans = 0.75) virtual void DrawTimeString(Font fnt, int color, int timer, int x, int y, double trans = 0.75)
{ {
let seconds = Thinker.Tics2Seconds(timer); let seconds = Thinker.Tics2Seconds(timer);
String s = String.Format("%02i:%02i:%02i", seconds / 3600, (seconds % 3600) / 60, seconds % 60); String s = String.Format("%02i:%02i:%02i", seconds / 3600, (seconds % 3600) / 60, seconds % 60);
@ -156,7 +156,7 @@ class AltHud ui
// //
//=========================================================================== //===========================================================================
void DrawStatLine(int x, in out int y, String prefix, String text) virtual void DrawStatLine(int x, in out int y, String prefix, String text)
{ {
y -= SmallFont.GetHeight()-1; y -= SmallFont.GetHeight()-1;
screen.DrawText(SmallFont, hudcolor_statnames, x, y, prefix, screen.DrawText(SmallFont, hudcolor_statnames, x, y, prefix,
@ -168,7 +168,7 @@ class AltHud ui
DTA_VirtualWidth, hudwidth, DTA_VirtualHeight, hudheight, DTA_Alpha, 0.75); DTA_VirtualWidth, hudwidth, DTA_VirtualHeight, hudheight, DTA_Alpha, 0.75);
} }
void DrawStatus(PlayerInfo CPlayer, int x, int y) virtual void DrawStatus(PlayerInfo CPlayer, int x, int y)
{ {
let mo = CPlayer.mo; let mo = CPlayer.mo;
if (hud_showscore) if (hud_showscore)
@ -209,7 +209,7 @@ class AltHud ui
// //
//=========================================================================== //===========================================================================
void DrawHealth(PlayerInfo CPlayer, int x, int y) virtual void DrawHealth(PlayerInfo CPlayer, int x, int y)
{ {
int health = CPlayer.health; int health = CPlayer.health;
@ -235,7 +235,7 @@ class AltHud ui
// //
//=========================================================================== //===========================================================================
void DrawArmor(BasicArmor barmor, HexenArmor harmor, int x, int y) virtual void DrawArmor(BasicArmor barmor, HexenArmor harmor, int x, int y)
{ {
int ap = 0; int ap = 0;
int bestslot = 4; int bestslot = 4;
@ -304,7 +304,7 @@ class AltHud ui
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
bool DrawOneKey(int xo, int x, int y, in out int c, Key inv) virtual bool DrawOneKey(int xo, int x, int y, in out int c, Key inv)
{ {
TextureID icon; TextureID icon;
@ -340,7 +340,7 @@ class AltHud ui
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
int DrawKeys(PlayerInfo CPlayer, int x, int y) virtual int DrawKeys(PlayerInfo CPlayer, int x, int y)
{ {
int yo = y; int yo = y;
int xo = x; int xo = x;
@ -445,7 +445,7 @@ class AltHud ui
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
int DrawAmmo(PlayerInfo CPlayer, int x, int y) virtual int DrawAmmo(PlayerInfo CPlayer, int x, int y)
{ {
int i,j,k; int i,j,k;
@ -558,7 +558,7 @@ class AltHud ui
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void DrawOneWeapon(PlayerInfo CPlayer, int x, in out int y, Weapon weapon) virtual void DrawOneWeapon(PlayerInfo CPlayer, int x, in out int y, Weapon weapon)
{ {
double trans; double trans;
@ -594,7 +594,7 @@ class AltHud ui
} }
void DrawWeapons(PlayerInfo CPlayer, int x, int y) virtual void DrawWeapons(PlayerInfo CPlayer, int x, int y)
{ {
int k,j; int k,j;
Inventory inv; Inventory inv;
@ -631,7 +631,7 @@ class AltHud ui
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void DrawInventory(PlayerInfo CPlayer, int x,int y) virtual void DrawInventory(PlayerInfo CPlayer, int x,int y)
{ {
Inventory rover; Inventory rover;
int numitems = (hudwidth - 2*x) / 32; int numitems = (hudwidth - 2*x) / 32;
@ -690,7 +690,7 @@ class AltHud ui
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void DrawFrags(PlayerInfo CPlayer, int x, int y) virtual void DrawFrags(PlayerInfo CPlayer, int x, int y)
{ {
DrawImageToBox(fragpic, x, y, 31, 17); DrawImageToBox(fragpic, x, y, 31, 17);
DrawHudNumber(HudFont, Font.CR_GRAY, CPlayer.fragcount, x + 33, y + 17); DrawHudNumber(HudFont, Font.CR_GRAY, CPlayer.fragcount, x + 33, y + 17);
@ -709,7 +709,7 @@ class AltHud ui
DTA_VirtualWidth, hudwidth, DTA_VirtualHeight, hudheight); DTA_VirtualWidth, hudwidth, DTA_VirtualHeight, hudheight);
} }
void DrawCoordinates(PlayerInfo CPlayer, bool withmapname) virtual void DrawCoordinates(PlayerInfo CPlayer, bool withmapname)
{ {
Vector3 pos; Vector3 pos;
String coordstr; String coordstr;
@ -772,7 +772,7 @@ class AltHud ui
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
private native static int GetRealTime(); private native static int GetRealTime();
bool DrawTime(int y) virtual bool DrawTime(int y)
{ {
if (hud_showtime > 0 && hud_showtime <= 9) if (hud_showtime > 0 && hud_showtime <= 9)
{ {
@ -833,7 +833,7 @@ class AltHud ui
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
native static int, int, int GetLatency(); native static int, int, int GetLatency();
bool DrawLatency(int y) virtual bool DrawLatency(int y)
{ {
if ((hud_showlag == 1 && netgame) || hud_showlag == 2) if ((hud_showlag == 1 && netgame) || hud_showlag == 2)
{ {
@ -858,7 +858,7 @@ class AltHud ui
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void DrawPowerups(PlayerInfo CPlayer, int y) virtual void DrawPowerups(PlayerInfo CPlayer, int y)
{ {
// Each icon gets a 32x32 block to draw itself in. // Each icon gets a 32x32 block to draw itself in.
int x, y; int x, y;
@ -969,7 +969,7 @@ class AltHud ui
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void Draw(PlayerInfo CPlayer, int w, int h) virtual void Draw(PlayerInfo CPlayer, int w, int h)
{ {
hudwidth = w; hudwidth = w;
hudheight = h; hudheight = h;