From ff4924bf8f2febcef1fd84cdce233c661e5bfae5 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Tue, 26 Nov 2019 12:02:19 +0200 Subject: [PATCH] - made most of AltHud class functions virtual This allows arbitrary customization of alternative HUD --- wadsrc/static/zscript/ui/statusbar/alt_hud.zs | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/wadsrc/static/zscript/ui/statusbar/alt_hud.zs b/wadsrc/static/zscript/ui/statusbar/alt_hud.zs index 5c02dd2cf..7504cb9ac 100644 --- a/wadsrc/static/zscript/ui/statusbar/alt_hud.zs +++ b/wadsrc/static/zscript/ui/statusbar/alt_hud.zs @@ -148,7 +148,7 @@ class AltHud ui // //--------------------------------------------------------------------------- - void DrawHudNumber(Font fnt, int color, int num, int x, int y, double trans = 0.75) + void DrawHudNumber(Font fnt, int color, int num, int x, int y, double trans = 0.75) { DrawHudText(fnt, color, String.Format("%d", num), x, y, trans); } @@ -159,7 +159,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); String s = String.Format("%02i:%02i:%02i", seconds / 3600, (seconds % 3600) / 60, seconds % 60); @@ -173,7 +173,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; screen.DrawText(SmallFont, hudcolor_statnames, x, y, prefix, @@ -185,7 +185,7 @@ class AltHud ui 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; if (hud_showscore) @@ -226,7 +226,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; @@ -252,7 +252,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 bestslot = 4; @@ -321,7 +321,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; @@ -357,7 +357,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 xo = x; @@ -462,7 +462,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; @@ -575,7 +575,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; @@ -611,7 +611,7 @@ class AltHud ui } - void DrawWeapons(PlayerInfo CPlayer, int x, int y) + virtual void DrawWeapons(PlayerInfo CPlayer, int x, int y) { int k,j; Inventory inv; @@ -648,7 +648,7 @@ class AltHud ui // //--------------------------------------------------------------------------- - void DrawInventory(PlayerInfo CPlayer, int x,int y) + virtual void DrawInventory(PlayerInfo CPlayer, int x,int y) { Inventory rover; int numitems = (hudwidth - 2*x) / 32; @@ -707,7 +707,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); DrawHudNumber(HudFont, Font.CR_GRAY, CPlayer.fragcount, x + 33, y + 17); @@ -726,7 +726,7 @@ class AltHud ui DTA_VirtualWidth, hudwidth, DTA_VirtualHeight, hudheight); } - void DrawCoordinates(PlayerInfo CPlayer, bool withmapname) + virtual void DrawCoordinates(PlayerInfo CPlayer, bool withmapname) { Vector3 pos; String coordstr; @@ -786,7 +786,7 @@ class AltHud ui //--------------------------------------------------------------------------- private native static int GetRealTime(); - bool DrawTime(int y) + virtual bool DrawTime(int y) { if (hud_showtime > 0 && hud_showtime <= 9) { @@ -847,7 +847,7 @@ class AltHud ui //--------------------------------------------------------------------------- native static int, int, int GetLatency(); - bool DrawLatency(int y) + virtual bool DrawLatency(int y) { if ((hud_showlag == 1 && netgame) || hud_showlag == 2) { @@ -872,7 +872,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. int x, y; @@ -978,7 +978,7 @@ class AltHud ui // //--------------------------------------------------------------------------- - void Draw(PlayerInfo CPlayer, int w, int h) + virtual void Draw(PlayerInfo CPlayer, int w, int h) { hudwidth = w; hudheight = h;