- Added a modified version of Karate Chris's submission for killing specific

monsters with the 'Kill' ccmd.


SVN r759 (trunk)
This commit is contained in:
Christoph Oelckers 2008-02-20 21:28:55 +00:00
parent 77040032c5
commit d412266bfc
5 changed files with 33 additions and 3 deletions

View File

@ -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 February 18, 2008
- Added vid_refreshrate cvar to override Windows' automatic refresh rate - Added vid_refreshrate cvar to override Windows' automatic refresh rate
selection. selection.

View File

@ -2336,6 +2336,27 @@ void Net_DoCommand (int type, BYTE **stream, int player)
} }
break; break;
case DEM_KILLCLASSCHEAT:
{
AActor *actor;
TThinkerIterator<AActor> 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: default:
I_Error ("Unknown net command: %d", type); I_Error ("Unknown net command: %d", type);
break; break;
@ -2372,6 +2393,7 @@ void Net_SkipCommand (int type, BYTE **stream)
case DEM_SUMMONFOE: case DEM_SUMMONFOE:
case DEM_SPRAY: case DEM_SPRAY:
case DEM_MORPHEX: case DEM_MORPHEX:
case DEM_KILLCLASSCHEAT:
skip = strlen ((char *)(*stream)) + 1; skip = strlen ((char *)(*stream)) + 1;
break; break;

View File

@ -149,6 +149,7 @@ enum EDemoCommand
DEM_TAKECHEAT, // 47 String: item to take, Word: quantity DEM_TAKECHEAT, // 47 String: item to take, Word: quantity
DEM_ADDCONTROLLER, // 48 Player to add to the controller list. DEM_ADDCONTROLLER, // 48 Player to add to the controller list.
DEM_DELCONTROLLER, // 49 Player to remove from 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 // The following are implemented by cht_DoCheat in m_cheat.cpp

View File

@ -1395,6 +1395,9 @@ CCMD (kill)
{ {
if (argv.argc() > 1) if (argv.argc() > 1)
{ {
if (CheckCheatmode ())
return;
if (!stricmp (argv[1], "monsters")) if (!stricmp (argv[1], "monsters"))
{ {
// Kill all the monsters // Kill all the monsters
@ -1406,8 +1409,8 @@ CCMD (kill)
} }
else else
{ {
Printf("cannot kill '%s'\n", argv[1]); Net_WriteByte (DEM_KILLCLASSCHEAT);
return; Net_WriteString (argv[1]);
} }
} }
else else

View File

@ -64,7 +64,7 @@
// Protocol version used in demos. // Protocol version used in demos.
// Bump it if you change existing DEM_ commands or add new ones. // Bump it if you change existing DEM_ commands or add new ones.
// Otherwise, it should be safe to leave it alone. // Otherwise, it should be safe to leave it alone.
#define DEMOGAMEVERSION 0x20A #define DEMOGAMEVERSION 0x20B
// Minimum demo version we can play. // Minimum demo version we can play.
// Bump it whenever you change or remove existing DEM_ commands. // Bump it whenever you change or remove existing DEM_ commands.