From 7b12d9388c2a4e0cb2371f79dcb408ecf779eca2 Mon Sep 17 00:00:00 2001 From: Kyle Belanger Date: Sun, 7 Apr 2019 02:12:47 -0400 Subject: [PATCH] Organization and trying to do things --- ANIMDEFS.txt | 2 +- ZSCRIPT.txt | 46 ++++++------------------------------ ZScript/{ => Base}/Player.zs | 0 ZScript/{ => Base}/Weapon.zs | 0 ZScript/Events/HUDHandler.zs | 29 +++++++++++++++++++++++ 5 files changed, 37 insertions(+), 40 deletions(-) rename ZScript/{ => Base}/Player.zs (100%) rename ZScript/{ => Base}/Weapon.zs (100%) create mode 100644 ZScript/Events/HUDHandler.zs diff --git a/ANIMDEFS.txt b/ANIMDEFS.txt index e8c50a9..c7cf6f4 100644 --- a/ANIMDEFS.txt +++ b/ANIMDEFS.txt @@ -5,7 +5,7 @@ flat SLIME01 pic 1 tics 1 pic 1 tics 1 flat FWATER1 pic 1 tics 1 pic 1 tics 1 flat BLOOD1 pic 1 tics 1 pic 1 tics 1 -// warping Flats +// Warping Flats warp2 flat NUKAGE1 warp flat LAVA1 warp2 flat SLIME01 diff --git a/ZSCRIPT.txt b/ZSCRIPT.txt index 1cb37cf..ac74617 100644 --- a/ZSCRIPT.txt +++ b/ZSCRIPT.txt @@ -1,44 +1,12 @@ -version "3.7.2" +version "3.8" -// Base #include "ZScript/Util.zs" -#include "ZScript/Player.zs" -#include "ZScript/Weapon.zs" +#include "ZScript/Structs.zs" #include "ZScript/StatusBar.zs" -// Structs -#include "ZScript/Structs.zs" +// Base +#include "ZScript/Base/Player.zs" +#include "ZScript/Base/Weapon.zs" -class RLHUDHandler : StaticEventHandler -{ - RLBasePlayer RLPlayer; - - Vector2 Size; - - override void OnRegister() - { - Super.OnRegister(); - - RLPlayer = RLBasePlayer(Players[0].MO); - - Size = (320, 240); - } - - override void RenderOverlay(RenderEvent e) - { - Super.RenderOverlay(e); - - // DrawTexture("MEDIA0", 0, 20); - // DrawBigText("" .. RLPlayer.Medikit, "Brick", 16, 16); - } - - ui void DrawBigText(string text, Color color, float x, float y) const - { - Screen.DrawText(Font.FindFont("BIGFONT"), color, x, y, text, DTA_VirtualWidth, int(Size.X), DTA_VirtualHeight, int(Size.Y)); - } - - ui void DrawTexture(string texture, float x, float y) const - { - Screen.DrawTexture(TexMan.CheckForTexture(texture, TexMan.Type_Any), true, x, y, DTA_VirtualWidth, int(Size.X), DTA_VirtualHeight, int(Size.Y), DTA_CenterOffset, true); - } -} +// Events +#include "ZScript/Events/HUDHandler.zs" diff --git a/ZScript/Player.zs b/ZScript/Base/Player.zs similarity index 100% rename from ZScript/Player.zs rename to ZScript/Base/Player.zs diff --git a/ZScript/Weapon.zs b/ZScript/Base/Weapon.zs similarity index 100% rename from ZScript/Weapon.zs rename to ZScript/Base/Weapon.zs diff --git a/ZScript/Events/HUDHandler.zs b/ZScript/Events/HUDHandler.zs new file mode 100644 index 0000000..08424b6 --- /dev/null +++ b/ZScript/Events/HUDHandler.zs @@ -0,0 +1,29 @@ +class RLHUDHandler : StaticEventHandler; + +ui Vector2 Size; + +override void RenderOverlay(RenderEvent e) +{ + RLBasePlayer cam = RLBasePlayer(e.Camera); + + Size = (320, 240); + + if (cam) + DrawMedikit(RLBasePlayer(Players[ConsolePlayer].MO)); +} + +ui void DrawMedikit(RLBasePlayer player) +{ + DrawTexture("MEDIA0", 0, 20); + DrawBigText(string.Format("%d", player.Medikit), "Brick", 16, 16); +} + +ui void DrawBigText(string text, Color color, float x, float y) const +{ + Screen.DrawText(Font.FindFont("BIGFONT"), color, x, y, text, DTA_VirtualWidth, int(Size.X), DTA_VirtualHeight, int(Size.Y)); +} + +ui void DrawTexture(string texture, float x, float y) const +{ + Screen.DrawTexture(TexMan.CheckForTexture(texture, TexMan.Type_Any), true, x, y, DTA_VirtualWidth, int(Size.X), DTA_VirtualHeight, int(Size.Y), DTA_CenterOffset, true); +}