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
|
|
|
// From SWP:
|
|
|
|
// Added SWKEYS
|
|
|
|
// Added SWGUN# and SWGOD
|
|
|
|
// Added SWMEDIC (25%)
|
|
|
|
// Added Full name key cheats - swbluecard - swgoldkey
|
|
|
|
// Added swquit
|
|
|
|
// Added 2 uzi's for swgimme
|
|
|
|
//
|
|
|
|
|
2019-10-09 16:09:05 +00:00
|
|
|
#include "ns.h"
|
|
|
|
|
2015-05-19 21:54:34 +00:00
|
|
|
#include "build.h"
|
|
|
|
|
|
|
|
#include "keys.h"
|
|
|
|
#include "names2.h"
|
|
|
|
#include "panel.h"
|
|
|
|
#include "game.h"
|
|
|
|
#include "mytypes.h"
|
|
|
|
#include "text.h"
|
|
|
|
|
2019-10-25 22:32:49 +00:00
|
|
|
#include "gamecontrol.h"
|
2019-12-09 20:19:05 +00:00
|
|
|
#include "gstrings.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;
|
2015-05-19 21:54:34 +00:00
|
|
|
char CheatInputString[256];
|
2015-05-19 21:58:29 +00:00
|
|
|
SWBOOL EveryCheat = FALSE;
|
|
|
|
SWBOOL ResCheat = FALSE;
|
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);
|
|
|
|
|
|
|
|
void ResCheatOn(PLAYERp, const char *)
|
2015-05-19 21:54:34 +00:00
|
|
|
{
|
|
|
|
ResCheat = TRUE;
|
|
|
|
}
|
|
|
|
|
2019-11-17 17:02:17 +00:00
|
|
|
void VoxCheat(PLAYERp, const char *)
|
2015-05-19 21:54:34 +00:00
|
|
|
{
|
|
|
|
//gs.Voxel ^= 1;
|
|
|
|
}
|
|
|
|
|
2019-11-17 17:02:17 +00:00
|
|
|
void RestartCheat(PLAYERp, const char *)
|
2015-05-19 21:54:34 +00:00
|
|
|
{
|
|
|
|
ExitLevel = TRUE;
|
|
|
|
}
|
|
|
|
|
2019-11-17 17:02:17 +00:00
|
|
|
void RoomCheat(PLAYERp, const char *)
|
2015-05-19 21:54:34 +00:00
|
|
|
{
|
2015-05-19 21:58:29 +00:00
|
|
|
extern SWBOOL FAF_DebugView;
|
2015-05-19 21:54:34 +00:00
|
|
|
FAF_DebugView ^= 1;
|
|
|
|
}
|
|
|
|
|
2019-11-17 17:02:17 +00:00
|
|
|
void SecretCheat(PLAYERp pp, const char *)
|
2015-05-19 21:54:34 +00:00
|
|
|
{
|
2019-10-27 15:53:00 +00:00
|
|
|
hud_stats = !hud_stats;
|
2015-05-19 21:54:34 +00:00
|
|
|
}
|
|
|
|
|
2019-11-17 17:02:17 +00:00
|
|
|
void NextCheat(PLAYERp pp, const char *)
|
2015-05-19 21:54:34 +00:00
|
|
|
{
|
|
|
|
Level++;
|
|
|
|
ExitLevel = TRUE;
|
|
|
|
}
|
|
|
|
|
2019-11-17 17:02:17 +00:00
|
|
|
void PrevCheat(PLAYERp pp, const char *)
|
2015-05-19 21:54:34 +00:00
|
|
|
{
|
|
|
|
Level--;
|
|
|
|
ExitLevel = TRUE;
|
|
|
|
}
|
|
|
|
|
2019-11-17 17:02:17 +00:00
|
|
|
void MapCheat(PLAYERp pp, const char *)
|
2015-05-19 21:54:34 +00:00
|
|
|
{
|
2019-11-17 17:02:17 +00:00
|
|
|
automapping ^= 1;
|
2015-05-19 21:54:34 +00:00
|
|
|
|
2019-11-17 17:02:17 +00:00
|
|
|
if (automapping)
|
2015-05-19 21:54:34 +00:00
|
|
|
MapSetAll2D(0);
|
|
|
|
else
|
|
|
|
MapSetAll2D(0xFF);
|
|
|
|
|
2019-12-09 20:19:05 +00:00
|
|
|
PutStringInfo(pp, GStrings(automapping ? "TXT_AMON" : "TXT_AMOFF"));
|
2015-05-19 21:54:34 +00:00
|
|
|
}
|
|
|
|
|
2019-11-17 17:02:17 +00:00
|
|
|
void LocCheat(PLAYERp pp, const char *)
|
2015-05-19 21:54:34 +00:00
|
|
|
{
|
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;
|
|
|
|
}
|
|
|
|
|
2019-11-17 17:02:17 +00:00
|
|
|
void GunsCheat(PLAYERp pp, const char *cheat_string)
|
|
|
|
{
|
|
|
|
PLAYERp p;
|
|
|
|
short pnum;
|
|
|
|
unsigned int i;
|
|
|
|
short gAmmo[10] = {0,9,12,20,3,6,5,5,10,1};
|
|
|
|
const char *cp = cheat_string;
|
2019-12-09 20:19:05 +00:00
|
|
|
const char *str = "TXT_GIVENW";
|
2019-11-17 17:02:17 +00:00
|
|
|
int gunnum, x;
|
|
|
|
USERp u;
|
2015-05-19 21:54:34 +00:00
|
|
|
|
2019-11-17 17:02:17 +00:00
|
|
|
cp += sizeof("swgun")-1;
|
|
|
|
gunnum = atol(cp);
|
|
|
|
if (gunnum == 0)
|
|
|
|
gunnum = 10;
|
|
|
|
if (gunnum < 2 || gunnum > 10)
|
|
|
|
return;
|
|
|
|
|
|
|
|
TRAVERSE_CONNECT(pnum)
|
|
|
|
{
|
|
|
|
p = &Player[pnum];
|
|
|
|
u = User[p->PlayerSprite];
|
|
|
|
x = gAmmo[gunnum-1];
|
|
|
|
if (TEST(p->WpnFlags, BIT(gunnum-1)) == 0)
|
|
|
|
p->WpnFlags += BIT(gunnum-2) << 1;
|
|
|
|
else
|
2019-12-09 20:19:05 +00:00
|
|
|
str = "TXTS_AMMOW";
|
2019-11-17 17:02:17 +00:00
|
|
|
p->WpnAmmo[gunnum-1] += x;
|
|
|
|
if (p->WpnAmmo[gunnum-1] > DamageData[gunnum-1].max_ammo)
|
|
|
|
{
|
|
|
|
p->WpnAmmo[gunnum-1] = DamageData[gunnum-1].max_ammo;
|
2019-12-09 20:19:05 +00:00
|
|
|
str = nullptr;
|
2019-11-17 17:02:17 +00:00
|
|
|
}
|
|
|
|
PlayerUpdateWeapon(p, u->WeaponNum);
|
|
|
|
}
|
2019-12-09 20:19:05 +00:00
|
|
|
if (str) PutStringInfo(pp, FStringf("%s %d", GStrings(str), gunnum));
|
2019-11-17 17:02:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void WeaponCheat(PLAYERp pp, const char *)
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
PlayerUpdateWeapon(p, u->WeaponNum);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-11-17 17:02:17 +00:00
|
|
|
void GodCheat(PLAYERp pp, const char *)
|
2015-05-19 21:54:34 +00:00
|
|
|
{
|
|
|
|
//
|
|
|
|
// GOD mode
|
|
|
|
//
|
|
|
|
GodMode ^= 1;
|
|
|
|
|
2019-12-09 20:19:05 +00:00
|
|
|
PutStringInfo(pp, GStrings(GodMode? "GOD MODE: ON" : "GOD MODE: OFF"));
|
2015-05-19 21:54:34 +00:00
|
|
|
}
|
|
|
|
|
2019-11-17 17:02:17 +00:00
|
|
|
void ClipCheat(PLAYERp pp, const char *)
|
2015-05-19 21:54:34 +00:00
|
|
|
{
|
|
|
|
FLIP(pp->Flags, PF_CLIP_CHEAT);
|
2019-12-09 20:19:05 +00:00
|
|
|
PutStringInfo(pp, GStrings(TEST(pp->Flags, PF_CLIP_CHEAT) ? "CLIPPING: OFF" : "CLIPPING: ON"));;
|
2015-05-19 21:54:34 +00:00
|
|
|
}
|
|
|
|
|
2019-11-17 17:02:17 +00:00
|
|
|
void WarpCheat(PLAYERp pp, const char *cheat_string)
|
2015-05-19 21:54:34 +00:00
|
|
|
{
|
2019-11-17 17:02:17 +00:00
|
|
|
const char *cp = cheat_string;
|
2015-05-19 21:54:34 +00:00
|
|
|
int episode_num;
|
|
|
|
int level_num;
|
|
|
|
|
|
|
|
cp += sizeof("swtrek")-1;
|
|
|
|
level_num = atol(cp);
|
|
|
|
|
|
|
|
//DSPRINTF(ds,"ep %d, lev %d",episode_num, level_num);
|
|
|
|
//MONO_PRINT(ds);
|
|
|
|
|
|
|
|
if (!SW_SHAREWARE)
|
|
|
|
{
|
|
|
|
if (level_num > 28 || level_num < 1)
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (level_num > 4 || level_num < 1)
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
Level = level_num;
|
|
|
|
ExitLevel = TRUE;
|
|
|
|
|
2019-12-09 20:19:05 +00:00
|
|
|
sprintf(ds, "%s %1d", GStrings("TXT_ENTERING"), Level);
|
2015-05-19 21:54:34 +00:00
|
|
|
PutStringInfo(pp, ds);
|
|
|
|
}
|
|
|
|
|
2019-11-17 17:02:17 +00:00
|
|
|
void ItemCheat(PLAYERp pp, const char *cheat_string)
|
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
|
|
|
|
}
|
|
|
|
|
|
|
|
WeaponCheat(pp, cheat_string);
|
|
|
|
PlayerUpdateKeys(pp);
|
|
|
|
}
|
|
|
|
|
2019-11-17 17:02:17 +00:00
|
|
|
VOID HealCheat(PLAYERp pp, const char *cheat_string)
|
|
|
|
{
|
|
|
|
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));
|
2019-11-17 17:02:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
VOID SortKeyCheat(PLAYERp pp, const char *sKey)
|
|
|
|
{
|
|
|
|
const char *sTemp = "";
|
|
|
|
|
|
|
|
CheatKeyType = "";
|
|
|
|
|
|
|
|
if (Bstrncasecmp(sKey, "swredcard",9) == 0)
|
|
|
|
{
|
|
|
|
sTemp = "swkey1";
|
|
|
|
CheatKeyType = "Red Cardkey";
|
|
|
|
}
|
|
|
|
else
|
|
|
|
if (Bstrncasecmp(sKey, "swbluecard",10) == 0)
|
|
|
|
{
|
|
|
|
sTemp = "swkey2";
|
|
|
|
CheatKeyType = "Blue Cardkey";
|
|
|
|
}
|
|
|
|
else
|
|
|
|
if (Bstrncasecmp(sKey, "swgreencard",11) == 0)
|
|
|
|
{
|
|
|
|
sTemp = "swkey3";
|
|
|
|
CheatKeyType = "Green Cardkey";
|
|
|
|
}
|
|
|
|
else
|
|
|
|
if (Bstrncasecmp(sKey, "swyellowcard",12) == 0)
|
|
|
|
{
|
|
|
|
sTemp = "swkey4";
|
|
|
|
CheatKeyType = "Yellow Cardkey";
|
|
|
|
}
|
|
|
|
else
|
|
|
|
if (Bstrncasecmp(sKey, "swgoldkey",9) == 0)
|
|
|
|
{
|
|
|
|
sTemp = "swkey5";
|
|
|
|
CheatKeyType = "Gold Key";
|
|
|
|
}
|
|
|
|
else
|
|
|
|
if (Bstrncasecmp(sKey, "swsilverkey",11) == 0)
|
|
|
|
{
|
|
|
|
sTemp = "swkey6";
|
|
|
|
CheatKeyType = "Silver Key";
|
|
|
|
}
|
|
|
|
else
|
|
|
|
if (Bstrncasecmp(sKey, "swbronzekey",11) == 0)
|
|
|
|
{
|
|
|
|
sTemp = "swkey7";
|
|
|
|
CheatKeyType = "Bronze Key";
|
|
|
|
}
|
|
|
|
else
|
|
|
|
if (Bstrncasecmp(sKey, "swredkey",8) == 0)
|
|
|
|
{
|
|
|
|
sTemp = "swkey8";
|
|
|
|
CheatKeyType = "Red Key";
|
|
|
|
}
|
|
|
|
|
|
|
|
if (Bstrncmp(sTemp, "", 1) != 0)
|
|
|
|
KeysCheat(pp, sTemp);
|
|
|
|
}
|
|
|
|
|
|
|
|
VOID KeysCheat(PLAYERp pp, const char *cheat_string)
|
|
|
|
{
|
|
|
|
// Get KEYS
|
|
|
|
PLAYERp p;
|
|
|
|
short pnum;
|
|
|
|
const char *cp = cheat_string;
|
2019-12-09 20:19:05 +00:00
|
|
|
const char *str = "TXT_GIVEKEY";
|
2019-11-17 17:02:17 +00:00
|
|
|
int keynum = 0;
|
|
|
|
|
|
|
|
cp += sizeof("swkey")-1;
|
|
|
|
keynum = atol(cp);
|
|
|
|
|
|
|
|
TRAVERSE_CONNECT(pnum)
|
|
|
|
{
|
|
|
|
p = &Player[pnum];
|
|
|
|
if (keynum < 1 || keynum > 8)
|
|
|
|
{
|
|
|
|
memset(p->HasKey, TRUE, sizeof(p->HasKey));
|
|
|
|
keynum = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
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
|
2019-12-09 20:19:05 +00:00
|
|
|
str = "TXT_KEYGIVEN";
|
2019-11-17 17:02:17 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
p->HasKey[keynum-1] = FALSE;
|
2019-12-09 20:19:05 +00:00
|
|
|
str = "TXT_KEYREMOVED";
|
2019-11-17 17:02:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
PlayerUpdateKeys(pp);
|
2019-12-09 20:19:05 +00:00
|
|
|
PutStringInfo(pp, GStrings(str));
|
2019-11-17 17:02:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void EveryCheatToggle(PLAYERp pp, const char *cheat_string)
|
2015-05-19 21:54:34 +00:00
|
|
|
{
|
|
|
|
EveryCheat ^= 1;
|
|
|
|
|
|
|
|
WeaponCheat(pp, cheat_string);
|
|
|
|
GodCheat(pp, cheat_string);
|
|
|
|
ItemCheat(pp, cheat_string);
|
|
|
|
}
|
|
|
|
|
2019-11-17 17:02:17 +00:00
|
|
|
void GeorgeFunc(PLAYERp pp, char *)
|
2015-05-19 21:54:34 +00:00
|
|
|
{
|
|
|
|
PlayerSound(DIGI_TAUNTAI9,&pp->posx,&pp->posy,&pp->posz,v3df_dontpan|v3df_doppler|v3df_follow,pp);
|
|
|
|
}
|
|
|
|
|
2019-11-17 17:02:17 +00:00
|
|
|
void BlackburnFunc(PLAYERp pp, char *)
|
2015-05-19 21:54:34 +00:00
|
|
|
{
|
|
|
|
PlayerSound(DIGI_TAUNTAI3,&pp->posx,&pp->posy,&pp->posz,v3df_dontpan|v3df_doppler|v3df_follow,pp);
|
|
|
|
}
|
|
|
|
|
2019-04-08 06:25:22 +00:00
|
|
|
int cheatcmp(const char *str1, const char *str2, int len)
|
2015-05-19 21:54:34 +00:00
|
|
|
{
|
2019-04-08 06:25:22 +00:00
|
|
|
const char *cp1 = str1;
|
|
|
|
const char *cp2 = str2;
|
2015-05-19 21:54:34 +00:00
|
|
|
|
|
|
|
do
|
|
|
|
{
|
|
|
|
if (*cp1 != *cp2)
|
|
|
|
{
|
|
|
|
if (!((*cp1 == '#' && isdigit(*cp2)) || (*cp2 == '#' && isdigit(*cp1))))
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
cp1++;
|
|
|
|
cp2++;
|
|
|
|
}
|
|
|
|
while (--len);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#define CF_ALL BIT(0)
|
|
|
|
#define CF_NOTSW BIT(1)
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
2019-04-08 06:25:22 +00:00
|
|
|
const char *CheatInputCode;
|
2019-11-17 17:02:17 +00:00
|
|
|
void (*CheatInputFunc)(PLAYERp, const char *);
|
2015-05-19 21:54:34 +00:00
|
|
|
char flags;
|
2019-11-17 17:02:17 +00:00
|
|
|
}CHEAT_INFO, *CHEAT_INFOp;
|
2015-05-19 21:54:34 +00:00
|
|
|
|
|
|
|
|
|
|
|
CHEAT_INFO ci[] =
|
2019-11-17 17:02:17 +00:00
|
|
|
{
|
|
|
|
{"swgod", GodCheat, 0},
|
|
|
|
{"swchan", GodCheat, 0},
|
|
|
|
{"swgimme", ItemCheat, 0},
|
|
|
|
{"swmedic", HealCheat, 0},
|
|
|
|
{"swkeys", KeysCheat, 0},
|
|
|
|
{"swredcard", SortKeyCheat, 0},
|
|
|
|
{"swbluecard", SortKeyCheat, 0},
|
|
|
|
{"swgreencard", SortKeyCheat, 0},
|
|
|
|
{"swyellowcard", SortKeyCheat, 0},
|
|
|
|
{"swgoldkey", SortKeyCheat, 0},
|
|
|
|
{"swsilverkey", SortKeyCheat, 0},
|
|
|
|
{"swbronzekey", SortKeyCheat, 0},
|
|
|
|
{"swredkey", SortKeyCheat, 0},
|
|
|
|
{"swgun#", GunsCheat, 0},
|
2015-05-19 21:54:34 +00:00
|
|
|
{"swtrek##", WarpCheat, 0},
|
|
|
|
{"swgreed", EveryCheatToggle, 0},
|
|
|
|
{"swghost", ClipCheat, 0},
|
|
|
|
|
|
|
|
{"swstart", RestartCheat, 0},
|
|
|
|
|
|
|
|
{"swres", ResCheatOn, 0},
|
|
|
|
{"swloc", LocCheat, 0},
|
|
|
|
{"swmap", MapCheat, 0},
|
|
|
|
{"swroom", RoomCheat, CF_NOTSW}, // Room above room dbug
|
|
|
|
#if DEBUG
|
|
|
|
{"swsecret", SecretCheat, CF_ALL},
|
|
|
|
#endif
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// !JIM! My simplified version of CheatInput which simply processes MessageInputString
|
|
|
|
void CheatInput(void)
|
|
|
|
{
|
2015-05-19 21:58:29 +00:00
|
|
|
static SWBOOL cur_show;
|
2015-05-19 21:54:34 +00:00
|
|
|
int ret;
|
2015-05-19 21:58:29 +00:00
|
|
|
SWBOOL match = FALSE;
|
2015-05-19 21:54:34 +00:00
|
|
|
unsigned int i;
|
|
|
|
|
|
|
|
//if (CommEnabled)
|
|
|
|
// return;
|
|
|
|
|
|
|
|
strcpy(CheatInputString,MessageInputString);
|
|
|
|
|
|
|
|
// make sure string is lower cased
|
|
|
|
Bstrlwr(CheatInputString);
|
|
|
|
|
|
|
|
// check for at least one single match
|
|
|
|
for (i = 0; i < SIZ(ci); i++)
|
|
|
|
{
|
|
|
|
// compare without the NULL
|
|
|
|
if (cheatcmp(CheatInputString, ci[i].CheatInputCode, strlen(CheatInputString)) == 0)
|
|
|
|
{
|
|
|
|
|
|
|
|
// if they are equal in length then its a complet match
|
|
|
|
if (strlen(CheatInputString) == strlen(ci[i].CheatInputCode))
|
|
|
|
{
|
|
|
|
match = TRUE;
|
|
|
|
CheatInputMode = FALSE;
|
|
|
|
|
|
|
|
if (TEST(ci[i].flags, CF_NOTSW) && SW_SHAREWARE)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (!TEST(ci[i].flags, CF_ALL))
|
|
|
|
{
|
|
|
|
if (CommEnabled)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (Skill >= 3)
|
|
|
|
{
|
2019-12-09 20:19:05 +00:00
|
|
|
PutStringInfo(Player, GStrings("TXTS_TOOSKILLFUL"));
|
2015-05-19 21:54:34 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ci[i].CheatInputFunc)
|
|
|
|
(*ci[i].CheatInputFunc)(Player, CheatInputString);
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
match = TRUE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!match)
|
|
|
|
{
|
|
|
|
CheatInputMode = FALSE;
|
|
|
|
}
|
|
|
|
}
|
2019-10-09 16:09:05 +00:00
|
|
|
END_SW_NS
|