From 431c47c95793ff81b0079f764f5ba75bcd6b71c3 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 15 Jun 2022 22:03:25 +0200 Subject: [PATCH] - fixed setup of ready state with Dehacked. This needs to emulate the hard coded chainsaw sound when weapon states get reassigned. --- src/gamedata/d_dehacked.cpp | 20 +++++++++++++++++++- src/namedef_custom.h | 2 ++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/gamedata/d_dehacked.cpp b/src/gamedata/d_dehacked.cpp index c19499c3d..f0784fbe2 100644 --- a/src/gamedata/d_dehacked.cpp +++ b/src/gamedata/d_dehacked.cpp @@ -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); @@ -2085,8 +2086,11 @@ static int PatchWeapon (int weapNum) statedef.SetStateLabel("Select", state); else if (strnicmp (Line1, "Select", 6) == 0) statedef.SetStateLabel("Deselect", state); - else if (strnicmp (Line1, "Bobbing", 7) == 0) + 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(NAME_AmmoType1) == nullptr) { info->IntVar(NAME_AmmoUse1) = 0; diff --git a/src/namedef_custom.h b/src/namedef_custom.h index deb213b70..8401ec289 100644 --- a/src/namedef_custom.h +++ b/src/namedef_custom.h @@ -279,6 +279,8 @@ xx(DropTime) xx(PickupSound) xx(WeaponScaleX) xx(WeaponScaleY) +xx(ReadySound) +xx(A_WeaponReady) // PlayerPawn member fields xx(ColorRangeStart)