- noclip cheat and splitting of Exhumed's cheat code into its own file.

This commit is contained in:
Christoph Oelckers 2020-09-03 00:41:32 +02:00
parent 66bf8113b8
commit a0874a26a7
17 changed files with 261 additions and 279 deletions

View file

@ -50,16 +50,15 @@ void sub_5A928(void)
const char *SetGodMode(bool god) const char *SetGodMode(bool god)
{ {
playerSetGodMode(gMe, god); playerSetGodMode(gMe, god);
bPlayerCheated = true;
return gMe->godMode? GStrings("TXTB_GODMODE") : GStrings("TXTB_NOTGODMODE"); return gMe->godMode? GStrings("TXTB_GODMODE") : GStrings("TXTB_NOTGODMODE");
} }
void SetClipMode(bool noclip) const char *SetClipMode(bool noclip)
{ {
gNoClip = noclip; gNoClip = noclip;
if (gNoClip) bPlayerCheated = true;
viewSetMessage(GStrings("TXTB_NOCLIP")); return gNoClip? GStrings("TXTB_NOCLIP") : GStrings("TXTB_NOCLIPOFF");
else
viewSetMessage(GStrings("TXTB_NOCLIPOFF"));
} }
void packStuff(PLAYER *pPlayer) void packStuff(PLAYER *pPlayer)
@ -312,18 +311,6 @@ void ProcessCheat(CHEATCODE nCheatCode, char* pzArgs)
case kCheatSatchel: case kCheatSatchel:
SetToys(true); SetToys(true);
break; break;
case kCheatEvaGalli:
SetClipMode(!gNoClip);
break;
case kCheatMpkfa:
viewSetMessage(SetGodMode(!gMe->godMode));
break;
case kCheatCapInMyAss:
viewSetMessage(SetGodMode(false));
break;
case kCheatNoCapInMyAss:
viewSetMessage(SetGodMode(true));
break;
case kCheatIdaho: case kCheatIdaho:
SetWeapons(true); SetWeapons(true);
break; break;
@ -468,6 +455,9 @@ const char* GameInterface::GenericCheat(int player, int cheat)
case CHT_GODON: case CHT_GODON:
return SetGodMode(true); return SetGodMode(true);
case CHT_NOCLIP:
return SetClipMode(!gNoClip);
default: default:
return nullptr; return nullptr;
} }
@ -514,7 +504,7 @@ static cheatseq_t s_CheatInfo[] = {
{"CLARICE", nullptr, doCheat<kCheatClarice>, 0 }, // CLARICE (Gives 100% body armor, 100% fire armor, 100% spirit armor) {"CLARICE", nullptr, doCheat<kCheatClarice>, 0 }, // CLARICE (Gives 100% body armor, 100% fire armor, 100% spirit armor)
{"FORK YOU", nullptr, doCheat<kCheatForkYou>, 0 }, // FORK YOU (Drunk mode, 1HP, no armor, no weapons, no ammo, no items, no keys, no map, guns akimbo power-up) {"FORK YOU", nullptr, 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", nullptr, doCheat<kCheatLieberMan>, 0 }, // LIEBERMAN (Sets the you cheated flag to true, at the end of the level you will see that you have cheated) {"LIEBERMAN", nullptr, 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", nullptr, doCheat<kCheatEvaGalli>, 0 }, // EVA GALLI (Disable/enable clipping (grant the ability to walk through walls)) {"EVA GALLI", "noclip" }, // EVA GALLI (Disable/enable clipping (grant the ability to walk through walls))
{"RATE", nullptr, doCheat<kCheatRate>, 1 }, // RATE (Display frame rate (doesn't count as a cheat)) {"RATE", nullptr, doCheat<kCheatRate>, 1 }, // RATE (Display frame rate (doesn't count as a cheat))
{"GOONIES", nullptr, doCheat<kCheatGoonies>, 0 }, // GOONIES (Enable full map. Displays the message "YOU HAVE THE MAP".) {"GOONIES", nullptr, doCheat<kCheatGoonies>, 0 }, // GOONIES (Enable full map. Displays the message "YOU HAVE THE MAP".)
//{"SPIELBERG", nullptr, 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.) //{"SPIELBERG", nullptr, 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.)

View file

@ -91,6 +91,5 @@ void SetWeapons(bool stat);
void SetToys(bool stat); void SetToys(bool stat);
void SetArmor(bool stat); void SetArmor(bool stat);
void SetKeys(bool stat); void SetKeys(bool stat);
void SetClipMode(bool noclip);
END_BLD_NS END_BLD_NS

View file

@ -129,21 +129,6 @@ static int osdcmd_give(CCmdFuncPtr parm)
return CCMD_SHOWHELP; return CCMD_SHOWHELP;
} }
static int osdcmd_noclip(CCmdFuncPtr)
{
if (numplayers == 1 && gamestate == GS_LEVEL)
{
SetClipMode(!gNoClip);
bPlayerCheated = true;
}
else
{
Printf("noclip: Not in a single-player game.\n");
}
return CCMD_OK;
}
static int osdcmd_levelwarp(CCmdFuncPtr parm) static int osdcmd_levelwarp(CCmdFuncPtr parm)
{ {
if (parm->numparms != 2) if (parm->numparms != 2)
@ -236,7 +221,6 @@ int32_t registerosdcommands(void)
{ {
C_RegisterFunction("map","map <mapname>: loads the given map", osdcmd_map); C_RegisterFunction("map","map <mapname>: 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("noclip","noclip: toggles clipping mode", osdcmd_noclip);
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);
C_RegisterFunction("warptocoords","warptocoords [x] [y] [z] [ang] (optional) [horiz] (optional): warps the player to the specified coordinates",osdcmd_warptocoords); C_RegisterFunction("warptocoords","warptocoords [x] [y] [z] [ang] (optional) [horiz] (optional): warps the player to the specified coordinates",osdcmd_warptocoords);
C_RegisterFunction("third_person_view", "Switch to third person view", osdcmd_third_person_view); C_RegisterFunction("third_person_view", "Switch to third person view", osdcmd_third_person_view);

View file

@ -115,9 +115,15 @@ bool Cheat_Responder (event_t *ev)
{ {
if (CheatAddKey (cheats, (uint8_t)ev->data2, &eat)) if (CheatAddKey (cheats, (uint8_t)ev->data2, &eat))
{ {
if (cheats->DontCheck || CheckCheatmode ()) if (cheats->DontCheck || !CheckCheatmode ())
{ {
eat |= cheats->Handler (cheats); if (cheats->Handler)
eat |= cheats->Handler (cheats);
else if (cheats->ccmd)
{
eat = true;
C_DoCommand(cheats->ccmd);
}
} }
} }
else if (cheats->Pos - cheats->Sequence > 2) else if (cheats->Pos - cheats->Sequence > 2)

View file

@ -121,4 +121,13 @@ CCMD(godoff)
} }
} }
CCMD(noclip)
{
if (!CheckCheatmode(true, true))
{
Net_WriteByte(DEM_GENERICCHEAT);
Net_WriteByte(CHT_NOCLIP);
}
}

View file

@ -99,7 +99,8 @@ enum ECheat
CHT_NONE, CHT_NONE,
CHT_GOD, CHT_GOD,
CHT_GODON, CHT_GODON,
CHT_GODOFF CHT_GODOFF,
CHT_NOCLIP,
}; };
typedef void(*NetCommandHandler)(int player, uint8_t **stream, bool skip); typedef void(*NetCommandHandler)(int player, uint8_t **stream, bool skip);

