From 5918167fb355423ecd3530009477a31d9d5e0aaa Mon Sep 17 00:00:00 2001 From: Rachael Alexanderson Date: Wed, 19 Jul 2017 15:02:46 -0400 Subject: [PATCH] - added 'kill baddies' cheat - does the same thing as 'kill monsters' only it ignores friendly monsters --- src/d_protocol.h | 3 ++- src/m_cheat.cpp | 3 ++- src/p_enemy.cpp | 4 ++-- src/p_enemy.h | 2 +- src/p_interaction.cpp | 9 +++++++++ 5 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/d_protocol.h b/src/d_protocol.h index a05cef29e0..f5bcf10fbd 100644 --- a/src/d_protocol.h +++ b/src/d_protocol.h @@ -219,7 +219,8 @@ enum ECheatCommand CHT_BUDDHA, CHT_NOCLIP2, CHT_BUDDHA2, - CHT_GOD2 + CHT_GOD2, + CHT_MASSACRE2 }; void StartChunk (int id, uint8_t **stream); diff --git a/src/m_cheat.cpp b/src/m_cheat.cpp index d1dd91e65c..aa7038fb16 100644 --- a/src/m_cheat.cpp +++ b/src/m_cheat.cpp @@ -321,8 +321,9 @@ void cht_DoCheat (player_t *player, int cheat) break; case CHT_MASSACRE: + case CHT_MASSACRE2: { - int killcount = P_Massacre (); + int killcount = P_Massacre (cheat == CHT_MASSACRE2); // killough 3/22/98: make more intelligent about plural // Ty 03/27/98 - string(s) *not* externalized mysnprintf (msgbuild, countof(msgbuild), "%d Monster%s Killed", killcount, killcount==1 ? "" : "s"); diff --git a/src/p_enemy.cpp b/src/p_enemy.cpp index 076e5772af..047b599240 100644 --- a/src/p_enemy.cpp +++ b/src/p_enemy.cpp @@ -3592,7 +3592,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_BossDeath) // //---------------------------------------------------------------------------- -int P_Massacre () +int P_Massacre (bool baddies) { // jff 02/01/98 'em' cheat - kill all monsters // partially taken from Chi's .46 port @@ -3606,7 +3606,7 @@ int P_Massacre () while ( (actor = iterator.Next ()) ) { - if (!(actor->flags2 & MF2_DORMANT) && (actor->flags3 & MF3_ISMONSTER)) + if (!(actor->flags2 & MF2_DORMANT) && (actor->flags3 & MF3_ISMONSTER) && (!baddies || !(actor->flags & MF_FRIENDLY))) { killcount += actor->Massacre(); } diff --git a/src/p_enemy.h b/src/p_enemy.h index a0e829c712..bdc044c5c6 100644 --- a/src/p_enemy.h +++ b/src/p_enemy.h @@ -68,7 +68,7 @@ void A_FaceTarget(AActor *actor); void A_Face(AActor *self, AActor *other, DAngle max_turn = 0., DAngle max_pitch = 270., DAngle ang_offset = 0., DAngle pitch_offset = 0., int flags = 0, double z_add = 0); bool CheckBossDeath (AActor *); -int P_Massacre (); +int P_Massacre (bool baddies = false); bool P_CheckMissileRange (AActor *actor); #define SKULLSPEED (20.) diff --git a/src/p_interaction.cpp b/src/p_interaction.cpp index f9c027c35f..a241647d9e 100644 --- a/src/p_interaction.cpp +++ b/src/p_interaction.cpp @@ -1966,6 +1966,15 @@ CCMD (kill) Net_WriteByte (DEM_GENERICCHEAT); Net_WriteByte (CHT_MASSACRE); } + else if (!stricmp (argv[1], "baddies")) + { + // Kill all the unfriendly monsters + if (CheckCheatmode ()) + return; + + Net_WriteByte (DEM_GENERICCHEAT); + Net_WriteByte (CHT_MASSACRE2); + } else { Net_WriteByte (DEM_KILLCLASSCHEAT);