2015-05-19 21:54:34 +00:00
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
/*
|
|
|
|
Copyright (C) 1997, 2005 - 3D Realms Entertainment
|
|
|
|
|
|
|
|
This file is part of Shadow Warrior version 1.2
|
|
|
|
|
|
|
|
Shadow Warrior is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU General Public License
|
|
|
|
as published by the Free Software Foundation; either version 2
|
|
|
|
of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
Original Source: 1997 - Frank Maddin and Jim Norwood
|
|
|
|
Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
|
|
|
|
*/
|
|
|
|
//-------------------------------------------------------------------------
|
2019-11-17 17:02:17 +00:00
|
|
|
|
2019-10-09 16:09:05 +00:00
|
|
|
#include "ns.h"
|
|
|
|
|
2015-05-19 21:54:34 +00:00
|
|
|
#include "build.h"
|
|
|
|
|
|
|
|
#include "names2.h"
|
|
|
|
#include "panel.h"
|
|
|
|
#include "game.h"
|
|
|
|
#include "mytypes.h"
|
2020-08-05 22:18:45 +00:00
|
|
|
#include "misc.h"
|
2015-05-19 21:54:34 +00:00
|
|
|
|
2019-10-25 22:32:49 +00:00
|
|
|
#include "gamecontrol.h"
|
2019-12-09 20:19:05 +00:00
|
|
|
#include "gstrings.h"
|
2020-08-12 20:24:51 +00:00
|
|
|
#include "cheathandler.h"
|
2020-09-02 22:29:17 +00:00
|
|
|
#include "d_protocol.h"
|
|
|
|
#include "cheats.h"
|
2015-05-19 21:54:34 +00:00
|
|
|
//#include "inv.h"
|
|
|
|
|
2019-10-09 16:09:05 +00:00
|
|
|
BEGIN_SW_NS
|
2015-05-19 21:54:34 +00:00
|
|
|
|
2015-05-19 21:58:29 +00:00
|
|
|
SWBOOL CheatInputMode = FALSE;
|
|
|
|
SWBOOL EveryCheat = FALSE;
|
2020-03-01 15:33:06 +00:00
|
|
|
SWBOOL mapcheat = false;
|
2020-08-12 20:24:51 +00:00
|
|
|
extern SWBOOL FAF_DebugView;
|
2015-05-19 21:54:34 +00:00
|
|
|
|
2019-11-17 17:02:17 +00:00
|
|
|
const char *CheatKeyType;
|
|
|
|
void KeysCheat(PLAYERp pp, const char *cheat_string);
|
|
|
|
|
2020-08-12 20:24:51 +00:00
|
|
|
static PLAYERp checkCheat(cheatseq_t* c)
|
2015-05-19 21:54:34 +00:00
|
|
|
{
|
2020-08-12 20:24:51 +00:00
|
|
|
if (CommEnabled)
|
|
|
|
return nullptr;
|
2015-05-19 21:54:34 +00:00
|
|
|
|
2020-09-02 22:29:17 +00:00
|
|
|
if (Skill >= 3 && !c->DontCheck && !sv_cheats)
|
2020-08-12 20:24:51 +00:00
|
|
|
{
|
|
|
|
PutStringInfo(&Player[screenpeek], GStrings("TXTS_TOOSKILLFUL"));
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
return &Player[screenpeek];
|
2015-05-19 21:54:34 +00:00
|
|
|
}
|
|
|
|
|
2020-09-02 22:29:17 +00:00
|
|
|
const char *GameInterface::CheckCheatMode()
|
|
|
|
{
|
|
|
|
if (Skill >= 3 && !sv_cheats)
|
|
|
|
{
|
|
|
|
return GStrings("TXTS_TOOSKILLFUL");
|
|
|
|
}
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const char *GameInterface::GenericCheat(int player, int cheat)
|
|
|
|
{
|
|
|
|
switch (cheat)
|
|
|
|
{
|
|
|
|
case CHT_GOD:
|
|
|
|
GodMode ^= 1; // fixme: Make god mode a player property.
|
|
|
|
return GStrings(GodMode ? "GOD MODE: ON" : "GOD MODE: OFF");
|
|
|
|
|
|
|
|
case CHT_GODOFF:
|
|
|
|
GodMode = 0; // fixme: Make god mode a player property.
|
|
|
|
return GStrings("GOD MODE: OFF");
|
|
|
|
|
|
|
|
case CHT_GODON:
|
|
|
|
GodMode = 1; // fixme: Make god mode a player property.
|
|
|
|
return GStrings("GOD MODE: ON");
|
|
|
|
|
|
|
|
default:
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-08-12 20:24:51 +00:00
|
|
|
bool RestartCheat(cheatseq_t* c)
|
2015-05-19 21:54:34 +00:00
|
|
|
{
|
2020-08-12 20:24:51 +00:00
|
|
|
if (!checkCheat(c)) return false;
|
2015-05-19 21:54:34 +00:00
|
|
|
ExitLevel = TRUE;
|
2020-08-12 20:24:51 +00:00
|
|
|
return true;
|
2015-05-19 21:54:34 +00:00
|
|
|
}
|
|
|
|
|
2020-08-12 20:24:51 +00:00
|
|
|
bool RoomCheat(cheatseq_t* c)
|
2015-05-19 21:54:34 +00:00
|
|
|
{
|
|
|
|
FAF_DebugView ^= 1;
|
2020-08-12 20:24:51 +00:00
|
|
|
return true;
|
2015-05-19 21:54:34 +00:00
|
|
|
}
|
|
|
|
|
2020-08-12 20:24:51 +00:00
|
|
|
bool NextCheat(cheatseq_t* c)
|
2015-05-19 21:54:34 +00:00
|
|
|
{
|
2020-08-12 20:24:51 +00:00
|
|
|
if (!checkCheat(c)) return false;
|
2020-08-16 12:39:18 +00:00
|
|
|
if (!currentLevel) return true;
|
|
|
|
NextLevel = FindMapByLevelNum(currentLevel->levelNumber + 1);
|
|
|
|
if (NextLevel) ExitLevel = TRUE;
|
2020-08-12 20:24:51 +00:00
|
|
|
return true;
|
2015-05-19 21:54:34 +00:00
|
|
|
}
|
|
|
|
|
2020-08-12 20:24:51 +00:00
|
|
|
bool PrevCheat(cheatseq_t* c)
|
2015-05-19 21:54:34 +00:00
|
|
|
{
|
2020-08-12 20:24:51 +00:00
|
|
|
if (!checkCheat(c)) return false;
|
2020-08-16 12:39:18 +00:00
|
|
|
if (!currentLevel) return true;
|
|
|
|
NextLevel = FindMapByLevelNum(currentLevel->levelNumber - 1);
|
|
|
|
if (NextLevel) ExitLevel = TRUE;
|
2020-08-12 20:24:51 +00:00
|
|
|
return true;
|
2015-05-19 21:54:34 +00:00
|
|
|
}
|
|
|
|
|
2020-08-12 20:24:51 +00:00
|
|
|
bool MapCheat(cheatseq_t* c)
|
2015-05-19 21:54:34 +00:00
|
|
|
{
|
2020-08-12 20:24:51 +00:00
|
|
|
PLAYERp pp;
|
|
|
|
if (!(pp=checkCheat(c))) return false;
|
2020-03-01 15:33:06 +00:00
|
|
|
mapcheat = !mapcheat;
|
2019-12-31 21:05:23 +00:00
|
|
|
// Need to do this differently. The code here was completely broken.
|
2020-08-19 17:18:47 +00:00
|
|
|
PutStringInfo(pp, GStrings(mapcheat ? "TXTS_AMON" : "TXTS_AMOFF"));
|
2020-08-12 20:24:51 +00:00
|
|
|
return true;
|
2015-05-19 21:54:34 +00:00
|
|
|
}
|
|
|
|
|
2020-08-12 20:24:51 +00:00
|
|
|
bool LocCheat(cheatseq_t* c)
|
2015-05-19 21:54:34 +00:00
|
|
|
{
|
2020-08-12 20:24:51 +00:00
|
|
|
if (!checkCheat(c)) return false;
|
2015-05-19 21:58:29 +00:00
|
|
|
extern SWBOOL LocationInfo;
|
2015-05-19 21:54:34 +00:00
|
|
|
LocationInfo++;
|
|
|
|
if (LocationInfo > 2)
|
|
|
|
LocationInfo = 0;
|
2020-08-12 20:24:51 +00:00
|
|
|
return true;
|
2015-05-19 21:54:34 +00:00
|
|
|
}
|
|
|
|
|
2020-08-12 20:24:51 +00:00
|
|
|
bool WeaponCheat(cheatseq_t* c)
|
2015-05-19 21:54:34 +00:00
|
|
|
{
|
2020-08-12 20:24:51 +00:00
|
|
|
if (!checkCheat(c)) return false;
|
2015-05-19 21:54:34 +00:00
|
|
|
PLAYERp p;
|
|
|
|
short pnum;
|
|
|
|
unsigned int i;
|
|
|
|
USERp u;
|
|
|
|
|
|
|
|
TRAVERSE_CONNECT(pnum)
|
|
|
|
{
|
|
|
|
p = &Player[pnum];
|
|
|
|
u = User[p->PlayerSprite];
|
|
|
|
|
2019-11-30 06:10:58 +00:00
|
|
|
if (!TEST(p->Flags, PF_TWO_UZI))
|
|
|
|
{
|
|
|
|
SET(p->Flags, PF_TWO_UZI);
|
|
|
|
SET(p->Flags, PF_PICKED_UP_AN_UZI);
|
|
|
|
}
|
|
|
|
|
2015-05-19 21:54:34 +00:00
|
|
|
// ALL WEAPONS
|
|
|
|
if (!SW_SHAREWARE)
|
|
|
|
p->WpnFlags = 0xFFFFFFFF;
|
|
|
|
else
|
|
|
|
p->WpnFlags = 0x0000207F; // Disallows high weapon cheat in shareware
|
|
|
|
|
|
|
|
for (i = 0; i < SIZ(p->WpnAmmo); i++)
|
|
|
|
{
|
|
|
|
p->WpnAmmo[i] = DamageData[i].max_ammo;
|
|
|
|
}
|
|
|
|
|
2020-01-23 17:55:37 +00:00
|
|
|
p->WpnShotgunAuto = 50;
|
|
|
|
p->WpnRocketHeat = 5;
|
|
|
|
p->WpnRocketNuke = 1;
|
|
|
|
|
|
|
|
PlayerUpdateWeapon(p, u->WeaponNum);
|
|
|
|
}
|
2020-08-12 20:24:51 +00:00
|
|
|
return true;
|
2020-01-23 17:55:37 +00:00
|
|
|
}
|
|
|
|
|
2020-08-12 20:24:51 +00:00
|
|
|
bool AmmoCheat(cheatseq_t* c)
|
2020-01-23 17:55:37 +00:00
|
|
|
{
|
2020-08-12 20:24:51 +00:00
|
|
|
if (!checkCheat(c)) return false;
|
2020-01-23 17:55:37 +00:00
|
|
|
PLAYERp p;
|
|
|
|
short pnum;
|
|
|
|
unsigned int i;
|
|
|
|
USERp u;
|
|
|
|
|
|
|
|
TRAVERSE_CONNECT(pnum)
|
|
|
|
{
|
|
|
|
p = &Player[pnum];
|
|
|
|
u = User[p->PlayerSprite];
|
|
|
|
|
|
|
|
p->WpnShotgunAuto = 50;
|
|
|
|
p->WpnRocketHeat = 5;
|
|
|
|
p->WpnRocketNuke = 1;
|
|
|
|
|
|
|
|
for (i = 0; i < SIZ(p->WpnAmmo); i++)
|
|
|
|
{
|
|
|
|
p->WpnAmmo[i] = DamageData[i].max_ammo;
|
|
|
|
}
|
|
|
|
|
2015-05-19 21:54:34 +00:00
|
|
|
PlayerUpdateWeapon(p, u->WeaponNum);
|
|
|
|
}
|
2020-08-12 20:24:51 +00:00
|
|
|
return true;
|
2015-05-19 21:54:34 +00:00
|
|
|
}
|
|
|
|
|
2020-08-12 20:24:51 +00:00
|
|
|
bool ClipCheat(cheatseq_t* c)
|
2015-05-19 21:54:34 +00:00
|
|
|
{
|
2020-08-12 20:24:51 +00:00
|
|
|
PLAYERp pp;
|
|
|
|
if (!(pp = checkCheat(c))) return false;
|
2015-05-19 21:54:34 +00:00
|
|
|
FLIP(pp->Flags, PF_CLIP_CHEAT);
|
2020-08-12 20:24:51 +00:00
|
|
|
PutStringInfo(pp, GStrings(TEST(pp->Flags, PF_CLIP_CHEAT) ? "CLIPPING: OFF" : "CLIPPING: ON"));
|
|
|
|
return true;
|
2015-05-19 21:54:34 +00:00
|
|
|
}
|
|
|
|
|
2020-08-12 20:24:51 +00:00
|
|
|
bool WarpCheat(cheatseq_t* c)
|
2015-05-19 21:54:34 +00:00
|
|
|
{
|
2020-08-12 20:24:51 +00:00
|
|
|
PLAYERp pp;
|
|
|
|
if (!(pp = checkCheat(c))) return false;
|
2015-05-19 21:54:34 +00:00
|
|
|
int level_num;
|
|
|
|
|
2020-08-12 20:24:51 +00:00
|
|
|
level_num = atol((char*)c->Args);
|
2020-08-16 12:39:18 +00:00
|
|
|
auto maprec = FindMapByLevelNum(level_num);
|
|
|
|
if (!maprec) return false;
|
2015-05-19 21:54:34 +00:00
|
|
|
|
2020-08-12 20:24:51 +00:00
|
|
|
if (!pp) return true;
|
2020-08-16 12:39:18 +00:00
|
|
|
if (SW_SHAREWARE)
|
2015-05-19 21:54:34 +00:00
|
|
|
{
|
|
|
|
if (level_num > 4 || level_num < 1)
|
2020-08-12 20:24:51 +00:00
|
|
|
return false;
|
2015-05-19 21:54:34 +00:00
|
|
|
}
|
2020-02-13 23:37:15 +00:00
|
|
|
if (TEST(pp->Flags, PF_DEAD))
|
2020-08-12 20:24:51 +00:00
|
|
|
return true;
|
2020-02-13 23:37:15 +00:00
|
|
|
|
2015-05-19 21:54:34 +00:00
|
|
|
|
2020-08-16 12:39:18 +00:00
|
|
|
NextLevel = maprec;
|
2015-05-19 21:54:34 +00:00
|
|
|
ExitLevel = TRUE;
|
|
|
|
|
2020-08-16 12:39:18 +00:00
|
|
|
sprintf(ds, "%s %s", GStrings("TXT_ENTERING"), maprec->DisplayName());
|
2015-05-19 21:54:34 +00:00
|
|
|
PutStringInfo(pp, ds);
|
2020-08-12 20:24:51 +00:00
|
|
|
return true;
|
2015-05-19 21:54:34 +00:00
|
|
|
}
|
|
|
|
|
2020-08-12 20:24:51 +00:00
|
|
|
bool ItemCheat(cheatseq_t* c)
|
2015-05-19 21:54:34 +00:00
|
|
|
{
|
2020-08-12 20:24:51 +00:00
|
|
|
PLAYERp pp;
|
|
|
|
if (!(pp = checkCheat(c))) return false;
|
2015-05-19 21:54:34 +00:00
|
|
|
//
|
|
|
|
// Get all ITEMS
|
|
|
|
//
|
|
|
|
PLAYERp p;
|
|
|
|
short pnum;
|
|
|
|
short inv;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
PutStringInfo(pp, "ITEMS");
|
|
|
|
|
|
|
|
TRAVERSE_CONNECT(pnum)
|
|
|
|
{
|
|
|
|
p = &Player[pnum];
|
|
|
|
memset(p->HasKey, TRUE, sizeof(p->HasKey));
|
|
|
|
|
|
|
|
p->WpnShotgunAuto = 50;
|
|
|
|
p->WpnRocketHeat = 5;
|
|
|
|
p->WpnRocketNuke = 1;
|
|
|
|
p->Armor = 100;
|
|
|
|
|
|
|
|
for (inv = 0; inv < MAX_INVENTORY; inv++)
|
|
|
|
{
|
|
|
|
p->InventoryPercent[inv] = 100;
|
|
|
|
//p->InventoryAmount[inv] = 1;
|
|
|
|
p->InventoryAmount[inv] = InventoryData[inv].MaxInv;
|
|
|
|
//PlayerUpdateInventory(p, inv);
|
|
|
|
}
|
|
|
|
|
|
|
|
PlayerUpdateInventory(p, p->InventoryNum);
|
|
|
|
//p->InventoryNum = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i=0; i<numsectors; i++)
|
|
|
|
{
|
|
|
|
if (SectUser[i] && SectUser[i]->stag == SECT_LOCK_DOOR)
|
|
|
|
SectUser[i]->number = 0; // unlock all doors of this type
|
|
|
|
}
|
|
|
|
|
2020-08-12 20:24:51 +00:00
|
|
|
WeaponCheat(c);
|
|
|
|
return true;
|
2015-05-19 21:54:34 +00:00
|
|
|
}
|
|
|
|
|
2020-08-12 20:24:51 +00:00
|
|
|
bool InventoryCheat(cheatseq_t* c)
|
2020-01-23 17:55:37 +00:00
|
|
|
{
|
2020-08-12 20:24:51 +00:00
|
|
|
PLAYERp pp;
|
|
|
|
if (!(pp = checkCheat(c))) return false;
|
2020-01-23 17:55:37 +00:00
|
|
|
//
|
|
|
|
// Get all ITEMS
|
|
|
|
//
|
|
|
|
PLAYERp p;
|
|
|
|
short pnum;
|
|
|
|
short inv;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
PutStringInfo(pp, "INVENTORY");
|
|
|
|
|
|
|
|
TRAVERSE_CONNECT(pnum)
|
|
|
|
{
|
|
|
|
p = &Player[pnum];
|
|
|
|
|
|
|
|
p->WpnShotgunAuto = 50;
|
|
|
|
p->WpnRocketHeat = 5;
|
|
|
|
p->WpnRocketNuke = 1;
|
|
|
|
p->Armor = 100;
|
|
|
|
|
|
|
|
for (inv = 0; inv < MAX_INVENTORY; inv++)
|
|
|
|
{
|
|
|
|
p->InventoryPercent[inv] = 100;
|
|
|
|
//p->InventoryAmount[inv] = 1;
|
|
|
|
p->InventoryAmount[inv] = InventoryData[inv].MaxInv;
|
|
|
|
//PlayerUpdateInventory(p, inv);
|
|
|
|
}
|
|
|
|
|
|
|
|
PlayerUpdateInventory(p, p->InventoryNum);
|
|
|
|
//p->InventoryNum = 0;
|
|
|
|
}
|
2020-08-12 20:24:51 +00:00
|
|
|
return true;
|
2020-01-23 17:55:37 +00:00
|
|
|
}
|
|
|
|
|
2020-08-12 20:24:51 +00:00
|
|
|
bool ArmorCheat(cheatseq_t* c)
|
2020-01-23 17:55:37 +00:00
|
|
|
{
|
2020-08-12 20:24:51 +00:00
|
|
|
PLAYERp pp;
|
|
|
|
if (!(pp = checkCheat(c))) return false;
|
2020-01-23 17:55:37 +00:00
|
|
|
short pnum;
|
|
|
|
const char *str = nullptr;
|
|
|
|
|
|
|
|
TRAVERSE_CONNECT(pnum)
|
|
|
|
{
|
|
|
|
if (User[Player[pnum].PlayerSprite]->Health < pp->MaxHealth)
|
|
|
|
str = "ARMOR";
|
|
|
|
Player[pnum].Armor = 100;
|
|
|
|
}
|
|
|
|
if (str) PutStringInfo(pp, GStrings(str));
|
2020-08-12 20:24:51 +00:00
|
|
|
return true;
|
2020-01-23 17:55:37 +00:00
|
|
|
}
|
|
|
|
|
2020-08-12 20:24:51 +00:00
|
|
|
bool HealCheat(cheatseq_t* c)
|
2019-11-17 17:02:17 +00:00
|
|
|
{
|
2020-08-12 20:24:51 +00:00
|
|
|
PLAYERp pp;
|
|
|
|
if (!(pp = checkCheat(c))) return false;
|
2019-11-17 17:02:17 +00:00
|
|
|
short pnum;
|
2019-12-09 20:19:05 +00:00
|
|
|
const char *str = nullptr;
|
2019-11-17 17:02:17 +00:00
|
|
|
|
|
|
|
TRAVERSE_CONNECT(pnum)
|
|
|
|
{
|
|
|
|
if (User[Player[pnum].PlayerSprite]->Health < pp->MaxHealth)
|
2019-12-09 20:19:05 +00:00
|
|
|
str = "TXTS_ADDEDHEALTH";
|
2019-11-17 17:02:17 +00:00
|
|
|
User[Player[pnum].PlayerSprite]->Health += 25;
|
|
|
|
}
|
2019-12-09 20:19:05 +00:00
|
|
|
if (str) PutStringInfo(pp, GStrings(str));
|
2020-08-12 20:24:51 +00:00
|
|
|
return true;
|
2019-11-17 17:02:17 +00:00
|
|
|
}
|
|
|
|
|
2020-08-12 20:24:51 +00:00
|
|
|
bool KeyCheat(cheatseq_t* c)
|
2019-11-17 17:02:17 +00:00
|
|
|
{
|
2020-08-12 20:24:51 +00:00
|
|
|
PLAYERp pp;
|
|
|
|
if (!(pp = checkCheat(c))) return false;
|
2019-11-17 17:02:17 +00:00
|
|
|
// Get KEYS
|
|
|
|
PLAYERp p;
|
|
|
|
short pnum;
|
2020-08-12 20:24:51 +00:00
|
|
|
const char *cp = (char*)c->Args;
|
2020-08-19 17:18:47 +00:00
|
|
|
const char *str = "TXTS_GIVEKEY";
|
2019-11-17 17:02:17 +00:00
|
|
|
int keynum = 0;
|
|
|
|
|
|
|
|
keynum = atol(cp);
|
|
|
|
|
|
|
|
TRAVERSE_CONNECT(pnum)
|
|
|
|
{
|
|
|
|
p = &Player[pnum];
|
2020-08-12 20:24:51 +00:00
|
|
|
if (keynum >= 1 && keynum <= 8)
|
2019-11-17 17:02:17 +00:00
|
|
|
{
|
|
|
|
if (p->HasKey[keynum-1] == FALSE)
|
|
|
|
{
|
|
|
|
p->HasKey[keynum-1] = TRUE; // cards: 0=red 1=blue 2=green 3=yellow | keys: 4=gold 5=silver 6=bronze 7=red
|
2020-08-19 17:18:47 +00:00
|
|
|
str = "TXTS_KEYGIVEN";
|
2019-11-17 17:02:17 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
p->HasKey[keynum-1] = FALSE;
|
2020-08-19 17:18:47 +00:00
|
|
|
str = "TXTS_KEYREMOVED";
|
2019-11-17 17:02:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-12-09 20:19:05 +00:00
|
|
|
PutStringInfo(pp, GStrings(str));
|
2020-08-12 20:24:51 +00:00
|
|
|
return true;
|
2019-11-17 17:02:17 +00:00
|
|
|
}
|
|
|
|
|
2020-08-12 20:24:51 +00:00
|
|
|
bool KeysCheat(cheatseq_t* c)
|
2015-05-19 21:54:34 +00:00
|
|
|
{
|
2020-08-12 20:24:51 +00:00
|
|
|
PLAYERp pp;
|
|
|
|
if (!(pp = checkCheat(c))) return false;
|
|
|
|
// Get KEYS
|
|
|
|
PLAYERp p;
|
|
|
|
short pnum;
|
2020-08-19 17:18:47 +00:00
|
|
|
const char* str = "TXTS_GIVEKEY";
|
2020-08-12 20:24:51 +00:00
|
|
|
int keynum = 0;
|
2015-05-19 21:54:34 +00:00
|
|
|
|
2020-08-12 20:24:51 +00:00
|
|
|
TRAVERSE_CONNECT(pnum)
|
2015-05-19 21:54:34 +00:00
|
|
|
{
|
2020-08-12 20:24:51 +00:00
|
|
|
p = &Player[pnum];
|
|
|
|
memset(p->HasKey, TRUE, sizeof(p->HasKey));
|
2015-05-19 21:54:34 +00:00
|
|
|
}
|
2020-08-12 20:24:51 +00:00
|
|
|
PutStringInfo(pp, GStrings(str));
|
|
|
|
return true;
|
2015-05-19 21:54:34 +00:00
|
|
|
}
|
|
|
|
|
2020-08-12 20:24:51 +00:00
|
|
|
bool EveryCheatToggle(cheatseq_t* c)
|
2015-05-19 21:54:34 +00:00
|
|
|
{
|
2020-08-12 20:24:51 +00:00
|
|
|
EveryCheat ^= 1;
|
2020-09-02 22:29:17 +00:00
|
|
|
C_DoCommand("god");
|
|
|
|
return WeaponCheat(c) && ItemCheat(c);
|
2020-08-12 20:24:51 +00:00
|
|
|
}
|
2015-05-19 21:54:34 +00:00
|
|
|
|
2020-08-19 14:50:32 +00:00
|
|
|
// The prefix was changed from 'sw' to 'lw' so that it doesn't contain two keys of the WASD control scheme, which interferes with input control.
|
2020-08-12 20:24:51 +00:00
|
|
|
static cheatseq_t swcheats[] = {
|
2020-09-02 22:29:17 +00:00
|
|
|
{"lwgod", "god" },
|
|
|
|
{"lwchan", "god" },
|
|
|
|
{"lwgimme", nullptr, ItemCheat, 0},
|
|
|
|
{"lwmedic", nullptr, HealCheat, 0},
|
|
|
|
{"lwkey#", nullptr, KeyCheat, 0},
|
|
|
|
{"lwkeys", nullptr, KeysCheat, 0},
|
|
|
|
{"lwammo", nullptr, AmmoCheat, 0},
|
|
|
|
{"lwarmor", nullptr, ArmorCheat, 0},
|
|
|
|
{"lwitems", nullptr, ItemCheat, 0},
|
|
|
|
{"lwguns", nullptr, WeaponCheat, 0},
|
|
|
|
{"lwtrek##", nullptr, WarpCheat, 0},
|
|
|
|
{"lwgreed", nullptr, EveryCheatToggle, 0},
|
|
|
|
{"lwghost", nullptr, ClipCheat, 0},
|
|
|
|
{"lwstart", nullptr, RestartCheat, 0},
|
|
|
|
{"lwloc", nullptr, LocCheat, 0},
|
|
|
|
{"lwmap", nullptr, MapCheat, 0},
|
|
|
|
{"lwroom", nullptr, RoomCheat, true}, // Room above room dbug
|
2015-05-19 21:54:34 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2020-08-12 20:24:51 +00:00
|
|
|
void InitCheats()
|
2015-05-19 21:54:34 +00:00
|
|
|
{
|
2020-08-12 20:24:51 +00:00
|
|
|
SetCheats(swcheats, countof(swcheats));
|
2015-05-19 21:54:34 +00:00
|
|
|
}
|
2020-08-12 20:24:51 +00:00
|
|
|
|
2019-10-09 16:09:05 +00:00
|
|
|
END_SW_NS
|