From fc809cfab6a35332fc44a9b7f40cf3fc61d954c4 Mon Sep 17 00:00:00 2001 From: jekyllgrim Date: Fri, 15 Dec 2023 14:53:25 +0300 Subject: [PATCH] Virtualized returns for SpecialMissileHit/SpecialBounceHit --- wadsrc/static/zscript/actors/actor.zs | 10 ++++++++-- wadsrc/static/zscript/actors/hexen/magelightning.zs | 4 ++-- wadsrc/static/zscript/actors/hexen/magestaff.zs | 4 ++-- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/wadsrc/static/zscript/actors/actor.zs b/wadsrc/static/zscript/actors/actor.zs index 65cd2a3c5..c07f0a4da 100644 --- a/wadsrc/static/zscript/actors/actor.zs +++ b/wadsrc/static/zscript/actors/actor.zs @@ -89,6 +89,12 @@ class Actor : Thinker native const DEFMORPHTICS = 40 * TICRATE; const MELEEDELTA = 20; + enum EMissileHitResult + { + MHIT_DEFAULT = -1, + MHIT_DESTROY = 0, + MHIT_PASS = 1, + } // flags are not defined here, the native fields for those get synthesized from the internal tables. @@ -540,13 +546,13 @@ class Actor : Thinker native // This is called before a missile gets exploded. virtual int SpecialMissileHit (Actor victim) { - return -1; + return MHIT_DEFAULT; } // This is called when a missile bounces off something. virtual int SpecialBounceHit(Actor bounceMobj, Line bounceLine, SecPlane bouncePlane) { - return -1; + return MHIT_DEFAULT; } // Called when the player presses 'use' and an actor is found, except if the diff --git a/wadsrc/static/zscript/actors/hexen/magelightning.zs b/wadsrc/static/zscript/actors/hexen/magelightning.zs index 9c67b2b39..764315ca2 100644 --- a/wadsrc/static/zscript/actors/hexen/magelightning.zs +++ b/wadsrc/static/zscript/actors/hexen/magelightning.zs @@ -147,7 +147,7 @@ class Lightning : Actor tracer = thing; } } - return 1; // lightning zaps through all sprites + return MHIT_PASS; // lightning zaps through all sprites } } @@ -417,7 +417,7 @@ class LightningZap : Actor } } } - return -1; + return MHIT_DEFAULT; } //============================================================================ diff --git a/wadsrc/static/zscript/actors/hexen/magestaff.zs b/wadsrc/static/zscript/actors/hexen/magestaff.zs index 782310c41..a0935e8c8 100644 --- a/wadsrc/static/zscript/actors/hexen/magestaff.zs +++ b/wadsrc/static/zscript/actors/hexen/magestaff.zs @@ -260,9 +260,9 @@ class MageStaffFX2 : Actor if (victim != target && !victim.player && !victim.bBoss) { victim.DamageMobj (self, target, 10, 'Fire'); - return 1; // Keep going + return MHIT_PASS; // Keep going } - return -1; + return MHIT_DEFAULT; } override bool SpecialBlastHandling (Actor source, double strength)