Improve cheat input, re-add SWWM Platinum cheats.
This commit is contained in:
parent
0588fd6dab
commit
4abd709bf9
18 changed files with 361 additions and 61 deletions
|
|
@ -139,8 +139,9 @@ Class SWWMHandler : EventHandler
|
|||
int multilevel[MAXPLAYERS];
|
||||
int lastitemcount[MAXPLAYERS];
|
||||
bool allkills, allitems, allsecrets;
|
||||
// for money cheat
|
||||
transient ui int kcode, lcode;
|
||||
// for custom cheats
|
||||
transient ui int kcode;
|
||||
transient ui String kstr;
|
||||
|
||||
// heal/armor flashes need to be handled here so they don't stack
|
||||
transient int hflash[MAXPLAYERS], aflash[MAXPLAYERS];
|
||||
|
|
@ -1228,36 +1229,55 @@ Class SWWMHandler : EventHandler
|
|||
{
|
||||
if ( e.Type == InputEvent.TYPE_KeyDown )
|
||||
{
|
||||
// need a reliable way to check for cheats
|
||||
//if ( sv_cheats )
|
||||
// cheat code handling
|
||||
String cht[] =
|
||||
{
|
||||
static const int lods[] = {38,24,32,31,24,33,18,50,24,49,18};
|
||||
// what's that spell?
|
||||
// loadsamoney! ... probably
|
||||
if ( e.KeyScan == lods[kcode] )
|
||||
{
|
||||
kcode++;
|
||||
if ( kcode >= 11 )
|
||||
{
|
||||
SendNetworkEvent("swwmmoneycheat",consoleplayer);
|
||||
kcode = 0;
|
||||
}
|
||||
}
|
||||
else kcode = 0;
|
||||
static const int deep[] = {32,18,18,25,38,24,19,18};
|
||||
// the deepest lore
|
||||
if ( e.KeyScan == deep[lcode] )
|
||||
{
|
||||
lcode++;
|
||||
if ( lcode >= 8 )
|
||||
{
|
||||
SendNetworkEvent("swwmlorecheat",consoleplayer);
|
||||
lcode = 0;
|
||||
}
|
||||
}
|
||||
else lcode = 0;
|
||||
"mklodsofemone", "mkdeeplore",
|
||||
// SWWM Platinum cheats
|
||||
"mkimstuck", "mkarmojumbo", "mkdangimhealthy",
|
||||
"mkwarriorofzaemonath", "mkpowerparp", "mkcannotseemyhands",
|
||||
"mkreflectonme", "mkgunzmeneeds", "mkbloodrainsfromheaven",
|
||||
"mknotwannaboom", "mkverywrappyoatmeal", "mkflaggerybingo",
|
||||
"mkheadsball", "mksmarties", "mknocilla",
|
||||
"mkmarioisaweenie", "mkpunish", "mkboingball",
|
||||
"mkgassy", "mkiamsuperman", "mktouchstone"
|
||||
};
|
||||
String cmd[] =
|
||||
{
|
||||
"swwmmoneycheat", "swwmlorecheat",
|
||||
// SWWM Platinum cheats
|
||||
"swwmsafecheat", "swwmweaponcheat", "swwmhealcheat",
|
||||
"swwmynykroncheat", "swwmgravcheat", "swwminvischeat",
|
||||
"swwmbarriercheat", "swwmammocheat", "swwmbloodcheat",
|
||||
"swwmexplocheat", "swwmallcheat", "swwmflagcheat",
|
||||
"swwmballcheat", "swwmsmartcheat", "swwmnutcheat",
|
||||
"swwmweeniecheat", "swwmpunishcheat", "swwmball2cheat",
|
||||
"swwmfartcheat", "swwmsupercheat", "swwmstonecheat"
|
||||
};
|
||||
bool matchany = false;
|
||||
kstr.AppendCharacter(e.KeyChar);
|
||||
for ( int i=0; i<cht.Size(); i++ )
|
||||
{
|
||||
if ( kstr != cht[i].Left(kstr.length()) ) continue;
|
||||
matchany = true;
|
||||
if ( kstr != cht[i] ) continue;
|
||||
SendNetworkEvent(cmd[i],consoleplayer);
|
||||
kcode = 0;
|
||||
kstr = "";
|
||||
return true;
|
||||
}
|
||||
if ( e.KeyScan == 33 ) // assuming that's the F key on all keyboards (hopefully)
|
||||
if ( !matchany )
|
||||
{
|
||||
kcode = 0;
|
||||
kstr = "";
|
||||
}
|
||||
else
|
||||
{
|
||||
kcode++;
|
||||
if ( kcode > 2 ) return true; // eat keypresses from this point
|
||||
}
|
||||
// F
|
||||
if ( e.KeyChar == 0x66 )
|
||||
{
|
||||
let demo = Demolitionist(players[consoleplayer].mo);
|
||||
let gone = PlayerGone(players[consoleplayer].mo);
|
||||
|
|
@ -1273,8 +1293,6 @@ Class SWWMHandler : EventHandler
|
|||
}
|
||||
}
|
||||
}
|
||||
if ( (kcode > 2) || (lcode > 2) )
|
||||
return true; // eat keypresses from this point
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
@ -1761,29 +1779,6 @@ Class SWWMHandler : EventHandler
|
|||
if ( dist < 2000 )
|
||||
Console.Printf("\cx%s\cx: %s\c-",players[e.Args[0]].GetUserName(),StringTable.Localize(e.Name.Mid(19)));
|
||||
}
|
||||
else if ( e.Name ~== "swwmmoneycheat" )
|
||||
{
|
||||
if ( consoleplayer == e.Args[0] )
|
||||
{
|
||||
Console.Printf("\cfLOADSAMONEY!\c-");
|
||||
S_StartSound("menu/buyinv",CHAN_ITEM,CHANF_UI);
|
||||
S_StartSound("misc/emone",CHAN_VOICE,CHANF_UI);
|
||||
}
|
||||
SWWMCredits.Give(players[e.Args[0]],1000000000);
|
||||
SWWMScoreObj.Spawn(1000000000,players[e.Args[0]].mo.Vec3Offset(0,0,players[e.Args[0]].mo.Height/2));
|
||||
}
|
||||
else if ( e.Name ~== "swwmlorecheat" )
|
||||
{
|
||||
// look up all lore files
|
||||
for ( int l=0; l<Wads.GetNumLumps(); l++ )
|
||||
{
|
||||
String fn = Wads.GetLumpFullName(l);
|
||||
if ( fn.Left(13) != "lore/default/" ) continue;
|
||||
int ext = fn.IndexOf(".txt");
|
||||
if ( ext != fn.Length()-4 ) continue;
|
||||
SWWMLoreLibrary.Add(players[e.Args[0]],fn.Mid(13,ext-13));
|
||||
}
|
||||
}
|
||||
else if ( e.Name.Left(8) ~== "swwmcbt." )
|
||||
{
|
||||
// from wikipedia, the free encyclopedia
|
||||
|
|
@ -1818,6 +1813,293 @@ Class SWWMHandler : EventHandler
|
|||
if ( e.Args[0] != consoleplayer ) return;
|
||||
checklist.Clear();
|
||||
}
|
||||
// CHEATS
|
||||
else if ( e.Name ~== "swwmmoneycheat" )
|
||||
{
|
||||
if ( SWWMUtility.CheatsDisabled(e.Args[0]) )
|
||||
return;
|
||||
// what's that spell?
|
||||
// loadsamoney! ... probably
|
||||
if ( consoleplayer == e.Args[0] )
|
||||
{
|
||||
Console.Printf("\cyLOADSAMONEY!\c-");
|
||||
S_StartSound("menu/buyinv",CHAN_ITEM,CHANF_UI);
|
||||
S_StartSound("misc/emone",CHAN_VOICE,CHANF_UI);
|
||||
}
|
||||
SWWMCredits.Give(players[e.Args[0]],1000000000);
|
||||
SWWMScoreObj.Spawn(1000000000,players[e.Args[0]].mo.Vec3Offset(0,0,players[e.Args[0]].mo.Height/2));
|
||||
}
|
||||
else if ( e.Name ~== "swwmlorecheat" )
|
||||
{
|
||||
if ( SWWMUtility.CheatsDisabled(e.Args[0]) )
|
||||
return;
|
||||
if ( consoleplayer == e.Args[0] )
|
||||
{
|
||||
Console.Printf("\cyKNOWLEDGE!\c-");
|
||||
S_StartSound("menu/buyinv",CHAN_ITEM,CHANF_UI);
|
||||
S_StartSound("misc/lamborghini",CHAN_VOICE,CHANF_UI);
|
||||
}
|
||||
// look up all lore files
|
||||
for ( int l=0; l<Wads.GetNumLumps(); l++ )
|
||||
{
|
||||
String fn = Wads.GetLumpFullName(l);
|
||||
if ( fn.Left(13) != "lore/default/" ) continue;
|
||||
int ext = fn.IndexOf(".txt");
|
||||
if ( ext != fn.Length()-4 ) continue;
|
||||
SWWMLoreLibrary.Add(players[e.Args[0]],fn.Mid(13,ext-13));
|
||||
}
|
||||
}
|
||||
else if ( e.Name ~== "swwmsafecheat" )
|
||||
{
|
||||
if ( SWWMUtility.CheatsDisabled(e.Args[0]) )
|
||||
return;
|
||||
if ( consoleplayer == e.Args[0] )
|
||||
{
|
||||
Console.Printf("\cyStay out of trouble.\c-");
|
||||
S_StartSound("menu/buyinv",CHAN_ITEM,CHANF_UI);
|
||||
}
|
||||
Vector3 safepos;
|
||||
double safeangle;
|
||||
[safepos, safeangle] = level.PickPlayerStart(e.Args[0]);
|
||||
players[e.Args[0]].mo.Teleport(safepos,safeangle,TF_TELEFRAG|TF_FORCED|TF_USESPOTZ);
|
||||
}
|
||||
else if ( e.Name ~== "swwmweaponcheat" )
|
||||
{
|
||||
if ( SWWMUtility.CheatsDisabled(e.Args[0]) )
|
||||
return;
|
||||
if ( consoleplayer == e.Args[0] )
|
||||
{
|
||||
Console.Printf("\cyYou better be happy now\c-");
|
||||
S_StartSound("menu/buyinv",CHAN_ITEM,CHANF_UI);
|
||||
S_StartSound("misc/w_pkup",CHAN_VOICE,CHANF_UI);
|
||||
}
|
||||
for ( int i=0; i<AllActorClasses.Size(); i++ )
|
||||
{
|
||||
let w = (Class<SWWMWeapon>)(AllActorClasses[i]);
|
||||
if ( !w || (w == 'SWWMWeapon') ) continue;
|
||||
let def = GetDefaultByType(w);
|
||||
if ( def.bCHEATNOTWEAPON ) continue;
|
||||
let ow = players[e.Args[0]].mo.FindInventory(w);
|
||||
if ( ow && (ow.Amount >= ow.MaxAmount) ) continue;
|
||||
if ( ow ) ow.Amount = ow.MaxAmount;
|
||||
else players[e.Args[0]].mo.GiveInventory(w,def.MaxAmount);
|
||||
}
|
||||
}
|
||||
else if ( e.Name ~== "swwmhealcheat" )
|
||||
{
|
||||
if ( SWWMUtility.CheatsDisabled(e.Args[0]) )
|
||||
return;
|
||||
if ( consoleplayer == e.Args[0] )
|
||||
{
|
||||
Console.Printf("\cyRemember to stay fit.\c-");
|
||||
S_StartSound("menu/buyinv",CHAN_ITEM,CHANF_UI);
|
||||
S_StartSound("misc/health_pkup",CHAN_VOICE,CHANF_UI);
|
||||
}
|
||||
players[e.Args[0]].health = players[e.Args[0]].mo.health = 1000;
|
||||
}
|
||||
else if ( e.Name ~== "swwmynykroncheat" )
|
||||
{
|
||||
if ( SWWMUtility.CheatsDisabled(e.Args[0]) )
|
||||
return;
|
||||
if ( consoleplayer == e.Args[0] )
|
||||
{
|
||||
Console.Printf("\cyYou're still crazy.\c-");
|
||||
S_StartSound("menu/buyinv",CHAN_ITEM,CHANF_UI);
|
||||
S_StartSound("misc/w_pkup",CHAN_VOICE,CHANF_UI);
|
||||
}
|
||||
players[e.Args[0]].mo.GiveInventory("Ynykron",1);
|
||||
}
|
||||
else if ( e.Name ~== "swwmgravcheat" )
|
||||
{
|
||||
if ( SWWMUtility.CheatsDisabled(e.Args[0]) )
|
||||
return;
|
||||
if ( consoleplayer == e.Args[0] )
|
||||
{
|
||||
Console.Printf("\cyGot something floatier.\c-");
|
||||
S_StartSound("menu/buyinv",CHAN_ITEM,CHANF_UI);
|
||||
S_StartSound("misc/p_pkup",CHAN_VOICE,CHANF_UI);
|
||||
}
|
||||
let g = GravityPower(players[e.Args[0]].mo.FindInventory("GravityPower"));
|
||||
if ( g ) g.EffectTics += g.default.EffectTics;
|
||||
else players[e.Args[0]].mo.GiveInventory("GravityPower",1);
|
||||
}
|
||||
else if ( e.Name ~== "swwminvischeat" )
|
||||
{
|
||||
if ( SWWMUtility.CheatsDisabled(e.Args[0]) )
|
||||
return;
|
||||
if ( consoleplayer == e.Args[0] )
|
||||
{
|
||||
Console.Printf("\cyProbably because you're invisible.\c-");
|
||||
S_StartSound("menu/buyinv",CHAN_ITEM,CHANF_UI);
|
||||
S_StartSound("misc/p_pkup",CHAN_VOICE,CHANF_UI);
|
||||
}
|
||||
let g = GhostPower(players[e.Args[0]].mo.FindInventory("GhostPower"));
|
||||
if ( g ) g.EffectTics += g.default.EffectTics;
|
||||
else players[e.Args[0]].mo.GiveInventory("GhostPower",1);
|
||||
}
|
||||
else if ( e.Name ~== "swwmbarriercheat" )
|
||||
{
|
||||
if ( SWWMUtility.CheatsDisabled(e.Args[0]) )
|
||||
return;
|
||||
if ( consoleplayer == e.Args[0] )
|
||||
{
|
||||
Console.Printf("\cySafe from those pesky elements.\c-");
|
||||
S_StartSound("menu/buyinv",CHAN_ITEM,CHANF_UI);
|
||||
S_StartSound("misc/p_pkup",CHAN_VOICE,CHANF_UI);
|
||||
}
|
||||
let b = BarrierPower(players[e.Args[0]].mo.FindInventory("BarrierPower"));
|
||||
if ( b ) b.EffectTics += b.default.EffectTics;
|
||||
else players[e.Args[0]].mo.GiveInventory("BarrierPower",1);
|
||||
}
|
||||
else if ( e.Name ~== "swwmammocheat" )
|
||||
{
|
||||
if ( SWWMUtility.CheatsDisabled(e.Args[0]) )
|
||||
return;
|
||||
if ( consoleplayer == e.Args[0] )
|
||||
{
|
||||
Console.Printf("\cyDon't squander it.\c-");
|
||||
S_StartSound("menu/buyinv",CHAN_ITEM,CHANF_UI);
|
||||
S_StartSound("misc/ammo_pkup",CHAN_VOICE,CHANF_UI);
|
||||
}
|
||||
players[e.Args[0]].mo.GiveInventory("HammerspaceEmbiggener",16,true);
|
||||
for ( Inventory i=players[e.Args[0]].mo.inv; i; i=i.inv )
|
||||
{
|
||||
if ( !(i is 'Ammo') ) continue;
|
||||
i.Amount = i.MaxAmount;
|
||||
}
|
||||
}
|
||||
else if ( e.Name ~== "swwmbloodcheat" )
|
||||
{
|
||||
if ( SWWMUtility.CheatsDisabled(e.Args[0]) )
|
||||
return;
|
||||
if ( consoleplayer == e.Args[0] )
|
||||
{
|
||||
Console.Printf("\cyEdgy...\c-");
|
||||
S_StartSound("misc/nocheat",CHAN_ITEM,CHANF_UI);
|
||||
}
|
||||
}
|
||||
else if ( e.Name ~== "swwmexplocheat" )
|
||||
{
|
||||
if ( SWWMUtility.CheatsDisabled(e.Args[0]) )
|
||||
return;
|
||||
if ( consoleplayer == e.Args[0] )
|
||||
{
|
||||
Console.Printf("\cyThat cheat's not needed anymore.\c-");
|
||||
S_StartSound("misc/nocheat",CHAN_ITEM,CHANF_UI);
|
||||
}
|
||||
}
|
||||
else if ( e.Name ~== "swwmallcheat" )
|
||||
{
|
||||
if ( SWWMUtility.CheatsDisabled(e.Args[0]) )
|
||||
return;
|
||||
if ( consoleplayer == e.Args[0] )
|
||||
{
|
||||
Console.Printf("\cyStill as wrappy as it's always been.\c-");
|
||||
S_StartSound("menu/buyinv",CHAN_ITEM,CHANF_UI);
|
||||
S_StartSound("fabricator/use",CHAN_VOICE,CHANF_UI);
|
||||
}
|
||||
players[e.Args[0]].mo.CheatGive("all",0);
|
||||
}
|
||||
else if ( e.Name ~== "swwmflagcheat" )
|
||||
{
|
||||
if ( SWWMUtility.CheatsDisabled(e.Args[0]) )
|
||||
return;
|
||||
if ( consoleplayer == e.Args[0] )
|
||||
{
|
||||
Console.Printf("\cyThere are no flags here.\c-");
|
||||
S_StartSound("misc/nocheat",CHAN_ITEM,CHANF_UI);
|
||||
}
|
||||
}
|
||||
else if ( e.Name ~== "swwmballcheat" )
|
||||
{
|
||||
if ( SWWMUtility.CheatsDisabled(e.Args[0]) )
|
||||
return;
|
||||
if ( consoleplayer == e.Args[0] )
|
||||
{
|
||||
Console.Printf("\cy\"Balls on your head\"? What was I even thinking...\c-");
|
||||
S_StartSound("misc/nocheat",CHAN_ITEM,CHANF_UI);
|
||||
}
|
||||
}
|
||||
else if ( e.Name ~== "swwmsmartcheat" )
|
||||
{
|
||||
if ( SWWMUtility.CheatsDisabled(e.Args[0]) )
|
||||
return;
|
||||
if ( consoleplayer == e.Args[0] )
|
||||
{
|
||||
Console.Printf("\cySkittles are better anyway.\c-");
|
||||
S_StartSound("misc/nocheat",CHAN_ITEM,CHANF_UI);
|
||||
}
|
||||
}
|
||||
else if ( e.Name ~== "swwmnutcheat" )
|
||||
{
|
||||
if ( SWWMUtility.CheatsDisabled(e.Args[0]) )
|
||||
return;
|
||||
if ( consoleplayer == e.Args[0] )
|
||||
{
|
||||
Console.Printf("\cyI'm way past that, it was bad for my health.\c-");
|
||||
S_StartSound("misc/nocheat",CHAN_ITEM,CHANF_UI);
|
||||
}
|
||||
}
|
||||
else if ( e.Name ~== "swwmweeniecheat" )
|
||||
{
|
||||
if ( SWWMUtility.CheatsDisabled(e.Args[0]) )
|
||||
return;
|
||||
if ( consoleplayer == e.Args[0] )
|
||||
{
|
||||
Console.Printf("\cyAlways has been.\c-");
|
||||
S_StartSound("misc/nocheat",CHAN_ITEM,CHANF_UI);
|
||||
}
|
||||
}
|
||||
else if ( e.Name ~== "swwmpunishcheat" )
|
||||
{
|
||||
if ( SWWMUtility.CheatsDisabled(e.Args[0]) )
|
||||
return;
|
||||
if ( consoleplayer == e.Args[0] )
|
||||
{
|
||||
Console.Printf("\cyThis is a bulli free zone.\c-");
|
||||
S_StartSound("misc/nocheat",CHAN_ITEM,CHANF_UI);
|
||||
}
|
||||
}
|
||||
else if ( e.Name ~== "swwmball2cheat" )
|
||||
{
|
||||
if ( SWWMUtility.CheatsDisabled(e.Args[0]) )
|
||||
return;
|
||||
if ( consoleplayer == e.Args[0] )
|
||||
{
|
||||
Console.Printf("\cy<insert amiga boing ball here>\c-");
|
||||
S_StartSound("misc/nocheat",CHAN_ITEM,CHANF_UI);
|
||||
}
|
||||
}
|
||||
else if ( e.Name ~== "swwmfartcheat" )
|
||||
{
|
||||
if ( SWWMUtility.CheatsDisabled(e.Args[0]) )
|
||||
return;
|
||||
if ( consoleplayer == e.Args[0] )
|
||||
{
|
||||
Console.Printf("\cyI'd rather not reimplement that one.\c-");
|
||||
S_StartSound("misc/nocheat",CHAN_ITEM,CHANF_UI);
|
||||
}
|
||||
}
|
||||
else if ( e.Name ~== "swwmsupercheat" )
|
||||
{
|
||||
if ( SWWMUtility.CheatsDisabled(e.Args[0]) )
|
||||
return;
|
||||
if ( consoleplayer == e.Args[0] )
|
||||
{
|
||||
Console.Printf("\cyNo, you're the Demolitionist.\c-");
|
||||
S_StartSound("misc/nocheat",CHAN_ITEM,CHANF_UI);
|
||||
}
|
||||
}
|
||||
else if ( e.Name ~== "swwmstonecheat" )
|
||||
{
|
||||
if ( SWWMUtility.CheatsDisabled(e.Args[0]) )
|
||||
return;
|
||||
if ( consoleplayer == e.Args[0] )
|
||||
{
|
||||
Console.Printf("\cyThe pinnacle of... wait, I misread that.\c-");
|
||||
S_StartSound("misc/nocheat",CHAN_ITEM,CHANF_UI);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// stuff for hud
|
||||
|
|
|
|||
|
|
@ -836,6 +836,20 @@ Class SWWMUtility
|
|||
if ( (maxdist > 0.) && (sc.z < maxdist) ) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
static clearscope bool CheatsDisabled( int p = -1 )
|
||||
{
|
||||
if ( cl_blockcheats || ((G_SkillPropertyInt(SKILLP_DisableCheats) || netgame || deathmatch) && !sv_cheats) )
|
||||
{
|
||||
if ( (p != -1) && (p == consoleplayer) )
|
||||
{
|
||||
Console.Printf("\cfSORRY NOTHING\c-");
|
||||
S_StartSound("misc/trombone",CHAN_VOICE,CHANF_UI);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Class RadiusDebugSphere : Actor
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue