Skip to content

Commit

Permalink
WorldHandler: Change to Static, precache xgame
Browse files Browse the repository at this point in the history
  • Loading branch information
Lemon-King committed Sep 16, 2024
1 parent 455fd22 commit dd19c8c
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions resources/assets/zscript/events/hxdd/worldhandler.zs
Original file line number Diff line number Diff line change
@@ -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);
Expand Down Expand Up @@ -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)) {

Expand All @@ -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;
Expand All @@ -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;
}
Expand Down

0 comments on commit dd19c8c

Please sign in to comment.