- use the generic cheat system for Blood.

This commit is contained in:
Christoph Oelckers 2020-08-03 20:51:31 +02:00
parent d729bc898c
commit d526c6401f
10 changed files with 136 additions and 187 deletions

View file

@ -63,6 +63,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
BEGIN_BLD_NS BEGIN_BLD_NS
void LocalKeys(void); void LocalKeys(void);
void InitCheats();
char bAddUserMap = false; char bAddUserMap = false;
bool bNoDemo = false; bool bNoDemo = false;
@ -734,6 +735,7 @@ static const char* actions[] = {
static void app_init() static void app_init()
{ {
InitCheats();
buttonMap.SetButtons(actions, NUM_ACTIONS); buttonMap.SetButtons(actions, NUM_ACTIONS);
memcpy(&gGameOptions, &gSingleGameOptions, sizeof(GAMEOPTIONS)); memcpy(&gGameOptions, &gSingleGameOptions, sizeof(GAMEOPTIONS));
gGameOptions.nMonsterSettings = !userConfig.nomonsters; gGameOptions.nMonsterSettings = !userConfig.nomonsters;

View file

@ -255,7 +255,7 @@ void GameInterface::StartGame(FNewGameStartup& gs)
gSkill = gs.Skill; gSkill = gs.Skill;
gGameOptions.nLevel = gs.Level; gGameOptions.nLevel = gs.Level;
gStartNewGame = true; gStartNewGame = true;
gCheatMgr.sub_5BCF4(); cheatReset();
} }
FSavegameInfo GameInterface::GetSaveSig() FSavegameInfo GameInterface::GetSaveSig()

View file

@ -100,7 +100,7 @@ void CEndGameMgr::Draw(void)
if (gGameOptions.nGameType == 0) if (gGameOptions.nGameType == 0)
{ {
DrawMenuCaption(GStrings("TXTB_LEVELSTATS")); DrawMenuCaption(GStrings("TXTB_LEVELSTATS"));
if (CCheatMgr::m_bPlayerCheated) if (bPlayerCheated)
{ {
viewDrawText(3, GStrings("TXTB_CHEATED"), 160, 32, -128, 0, 1, 1); viewDrawText(3, GStrings("TXTB_CHEATED"), 160, 32, -128, 0, 1, 1);
} }

View file

@ -678,7 +678,7 @@ void MyLoadSave::Load(void)
psky_t *skyInfo = tileSetupSky(DEFAULTPSKY); psky_t *skyInfo = tileSetupSky(DEFAULTPSKY);
Read(skyInfo, sizeof(*skyInfo)); Read(skyInfo, sizeof(*skyInfo));
skyInfo->combinedtile = -1; skyInfo->combinedtile = -1;
gCheatMgr.sub_5BCF4(); cheatReset();
} }

View file

@ -37,11 +37,11 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "player.h" #include "player.h"
#include "view.h" #include "view.h"
#include "gstrings.h" #include "gstrings.h"
#include "cheathandler.h"
BEGIN_BLD_NS BEGIN_BLD_NS
CPlayerMsg gPlayerMsg; CPlayerMsg gPlayerMsg;
CCheatMgr gCheatMgr;
void sub_5A928(void) void sub_5A928(void)
{ {
@ -361,89 +361,20 @@ bool CPlayerMsg::IsWhitespaceOnly(const char * const pzString)
return true; return true;
} }
CCheatMgr::CHEATINFO CCheatMgr::s_CheatInfo[] = { bool bPlayerCheated = false;
{"NQLGB", kCheatMpkfa, 0 }, // MPKFA (Invincibility)
{"DBQJONZBTT", kCheatCapInMyAss, 0 }, // CAPINMYASS (Disable invincibility )
{"OPDBQJONZBTT", kCheatNoCapInMyAss, 0 }, // NOCAPINMYASS (Invincibility)
{"J!XBOOB!CF!MJLF!LFWJO", kCheatNoCapInMyAss, 0 }, // I WANNA BE LIKE KEVIN (Invincibility)
{"JEBIP", kCheatIdaho, 0 }, // IDAHO (All weapons and full ammo)
{"NPOUBOB", kCheatMontana, 0 }, // MONTANA (All weapons, full ammo and all items)
{"HSJTXPME", kCheatGriswold, 0 }, // GRISWOLD (Full armor (same effect as getting super armor))
{"FENBSL", kCheatEdmark, 0 }, // EDMARK (Does a lot of fire damage to you (if you have 200HP and 200 fire armor then you can survive). Displays the message "THOSE WERE THE DAYS".)
{"UFRVJMB", kCheatTequila, 0 }, // TEQUILA (Guns akimbo power-up)
{"CVO[", kCheatBunz, 0 }, // BUNZ (All weapons, full ammo, and guns akimbo power-up)
{"GVOLZ!TIPFT", kCheatFunkyShoes, 0 }, // FUNKY SHOES (Gives jump boots item and activates it)
{"HBUFLFFQFS", kCheatGateKeeper, 0 }, // GATEKEEPER (Sets the you cheated flag to true, at the end of the level you will see that you have cheated)
{"LFZNBTUFS", kCheatKeyMaster, 0 }, // KEYMASTER (All keys)
{"KPKP", kCheatJoJo, 0 }, // JOJO (Drunk mode (same effect as getting bitten by red spider))
{"TBUDIFM", kCheatSatchel, 0 }, // SATCHEL (Full inventory)
{"TQPSL", kCheatSpork, 0 }, // SPORK (200% health (same effect as getting life seed))
{"POFSJOH", kCheatOneRing, 0 }, // ONERING (Cloak of invisibility power-up)
{"NBSJP", kCheatMario, 1 }, // MARIO (Warp to level E M, e.g.: MARIO 1 3 will take you to Phantom Express)
{"DBMHPO", kCheatCalgon, 1 }, // CALGON (Jumps to next level or can be used like MARIO with parameters)
{"LFWPSLJBO", kCheatKevorkian, 0 }, // KEVORKIAN (Does a lot of physical damage to you (if you have 200HP and 200 fire armor then you can survive). Displays the message "KEVORKIAN APPROVES".)
{"NDHFF", kCheatMcGee, 0 }, // MCGEE (Sets you on fire. Displays the message "YOU'RE FIRED".)
{"LSVFHFS", kCheatKrueger, 0 }, // KRUEGER (200% health, but sets you on fire. Displays the message "FLAME RETARDANT".)
{"DIFFTFIFBE", kCheatCheeseHead, 0 }, // CHEESEHEAD (100% diving suit)
{"DPVTUFBV", kCheatCousteau, 0 }, // COUSTEAU (200% health and diving suit)
{"WPPSIFFT", kCheatVoorhees, 0 }, // VOORHEES (Death mask power-up)
{"MBSB!DSPGU", kCheatLaraCroft, 0 }, // LARA CROFT (All weapons and infinite ammo. Displays the message "LARA RULES". Typing it the second time will lose all weapons and ammo.)
{"IPOHLPOH", kCheatHongKong, 0 }, // HONGKONG (All weapons and infinite ammo)
{"GSBOLFOTUFJO", kCheatFrankenstein, 0 }, // FRANKENSTEIN (100% med-kit)
{"TUFSOP", kCheatSterno, 0 }, // STERNO (Temporary blindness (same effect as getting bitten by green spider))
{"DMBSJDF", kCheatClarice, 0 }, // CLARICE (Gives 100% body armor, 100% fire armor, 100% spirit armor)
{"GPSL!ZPV", kCheatForkYou, 0 }, // FORK YOU (Drunk mode, 1HP, no armor, no weapons, no ammo, no items, no keys, no map, guns akimbo power-up)
{"MJFCFSNBO", kCheatLieberMan, 0 }, // LIEBERMAN (Sets the you cheated flag to true, at the end of the level you will see that you have cheated)
{"FWB!HBMMJ", kCheatEvaGalli, 0 }, // EVA GALLI (Disable/enable clipping (grant the ability to walk through walls))
{"SBUF", kCheatRate, 0 }, // RATE (Display frame rate (doesn't count as a cheat))
{"HPPOJFT", kCheatGoonies, 0 }, // GOONIES (Enable full map. Displays the message "YOU HAVE THE MAP".)
{"TQJFMCFSH", kCheatSpielberg, 1 }, // SPIELBERG (Disables all cheats. If number values corresponding to a level and episode number are entered after the cheat word (i.e. "spielberg 1 3" for Phantom Express), you will be spawned to said level and the game will begin recording a demo from your actions.)
};
bool CCheatMgr::m_bPlayerCheated = false; static int parseArgs(char *pzArgs, int *nArg1, int *nArg2)
bool CCheatMgr::Check(char *pzString)
{
char buffer[80];
strcpy(buffer, pzString);
for (size_t i = 0; i < strlen(pzString); i++)
buffer[i]++;
for (int i = 0; i < 36; i++)
{
int nCheatLen = strlen(s_CheatInfo[i].pzString);
if (s_CheatInfo[i].flags & 1)
{
if (!strnicmp(buffer, s_CheatInfo[i].pzString, nCheatLen))
{
Process(s_CheatInfo[i].id, buffer+nCheatLen);
return true;
}
}
if (!strcmp(buffer, s_CheatInfo[i].pzString))
{
Process(s_CheatInfo[i].id, NULL);
return true;
}
}
return false;
}
int parseArgs(char *pzArgs, int *nArg1, int *nArg2)
{ {
if (!nArg1 || !nArg2) if (!nArg1 || !nArg2)
return -1; return -1;
int nLength = strlen(pzArgs); *nArg1 = pzArgs[0] - '0' - 1;
for (int i = 0; i < nLength; i++) *nArg2 = (pzArgs[1] - '0')*10+(pzArgs[2]-'0') - 1;
pzArgs[i]--; *nArg1 = ClipRange(*nArg1, 0, gEpisodeCount-1);
int stat = sscanf(pzArgs, " %d %d", nArg1, nArg2); *nArg2 = ClipRange(*nArg2, 0, gEpisodeInfo[*nArg1].nLevels-1);
if (stat == 2 && (*nArg1 == 0 || *nArg2 == 0)) return 2;
return -1;
*nArg1 = ClipRange(*nArg1-1, 0, gEpisodeCount-1);
*nArg2 = ClipRange(*nArg2-1, 0, gEpisodeInfo[*nArg1].nLevels-1);
return stat;
} }
void CCheatMgr::Process(CCheatMgr::CHEATCODE nCheatCode, char* pzArgs) void ProcessCheat(CHEATCODE nCheatCode, char* pzArgs)
{ {
dassert(nCheatCode > kCheatNone && nCheatCode < kCheatMax); dassert(nCheatCode > kCheatNone && nCheatCode < kCheatMax);
@ -609,12 +540,59 @@ void CCheatMgr::Process(CCheatMgr::CHEATCODE nCheatCode, char* pzArgs)
default: default:
break; break;
} }
m_bPlayerCheated = true; bPlayerCheated = true;
} }
void CCheatMgr::sub_5BCF4(void) template<CHEATCODE code> bool doCheat(cheatseq_t *c)
{ {
m_bPlayerCheated = 0; ProcessCheat(code, (char*)c->Args);
return true;
}
static cheatseq_t s_CheatInfo[] = {
{"MPKFA", doCheat<kCheatMpkfa>, 0 }, // MPKFA (Invincibility)
{"CAPINMYASS", doCheat<kCheatCapInMyAss>, 0 }, // CAPINMYASS (Disable invincibility )
{"NOCAPINMYASS", doCheat<kCheatNoCapInMyAss>, 0 }, // NOCAPINMYASS (Invincibility)
{"I WANNA BE LIKE KEVIN", doCheat<kCheatNoCapInMyAss>, 0 }, // I WANNA BE LIKE KEVIN (Invincibility)
{"IDAHO", doCheat<kCheatIdaho>, 0 }, // IDAHO (All weapons and full ammo)
{"MONTANA", doCheat<kCheatMontana>, 0 }, // MONTANA (All weapons, full ammo and all items)
{"GRISWOLD", doCheat<kCheatGriswold>, 0 }, // GRISWOLD (Full armor (same effect as getting super armor))
{"EDMARK", doCheat<kCheatEdmark>, 0 }, // EDMARK (Does a lot of fire damage to you (if you have 200HP and 200 fire armor then you can survive). Displays the message "THOSE WERE THE DAYS".)
{"TEQUILA", doCheat<kCheatTequila>, 0 }, // TEQUILA (Guns akimbo power-up)
{"BUNZ[", doCheat<kCheatBunz>, 0 }, // BUNZ (All weapons, full ammo, and guns akimbo power-up)
{"FUNKY SHOES", doCheat<kCheatFunkyShoes>, 0 }, // FUNKY SHOES (Gives jump boots item and activates it)
{"GATEKEEPER", doCheat<kCheatGateKeeper>, 0 }, // GATEKEEPER (Sets the you cheated flag to true, at the end of the level you will see that you have cheated)
{"KEYMASTER", doCheat<kCheatKeyMaster>, 0 }, // KEYMASTER (All keys)
{"JOJO", doCheat<kCheatJoJo>, 0 }, // JOJO (Drunk mode (same effect as getting bitten by red spider))
{"SATCHEL", doCheat<kCheatSatchel>, 0 }, // SATCHEL (Full inventory)
{"SPORK", doCheat<kCheatSpork>, 0 }, // SPORK (200% health (same effect as getting life seed))
{"ONERING", doCheat<kCheatOneRing>, 0 }, // ONERING (Cloak of invisibility power-up)
{"MARIO###", doCheat<kCheatMario>, 0 }, // MARIO (Warp to level E M, e.g.: MARIO 1 3 will take you to Phantom Express)
{"CALGON", doCheat<kCheatCalgon>, 0 }, // CALGON (Jumps to next level or can be used like MARIO with parameters)
{"KEVORKIAN", doCheat<kCheatKevorkian>, 0 }, // KEVORKIAN (Does a lot of physical damage to you (if you have 200HP and 200 fire armor then you can survive). Displays the message "KEVORKIAN APPROVES".)
{"MCGEE", doCheat<kCheatMcGee>, 0 }, // MCGEE (Sets you on fire. Displays the message "YOU'RE FIRED".)
{"KRUEGER", doCheat<kCheatKrueger>, 0 }, // KRUEGER (200% health, but sets you on fire. Displays the message "FLAME RETARDANT".)
{"CHEESEHEAD", doCheat<kCheatCheeseHead>, 0 }, // CHEESEHEAD (100% diving suit)
{"COUSTEAU", doCheat<kCheatCousteau>, 0 }, // COUSTEAU (200% health and diving suit)
{"VOORHEES", doCheat<kCheatVoorhees>, 0 }, // VOORHEES (Death mask power-up)
{"LARA CROFT", doCheat<kCheatLaraCroft>, 0 }, // LARA CROFT (All weapons and infinite ammo. Displays the message "LARA RULES". Typing it the second time will lose all weapons and ammo.)
{"HONGKONG", doCheat<kCheatHongKong>, 0 }, // HONGKONG (All weapons and infinite ammo)
{"FRANKENSTEIN", doCheat<kCheatFrankenstein>, 0 }, // FRANKENSTEIN (100% med-kit)
{"STERNO", doCheat<kCheatSterno>, 0 }, // STERNO (Temporary blindness (same effect as getting bitten by green spider))
{"CLARICE", doCheat<kCheatClarice>, 0 }, // CLARICE (Gives 100% body armor, 100% fire armor, 100% spirit armor)
{"FORK YOU", doCheat<kCheatForkYou>, 0 }, // FORK YOU (Drunk mode, 1HP, no armor, no weapons, no ammo, no items, no keys, no map, guns akimbo power-up)
{"LIEBERMAN", doCheat<kCheatLieberMan>, 0 }, // LIEBERMAN (Sets the you cheated flag to true, at the end of the level you will see that you have cheated)
{"EVA GALLI", doCheat<kCheatEvaGalli>, 0 }, // EVA GALLI (Disable/enable clipping (grant the ability to walk through walls))
{"RATE", doCheat<kCheatRate>, 1 }, // RATE (Display frame rate (doesn't count as a cheat))
{"GOONIES", doCheat<kCheatGoonies>, 0 }, // GOONIES (Enable full map. Displays the message "YOU HAVE THE MAP".)
//{"SPIELBERG", doCheat<kCheatSpielberg, 1 }, // SPIELBERG (Disables all cheats. If number values corresponding to a level and episode number are entered after the cheat word (i.e. "spielberg 1 3" for Phantom Express), you will be spawned to said level and the game will begin recording a demo from your actions.)
};
void cheatReset(void)
{
bPlayerCheated = 0;
playerSetGodMode(gMe, 0); playerSetGodMode(gMe, 0);
gNoClip = 0; gNoClip = 0;
packClear(gMe); packClear(gMe);
@ -631,12 +609,12 @@ public:
void MessagesLoadSave::Load() void MessagesLoadSave::Load()
{ {
Read(&CCheatMgr::m_bPlayerCheated, sizeof(CCheatMgr::m_bPlayerCheated)); Read(&bPlayerCheated, sizeof(bPlayerCheated));
} }
void MessagesLoadSave::Save() void MessagesLoadSave::Save()
{ {
Write(&CCheatMgr::m_bPlayerCheated, sizeof(CCheatMgr::m_bPlayerCheated)); Write(&bPlayerCheated, sizeof(bPlayerCheated));
} }
static MessagesLoadSave *myLoadSave; static MessagesLoadSave *myLoadSave;
@ -646,4 +624,9 @@ void MessagesLoadSaveConstruct(void)
myLoadSave = new MessagesLoadSave(); myLoadSave = new MessagesLoadSave();
} }
void InitCheats()
{
SetCheats(s_CheatInfo, countof(s_CheatInfo));
}
END_BLD_NS END_BLD_NS

