mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-31 19:20:33 +00:00
- migrated SW cheats to the generic system, removed the more pointless of SWP's cheats and filled in a few blanks.
This commit is contained in:
parent
80d1b71899
commit
aef59ef523
10 changed files with 150 additions and 505 deletions
|
@ -122,7 +122,7 @@ bool Cheat_Responder (event_t *ev)
|
|||
|
||||
void PlaybackCheat(const char *p)
|
||||
{
|
||||
if (!gi->CheatAllowed(false))
|
||||
if (gi->CheatAllowed(false))
|
||||
{
|
||||
event_t ev = { EV_KeyDown, 0, 0, -1 };
|
||||
Cheat_Responder(&ev); // Reset the parser by passing a non-existent key.
|
||||
|
@ -142,8 +142,8 @@ void PlaybackCheat(const char *p)
|
|||
|
||||
CCMD(activatecheat)
|
||||
{
|
||||
if (argv.argc() != 1)
|
||||
if (argv.argc() < 2)
|
||||
Printf("activatecheat <string>: activates a classic cheat code\n");
|
||||
else
|
||||
PlaybackCheat(argv[0]);
|
||||
PlaybackCheat(argv[1]);
|
||||
}
|
||||
|
|
|
@ -567,9 +567,6 @@ int AutoBreakWall(WALLp wallp, int hit_x, int hit_y, int hit_z, short ang, short
|
|||
WALLp nwp;
|
||||
SPRITEp bsp;
|
||||
|
||||
//DSPRINTF(ds,"wallnum %d, pic %d, lo %d, hi %d",wallp-wall, wallp->picnum, wallp->lotag, wallp->hitag);
|
||||
MONO_PRINT(ds);
|
||||
|
||||
wallp->lotag = 0;
|
||||
if (wallp->nextwall >= 0)
|
||||
{
|
||||
|
@ -593,9 +590,6 @@ int AutoBreakWall(WALLp wallp, int hit_x, int hit_y, int hit_z, short ang, short
|
|||
|
||||
if (!break_info)
|
||||
{
|
||||
//DSPRINTF(ds,"Break Info not found - wall %d", wallp - wall);
|
||||
MONO_PRINT(ds);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
|
|
@ -579,20 +579,9 @@ void DoTheCache(void)
|
|||
{
|
||||
if ((TEST(gotpic[i>>3], 1<<(i&7))) && (!tilePtr(i)))
|
||||
{
|
||||
// For the hardware renderer precaching the raw pixel data is pointless.
|
||||
if (videoGetRenderMode() < REND_POLYMOST)
|
||||
tileLoad(i);
|
||||
#ifdef USE_OPENGL
|
||||
if (r_precache) PrecacheHardwareTextures(i);
|
||||
#endif
|
||||
|
||||
cnt++;
|
||||
if (!(cnt&7))
|
||||
{
|
||||
AnimateCacheCursor();
|
||||
handleevents();
|
||||
getpackets();
|
||||
}
|
||||
// Without palettes this is rather useless...
|
||||
if (r_precache) PrecacheHardwareTextures(i);
|
||||
cnt++;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -23,14 +23,6 @@ Original Source: 1997 - Frank Maddin and Jim Norwood
|
|||
Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
|
||||
*/
|
||||
//-------------------------------------------------------------------------
|
||||
// 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
|
||||
//
|
||||
|
||||
#include "ns.h"
|
||||
|
||||
|
@ -44,111 +36,85 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
|
|||
|
||||
#include "gamecontrol.h"
|
||||
#include "gstrings.h"
|
||||
#include "cheathandler.h"
|
||||
//#include "inv.h"
|
||||
|
||||
BEGIN_SW_NS
|
||||
|
||||
SWBOOL CheatInputMode = FALSE;
|
||||
SWBOOL EveryCheat = FALSE;
|
||||
SWBOOL ResCheat = FALSE;
|
||||
SWBOOL mapcheat = false;
|
||||
extern SWBOOL FAF_DebugView;
|
||||
|
||||
const char *CheatKeyType;
|
||||
void KeysCheat(PLAYERp pp, const char *cheat_string);
|
||||
|
||||
void ResCheatOn(PLAYERp, const char *)
|
||||
static PLAYERp checkCheat(cheatseq_t* c)
|
||||
{
|
||||
ResCheat = TRUE;
|
||||
if (CommEnabled)
|
||||
return nullptr;
|
||||
|
||||
if (Skill >= 3 && !c->DontCheck)
|
||||
{
|
||||
PutStringInfo(&Player[screenpeek], GStrings("TXTS_TOOSKILLFUL"));
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return &Player[screenpeek];
|
||||
}
|
||||
|
||||
void VoxCheat(PLAYERp, const char *)
|
||||
{
|
||||
//gs.Voxel ^= 1;
|
||||
}
|
||||
|
||||
void RestartCheat(PLAYERp, const char *)
|
||||
bool RestartCheat(cheatseq_t* c)
|
||||
{
|
||||
if (!checkCheat(c)) return false;
|
||||
ExitLevel = TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
void RoomCheat(PLAYERp, const char *)
|
||||
bool RoomCheat(cheatseq_t* c)
|
||||
{
|
||||
extern SWBOOL FAF_DebugView;
|
||||
FAF_DebugView ^= 1;
|
||||
return true;
|
||||
}
|
||||
|
||||
void SecretCheat(PLAYERp pp, const char *)
|
||||
{
|
||||
hud_stats = !hud_stats;
|
||||
}
|
||||
|
||||
void NextCheat(PLAYERp pp, const char *)
|
||||
bool NextCheat(cheatseq_t* c)
|
||||
{
|
||||
if (!checkCheat(c)) return false;
|
||||
Level++;
|
||||
ExitLevel = TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
void PrevCheat(PLAYERp pp, const char *)
|
||||
bool PrevCheat(cheatseq_t* c)
|
||||
{
|
||||
if (!checkCheat(c)) return false;
|
||||
Level--;
|
||||
ExitLevel = TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
void MapCheat(PLAYERp pp, const char *)
|
||||
bool MapCheat(cheatseq_t* c)
|
||||
{
|
||||
PLAYERp pp;
|
||||
if (!(pp=checkCheat(c))) return false;
|
||||
mapcheat = !mapcheat;
|
||||
// Need to do this differently. The code here was completely broken.
|
||||
PutStringInfo(pp, GStrings(mapcheat ? "TXT_AMON" : "TXT_AMOFF"));
|
||||
return true;
|
||||
}
|
||||
|
||||
void LocCheat(PLAYERp pp, const char *)
|
||||
bool LocCheat(cheatseq_t* c)
|
||||
{
|
||||
if (!checkCheat(c)) return false;
|
||||
extern SWBOOL LocationInfo;
|
||||
LocationInfo++;
|
||||
if (LocationInfo > 2)
|
||||
LocationInfo = 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
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;
|
||||
const char *str = "TXT_GIVENW";
|
||||
int gunnum, x;
|
||||
USERp u;
|
||||
|
||||
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
|
||||
str = "TXTS_AMMOW";
|
||||
p->WpnAmmo[gunnum-1] += x;
|
||||
if (p->WpnAmmo[gunnum-1] > DamageData[gunnum-1].max_ammo)
|
||||
{
|
||||
p->WpnAmmo[gunnum-1] = DamageData[gunnum-1].max_ammo;
|
||||
str = nullptr;
|
||||
}
|
||||
PlayerUpdateWeapon(p, u->WeaponNum);
|
||||
}
|
||||
if (str) PutStringInfo(pp, FStringf("%s %d", GStrings(str), gunnum));
|
||||
}
|
||||
|
||||
void WeaponCheat(PLAYERp pp, const char *)
|
||||
bool WeaponCheat(cheatseq_t* c)
|
||||
{
|
||||
if (!checkCheat(c)) return false;
|
||||
PLAYERp p;
|
||||
short pnum;
|
||||
unsigned int i;
|
||||
|
@ -182,10 +148,12 @@ void WeaponCheat(PLAYERp pp, const char *)
|
|||
|
||||
PlayerUpdateWeapon(p, u->WeaponNum);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void AmmoCheat(PLAYERp pp, const char *)
|
||||
bool AmmoCheat(cheatseq_t* c)
|
||||
{
|
||||
if (!checkCheat(c)) return false;
|
||||
PLAYERp p;
|
||||
short pnum;
|
||||
unsigned int i;
|
||||
|
@ -207,49 +175,56 @@ void AmmoCheat(PLAYERp pp, const char *)
|
|||
|
||||
PlayerUpdateWeapon(p, u->WeaponNum);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void GodCheat(PLAYERp pp, const char *)
|
||||
bool GodCheat(cheatseq_t* c)
|
||||
{
|
||||
PLAYERp pp;
|
||||
if (!(pp = checkCheat(c))) return false;
|
||||
//
|
||||
// GOD mode
|
||||
//
|
||||
GodMode ^= 1;
|
||||
|
||||
PutStringInfo(pp, GStrings(GodMode? "GOD MODE: ON" : "GOD MODE: OFF"));
|
||||
return true;
|
||||
}
|
||||
|
||||
void ClipCheat(PLAYERp pp, const char *)
|
||||
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"));;
|
||||
PutStringInfo(pp, GStrings(TEST(pp->Flags, PF_CLIP_CHEAT) ? "CLIPPING: OFF" : "CLIPPING: ON"));
|
||||
return true;
|
||||
}
|
||||
|
||||
void WarpCheat(PLAYERp pp, const char *cheat_string)
|
||||
bool WarpCheat(cheatseq_t* c)
|
||||
{
|
||||
const char *cp = cheat_string;
|
||||
PLAYERp pp;
|
||||
if (!(pp = checkCheat(c))) return false;
|
||||
int level_num;
|
||||
|
||||
cp += sizeof("swtrek")-1;
|
||||
level_num = atol(cp);
|
||||
level_num = atol((char*)c->Args);
|
||||
|
||||
//int episode_num;
|
||||
//DSPRINTF(ds,"ep %d, lev %d",episode_num, level_num);
|
||||
//MONO_PRINT(ds);
|
||||
|
||||
if (!pp) return;
|
||||
if (!pp) return true;
|
||||
if (!SW_SHAREWARE)
|
||||
{
|
||||
if (level_num > 28 || level_num < 1)
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (level_num > 4 || level_num < 1)
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
if (TEST(pp->Flags, PF_DEAD))
|
||||
return;
|
||||
return true;
|
||||
|
||||
|
||||
Level = level_num;
|
||||
|
@ -257,10 +232,13 @@ void WarpCheat(PLAYERp pp, const char *cheat_string)
|
|||
|
||||
sprintf(ds, "%s %1d", GStrings("TXT_ENTERING"), Level);
|
||||
PutStringInfo(pp, ds);
|
||||
return true;
|
||||
}
|
||||
|
||||
void ItemCheat(PLAYERp pp, const char *cheat_string)
|
||||
bool ItemCheat(cheatseq_t* c)
|
||||
{
|
||||
PLAYERp pp;
|
||||
if (!(pp = checkCheat(c))) return false;
|
||||
//
|
||||
// Get all ITEMS
|
||||
//
|
||||
|
@ -299,12 +277,15 @@ void ItemCheat(PLAYERp pp, const char *cheat_string)
|
|||
SectUser[i]->number = 0; // unlock all doors of this type
|
||||
}
|
||||
|
||||
WeaponCheat(pp, cheat_string);
|
||||
WeaponCheat(c);
|
||||
PlayerUpdateKeys(pp);
|
||||
return true;
|
||||
}
|
||||
|
||||
void InventoryCheat(PLAYERp pp, const char *cheat_string)
|
||||
bool InventoryCheat(cheatseq_t* c)
|
||||
{
|
||||
PLAYERp pp;
|
||||
if (!(pp = checkCheat(c))) return false;
|
||||
//
|
||||
// Get all ITEMS
|
||||
//
|
||||
|
@ -335,11 +316,13 @@ void InventoryCheat(PLAYERp pp, const char *cheat_string)
|
|||
PlayerUpdateInventory(p, p->InventoryNum);
|
||||
//p->InventoryNum = 0;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void ArmorCheat(PLAYERp pp, const char *cheat_string)
|
||||
bool ArmorCheat(cheatseq_t* c)
|
||||
{
|
||||
PLAYERp pp;
|
||||
if (!(pp = checkCheat(c))) return false;
|
||||
short pnum;
|
||||
const char *str = nullptr;
|
||||
|
||||
|
@ -350,10 +333,13 @@ void ArmorCheat(PLAYERp pp, const char *cheat_string)
|
|||
Player[pnum].Armor = 100;
|
||||
}
|
||||
if (str) PutStringInfo(pp, GStrings(str));
|
||||
return true;
|
||||
}
|
||||
|
||||
void HealCheat(PLAYERp pp, const char *cheat_string)
|
||||
bool HealCheat(cheatseq_t* c)
|
||||
{
|
||||
PLAYERp pp;
|
||||
if (!(pp = checkCheat(c))) return false;
|
||||
short pnum;
|
||||
const char *str = nullptr;
|
||||
|
||||
|
@ -364,87 +350,26 @@ void HealCheat(PLAYERp pp, const char *cheat_string)
|
|||
User[Player[pnum].PlayerSprite]->Health += 25;
|
||||
}
|
||||
if (str) PutStringInfo(pp, GStrings(str));
|
||||
return true;
|
||||
}
|
||||
|
||||
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)
|
||||
bool KeyCheat(cheatseq_t* c)
|
||||
{
|
||||
PLAYERp pp;
|
||||
if (!(pp = checkCheat(c))) return false;
|
||||
// Get KEYS
|
||||
PLAYERp p;
|
||||
short pnum;
|
||||
const char *cp = cheat_string;
|
||||
const char *cp = (char*)c->Args;
|
||||
const char *str = "TXT_GIVEKEY";
|
||||
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 (keynum >= 1 && keynum <= 8)
|
||||
{
|
||||
if (p->HasKey[keynum-1] == FALSE)
|
||||
{
|
||||
|
@ -460,147 +385,60 @@ void KeysCheat(PLAYERp pp, const char *cheat_string)
|
|||
}
|
||||
PlayerUpdateKeys(pp);
|
||||
PutStringInfo(pp, GStrings(str));
|
||||
return true;
|
||||
}
|
||||
|
||||
void EveryCheatToggle(PLAYERp pp, const char *cheat_string)
|
||||
bool KeysCheat(cheatseq_t* c)
|
||||
{
|
||||
PLAYERp pp;
|
||||
if (!(pp = checkCheat(c))) return false;
|
||||
// Get KEYS
|
||||
PLAYERp p;
|
||||
short pnum;
|
||||
const char* str = "TXT_GIVEKEY";
|
||||
int keynum = 0;
|
||||
|
||||
TRAVERSE_CONNECT(pnum)
|
||||
{
|
||||
p = &Player[pnum];
|
||||
memset(p->HasKey, TRUE, sizeof(p->HasKey));
|
||||
}
|
||||
PlayerUpdateKeys(pp);
|
||||
PutStringInfo(pp, GStrings(str));
|
||||
return true;
|
||||
}
|
||||
|
||||
bool EveryCheatToggle(cheatseq_t* c)
|
||||
{
|
||||
EveryCheat ^= 1;
|
||||
|
||||
WeaponCheat(pp, cheat_string);
|
||||
GodCheat(pp, cheat_string);
|
||||
ItemCheat(pp, cheat_string);
|
||||
}
|
||||
|
||||
void GeorgeFunc(PLAYERp pp, char *)
|
||||
{
|
||||
PlayerSound(DIGI_TAUNTAI9, v3df_dontpan|v3df_doppler|v3df_follow,pp);
|
||||
}
|
||||
|
||||
void BlackburnFunc(PLAYERp pp, char *)
|
||||
{
|
||||
PlayerSound(DIGI_TAUNTAI3, v3df_dontpan|v3df_doppler|v3df_follow,pp);
|
||||
}
|
||||
|
||||
int cheatcmp(const char *str1, const char *str2, int len)
|
||||
{
|
||||
const char *cp1 = str1;
|
||||
const char *cp2 = str2;
|
||||
|
||||
do
|
||||
{
|
||||
if (*cp1 != *cp2)
|
||||
{
|
||||
if (!((*cp1 == '#' && isdigit(*cp2)) || (*cp2 == '#' && isdigit(*cp1))))
|
||||
return -1;
|
||||
}
|
||||
|
||||
cp1++;
|
||||
cp2++;
|
||||
}
|
||||
while (--len);
|
||||
|
||||
return 0;
|
||||
return WeaponCheat(c) && GodCheat(c) && ItemCheat(c);
|
||||
}
|
||||
|
||||
|
||||
#define CF_ALL BIT(0)
|
||||
#define CF_NOTSW BIT(1)
|
||||
|
||||
typedef struct
|
||||
{
|
||||
const char *CheatInputCode;
|
||||
void (*CheatInputFunc)(PLAYERp, const char *);
|
||||
char flags;
|
||||
}CHEAT_INFO, *CHEAT_INFOp;
|
||||
|
||||
|
||||
CHEAT_INFO ci[] =
|
||||
{
|
||||
{"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},
|
||||
static cheatseq_t swcheats[] = {
|
||||
{"swgod", GodCheat, 0},
|
||||
{"swchan", GodCheat, 0},
|
||||
{"swgimme", ItemCheat, 0},
|
||||
{"swmedic", HealCheat, 0},
|
||||
{"swkey#", KeyCheat, 0},
|
||||
{"swkeys", KeysCheat, 0},
|
||||
{"swammo", AmmoCheat, 0},
|
||||
{"swarmor", ArmorCheat, 0},
|
||||
{"switems", ItemCheat, 0},
|
||||
{"swguns", WeaponCheat, 0},
|
||||
{"swtrek##", WarpCheat, 0},
|
||||
{"swgreed", EveryCheatToggle, 0},
|
||||
{"swghost", ClipCheat, 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
|
||||
{"swroom", RoomCheat, true}, // Room above room dbug
|
||||
};
|
||||
|
||||
|
||||
// !JIM! My simplified version of CheatInput which simply processes MessageInputString
|
||||
void CheatInput(void)
|
||||
void InitCheats()
|
||||
{
|
||||
SWBOOL match = FALSE;
|
||||
unsigned int i;
|
||||
|
||||
//if (CommEnabled)
|
||||
// return;
|
||||
FString CheatInputString = MessageInputString;
|
||||
CheatInputString.ToLower();
|
||||
|
||||
// check for at least one single match
|
||||
for (i = 0; i < SIZ(ci); i++)
|
||||
{
|
||||
// compare without the NULL
|
||||
if (cheatcmp(CheatInputString, ci[i].CheatInputCode, CheatInputString.Len()) == 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)
|
||||
{
|
||||
PutStringInfo(Player, GStrings("TXTS_TOOSKILLFUL"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (ci[i].CheatInputFunc)
|
||||
(*ci[i].CheatInputFunc)(Player, CheatInputString);
|
||||
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
match = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!match)
|
||||
{
|
||||
CheatInputMode = FALSE;
|
||||
}
|
||||
SetCheats(swcheats, countof(swcheats));
|
||||
}
|
||||
|
||||
END_SW_NS
|
||||
|
|
|
@ -1530,20 +1530,8 @@ void SpriteSortList2D(int tx, int ty)
|
|||
}
|
||||
}
|
||||
|
||||
void CheatResChange(void)
|
||||
{
|
||||
}
|
||||
|
||||
void DrawCheckKeys(PLAYERp pp)
|
||||
{
|
||||
extern SWBOOL ResCheat;
|
||||
|
||||
if (ResCheat)
|
||||
{
|
||||
ResCheat = FALSE;
|
||||
CheatResChange(); // allow all modes when cheating
|
||||
}
|
||||
|
||||
if (ConPanel) return;
|
||||
|
||||
if (!InputMode)
|
||||
|
|
|
@ -161,7 +161,6 @@ SWBOOL NewGame = TRUE;
|
|||
SWBOOL InMenuLevel = FALSE;
|
||||
SWBOOL LoadGameOutsideMoveLoop = FALSE;
|
||||
SWBOOL LoadGameFromDemo = FALSE;
|
||||
SWBOOL ArgCheat = FALSE;
|
||||
extern SWBOOL NetBroadcastMode, NetModeOverride;
|
||||
SWBOOL MultiPlayQuitFlag = FALSE;
|
||||
//Miscellaneous variables
|
||||
|
@ -972,17 +971,7 @@ InitLevel(void)
|
|||
{
|
||||
DisplayDemoText();
|
||||
}
|
||||
|
||||
|
||||
if (ArgCheat)
|
||||
{
|
||||
int bak = hud_messages;
|
||||
hud_messages = 0;
|
||||
EveryCheatToggle(&Player[0],NULL);
|
||||
hud_messages = bak;
|
||||
GodMode = TRUE;
|
||||
}
|
||||
|
||||
|
||||
// reset NewGame
|
||||
NewGame = FALSE;
|
||||
|
||||
|
@ -2469,6 +2458,7 @@ int32_t GameInterface::app_main()
|
|||
void gameinput(void);
|
||||
int cnt = 0;
|
||||
|
||||
InitCheats();
|
||||
buttonMap.SetButtons(actions, NUM_ACTIONS);
|
||||
automapping = 1;
|
||||
BorderAdjust = true;
|
||||
|
|
|
@ -2419,8 +2419,6 @@ void LoadKVXFromScript(const char *filename); // scrip2.c
|
|||
void LoadPLockFromScript(const char *filename); // scrip2.c
|
||||
void LoadCustomInfoFromScript(const char *filename); // scrip2.c
|
||||
|
||||
void EveryCheatToggle(PLAYERp pp,const char *cheat_string); // cheats.c
|
||||
|
||||
int PlayerInitChemBomb(PLAYERp pp); // jweapon.c
|
||||
int PlayerInitFlashBomb(PLAYERp pp); // jweapon.c
|
||||
int PlayerInitCaltrops(PLAYERp pp); // jweapon.c
|
||||
|
|
|
@ -16,34 +16,7 @@ void PreCacheRange(short start_pic, short end_pic);
|
|||
void DoTheCache(void);
|
||||
void precache(void);
|
||||
|
||||
|
||||
void KeysCheat(PLAYERstruct * pp, const char *cheat_string);
|
||||
void ResCheatOn(PLAYERstruct *, const char *);
|
||||
void VoxCheat(PLAYERstruct *, const char *);
|
||||
void RestartCheat(PLAYERstruct *, const char *);
|
||||
void RoomCheat(PLAYERstruct *, const char *);
|
||||
void SecretCheat(PLAYERstruct * pp, const char *);
|
||||
void NextCheat(PLAYERstruct * pp, const char *);
|
||||
void PrevCheat(PLAYERstruct * pp, const char *);
|
||||
void MapCheat(PLAYERstruct * pp, const char *);
|
||||
void LocCheat(PLAYERstruct * pp, const char *);
|
||||
void GunsCheat(PLAYERstruct * pp, const char *cheat_string);
|
||||
void AmmoCheat(PLAYERstruct * pp, const char *);
|
||||
void WeaponCheat(PLAYERstruct * pp, const char *);
|
||||
void GodCheat(PLAYERstruct * pp, const char *);
|
||||
void ClipCheat(PLAYERstruct * pp, const char *);
|
||||
void WarpCheat(PLAYERstruct * pp, const char *cheat_string);
|
||||
void ItemCheat(PLAYERstruct * pp, const char *cheat_string);
|
||||
void InventoryCheat(PLAYERstruct * pp, const char *cheat_string);
|
||||
void ArmorCheat(PLAYERstruct * pp, const char *cheat_string);
|
||||
void HealCheat(PLAYERstruct * pp, const char *cheat_string);
|
||||
void SortKeyCheat(PLAYERstruct * pp, const char *sKey);
|
||||
void KeysCheat(PLAYERstruct * pp, const char *cheat_string);
|
||||
void EveryCheatToggle(PLAYERstruct * pp, const char *cheat_string);
|
||||
void GeorgeFunc(PLAYERstruct * pp, char *);
|
||||
void BlackburnFunc(PLAYERstruct * pp, char *);
|
||||
int cheatcmp(const char *str1, const char *str2, int len);
|
||||
void CheatInput(void);
|
||||
void InitCheats();
|
||||
|
||||
void MapColors(short num,COLOR_MAP cm,short create);
|
||||
void InitPalette(void);
|
||||
|
|
|
@ -48,10 +48,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
|
||||
BEGIN_SW_NS
|
||||
|
||||
char boardfilename[BMAX_PATH] = {0};
|
||||
|
||||
struct osdcmd_cheatsinfo osdcmd_cheatsinfo_stat = { -1, 0, 0 };
|
||||
|
||||
static int osdcmd_map(CCmdFuncPtr parm)
|
||||
{
|
||||
if (parm->numparms != 1)
|
||||
|
@ -73,51 +69,29 @@ static int osdcmd_map(CCmdFuncPtr parm)
|
|||
{
|
||||
if (mapList[i].labelName.CompareNoCase(mapname) == 0)
|
||||
{
|
||||
FStringf cheatcode("swtrek%02d", i);
|
||||
WarpCheat(Player, cheatcode);
|
||||
FStringf cheatcode("activatecheat swtrek%02d", i);
|
||||
C_DoCommand(cheatcode);
|
||||
return CCMD_OK;
|
||||
}
|
||||
}
|
||||
return CCMD_OK;
|
||||
}
|
||||
|
||||
|
||||
static int osdcmd_activatecheat(CCmdFuncPtr parm)
|
||||
static int osdcmd_god(CCmdFuncPtr)
|
||||
{
|
||||
if (parm->numparms != 1)
|
||||
return CCMD_SHOWHELP;
|
||||
|
||||
memset(MessageInputString, '\0', sizeof(MessageInputString));
|
||||
strcpy(MessageInputString, parm->parms[0]);
|
||||
CheatInput();
|
||||
|
||||
C_DoCommand("activatecheat swgod");
|
||||
return CCMD_OK;
|
||||
}
|
||||
|
||||
static int osdcmd_god(CCmdFuncPtr UNUSED(parm))
|
||||
static int osdcmd_noclip(CCmdFuncPtr)
|
||||
{
|
||||
UNREFERENCED_CONST_PARAMETER(parm);
|
||||
|
||||
GodCheat(Player, "swgod");
|
||||
|
||||
C_DoCommand("activatecheat swghost");
|
||||
return CCMD_OK;
|
||||
}
|
||||
|
||||
static int osdcmd_noclip(CCmdFuncPtr UNUSED(parm))
|
||||
int osdcmd_restartmap(CCmdFuncPtr)
|
||||
{
|
||||
UNREFERENCED_CONST_PARAMETER(parm);
|
||||
|
||||
ClipCheat(Player, "swghost");
|
||||
|
||||
return CCMD_OK;
|
||||
}
|
||||
|
||||
int osdcmd_restartmap(CCmdFuncPtr UNUSED(parm))
|
||||
{
|
||||
UNREFERENCED_CONST_PARAMETER(parm);
|
||||
|
||||
RestartCheat(Player, "swstart");
|
||||
|
||||
C_DoCommand("activatecheat swstart");
|
||||
return CCMD_OK;
|
||||
}
|
||||
|
||||
|
@ -125,110 +99,14 @@ int osdcmd_levelwarp(CCmdFuncPtr parm)
|
|||
{
|
||||
if (parm->numparms != 1) return CCMD_SHOWHELP;
|
||||
|
||||
char cheatcode[9] = "swtrek##";
|
||||
char cheatcode[] = "activatecheat swtrek##";
|
||||
|
||||
for (int i = 0; i < 2; i++)
|
||||
cheatcode[6+i] = parm->parms[0][i];
|
||||
|
||||
WarpCheat(Player, cheatcode);
|
||||
cheatcode[20+i] = parm->parms[0][i];
|
||||
C_DoCommand(cheatcode);
|
||||
return CCMD_OK;
|
||||
}
|
||||
|
||||
#if 0
|
||||
static int osdcmd_spawn(CCmdFuncPtr parm)
|
||||
{
|
||||
int32_t picnum = 0;
|
||||
uint16_t cstat=0;
|
||||
char pal=0;
|
||||
int16_t ang=0;
|
||||
int16_t set=0, idx;
|
||||
vec3_t vect;
|
||||
|
||||
if (numplayers > 1 || !(ps[myconnectindex].gm & MODE_GAME))
|
||||
{
|
||||
Printf("spawn: Can't spawn sprites in multiplayer games or demos\n");
|
||||
return CCMD_OK;
|
||||
}
|
||||
|
||||
switch (parm->numparms)
|
||||
{
|
||||
case 7: // x,y,z
|
||||
vect.x = Batol(parm->parms[4]);
|
||||
vect.y = Batol(parm->parms[5]);
|
||||
vect.z = Batol(parm->parms[6]);
|
||||
set |= 8;
|
||||
fallthrough__;
|
||||
case 4: // ang
|
||||
ang = Batol(parm->parms[3]) & 2047;
|
||||
set |= 4;
|
||||
fallthrough__;
|
||||
case 3: // cstat
|
||||
cstat = (uint16_t)Batol(parm->parms[2]);
|
||||
set |= 2;
|
||||
fallthrough__;
|
||||
case 2: // pal
|
||||
pal = (uint8_t)Batol(parm->parms[1]);
|
||||
set |= 1;
|
||||
fallthrough__;
|
||||
case 1: // tile number
|
||||
if (isdigit(parm->parms[0][0]))
|
||||
{
|
||||
picnum = Batol(parm->parms[0]);
|
||||
}
|
||||
else
|
||||
{
|
||||
int32_t i;
|
||||
int32_t j;
|
||||
|
||||
for (j=0; j<2; j++)
|
||||
{
|
||||
for (i=0; i<g_labelCnt; i++)
|
||||
{
|
||||
if ((j == 0 && !Bstrcmp(label+(i<<6), parm->parms[0])) ||
|
||||
(j == 1 && !Bstrcasecmp(label+(i<<6), parm->parms[0])))
|
||||
{
|
||||
picnum = labelcode[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (i < g_labelCnt)
|
||||
break;
|
||||
}
|
||||
if (i==g_labelCnt)
|
||||
{
|
||||
Printf("spawn: Invalid tile label given\n");
|
||||
return CCMD_OK;
|
||||
}
|
||||
}
|
||||
|
||||
if ((uint32_t)picnum >= MAXUSERTILES)
|
||||
{
|
||||
Printf("spawn: Invalid tile number\n");
|
||||
return CCMD_OK;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
return CCMD_SHOWHELP;
|
||||
}
|
||||
|
||||
idx = A_Spawn(ps[myconnectindex].i, picnum);
|
||||
if (set & 1) sprite[idx].pal = (uint8_t)pal;
|
||||
if (set & 2) sprite[idx].cstat = (int16_t)cstat;
|
||||
if (set & 4) sprite[idx].ang = ang;
|
||||
if (set & 8)
|
||||
{
|
||||
if (setsprite(idx, &vect) < 0)
|
||||
{
|
||||
Printf("spawn: Sprite can't be spawned into null space\n");
|
||||
A_DeleteSprite(idx);
|
||||
}
|
||||
}
|
||||
|
||||
return CCMD_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
static int osdcmd_give(CCmdFuncPtr parm)
|
||||
{
|
||||
|
@ -236,39 +114,39 @@ static int osdcmd_give(CCmdFuncPtr parm)
|
|||
|
||||
if (parm->numparms != 1) return CCMD_SHOWHELP;
|
||||
|
||||
if (!Bstrcasecmp(parm->parms[0], "all"))
|
||||
if (!stricmp(parm->parms[0], "all"))
|
||||
{
|
||||
ItemCheat(Player, "swgimme");
|
||||
C_DoCommand("activatecheat swgimme");
|
||||
return CCMD_OK;
|
||||
}
|
||||
else if (!Bstrcasecmp(parm->parms[0], "health"))
|
||||
else if (!stricmp(parm->parms[0], "health"))
|
||||
{
|
||||
HealCheat(Player, "swmedic");
|
||||
C_DoCommand("activatecheat swmedic");
|
||||
return CCMD_OK;
|
||||
}
|
||||
else if (!Bstrcasecmp(parm->parms[0], "weapons"))
|
||||
else if (!stricmp(parm->parms[0], "weapons"))
|
||||
{
|
||||
WeaponCheat(Player, "swguns");
|
||||
C_DoCommand("activatecheat swguns");
|
||||
return CCMD_OK;
|
||||
}
|
||||
else if (!Bstrcasecmp(parm->parms[0], "ammo"))
|
||||
else if (!stricmp(parm->parms[0], "ammo"))
|
||||
{
|
||||
AmmoCheat(Player, "");
|
||||
C_DoCommand("activatecheat swammo");
|
||||
return CCMD_OK;
|
||||
}
|
||||
else if (!Bstrcasecmp(parm->parms[0], "armor"))
|
||||
else if (!stricmp(parm->parms[0], "armor"))
|
||||
{
|
||||
ArmorCheat(Player, ""); // this cheat did not exist before
|
||||
C_DoCommand("activatecheat swarmor");
|
||||
return CCMD_OK;
|
||||
}
|
||||
else if (!Bstrcasecmp(parm->parms[0], "keys"))
|
||||
else if (!stricmp(parm->parms[0], "keys"))
|
||||
{
|
||||
KeysCheat(Player, "swkeys");
|
||||
C_DoCommand("activatecheat swkeys");
|
||||
return CCMD_OK;
|
||||
}
|
||||
else if (!Bstrcasecmp(parm->parms[0], "inventory"))
|
||||
else if (!stricmp(parm->parms[0], "inventory"))
|
||||
{
|
||||
InventoryCheat(Player, ""); // this cheat did not exist before
|
||||
C_DoCommand("activatecheat switems");
|
||||
return CCMD_OK;
|
||||
}
|
||||
return CCMD_SHOWHELP;
|
||||
|
@ -301,7 +179,6 @@ int32_t registerosdcommands(void)
|
|||
C_RegisterFunction("map","map <mapfile>: loads the given map", osdcmd_map);
|
||||
C_RegisterFunction("give","give <all|health|weapons|ammo|armor|keys|inventory>: gives requested item", osdcmd_give);
|
||||
C_RegisterFunction("god","god: toggles god mode", osdcmd_god);
|
||||
// C_RegisterFunction("activatecheat","activatecheat <string>: activates a classic cheat code", osdcmd_activatecheat);
|
||||
|
||||
C_RegisterFunction("noclip","noclip: toggles clipping mode", osdcmd_noclip);
|
||||
|
||||
|
|
|
@ -32,8 +32,6 @@ struct osdcmd_cheatsinfo {
|
|||
int32_t volume,level;
|
||||
};
|
||||
|
||||
extern struct osdcmd_cheatsinfo osdcmd_cheatsinfo_stat;
|
||||
|
||||
int32_t registerosdcommands(void);
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue