- Blood: add 'activatecheat' ccmd to pass a raw string to the cheat checker

This commit is contained in:
Rachael Alexanderson 2020-01-25 10:36:18 -05:00
parent c0b18d0356
commit 7765fa45cd
2 changed files with 22 additions and 1 deletions

View file

@ -62,7 +62,7 @@ void CEndGameMgr::Draw(void)
viewDrawText(1, GStrings("TXTB_LEVELSTATS"), 160, nY, -128, 0, 1, 0);
if (CCheatMgr::m_bPlayerCheated)
{
viewDrawText(3, GStrings("TXTB_CHESTED"), 160, 32, -128, 0, 1, 1);
viewDrawText(3, GStrings("TXTB_CHEATED"), 160, 32, -128, 0, 1, 1);
}
gKillMgr.Draw();
gSecretMgr.Draw();

View file

@ -44,6 +44,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
BEGIN_BLD_NS
extern CCheatMgr gCheatMgr;
static int osdcmd_map(osdcmdptr_t parm)
{
char filename[BMAX_PATH];
@ -201,6 +203,24 @@ void onvideomodechange(int32_t newmode)
UpdateDacs(gLastPal, false);
}
static int osdcmd_activatecheat(osdcmdptr_t parm)
{
FString CheatEntry;
if (parm->numparms != 1)
return OSDCMD_SHOWHELP;
CheatEntry = (char*)(parm->parms[0]);
CheatEntry.ToUpper();
if (gCheatMgr.Check((char*)(CheatEntry.GetChars())))
return OSDCMD_OK;
else
{
Printf("Unrecognized cheat!: %s\n", parm->parms[0]);
return OSDCMD_OK;
}
}
int32_t registerosdcommands(void)
@ -212,6 +232,7 @@ int32_t registerosdcommands(void)
OSD_RegisterFunction("god","god: toggles god mode", osdcmd_god);
OSD_RegisterFunction("noclip","noclip: toggles clipping mode", osdcmd_noclip);
OSD_RegisterFunction("activatecheat","activatecheat <string>: activates a classic cheat code", osdcmd_activatecheat);
return 0;
}