diff --git a/src/events.cpp b/src/events.cpp index 30a699ee2..c75abdf87 100755 --- a/src/events.cpp +++ b/src/events.cpp @@ -368,17 +368,10 @@ DEFINE_ACTION_FUNCTION(DStaticEventHandler, Unregister) ACTION_RETURN_BOOL(E_UnregisterHandler(handler)); } -#define DEFINE_EVENT_HANDLER(cls, funcname, args) DEFINE_ACTION_FUNCTION(cls, funcname) \ -{ \ - PARAM_SELF_PROLOGUE(cls); \ - return 0; \ -} \ -void cls::funcname(args) \ +#define DEFINE_EVENT_HANDLER(cls, funcname, args) void cls::funcname(args) \ { \ IFVIRTUAL(cls, funcname) \ { \ - if (func == cls##_##funcname##_VMPtr) \ - return; \ VMValue params[1] = { (cls*)this }; \ GlobalVMStack.Call(func, params, 1, nullptr, 0, nullptr); \ } \ diff --git a/wadsrc/static/zscript/events.txt b/wadsrc/static/zscript/events.txt index e5b878603..8e6b1f682 100755 --- a/wadsrc/static/zscript/events.txt +++ b/wadsrc/static/zscript/events.txt @@ -9,22 +9,23 @@ class StaticEventHandler : Object native protected static native bool Register(StaticEventHandler handler); protected static native bool Unregister(StaticEventHandler handler); - virtual native void WorldLoaded(); - virtual native void WorldUnloaded(); - virtual native void WorldThingSpawned(); - - virtual native void RenderFrame(); + // world stuff + virtual void WorldLoaded() {} + virtual void WorldUnloaded() {} + virtual void WorldThingSpawned() {} + // render stuff + virtual void RenderFrame() {} } class StaticRenderEventHandler : StaticEventHandler native { - // for frame and camera - native readonly Vector3 ViewPos; - native readonly double ViewAngle; - native readonly double ViewPitch; - native readonly double ViewRoll; - native readonly double FracTic; - native readonly Actor Camera; + // for frame and camera + native readonly Vector3 ViewPos; + native readonly double ViewAngle; + native readonly double ViewPitch; + native readonly double ViewRoll; + native readonly double FracTic; + native readonly Actor Camera; } class StaticWorldEventHandler : StaticEventHandler native @@ -36,12 +37,12 @@ class StaticWorldEventHandler : StaticEventHandler native class EventHandler : StaticEventHandler native { - static native StaticEventHandler Create(class type); - static native StaticEventHandler CreateOnce(class type); - static native StaticEventHandler Find(class type); + static native StaticEventHandler Create(class type); + static native StaticEventHandler CreateOnce(class type); + static native StaticEventHandler Find(class type); - static native bool Register(StaticEventHandler handler); - static native bool Unregister(StaticEventHandler handler); + static native bool Register(StaticEventHandler handler); + static native bool Unregister(StaticEventHandler handler); } class RenderEventHandler : StaticRenderEventHandler native { }