View file

@ -57,11 +57,7 @@ private:
bool IsWhitespaceOnly(const char* const pzString); bool IsWhitespaceOnly(const char* const pzString);
}; };
class CCheatMgr enum CHEATCODE
{
public:
static bool m_bPlayerCheated;
enum CHEATCODE
{ {
kCheatNone = 0, kCheatNone = 0,
kCheat1, // refills ammo, no cheat code for it kCheat1, // refills ammo, no cheat code for it
@ -103,21 +99,11 @@ public:
kCheatCalgon, kCheatCalgon,
kCheatMax kCheatMax
}; };
struct CHEATINFO
{ extern bool bPlayerCheated;
const char* pzString; void cheatReset(void);
CHEATCODE id;
int flags;
};
static CHEATINFO s_CheatInfo[];
CCheatMgr() {}
bool Check(char *pzString);
void Process(CHEATCODE nCheatCode, char* pzArgs);
void sub_5BCF4(void);
};
extern CPlayerMsg gPlayerMsg; extern CPlayerMsg gPlayerMsg;
extern CCheatMgr gCheatMgr;
void SetAmmo(bool stat); void SetAmmo(bool stat);
void SetWeapons(bool stat); void SetWeapons(bool stat);

View file

@ -104,43 +104,43 @@ static int osdcmd_give(CCmdFuncPtr parm)
SetToys(true); SetToys(true);
SetArmor(true); SetArmor(true);
SetKeys(true); SetKeys(true);
gCheatMgr.m_bPlayerCheated = true; bPlayerCheated = true;
return CCMD_OK; return CCMD_OK;
} }
else if (!Bstrcasecmp(parm->parms[0], "health")) else if (!Bstrcasecmp(parm->parms[0], "health"))
{ {
actHealDude(gMe->pXSprite, 200, 200); actHealDude(gMe->pXSprite, 200, 200);
gCheatMgr.m_bPlayerCheated = true; bPlayerCheated = true;
return CCMD_OK; return CCMD_OK;
} }
else if (!Bstrcasecmp(parm->parms[0], "weapons")) else if (!Bstrcasecmp(parm->parms[0], "weapons"))
{ {
SetWeapons(true); SetWeapons(true);
gCheatMgr.m_bPlayerCheated = true; bPlayerCheated = true;
return CCMD_OK; return CCMD_OK;
} }
else if (!Bstrcasecmp(parm->parms[0], "ammo")) else if (!Bstrcasecmp(parm->parms[0], "ammo"))
{ {
SetAmmo(true); SetAmmo(true);
gCheatMgr.m_bPlayerCheated = true; bPlayerCheated = true;
return CCMD_OK; return CCMD_OK;
} }
else if (!Bstrcasecmp(parm->parms[0], "armor")) else if (!Bstrcasecmp(parm->parms[0], "armor"))
{ {
SetArmor(true); SetArmor(true);
gCheatMgr.m_bPlayerCheated = true; bPlayerCheated = true;
return CCMD_OK; return CCMD_OK;
} }
else if (!Bstrcasecmp(parm->parms[0], "keys")) else if (!Bstrcasecmp(parm->parms[0], "keys"))
{ {
SetKeys(true); SetKeys(true);
gCheatMgr.m_bPlayerCheated = true; bPlayerCheated = true;
return CCMD_OK; return CCMD_OK;
} }
else if (!Bstrcasecmp(parm->parms[0], "inventory")) else if (!Bstrcasecmp(parm->parms[0], "inventory"))
{ {
SetToys(true); SetToys(true);
gCheatMgr.m_bPlayerCheated = true; bPlayerCheated = true;
return CCMD_OK; return CCMD_OK;
} }
return CCMD_SHOWHELP; return CCMD_SHOWHELP;
@ -152,7 +152,7 @@ static int osdcmd_god(CCmdFuncPtr UNUSED(parm))
if (numplayers == 1 && gamestate == GS_LEVEL) if (numplayers == 1 && gamestate == GS_LEVEL)
{ {
SetGodMode(!gMe->godMode); SetGodMode(!gMe->godMode);
gCheatMgr.m_bPlayerCheated = true; bPlayerCheated = true;
} }
else else
Printf("god: Not in a single-player game.\n"); Printf("god: Not in a single-player game.\n");
@ -167,7 +167,7 @@ static int osdcmd_noclip(CCmdFuncPtr UNUSED(parm))
if (numplayers == 1 && gamestate == GS_LEVEL) if (numplayers == 1 && gamestate == GS_LEVEL)
{ {
SetClipMode(!gNoClip); SetClipMode(!gNoClip);
gCheatMgr.m_bPlayerCheated = true; bPlayerCheated = true;
} }
else else
{ {
@ -177,24 +177,6 @@ static int osdcmd_noclip(CCmdFuncPtr UNUSED(parm))
return CCMD_OK; return CCMD_OK;
} }
static int osdcmd_activatecheat(CCmdFuncPtr parm)
{
FString CheatEntry;
if (parm->numparms != 1)
return CCMD_SHOWHELP;
CheatEntry = (char*)(parm->parms[0]);
CheatEntry.ToUpper();
if (gCheatMgr.Check((char*)(CheatEntry.GetChars())))
return CCMD_OK;
else
{
Printf("Unrecognized cheat!: %s\n", parm->parms[0]);
return CCMD_OK;
}
}
static int osdcmd_levelwarp(CCmdFuncPtr parm) static int osdcmd_levelwarp(CCmdFuncPtr parm)
{ {
if (parm->numparms != 2) if (parm->numparms != 2)
@ -218,8 +200,6 @@ int32_t registerosdcommands(void)
C_RegisterFunction("god","god: toggles god mode", osdcmd_god); C_RegisterFunction("god","god: toggles god mode", osdcmd_god);
C_RegisterFunction("noclip","noclip: toggles clipping mode", osdcmd_noclip); C_RegisterFunction("noclip","noclip: toggles clipping mode", osdcmd_noclip);
C_RegisterFunction("activatecheat","activatecheat <string>: activates a classic cheat code", osdcmd_activatecheat);
C_RegisterFunction("levelwarp","levelwarp <e> <m>: warp to episode 'e' and map 'm'", osdcmd_levelwarp); C_RegisterFunction("levelwarp","levelwarp <e> <m>: warp to episode 'e' and map 'm'", osdcmd_levelwarp);
return 0; return 0;

View file

@ -29,6 +29,7 @@
#include "cheathandler.h" #include "cheathandler.h"
#include "printf.h" #include "printf.h"
#include "gamestruct.h" #include "gamestruct.h"
#include "utf8.h"
static cheatseq_t *cheatlist; static cheatseq_t *cheatlist;
static int numcheats; static int numcheats;
@ -62,7 +63,7 @@ static bool CheatAddKey (cheatseq_t *cheat, uint8_t key, bool *eat)
cheat->Args[cheat->CurrentArg++] = key; cheat->Args[cheat->CurrentArg++] = key;
cheat->Pos++; cheat->Pos++;
} }
else if (key == *cheat->Pos) else if (upperforlower[key] == upperforlower[*cheat->Pos])
{ {
cheat->Pos++; cheat->Pos++;
} }
@ -138,3 +139,11 @@ void PlaybackCheat(const char *p)
Printf("activatecheat: Cheats not allowed.\n"); Printf("activatecheat: Cheats not allowed.\n");
} }
CCMD(activatecheat)
{
if (argv.argc() != 1)
Printf("activatecheat <string>: activates a classic cheat code\n");
else
PlaybackCheat(argv[0]);
}

