From f72da434a8980d3872014ca8e3d4ac16899a0f97 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 13 Sep 2023 17:50:19 +0200 Subject: [PATCH] - fixed: For Dehacked, A_CPosAttack needs to use a hard coded attack sound. This discrepancy is ancient, so the approach used for the shotgunner does not work here and some hacks are needed to remap the function only for Dehacked. --- src/gamedata/d_dehacked.cpp | 5 ++++- wadsrc/static/zscript/actors/doom/possessed.zs | 15 +++++++++++++-- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/gamedata/d_dehacked.cpp b/src/gamedata/d_dehacked.cpp index 0b4f25576..6cb5b99bb 100644 --- a/src/gamedata/d_dehacked.cpp +++ b/src/gamedata/d_dehacked.cpp @@ -2696,6 +2696,8 @@ static int PatchCodePtrs (int dummy) // This skips the action table and goes directly to the internal symbol table // DEH compatible functions are easy to recognize. + // Note that A_CPosAttack needs to be remapped because it differs from the original and cannot be renamed anymore. + if (!symname.CompareNoCase("A_CPosAttack")) symname = "A_CPosAttackDehacked"; PFunction *sym = dyn_cast(PClass::FindActor(NAME_Weapon)->FindSymbol(symname, true)); if (sym == NULL) { @@ -3371,7 +3373,8 @@ static bool LoadDehSupp () // all relevant code pointers are either defined in Weapon // or Actor so this will find all of them. FString name = "A_"; - name << sc.String; + if (sc.Compare("CPosAttack")) name << "CPosAttackDehacked"; + else name << sc.String; PFunction *sym = dyn_cast(wcls->FindSymbol(name, true)); if (sym == NULL) { diff --git a/wadsrc/static/zscript/actors/doom/possessed.zs b/wadsrc/static/zscript/actors/doom/possessed.zs index eef344ab8..4fa9e0f7e 100644 --- a/wadsrc/static/zscript/actors/doom/possessed.zs +++ b/wadsrc/static/zscript/actors/doom/possessed.zs @@ -315,12 +315,12 @@ extend class Actor } } - void A_CPosAttack() + private void A_CPosAttackInternal(Sound snd) { if (target) { if (bStealth) visdir = 1; - A_StartSound(AttackSound, CHAN_WEAPON); + A_StartSound(snd, CHAN_WEAPON); A_FaceTarget(); double slope = AimLineAttack(angle, MISSILERANGE); double ang = angle + Random2[CPosAttack]() * (22.5/256); @@ -328,6 +328,17 @@ extend class Actor LineAttack(ang, MISSILERANGE, slope, damage, "Hitscan", "Bulletpuff"); } } + + void A_CPosAttack() + { + A_CPosAttackInternal(AttackSound); + } + + void A_CPosAttackDehacked() + { + A_CPosAttackInternal("chainguy/attack"); + } + void A_CPosRefire() {