diff --git a/docs/rh-log.txt b/docs/rh-log.txt index a7dc803b9..6e487a900 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,3 +1,7 @@ +February 20, 2008 (Changes by Graf Zahl) +- Added a modified version of Karate Chris's submission for killing specific + monsters with the 'Kill' ccmd. + February 18, 2008 - Added vid_refreshrate cvar to override Windows' automatic refresh rate selection. diff --git a/src/d_net.cpp b/src/d_net.cpp index 896b974cb..82f7a2b03 100644 --- a/src/d_net.cpp +++ b/src/d_net.cpp @@ -2336,6 +2336,27 @@ void Net_DoCommand (int type, BYTE **stream, int player) } break; + case DEM_KILLCLASSCHEAT: + { + AActor *actor; + TThinkerIterator iterator; + + char *classname = ReadString (stream); + int killcount = 0; + + while ( (actor = iterator.Next ()) ) + { + if (!stricmp (actor->GetClass ()->TypeName.GetChars (), classname)) + { + if (!(actor->flags2 & MF2_DORMANT) && (actor->flags3 & MF3_ISMONSTER)) + killcount += actor->Massacre (); + } + } + + Printf ("Killed %d monsters of type %s.\n",killcount, classname); + } + break; + default: I_Error ("Unknown net command: %d", type); break; @@ -2372,6 +2393,7 @@ void Net_SkipCommand (int type, BYTE **stream) case DEM_SUMMONFOE: case DEM_SPRAY: case DEM_MORPHEX: + case DEM_KILLCLASSCHEAT: skip = strlen ((char *)(*stream)) + 1; break; diff --git a/src/d_protocol.h b/src/d_protocol.h index 104d307e6..e28e1d3d3 100644 --- a/src/d_protocol.h +++ b/src/d_protocol.h @@ -149,6 +149,7 @@ enum EDemoCommand DEM_TAKECHEAT, // 47 String: item to take, Word: quantity DEM_ADDCONTROLLER, // 48 Player to add to the controller list. DEM_DELCONTROLLER, // 49 Player to remove from the controller list. + DEM_KILLCLASSCHEAT, // 50 String: Class to kill. }; // The following are implemented by cht_DoCheat in m_cheat.cpp diff --git a/src/p_interaction.cpp b/src/p_interaction.cpp index 533c45181..b8aceda7e 100644 --- a/src/p_interaction.cpp +++ b/src/p_interaction.cpp @@ -1395,6 +1395,9 @@ CCMD (kill) { if (argv.argc() > 1) { + if (CheckCheatmode ()) + return; + if (!stricmp (argv[1], "monsters")) { // Kill all the monsters @@ -1406,8 +1409,8 @@ CCMD (kill) } else { - Printf("cannot kill '%s'\n", argv[1]); - return; + Net_WriteByte (DEM_KILLCLASSCHEAT); + Net_WriteString (argv[1]); } } else diff --git a/src/version.h b/src/version.h index 911faca61..b1a1d5a65 100644 --- a/src/version.h +++ b/src/version.h @@ -64,7 +64,7 @@ // Protocol version used in demos. // Bump it if you change existing DEM_ commands or add new ones. // Otherwise, it should be safe to leave it alone. -#define DEMOGAMEVERSION 0x20A +#define DEMOGAMEVERSION 0x20B // Minimum demo version we can play. // Bump it whenever you change or remove existing DEM_ commands.