From a71736b59886d8204162da176c89f61d6d23f4f8 Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Sat, 10 Nov 2012 03:38:52 +0000 Subject: [PATCH] - Fixed: If there are not enough states for a spawned debris chunk, A_SpawnDebris should still fling it somewhere. SVN r3963 (trunk) --- src/thingdef/thingdef_codeptr.cpp | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/thingdef/thingdef_codeptr.cpp b/src/thingdef/thingdef_codeptr.cpp index c55cd32ac5..597ba48d41 100644 --- a/src/thingdef/thingdef_codeptr.cpp +++ b/src/thingdef/thingdef_codeptr.cpp @@ -2299,15 +2299,18 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SpawnDebris) for (i = 0; i < GetDefaultByType(debris)->health; i++) { mo = Spawn(debris, self->x+((pr_spawndebris()-128)<<12), - self->y+((pr_spawndebris()-128)<<12), - self->z+(pr_spawndebris()*self->height/256+self->GetBobOffset()), ALLOW_REPLACE); - if (mo && transfer_translation) + self->y + ((pr_spawndebris()-128)<<12), + self->z + (pr_spawndebris()*self->height/256+self->GetBobOffset()), ALLOW_REPLACE); + if (mo) { - mo->Translation = self->Translation; - } - if (mo && i < mo->GetClass()->ActorInfo->NumOwnedStates) - { - mo->SetState (mo->GetClass()->ActorInfo->OwnedStates + i); + if (transfer_translation) + { + mo->Translation = self->Translation; + } + if (i < mo->GetClass()->ActorInfo->NumOwnedStates) + { + mo->SetState(mo->GetClass()->ActorInfo->OwnedStates + i); + } mo->velz = FixedMul(mult_v, ((pr_spawndebris()&7)+5)*FRACUNIT); mo->velx = FixedMul(mult_h, pr_spawndebris.Random2()<<(FRACBITS-6)); mo->vely = FixedMul(mult_h, pr_spawndebris.Random2()<<(FRACBITS-6));