- fixed setup of ready state with Dehacked.

This needs to emulate the hard coded chainsaw sound when weapon states get reassigned.
This commit is contained in:
Christoph Oelckers 2022-06-15 22:03:25 +02:00
parent 972e9cba09
commit 431c47c957
2 changed files with 21 additions and 1 deletions

View file

@ -2066,6 +2066,7 @@ static int PatchWeapon (int weapNum)
Printf ("Weapon %d out of range.\n", weapNum);
}
FState* readyState = nullptr;
while ((result = GetLine ()) == 1)
{
int val = atoi (Line2);
@ -2086,7 +2087,10 @@ static int PatchWeapon (int weapNum)
else if (strnicmp (Line1, "Select", 6) == 0)
statedef.SetStateLabel("Deselect", state);
else if (strnicmp(Line1, "Bobbing", 7) == 0)
{
readyState = state;
statedef.SetStateLabel("Ready", state);
}
else if (strnicmp (Line1, "Shooting", 8) == 0)
statedef.SetStateLabel("Fire", state);
else if (strnicmp (Line1, "Firing", 6) == 0)
@ -2197,6 +2201,20 @@ static int PatchWeapon (int weapNum)
if (info)
{
// Emulate the hard coded ready sound of the chainsaw as good as possible.
if (readyState)
{
FState* state = FindState(67); // S_SAW
if (readyState == state)
{
info->IntVar(NAME_ReadySound) = S_FindSound("weapons/sawidle");
}
else
{
info->IntVar(NAME_ReadySound) = 0;
}
}
if (info->PointerVar<PClassActor>(NAME_AmmoType1) == nullptr)
{
info->IntVar(NAME_AmmoUse1) = 0;

View file

@ -279,6 +279,8 @@ xx(DropTime)
xx(PickupSound)
xx(WeaponScaleX)
xx(WeaponScaleY)
xx(ReadySound)
xx(A_WeaponReady)
// PlayerPawn member fields
xx(ColorRangeStart)