From b667b930a3247b3f5240148dfab15a37ef8902da Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 3 Oct 2024 22:30:09 +0200 Subject: [PATCH] fixed logic bug with HitFriend and Refire functions. The old code was essentially ineffective and useless, this is how MBF had it and how it was supposed to be. --- wadsrc/static/zscript/actors/doom/possessed.zs | 6 +++++- wadsrc/static/zscript/actors/doom/spidermaster.zs | 6 +++++- wadsrc/static/zscript/actors/strife/sentinel.zs | 6 +++++- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/wadsrc/static/zscript/actors/doom/possessed.zs b/wadsrc/static/zscript/actors/doom/possessed.zs index 4fa9e0f7e..26966e1f0 100644 --- a/wadsrc/static/zscript/actors/doom/possessed.zs +++ b/wadsrc/static/zscript/actors/doom/possessed.zs @@ -342,12 +342,16 @@ extend class Actor void A_CPosRefire() { + if (HitFriend()) + { + SetState(SeeState); + return; + } // keep firing unless target got out of sight A_FaceTarget(); if (Random[CPosRefire](0, 255) >= 40) { if (!target - || HitFriend() || target.health <= 0 || !CheckSight(target, SF_SEEPASTBLOCKEVERYTHING|SF_SEEPASTSHOOTABLELINES)) { diff --git a/wadsrc/static/zscript/actors/doom/spidermaster.zs b/wadsrc/static/zscript/actors/doom/spidermaster.zs index 62701e395..c2685f480 100644 --- a/wadsrc/static/zscript/actors/doom/spidermaster.zs +++ b/wadsrc/static/zscript/actors/doom/spidermaster.zs @@ -73,12 +73,16 @@ extend class Actor { void A_SpidRefire() { + if (HitFriend()) + { + SetState(SeeState); + return; + } // keep firing unless target got out of sight A_FaceTarget(); if (Random[CPosRefire](0, 255) >= 10) { if (!target - || HitFriend() || target.health <= 0 || !CheckSight(target, SF_SEEPASTBLOCKEVERYTHING|SF_SEEPASTSHOOTABLELINES)) { diff --git a/wadsrc/static/zscript/actors/strife/sentinel.zs b/wadsrc/static/zscript/actors/strife/sentinel.zs index 0987cc018..84b9c3f0c 100644 --- a/wadsrc/static/zscript/actors/strife/sentinel.zs +++ b/wadsrc/static/zscript/actors/strife/sentinel.zs @@ -164,13 +164,17 @@ extend class Actor void A_SentinelRefire() { A_FaceTarget (); + if (HitFriend()) + { + SetState(SeeState); + return; + } if (random[SentinelRefire]() >= 30) { if (target == NULL || target.health <= 0 || !CheckSight (target, SF_SEEPASTBLOCKEVERYTHING|SF_SEEPASTSHOOTABLELINES) || - HitFriend() || (MissileState == NULL && !CheckMeleeRange()) || random[SentinelRefire]() < 40) {