View file

@ -120,16 +120,6 @@ static int ccmd_map(CCmdFuncPtr parm)
return CCMD_OK; return CCMD_OK;
} }
static int ccmd_activatecheat(CCmdFuncPtr parm)
{
if (parm->numparms != 1)
return CCMD_SHOWHELP;
PlaybackCheat(parm->parms[0]);
return CCMD_OK;
}
static int ccmd_god(CCmdFuncPtr) static int ccmd_god(CCmdFuncPtr)
{ {
if (numplayers == 1 && ps[myconnectindex].gm & MODE_GAME) if (numplayers == 1 && ps[myconnectindex].gm & MODE_GAME)
@ -280,7 +270,6 @@ int registerosdcommands(void)
C_RegisterFunction("give","give <all|health|weapons|ammo|armor|keys|inventory>: gives requested item", ccmd_give); C_RegisterFunction("give","give <all|health|weapons|ammo|armor|keys|inventory>: gives requested item", ccmd_give);
C_RegisterFunction("god","god: toggles god mode", ccmd_god); C_RegisterFunction("god","god: toggles god mode", ccmd_god);
C_RegisterFunction("activatecheat","activatecheat <string>: activates a cheat code", ccmd_activatecheat);
C_RegisterFunction("noclip","noclip: toggles clipping mode", ccmd_noclip); C_RegisterFunction("noclip","noclip: toggles clipping mode", ccmd_noclip);
C_RegisterFunction("restartmap", "restartmap: restarts the current map", ccmd_restartmap); C_RegisterFunction("restartmap", "restartmap: restarts the current map", ccmd_restartmap);

View file

@ -281,7 +281,7 @@ int32_t registerosdcommands(void)
C_RegisterFunction("map","map <mapfile>: loads the given map", osdcmd_map); C_RegisterFunction("map","map <mapfile>: loads the given map", osdcmd_map);
C_RegisterFunction("give","give <all|health|weapons|ammo|armor|keys|inventory>: gives requested item", osdcmd_give); C_RegisterFunction("give","give <all|health|weapons|ammo|armor|keys|inventory>: gives requested item", osdcmd_give);
C_RegisterFunction("god","god: toggles god mode", osdcmd_god); C_RegisterFunction("god","god: toggles god mode", osdcmd_god);
C_RegisterFunction("activatecheat","activatecheat <string>: activates a classic cheat code", osdcmd_activatecheat); // C_RegisterFunction("activatecheat","activatecheat <string>: activates a classic cheat code", osdcmd_activatecheat);
C_RegisterFunction("noclip","noclip: toggles clipping mode", osdcmd_noclip); C_RegisterFunction("noclip","noclip: toggles clipping mode", osdcmd_noclip);