From dd19c8c60a810b52748b71fe68bb7d195255e77b Mon Sep 17 00:00:00 2001 From: Lemon-King Date: Sun, 15 Sep 2024 21:08:41 -0400 Subject: [PATCH] WorldHandler: Change to Static, precache xgame --- .../assets/zscript/events/hxdd/worldhandler.zs | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/resources/assets/zscript/events/hxdd/worldhandler.zs b/resources/assets/zscript/events/hxdd/worldhandler.zs index ba6b9c5..a760b5f 100644 --- a/resources/assets/zscript/events/hxdd/worldhandler.zs +++ b/resources/assets/zscript/events/hxdd/worldhandler.zs @@ -1,7 +1,9 @@ // ref: https://forum.zdoom.org/viewtopic.php?f=122&t=67766 -class HXDDWorldEventHandler : EventHandler { +class HXDDWorldEventHandler : StaticEventHandler { + XGameTranslation xgame; + void UserOptions_TextureSwap() { int hxdd_waterstyle = LemonUtil.CVAR_GetInt("hxdd_waterstyle", 0); int hxdd_lavastyle = LemonUtil.CVAR_GetInt("hxdd_lavastyle", 0); @@ -73,6 +75,11 @@ class HXDDWorldEventHandler : EventHandler { } } + override void OnRegister() { + SetOrder(0x48657265746963 + 0x486578656E); + self.xgame = new("XGameTranslation").Init(); + } + override void WorldLoaded(WorldEvent e) { if (LemonUtil.IsGameType(Game_Doom)) { @@ -83,10 +90,6 @@ class HXDDWorldEventHandler : EventHandler { UserOptions_TextureSwap(); } - override void NewGame () { - //LemonUtil.TryOpenMapByName(); - } - override void WorldLinePreActivated(WorldEvent e) { if (LemonUtil.IsGameType(GAME_Doom)) { return; @@ -104,12 +107,7 @@ class HXDDWorldEventHandler : EventHandler { } } - XGameTranslation xgame; override void CheckReplacement(ReplaceEvent e) { - if (!xgame) { - xgame = new("XGameTranslation"); - xgame.Init(); - } if (e.IsFinal) { return; }