From b8db84b6bc493775317efb02458f0cef584aa494 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 20 Jun 2010 17:57:32 +0000 Subject: [PATCH] - added a new dmflag to allow killing all monsters spawned by a boss brain's cubes after killing the brain (for those who like clean level statistics.) SVN r2385 (trunk) --- src/actor.h | 2 +- src/d_main.cpp | 1 + src/doomdef.h | 1 + src/g_doom/a_bossbrain.cpp | 16 ++++++++++++++++ src/m_options.cpp | 1 + 5 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/actor.h b/src/actor.h index db4d07dbb7..6e0c625f14 100644 --- a/src/actor.h +++ b/src/actor.h @@ -260,7 +260,7 @@ enum MF4_NOEXTREMEDEATH = 0x10000000, // this projectile or weapon never gibs its victim MF4_EXTREMEDEATH = 0x20000000, // this projectile or weapon always gibs its victim MF4_FRIGHTENED = 0x40000000, // Monster runs away from player - /* = 0x80000000, */ + MF4_BOSSSPAWNED = 0x80000000, // Spawned by a boss spawn cube // --- mobj.flags5 --- diff --git a/src/d_main.cpp b/src/d_main.cpp index 1fecffab9b..c24b18480a 100644 --- a/src/d_main.cpp +++ b/src/d_main.cpp @@ -459,6 +459,7 @@ CVAR (Flag, sv_chasecam, dmflags2, DF2_CHASECAM); CVAR (Flag, sv_disallowsuicide, dmflags2, DF2_NOSUICIDE); CVAR (Flag, sv_noautoaim, dmflags2, DF2_NOAUTOAIM); CVAR (Flag, sv_dontcheckammo, dmflags2, DF2_DONTCHECKAMMO); +CVAR (Flag, sv_killbossmonst, dmflags2, DF2_KILLBOSSMONST); //========================================================================== // diff --git a/src/doomdef.h b/src/doomdef.h index 716b2e105f..3aa527523b 100644 --- a/src/doomdef.h +++ b/src/doomdef.h @@ -293,6 +293,7 @@ enum DF2_NOSUICIDE = 1 << 22, // Players are not allowed to suicide. DF2_NOAUTOAIM = 1 << 23, // Players cannot use autoaim. DF2_DONTCHECKAMMO = 1 << 24, // Don't Check ammo when switching weapons. + DF2_KILLBOSSMONST = 1 << 25, // Kills all monsters spawned by a boss cube when the boss dies }; // [RH] Compatibility flags. diff --git a/src/g_doom/a_bossbrain.cpp b/src/g_doom/a_bossbrain.cpp index 47374e6173..0110b0ae5e 100644 --- a/src/g_doom/a_bossbrain.cpp +++ b/src/g_doom/a_bossbrain.cpp @@ -76,6 +76,21 @@ DEFINE_ACTION_FUNCTION(AActor, A_BrainDie) if ((deathmatch || alwaysapplydmflags) && (dmflags & DF_NO_EXIT)) return; + // New dmflag: Kill all boss spawned monsters before ending the level. + if (dmflags2 & DF2_KILLBOSSMONST) + { + TThinkerIterator it; + AActor *mo; + while ((mo = it.Next())) + { + if (mo->flags4 & MF4_BOSSSPAWNED) + { + P_DamageMobj(mo, self, self, mo->health, NAME_None, + DMG_NO_ARMOR|DMG_FORCED|DMG_THRUSTLESS|DMG_NO_FACTOR); + } + } + } + G_ExitLevel (0, false); } @@ -250,6 +265,7 @@ static void SpawnFly(AActor *self, const PClass *spawntype, FSoundID sound) // telefrag anything in this spot P_TeleportMove (newmobj, newmobj->x, newmobj->y, newmobj->z, true); } + newmobj->flags4 |= MF4_BOSSSPAWNED; } } diff --git a/src/m_options.cpp b/src/m_options.cpp index 67aab6d62f..324b45cc6b 100644 --- a/src/m_options.cpp +++ b/src/m_options.cpp @@ -1048,6 +1048,7 @@ static menuitem_t DMFlagsItems[] = { { bitflag, "Allow spying", {&dmflags2}, {1}, {0}, {0}, {(value_t *)DF2_DISALLOW_SPYING} }, { bitflag, "Chasecam cheat", {&dmflags2}, {0}, {0}, {0}, {(value_t *)DF2_CHASECAM} }, { bitflag, "Check ammo for weapon switch", {&dmflags2}, {1}, {0}, {0}, {(value_t *)DF2_DONTCHECKAMMO} }, + { bitflag, "Killing boss brain kills all its monsters", {&dmflags2}, {0}, {0}, {0}, {(value_t *)DF2_KILLBOSSMONST} }, { redtext, " ", {NULL}, {0}, {0}, {0}, {NULL} }, { whitetext,"Deathmatch Settings", {NULL}, {0}, {0}, {0}, {NULL} },