From e51bd95d03994cd4de9db311341648fc81d09e20 Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Sun, 22 Apr 2012 02:08:27 +0000 Subject: [PATCH] - Fixed: P_SpawnBlood did not check that the state it was setting for low-damage blood was valid. SVN r3576 (trunk) --- src/p_mobj.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index 90dcda6e8..0243137f9 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -4668,15 +4668,25 @@ void P_SpawnBlood (fixed_t x, fixed_t y, fixed_t z, angle_t dir, int damage, AAc FState *state = th->FindState(NAME_Spray); if (state != NULL) th->SetState (state); } - else damage+=2; + else damage += 2; } + int advance = 0; if (damage <= 12 && damage >= 9) { - th->SetState (th->SpawnState + 1); + advance = 1; } else if (damage < 9) { - th->SetState (th->SpawnState + 2); + advance = 2; + } + for (; advance > 0; --advance) + { + // [RH] Do not set to a state we do not own. + if (th->SpawnState + advance < th->GetClass()->ActorInfo->OwnedStates + NumOwnedStates) + { + th->SetState(th->SpawnState + advance); + break; + } } } }