From 4be9222646619cc156b08ee7ad98e9aa080030e2 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 4 Jan 2017 11:13:19 +0100 Subject: [PATCH] - fixed: Dehacked must flag all states it touched for use in weapons. --- src/d_dehacked.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/d_dehacked.cpp b/src/d_dehacked.cpp index 82f8113017..f4663f4bf6 100644 --- a/src/d_dehacked.cpp +++ b/src/d_dehacked.cpp @@ -238,6 +238,7 @@ TArray TouchedActors; char *UnchangedSpriteNames; int NumUnchangedSprites; +bool changedStates; // Sprite<->Class map for ADehackedPickup::DetermineType static struct DehSpriteMap @@ -988,6 +989,7 @@ static int PatchThing (int thingy) { statedef.MakeStateDefines(type); patchedStates = true; + changedStates = true; } if (!strnicmp (Line1, "Initial", 7)) @@ -1460,6 +1462,7 @@ static int PatchFrame (int frameNum) else if (keylen == 10 && stricmp (Line1, "Next frame") == 0) { info->NextState = FindState (val); + changedStates = true; } else if (keylen == 16 && stricmp (Line1, "Sprite subnumber") == 0) { @@ -3049,6 +3052,17 @@ void FinishDehPatch () DPrintf (DMSG_NOTIFY, "%s replaces %s\n", subclass->TypeName.GetChars(), type->TypeName.GetChars()); } + // To avoid errors, flag all potentially touched states for use in weapons. + if (changedStates) + { + for (auto &s : StateMap) + { + for (auto i = 0; i < s.StateSpan; i++) + { + s.State[i].UseFlags |= SUF_WEAPON; + } + } + } // Now that all Dehacked patches have been processed, it's okay to free StateMap. StateMap.Clear(); StateMap.ShrinkToFit();