- added a damage type parameter to MDK CCMD.

This commit is contained in:
Christoph Oelckers 2017-02-27 20:07:21 +01:00
parent ac4074a69a
commit e511f7f84b
5 changed files with 32 additions and 8 deletions

View File

@ -2380,6 +2380,11 @@ void Net_DoCommand (int type, BYTE **stream, int player)
SprayDecal(players[player].mo, s); SprayDecal(players[player].mo, s);
break; break;
case DEM_MDK:
s = ReadString(stream);
cht_DoMDK(&players[player], s);
break;
case DEM_PAUSE: case DEM_PAUSE:
if (gamestate == GS_LEVEL) if (gamestate == GS_LEVEL)
{ {
@ -2666,13 +2671,12 @@ void Net_DoCommand (int type, BYTE **stream, int player)
case DEM_NETEVENT: case DEM_NETEVENT:
{ {
const char *ename = ReadString(stream); s = ReadString(stream);
int argn = ReadByte(stream); int argn = ReadByte(stream);
int arg[3] = { 0, 0, 0 }; int arg[3] = { 0, 0, 0 };
for (int i = 0; i < 3; i++) for (int i = 0; i < 3; i++)
arg[i] = ReadLong(stream); arg[i] = ReadLong(stream);
E_Console(player, ename, arg[0], arg[1], arg[2]); E_Console(player, s, arg[0], arg[1], arg[2]);
delete[] ename;
} }
break; break;
@ -2723,7 +2727,7 @@ void Net_SkipCommand (int type, BYTE **stream)
break; break;
case DEM_NETEVENT: case DEM_NETEVENT:
skip = strlen((char *)(*stream)) + 13; skip = strlen((char *)(*stream)) + 14;
break; break;
case DEM_SUMMON2: case DEM_SUMMON2:
@ -2747,6 +2751,7 @@ void Net_SkipCommand (int type, BYTE **stream)
case DEM_SPRAY: case DEM_SPRAY:
case DEM_MORPHEX: case DEM_MORPHEX:
case DEM_KILLCLASSCHEAT: case DEM_KILLCLASSCHEAT:
case DEM_MDK:
skip = strlen ((char *)(*stream)) + 1; skip = strlen ((char *)(*stream)) + 1;
break; break;

View File

@ -159,7 +159,8 @@ enum EDemoCommand
DEM_SETSLOTPNUM, // 67 Byte: player number, the rest is the same as DEM_SETSLOT DEM_SETSLOTPNUM, // 67 Byte: player number, the rest is the same as DEM_SETSLOT
DEM_REMOVE, // 68 DEM_REMOVE, // 68
DEM_FINISHGAME, // 69 DEM_FINISHGAME, // 69
DEM_NETEVENT // 70 String: Event name, Byte: Arg count; each arg is a 4-byte int DEM_NETEVENT, // 70 String: Event name, Byte: Arg count; each arg is a 4-byte int
DEM_MDK // 71 String: Damage type
}; };
// The following are implemented by cht_DoCheat in m_cheat.cpp // The following are implemented by cht_DoCheat in m_cheat.cpp

View File

@ -55,6 +55,22 @@
// writes some bytes to the network data stream, and the network code // writes some bytes to the network data stream, and the network code
// later calls us. // later calls us.
void cht_DoMDK(player_t *player, const char *mod)
{
if (player->mo == NULL)
{
Printf("What do you want to kill outside of a game?\n");
}
else if (!deathmatch)
{
// Don't allow this in deathmatch even with cheats enabled, because it's
// a very very cheap kill.
P_LineAttack(player->mo, player->mo->Angles.Yaw, PLAYERMISSILERANGE,
P_AimLineAttack(player->mo, player->mo->Angles.Yaw, PLAYERMISSILERANGE), TELEFRAG_DAMAGE,
mod, NAME_BulletPuff);
}
}
void cht_DoCheat (player_t *player, int cheat) void cht_DoCheat (player_t *player, int cheat)
{ {
static const char * const BeholdPowers[9] = static const char * const BeholdPowers[9] =
@ -671,6 +687,7 @@ CCMD (mdk)
if (CheckCheatmode ()) if (CheckCheatmode ())
return; return;
Net_WriteByte (DEM_GENERICCHEAT); const char *name = argv.argc() > 1 ? argv[1] : "";
Net_WriteByte (CHT_MDK); Net_WriteByte (DEM_MDK);
Net_WriteString(name);
} }

View File

@ -31,6 +31,7 @@
class player_t; class player_t;
class PClassActor; class PClassActor;
void cht_DoMDK(player_t *player, const char *mod);
void cht_DoCheat (player_t *player, int cheat); void cht_DoCheat (player_t *player, int cheat);
void cht_Give (player_t *player, const char *item, int amount=1); void cht_Give (player_t *player, const char *item, int amount=1);
void cht_Take (player_t *player, const char *item, int amount=1); void cht_Take (player_t *player, const char *item, int amount=1);

View File

@ -57,7 +57,7 @@ const char *GetVersionString();
// Version identifier for network games. // Version identifier for network games.
// Bump it every time you do a release unless you're certain you // Bump it every time you do a release unless you're certain you
// didn't change anything that will affect sync. // didn't change anything that will affect sync.
#define NETGAMEVERSION 232 #define NETGAMEVERSION 233
// Version stored in the ini's [LastRun] section. // Version stored in the ini's [LastRun] section.
// Bump it if you made some configuration change that you want to // Bump it if you made some configuration change that you want to