- 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.
This commit is contained in:
Christoph Oelckers 2023-09-13 17:50:19 +02:00
parent 8b31e0d3b6
commit f72da434a8
2 changed files with 17 additions and 3 deletions

View file

@ -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<PFunction>(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<PFunction>(wcls->FindSymbol(name, true));
if (sym == NULL)
{

View file

@ -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()
{