From e21c9e0ef890e101b5b1951ec607895a3fdd7704 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 b791c899f..7ddbf902d 100644 --- a/wadsrc/static/zscript/ui/statusbar/alt_hud.zs +++ b/wadsrc/static/zscript/ui/statusbar/alt_hud.zs @@ -131,7 +131,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); } @@ -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); 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; 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); } - void DrawStatus(PlayerInfo CPlayer, int x, int y) + virtual void DrawStatus(PlayerInfo CPlayer, int x, int y) { let mo = CPlayer.mo; 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; @@ -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 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; @@ -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 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; @@ -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; @@ -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; 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; 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); DrawHudNumber(HudFont, Font.CR_GRAY, CPlayer.fragcount, x + 33, y + 17); @@ -709,7 +709,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; @@ -772,7 +772,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) { @@ -833,7 +833,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) { @@ -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. 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; hudheight = h;