View file

@ -6,6 +6,7 @@ set( PCH_SOURCES
src/bubbles.cpp src/bubbles.cpp
src/bullet.cpp src/bullet.cpp
src/cd.cpp src/cd.cpp
src/cheats.cpp
src/enginesubs.cpp src/enginesubs.cpp
src/exhumed.cpp src/exhumed.cpp
src/fish.cpp src/fish.cpp

View file

@ -0,0 +1,180 @@
//-------------------------------------------------------------------------
/*
Copyright (C) 2010-2019 EDuke32 developers and contributors
Copyright (C) 2019 sirlemonhead, Nuke.YKT
This file is part of PCExhumed.
PCExhumed is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License version 2
as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
//-------------------------------------------------------------------------
#include "ns.h"
#include "compat.h"
#include "common.h"
#include "engine.h"
#include "exhumed.h"
#include "sequence.h"
#include "names.h"
#include "player.h"
#include "ps_input.h"
#include "sound.h"
#include "view.h"
#include "status.h"
#include "version.h"
#include "gamecvars.h"
#include "savegamehelp.h"
#include "c_dispatch.h"
#include "raze_sound.h"
#include "gamestate.h"
#include "c_console.h"
#include "cheathandler.h"
#include "inputstate.h"
#include "d_protocol.h"
#include "gstrings.h"
BEGIN_PS_NS
static const char* GodCheat(int nPlayer, int state)
{
if (state == -1)
{
if (PlayerList[nPlayer].invincibility >= 0)
PlayerList[nPlayer].invincibility = -1;
else
PlayerList[nPlayer].invincibility = 0;
}
else PlayerList[nPlayer].invincibility = -state;
return GStrings(PlayerList[nPlayer].invincibility ? "TXT_EX_DEITYON" : "TXT_EX_DEITYOFF");
}
static const char* SlipCheat()
{
if (bSlipMode == false)
{
bSlipMode = true;
return GStrings("TXT_EX_SLIPON");
}
else
{
bSlipMode = false;
return GStrings("TXT_EX_SLIPOFF");
}
}
const char* GameInterface::GenericCheat(int player, int cheat)
{
switch (cheat)
{
case CHT_GOD:
return GodCheat(player, -1);
case CHT_GODOFF:
return GodCheat(player, 0);
case CHT_GODON:
return GodCheat(player, 1);
case CHT_NOCLIP:
return SlipCheat();
default:
return nullptr;
}
}
static bool HollyCheat(cheatseq_t* c)
{
// Do the closest thing to this cheat that's available.
C_ToggleConsole();
return true;
}
static bool KimberlyCheat(cheatseq_t* c)
{
Printf(PRINT_NOTIFY, "%s\n", GStrings("TXT_EX_SWEETIE"));
return true;
}
static bool CopCheat(cheatseq_t* c)
{
lLocalCodes |= kButtonCheatGuns;
return true;
}
static bool LiteCheat(cheatseq_t* c)
{
Printf(PRINT_NOTIFY, "%s\n", GStrings("TXT_EX_FLASHES"));
bDoFlashes = !bDoFlashes;
g_visibility = 2048 + 512 - g_visibility; // let there be light - for real!
return true;
}
static bool KeyCheat(cheatseq_t* c)
{
lLocalCodes |= kButtonCheatKeys;
return true;
}
static bool SnakeCheat(cheatseq_t* c)
{
if (!nNetPlayerCount)
{
if (bSnakeCam == false)
{
bSnakeCam = true;
Printf(PRINT_NOTIFY, "%s\n", GStrings("TXT_EX_SNAKEON"));
}
else {
bSnakeCam = false;
Printf(PRINT_NOTIFY, "%s\n", GStrings("TXT_EX_SNAKEOFF"));
}
}
return true;
}
static bool SphereCheat(cheatseq_t* c)
{
Printf(PRINT_NOTIFY, "%s\n", GStrings("TXT_EX_FULLMAP"));
GrabMap();
bShowTowers = true;
return true;
}
static bool SwagCheat(cheatseq_t* c)
{
lLocalCodes |= kButtonCheatItems;
return true;
}
static cheatseq_t excheats[] = {
{"holly", nullptr, HollyCheat, 0},
{"kimberly", nullptr, KimberlyCheat, 0},
{"lobocop", nullptr, CopCheat, 0},
{"lobodeity", "god" },
{"lobolite", nullptr, LiteCheat, 0},
{"lobopick", nullptr, KeyCheat, 0},
{"loboslip", "noclip" },
{"lobosnake", nullptr, SnakeCheat, 0},
{"lobosphere", nullptr, SphereCheat, 0},
{"loboswag", nullptr, SwagCheat, 0},
{"loboxy", "stat printcoords", nullptr, true},
};
void InitCheats()
{
SetCheats(excheats, countof(excheats));
}
END_PS_NS

View file

@ -61,6 +61,7 @@ extern short bLockPan;
void uploadCinemaPalettes(); void uploadCinemaPalettes();
int32_t registerosdcommands(void); int32_t registerosdcommands(void);
void InitFonts(); void InitFonts();
void InitCheats();
int EndLevel = false; int EndLevel = false;
@ -102,7 +103,6 @@ void CopyTileToBitmap(short nSrcTile, short nDestTile, int xPos, int yPos);
void EraseScreen(int nVal); void EraseScreen(int nVal);
void LoadStatus(); void LoadStatus();
void MySetView(int x1, int y1, int x2, int y2); void MySetView(int x1, int y1, int x2, int y2);
void mysetbrightness(char al);
char sHollyStr[40]; char sHollyStr[40];
@ -196,147 +196,6 @@ void ShutDown(void)
//UnInitFX(); //UnInitFX();
} }
static const char* GodCheat(int nPlayer, int state)
{
if (state == -1)
{
if (PlayerList[nPlayer].invincibility >= 0)
PlayerList[nPlayer].invincibility = -1;
else
PlayerList[nPlayer].invincibility = 0;
}
else PlayerList[nPlayer].invincibility = -state;
return GStrings(PlayerList[nPlayer].invincibility ? "TXT_EX_DEITYON" : "TXT_EX_DEITYOFF");
}
const char* GameInterface::GenericCheat(int player, int cheat)
{
switch (cheat)
{
case CHT_GOD:
return GodCheat(player, -1);
case CHT_GODOFF:
return GodCheat(player, 0);
case CHT_GODON:
return GodCheat(player, 1);
default:
return nullptr;
}
}
static bool HollyCheat(cheatseq_t* c)
{
// Do the closest thing to this cheat that's available.
C_ToggleConsole();
return true;
}
static bool KimberlyCheat(cheatseq_t* c)
{
Printf(PRINT_NOTIFY, "%s\n", GStrings("TXT_EX_SWEETIE"));
return true;
}
static bool CopCheat(cheatseq_t* c)
{
lLocalCodes |= kButtonCheatGuns;
return true;
}
static bool LiteCheat(cheatseq_t* c)
{
Printf(PRINT_NOTIFY, "%s\n", GStrings("TXT_EX_FLASHES"));
bDoFlashes = !bDoFlashes;
return true;
}
static bool KeyCheat(cheatseq_t* c)
{
lLocalCodes |= kButtonCheatKeys;
return true;
}
bool SlipCheat(cheatseq_t* c)
{
if (!nNetPlayerCount)
{
if (bSlipMode == false)
{
bSlipMode = true;
Printf(PRINT_NOTIFY, "%s\n", GStrings("TXT_EX_SLIPON"));
}
else {
bSlipMode = false;
Printf(PRINT_NOTIFY, "%s\n", GStrings("TXT_EX_SLIPOFF"));
}
}
return true;
}
static bool SnakeCheat(cheatseq_t* c)
{
if (!nNetPlayerCount)
{
if (bSnakeCam == false)
{
bSnakeCam = true;
Printf(PRINT_NOTIFY, "%s\n", GStrings("TXT_EX_SNAKEON"));
}
else {
bSnakeCam = false;
Printf(PRINT_NOTIFY, "%s\n", GStrings("TXT_EX_SNAKEOFF"));
}
}
return true;
}
static bool SphereCheat(cheatseq_t* c)
{
Printf(PRINT_NOTIFY, "%s\n", GStrings("TXT_EX_FULLMAP"));
GrabMap();
bShowTowers = true;
return true;
}
static bool SwagCheat(cheatseq_t* c)
{
lLocalCodes |= kButtonCheatItems;
return true;
}
static bool CoordCheat(cheatseq_t* c)
{
C_DoCommand("stat printcoords");
return true;
}
static cheatseq_t excheats[] = {
{"holly", nullptr, HollyCheat, 0},
{"kimberly", nullptr, KimberlyCheat, 0},
{"lobocop", nullptr, CopCheat, 0},
{"lobodeity", "god" },
{"lobolite", nullptr, LiteCheat, 0},
{"lobopick", nullptr, KeyCheat, 0},
{"loboslip", nullptr, SlipCheat, 0},
{"lobosnake", nullptr, SnakeCheat, 0},
{"lobosphere", nullptr, SphereCheat, 0},
{"loboswag", nullptr, SwagCheat, 0},
{"loboxy", nullptr, CoordCheat, true},
};
void mysetbrightness(char nBrightness)
{
g_visibility = 2048 - (nBrightness << 9);
}
void DoClockBeep() void DoClockBeep()
{ {
for (int i = headspritestat[407]; i != -1; i = nextspritestat[i]) { for (int i = headspritestat[407]; i != -1; i = nextspritestat[i]) {
@ -625,7 +484,7 @@ void GameInterface::app_init()
mi->cdSongId = (nTrack % 8) + 11; mi->cdSongId = (nTrack % 8) + 11;
} }
SetCheats(excheats, countof(excheats)); InitCheats();
registerosdcommands(); registerosdcommands();
if (nNetPlayerCount == -1) if (nNetPlayerCount == -1)
{ {

View file

@ -74,8 +74,6 @@ void mydeletesprite(int nSprite);
void GrabPalette(); void GrabPalette();
void mysetbrightness(char nBrightness);
void StartFadeIn(); void StartFadeIn();
void InitSpiritHead(); void InitSpiritHead();
@ -157,6 +155,7 @@ extern short nRedTicks;
extern short nClockVal; extern short nClockVal;
extern short bSlipMode; extern short bSlipMode;
extern short bDoFlashes;
extern int bVanilla; extern int bVanilla;

View file

@ -34,21 +34,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
BEGIN_PS_NS BEGIN_PS_NS
bool SlipCheat(cheatseq_t* c);
static int osdcmd_noclip(CCmdFuncPtr)
{
if (!nNetPlayerCount && !bInDemo)
{
SlipCheat(nullptr);
}
else
{
Printf("noclip: Not in a single-player game.\n");
}
return CCMD_OK;
}
static int osdcmd_map(CCmdFuncPtr parm) static int osdcmd_map(CCmdFuncPtr parm)
{ {
@ -212,7 +197,6 @@ int32_t registerosdcommands(void)
C_RegisterFunction("map","map <mapname>: loads the given map", osdcmd_map); C_RegisterFunction("map","map <mapname>: loads the given map", osdcmd_map);
C_RegisterFunction("exitmap", "exits current map", osdcmd_exitmap); C_RegisterFunction("exitmap", "exits current map", osdcmd_exitmap);
C_RegisterFunction("doors", "opens/closes doors", osdcmd_doors); C_RegisterFunction("doors", "opens/closes doors", osdcmd_doors);
C_RegisterFunction("noclip","noclip: toggles clipping mode", osdcmd_noclip);
C_RegisterFunction("spawn","spawn <creaturetype>: spawns a creature",osdcmd_spawn); C_RegisterFunction("spawn","spawn <creaturetype>: spawns a creature",osdcmd_spawn);
C_RegisterFunction("warptocoords","warptocoords [x] [y] [z] [ang] (optional) [horiz] (optional): warps the player to the specified coordinates",osdcmd_warptocoords); C_RegisterFunction("warptocoords","warptocoords [x] [y] [z] [ang] (optional) [horiz] (optional): warps the player to the specified coordinates",osdcmd_warptocoords);
C_RegisterFunction("third_person_view", "Switch to third person view", osdcmd_third_person_view); C_RegisterFunction("third_person_view", "Switch to third person view", osdcmd_third_person_view);

View file

@ -38,7 +38,6 @@ Modifications for JonoF's port by Jonathon Fowler (jf@jonof.id.au)
BEGIN_DUKE_NS BEGIN_DUKE_NS
bool cheatGod(cheatseq_t*); bool cheatGod(cheatseq_t*);
bool cheatClip(cheatseq_t*);
bool cheatWeapons(cheatseq_t* s); bool cheatWeapons(cheatseq_t* s);
bool cheatStuff(cheatseq_t* s); bool cheatStuff(cheatseq_t* s);
bool cheatKeys(cheatseq_t* s); bool cheatKeys(cheatseq_t* s);
@ -120,20 +119,6 @@ static int ccmd_map(CCmdFuncPtr parm)
return CCMD_OK; return CCMD_OK;
} }
static int ccmd_noclip(CCmdFuncPtr)
{
if (numplayers == 1 && ps[myconnectindex].gm & MODE_GAME)
{
cheatClip(nullptr);
}
else
{
Printf("noclip: Not in a single-player game.\n");
}
return CCMD_OK;
}
static int ccmd_restartmap(CCmdFuncPtr) static int ccmd_restartmap(CCmdFuncPtr)
{ {
if (ps[myconnectindex].gm & MODE_GAME && ud.multimode == 1) if (ps[myconnectindex].gm & MODE_GAME && ud.multimode == 1)
@ -323,7 +308,6 @@ int registerosdcommands(void)
C_RegisterFunction("map","map <mapname>: warp to the given map, identified by its name", ccmd_map); C_RegisterFunction("map","map <mapname>: warp to the given map, identified by its name", ccmd_map);
C_RegisterFunction("levelwarp","levelwarp <e> <m>: warp to episode 'e' and map 'm'", ccmd_levelwarp); C_RegisterFunction("levelwarp","levelwarp <e> <m>: warp to episode 'e' and map 'm'", ccmd_levelwarp);
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("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);
C_RegisterFunction("spawn","spawn <picnum> [palnum] [cstat] [ang] [x y z]: spawns a sprite with the given properties",ccmd_spawn); C_RegisterFunction("spawn","spawn <picnum> [palnum] [cstat] [ang] [x y z]: spawns a sprite with the given properties",ccmd_spawn);
C_RegisterFunction("warptocoords","warptocoords [x] [y] [z] [ang] (optional) [horiz] (optional): warps the player to the specified coordinates",osdcmd_warptocoords); C_RegisterFunction("warptocoords","warptocoords [x] [y] [z] [ang] (optional) [horiz] (optional): warps the player to the specified coordinates",osdcmd_warptocoords);

View file

@ -105,6 +105,10 @@ const char* GameInterface::GenericCheat(int player, int cheat)
case CHT_GODON: case CHT_GODON:
return cheatGod(player, 1); return cheatGod(player, 1);
case CHT_NOCLIP:
ud.clipping = 1 - ud.clipping;
return quoteMgr.GetQuote(ud.clipping ? QUOTE_CHEAT_NOCLIP : QUOTE_CHEAT_NOCLIP);
default: default:
return nullptr; return nullptr;
} }
@ -170,13 +174,6 @@ static bool cheatDebug(cheatseq_t *)
return true; return true;
} }
bool cheatClip(cheatseq_t *)
{
ud.clipping = 1-ud.clipping;
FTA(112+ud.clipping,&ps[myconnectindex]);
return true;
}
static bool cheatAllen(cheatseq_t *) static bool cheatAllen(cheatseq_t *)
{ {
FTA(79,&ps[myconnectindex]); FTA(79,&ps[myconnectindex]);
@ -458,7 +455,7 @@ static cheatseq_t dukecheats[] = {
{ "dnshowmap", nullptr, cheatMap }, { "dnshowmap", nullptr, cheatMap },
{ "dnkroz", "god" }, { "dnkroz", "god" },
{ "dnallen", nullptr, cheatAllen }, { "dnallen", nullptr, cheatAllen },
{ "dnclip", nullptr, cheatClip }, { "dnclip", "noclip" },
{ "dnweapons", nullptr, cheatWeapons }, { "dnweapons", nullptr, cheatWeapons },
{ "dninventory", nullptr, cheatInventory }, { "dninventory", nullptr, cheatInventory },
{ "dnkeys", nullptr, cheatKeys }, { "dnkeys", nullptr, cheatKeys },
@ -481,7 +478,7 @@ static cheatseq_t ww2cheats[] =
{ "gi2matt", nullptr, cheatTodd }, { "gi2matt", nullptr, cheatTodd },
{ "gi2showmap", nullptr, cheatMap }, { "gi2showmap", nullptr, cheatMap },
{ "gi2ryan", "god" }, { "gi2ryan", "god" },
{ "gi2clip", nullptr, cheatClip }, { "gi2clip", "noclip" },
{ "gi2weapons", nullptr, cheatWeapons }, { "gi2weapons", nullptr, cheatWeapons },
{ "gi2inventory", nullptr, cheatInventory }, { "gi2inventory", nullptr, cheatInventory },
{ "gi2debug", nullptr, cheatDebug, 1 }, { "gi2debug", nullptr, cheatDebug, 1 },
@ -502,7 +499,7 @@ static cheatseq_t namcheats[] = {
{ "nvamatt", nullptr, cheatTodd }, { "nvamatt", nullptr, cheatTodd },
{ "nvashowmap", nullptr, cheatMap }, { "nvashowmap", nullptr, cheatMap },
{ "nvagod", "god" }, { "nvagod", "god" },
{ "nvaclip", nullptr, cheatClip }, { "nvaclip", "noclip" },
{ "nvaweapons", nullptr, cheatWeapons }, { "nvaweapons", nullptr, cheatWeapons },
{ "nvainventory",nullptr, cheatInventory }, { "nvainventory",nullptr, cheatInventory },
{ "nvadebug", nullptr, cheatDebug, 1 }, { "nvadebug", nullptr, cheatDebug, 1 },
@ -527,7 +524,7 @@ static cheatseq_t rrcheats[] = {
{ "rdrafael", nullptr, cheatTodd }, { "rdrafael", nullptr, cheatTodd },
{ "rdshowmap", nullptr, cheatMap }, { "rdshowmap", nullptr, cheatMap },
{ "rdelvis", "god" }, { "rdelvis", "god" },
{ "rdclip", nullptr, cheatClip }, { "rdclip", "noclip" },
{ "rdguns", nullptr, cheatWeapons }, { "rdguns", nullptr, cheatWeapons },
{ "rdinventory", nullptr, cheatInventory }, { "rdinventory", nullptr, cheatInventory },
{ "rdkeys", nullptr, cheatKeys }, { "rdkeys", nullptr, cheatKeys },

View file

@ -210,6 +210,7 @@ enum EQuote
QUOTE_NVG_OFF = 107, QUOTE_NVG_OFF = 107,
QUOTE_VIEW_MODE_OFF = 109, QUOTE_VIEW_MODE_OFF = 109,
QUOTE_SHOW_MAP_ON = 111, QUOTE_SHOW_MAP_ON = 111,
QUOTE_CHEAT_CLIP = 112,
QUOTE_CHEAT_NOCLIP = 113, QUOTE_CHEAT_NOCLIP = 113,
QUOTE_SAVE_BAD_VERSION = 114, QUOTE_SAVE_BAD_VERSION = 114,
QUOTE_RESERVED = 115, QUOTE_RESERVED = 115,

View file

@ -74,7 +74,6 @@ const char *GameInterface::CheckCheatMode()
return nullptr; return nullptr;
} }
const char *GameInterface::GenericCheat(int player, int cheat) const char *GameInterface::GenericCheat(int player, int cheat)
{ {
switch (cheat) switch (cheat)
@ -91,6 +90,10 @@ const char *GameInterface::GenericCheat(int player, int cheat)
GodMode = 1; // fixme: Make god mode a player property. GodMode = 1; // fixme: Make god mode a player property.
return GStrings("GOD MODE: ON"); return GStrings("GOD MODE: ON");
case CHT_NOCLIP:
Player[player].Flags ^= PF_CLIP_CHEAT;
return GStrings(Player[player].Flags & PF_CLIP_CHEAT ? "CLIPPING: OFF" : "CLIPPING: ON");
default: default:
return nullptr; return nullptr;
} }
@ -214,15 +217,6 @@ bool AmmoCheat(cheatseq_t* c)
return true; return true;
} }
bool ClipCheat(cheatseq_t* c)
{
PLAYERp pp;
if (!(pp = checkCheat(c))) return false;
FLIP(pp->Flags, PF_CLIP_CHEAT);
PutStringInfo(pp, GStrings(TEST(pp->Flags, PF_CLIP_CHEAT) ? "CLIPPING: OFF" : "CLIPPING: ON"));
return true;
}
bool WarpCheat(cheatseq_t* c) bool WarpCheat(cheatseq_t* c)
{ {
PLAYERp pp; PLAYERp pp;
@ -442,7 +436,7 @@ static cheatseq_t swcheats[] = {
{"lwguns", nullptr, WeaponCheat, 0}, {"lwguns", nullptr, WeaponCheat, 0},
{"lwtrek##", nullptr, WarpCheat, 0}, {"lwtrek##", nullptr, WarpCheat, 0},
{"lwgreed", nullptr, EveryCheatToggle, 0}, {"lwgreed", nullptr, EveryCheatToggle, 0},
{"lwghost", nullptr, ClipCheat, 0}, {"lwghost", "noclip" },
{"lwstart", nullptr, RestartCheat, 0}, {"lwstart", nullptr, RestartCheat, 0},
{"lwloc", nullptr, LocCheat, 0}, {"lwloc", nullptr, LocCheat, 0},
{"lwmap", nullptr, MapCheat, 0}, {"lwmap", nullptr, MapCheat, 0},

View file

@ -1021,41 +1021,42 @@ extern PLAYER Player[MAX_SW_PLAYERS_REG+1];
// Player Flags // Player Flags
// //
#define PF_DEAD (BIT(1)) enum
#define PF_JUMPING (BIT(2)) {
#define PF_FALLING (BIT(3)) PF_DEAD = (BIT(1)),
#define PF_LOCK_CRAWL (BIT(4)) PF_JUMPING = (BIT(2)),
#define PF_LOCK_HORIZ (BIT(5)) PF_FALLING = (BIT(3)),
#define PF_LOOKING (BIT(6)) PF_LOCK_CRAWL = (BIT(4)),
#define PF_PLAYER_MOVED (BIT(7)) PF_LOCK_HORIZ = (BIT(5)),
#define PF_PLAYER_RIDING (BIT(8)) PF_LOOKING = (BIT(6)),
#define PF_AUTO_AIM (BIT(9)) PF_PLAYER_MOVED = (BIT(7)),
#define PF_RECOIL (BIT(10)) PF_PLAYER_RIDING = (BIT(8)),
PF_AUTO_AIM = (BIT(9)),
#define PF_FLYING (BIT(11)) PF_RECOIL = (BIT(10)),
#define PF_WEAPON_RETRACT (BIT(12)) PF_FLYING = (BIT(11)),
#define PF_PICKED_UP_AN_UZI (BIT(13)) PF_WEAPON_RETRACT = (BIT(12)),
#define PF_CRAWLING (BIT(14)) PF_PICKED_UP_AN_UZI = (BIT(13)),
#define PF_CLIMBING (BIT(15)) PF_CRAWLING = (BIT(14)),
#define PF_SWIMMING (BIT(16)) PF_CLIMBING = (BIT(15)),
#define PF_DIVING (BIT(17)) PF_SWIMMING = (BIT(16)),
#define PF_DIVING_IN_LAVA (BIT(18)) PF_DIVING = (BIT(17)),
#define PF_TWO_UZI (BIT(19)) PF_DIVING_IN_LAVA = (BIT(18)),
#define PF_TURN_180 (BIT(21)) PF_TWO_UZI = (BIT(19)),
#define PF_DEAD_HEAD (BIT(22)) // are your a dead head PF_TURN_180 = (BIT(21)),
#define PF_HEAD_CONTROL (BIT(23)) // have control of turning when a head? PF_DEAD_HEAD = (BIT(22)), // are your a dead head
#define PF_CLIP_CHEAT (BIT(24)) // cheat for wall clipping PF_HEAD_CONTROL = (BIT(23)), // have control of turning when a head?
#define PF_SLIDING (BIT(25)) // cheat for wall clipping PF_CLIP_CHEAT = (BIT(24)), // cheat for wall clipping
#define PF_VIEW_FROM_OUTSIDE (BIT(26)) PF_SLIDING = (BIT(25)), // cheat for wall clipping
#define PF_VIEW_OUTSIDE_WEAPON (BIT(27)) PF_VIEW_FROM_OUTSIDE = (BIT(26)),
#define PF_VIEW_FROM_CAMERA (BIT(28)) PF_VIEW_OUTSIDE_WEAPON= (BIT(27)),
#define PF_TANK (BIT(29)) // Doin the tank thang PF_VIEW_FROM_CAMERA = (BIT(28)),
#define PF_MOUSE_AIMING_ON (BIT(30)) PF_TANK = (BIT(29)), // Doin the tank thang
#define PF_WEAPON_DOWN (BIT(31)) PF_MOUSE_AIMING_ON = (BIT(30)),
PF_WEAPON_DOWN = (BIT(31)),
#define PF2_TELEPORTED (BIT(0)) PF2_TELEPORTED = (BIT(0)),
#define PF2_INPUT_CAN_TURN (BIT(1)) // Allow calling DoPlayerTurn from getinput PF2_INPUT_CAN_TURN = (BIT(1)), // Allow calling DoPlayerTurn from getinput
#define PF2_INPUT_CAN_AIM (BIT(2)) // Allow calling DoPlayerHorizon from getinput PF2_INPUT_CAN_AIM = (BIT(2)), // Allow calling DoPlayerHorizon from getinput
};
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
// //

View file

@ -100,12 +100,6 @@ static int osdcmd_map(CCmdFuncPtr parm)
return CCMD_OK; return CCMD_OK;
} }
static int osdcmd_noclip(CCmdFuncPtr)
{
C_DoCommand("activatecheat lwghost");
return CCMD_OK;
}
int osdcmd_restartmap(CCmdFuncPtr) int osdcmd_restartmap(CCmdFuncPtr)
{ {
C_DoCommand("activatecheat lwstart"); C_DoCommand("activatecheat lwstart");
@ -295,7 +289,6 @@ int32_t registerosdcommands(void)
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("bunny", "bunny: toggles bunny rocket mode", osdcmd_bunny); C_RegisterFunction("bunny", "bunny: toggles bunny rocket mode", osdcmd_bunny);
C_RegisterFunction("mirror_debug", "mirror [mirrornum]: print mirror debug info", osdcmd_mirror); C_RegisterFunction("mirror_debug", "mirror [mirrornum]: print mirror debug info", osdcmd_mirror);
C_RegisterFunction("noclip","noclip: toggles clipping mode", osdcmd_noclip);
C_RegisterFunction("levelwarp", "levelwarp <num>: warp to level", osdcmd_levelwarp); C_RegisterFunction("levelwarp", "levelwarp <num>: warp to level", osdcmd_levelwarp);
C_RegisterFunction("restartmap", "restartmap: restarts the current map", osdcmd_restartmap); C_RegisterFunction("restartmap", "restartmap: restarts the current map", osdcmd_restartmap);
C_RegisterFunction("warptocoords","warptocoords [x] [y] [z] [ang] (optional) [horiz] (optional): warps the player to the specified coordinates",osdcmd_warptocoords); C_RegisterFunction("warptocoords","warptocoords [x] [y] [z] [ang] (optional) [horiz] (optional): warps the player to the specified coordinates",osdcmd_warptocoords);