From 93d8d8a890a266096ec5ab7ae51ad2066d9fd6bd Mon Sep 17 00:00:00 2001 From: hendricks266 Date: Wed, 5 Jul 2017 05:38:08 +0000 Subject: [PATCH] Add "activatecheat" console command. git-svn-id: https://svn.eduke32.com/eduke32@6322 1a8010ca-5511-0410-912e-c29ae57300e0 --- source/duke3d/src/osdcmds.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/source/duke3d/src/osdcmds.cpp b/source/duke3d/src/osdcmds.cpp index d7ec6fc96..a084bde8a 100644 --- a/source/duke3d/src/osdcmds.cpp +++ b/source/duke3d/src/osdcmds.cpp @@ -327,6 +327,19 @@ static int32_t osdcmd_demo(osdfuncparm_t const * const parm) return OSDCMD_OK; } +static int32_t osdcmd_activatecheat(osdfuncparm_t const * const parm) +{ + if (parm->numparms != 1) + return OSDCMD_SHOWHELP; + + if (numplayers == 1 && g_player[myconnectindex].ps->gm & MODE_GAME) + osdcmd_cheatsinfo_stat.cheatnum = Batoi(parm->parms[0]); + else + OSD_Printf("activatecheat: Not in a single-player game.\n"); + + return OSDCMD_OK; +} + static int32_t osdcmd_god(osdfuncparm_t const * const UNUSED(parm)) { UNREFERENCED_CONST_PARAMETER(parm); @@ -1710,6 +1723,7 @@ int32_t registerosdcommands(void) OSD_RegisterFunction("give","give : gives requested item", osdcmd_give); OSD_RegisterFunction("god","god: toggles god mode", osdcmd_god); + OSD_RegisterFunction("activatecheat","activatecheat : activates a cheat code", osdcmd_activatecheat); OSD_RegisterFunction("initgroupfile","initgroupfile : adds a grp file into the game filesystem", osdcmd_initgroupfile); #ifdef DEBUGGINGAIDS