PCExhumed: Add god, noclip and changelevel console commands.

# Conflicts:
#	source/exhumed/src/osdcmds.cpp
This commit is contained in:
sirlemonhead 2020-01-06 21:03:16 +00:00 committed by Christoph Oelckers
parent 86503338ec
commit 56abec7ed4
4 changed files with 82 additions and 10 deletions

View file

@ -887,13 +887,13 @@ void DoPassword(int nPassword)
case 2: // LOBOCOP
{
lLocalCodes |= 0x20;
lLocalCodes |= kButtonCheatGuns;
break;
}
case 3: // LOBODEITY
{
lLocalCodes |= 0x40;
lLocalCodes |= kButtonCheatGodMode;
break;
}
@ -910,7 +910,7 @@ void DoPassword(int nPassword)
case 5:
{
lLocalCodes |= 0x80;
lLocalCodes |= kButtonCheatKeys;
break;
}
@ -954,7 +954,7 @@ void DoPassword(int nPassword)
case 9:
{
lLocalCodes |= 0x100; // LOBOSWAG?
lLocalCodes |= kButtonCheatItems; // LOBOSWAG
break;
}

View file

@ -143,6 +143,7 @@ void mysetbrightness(char nBrightness);
void StartFadeIn();
int DoFadeIn();
void DoPassword(int nPassword);
void InitSpiritHead();

View file

@ -30,11 +30,81 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
BEGIN_PS_NS
static int osdcmd_god(osdcmdptr_t UNUSED(parm))
{
UNREFERENCED_CONST_PARAMETER(parm);
if (!nNetPlayerCount && !bInDemo)
{
DoPassword(3);
}
else
OSD_Printf("god: Not in a single-player game.\n");
return OSDCMD_OK;
}
static int osdcmd_noclip(osdcmdptr_t UNUSED(parm))
{
UNREFERENCED_CONST_PARAMETER(parm);
if (!nNetPlayerCount && !bInDemo)
{
DoPassword(6);
}
else
{
OSD_Printf("noclip: Not in a single-player game.\n");
}
return OSDCMD_OK;
}
static int osdcmd_changelevel(osdcmdptr_t parm)
{
char* p;
if (parm->numparms != 1) return OSDCMD_SHOWHELP;
int nLevel = strtol(parm->parms[0], &p, 10);
if (p[0]) return OSDCMD_SHOWHELP;
if (nLevel < 0) return OSDCMD_SHOWHELP;
int nMaxLevels;
if (!ISDEMOVER) {
nMaxLevels = 32;
}
else {
nMaxLevels = 4;
}
if (nLevel > nMaxLevels)
{
OSD_Printf("changelevel: invalid level number\n");
return OSDCMD_SHOWHELP;
}
levelnew = nLevel;
levelnum = nLevel;
return OSDCMD_OK;
}
static inline int osdcmd_quit(osdcmdptr_t UNUSED(parm))
{
UNREFERENCED_CONST_PARAMETER(parm);
OSD_ShowDisplay(0);
ShutDown();
return OSDCMD_OK;
}
int32_t registerosdcommands(void)
{
//if (VOLUMEONE)
// OSD_RegisterFunction("changelevel","changelevel <level>: warps to the given level", osdcmd_changelevel);
OSD_RegisterFunction("changelevel","changelevel <level>: warps to the given level", osdcmd_changelevel);
//else
//{
// OSD_RegisterFunction("changelevel","changelevel <volume> <level>: warps to the given level", osdcmd_changelevel);
@ -47,9 +117,10 @@ int32_t registerosdcommands(void)
//OSD_RegisterFunction("give","give <all|health|weapons|ammo|armor|keys|inventory>: gives requested item", osdcmd_give);
//OSD_RegisterFunction("god","god: toggles god mode", osdcmd_god);
OSD_RegisterFunction("god","god: toggles god mode", osdcmd_god);
//OSD_RegisterFunction("activatecheat","activatecheat <id>: activates a cheat code", osdcmd_activatecheat);
OSD_RegisterFunction("noclip","noclip: toggles clipping mode", osdcmd_noclip);
//OSD_RegisterFunction("restartmap", "restartmap: restarts the current map", osdcmd_restartmap);
//OSD_RegisterFunction("restartsound","restartsound: reinitializes the sound system",osdcmd_restartsound);

View file

@ -1415,7 +1415,7 @@ loc_1AB8E:
uint16_t buttons = sPlayerInput[nPlayer].buttons;
if (buttons & 0x40) // LOBODEITY cheat
if (buttons & kButtonCheatGodMode) // LOBODEITY cheat
{
char strDeity[96]; // TODO - reduce in size?
@ -1437,18 +1437,18 @@ loc_1AB8E:
sprintf(strDeity, "Deity mode %s for player", strDMode);
StatusMessage(150, strDeity);
}
else if (buttons & 0x20) // LOBOCOP cheat
else if (buttons & kButtonCheatGuns) // LOBOCOP cheat
{
FillWeapons(nPlayer);
StatusMessage(150, "All weapons loaded for player");
}
else if (buttons & 0x80) // LOBOPICK cheat
else if (buttons & kButtonCheatKeys) // LOBOPICK cheat
{
PlayerList[nPlayer].keys = 0xFFFF;
StatusMessage(150, "All keys loaded for player");
RefreshStatus();
}
else if (buttons & 0x100) // LOBOSWAG cheat
else if (buttons & kButtonCheatItems) // LOBOSWAG cheat
{
FillItems(nPlayer);
StatusMessage(150, "All items loaded for player");