From 9cca4ff71d59f59cf86979cd9e7c6f975a9c3692 Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Sat, 26 Jan 2013 02:54:09 +0000 Subject: [PATCH] - Fixed: Lost Souls spawned by Pain Elementals were not killed by DF2_KILLBOSSMONST. SVN r4047 (trunk) --- src/g_doom/a_bossbrain.cpp | 20 +++++++++++++------- src/g_doom/a_painelemental.cpp | 2 ++ 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/g_doom/a_bossbrain.cpp b/src/g_doom/a_bossbrain.cpp index f0263f5bc2..873b5c6dc0 100644 --- a/src/g_doom/a_bossbrain.cpp +++ b/src/g_doom/a_bossbrain.cpp @@ -79,16 +79,22 @@ DEFINE_ACTION_FUNCTION(AActor, A_BrainDie) // New dmflag: Kill all boss spawned monsters before ending the level. if (dmflags2 & DF2_KILLBOSSMONST) { - TThinkerIterator it; - AActor *mo; - while ((mo = it.Next())) + int count; // Repeat until we have no more boss-spawned monsters. + do // (e.g. Pain Elementals can spawn more to kill upon death.) { - if (mo->flags4 & MF4_BOSSSPAWNED) + TThinkerIterator it; + AActor *mo; + count = 0; + while ((mo = it.Next())) { - P_DamageMobj(mo, self, self, mo->health, NAME_None, - DMG_NO_ARMOR|DMG_FORCED|DMG_THRUSTLESS|DMG_NO_FACTOR); + if (mo->health > 0 && mo->flags4 & MF4_BOSSSPAWNED) + { + P_DamageMobj(mo, self, self, mo->health, NAME_None, + DMG_NO_ARMOR|DMG_FORCED|DMG_THRUSTLESS|DMG_NO_FACTOR); + count++; + } } - } + } while (count != 0); } G_ExitLevel (0, false); diff --git a/src/g_doom/a_painelemental.cpp b/src/g_doom/a_painelemental.cpp index 55451a8927..db7d83021c 100644 --- a/src/g_doom/a_painelemental.cpp +++ b/src/g_doom/a_painelemental.cpp @@ -111,6 +111,8 @@ void A_PainShootSkull (AActor *self, angle_t angle, const PClass *spawntype, int other = Spawn (spawntype, x, y, z, ALLOW_REPLACE); + // Transfer boss-spawned flag + other->flags4 |= self->flags4 & MF4_BOSSSPAWNED; // Check to see if the new Lost Soul's z value is above the // ceiling of its new sector, or below the floor. If so, kill it.