mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-10 23:02:03 +00:00
Implement NAM and WWII GI's replacement cheats.
Whereas Duke starts cheats with DN, NAM starts with NVA and WWII GI starts with WW2. (Hackily: CheatKeys[] is still size 2, and the third character is at the start of every CheatString.) The cheats hyper (NAM-only), coords, view, skill, weapons, and inventory were not originally present but since they work properly and this is EDuke32, I have re-added them. Non-working cheats are now disabled. git-svn-id: https://svn.eduke32.com/eduke32@5451 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
637f48e9ce
commit
4aae9378d0
3 changed files with 147 additions and 17 deletions
|
@ -8213,6 +8213,8 @@ const uint8_t CheatFunctionIDs[] =
|
|||
CHEAT_DEBUG,
|
||||
};
|
||||
|
||||
char const * const g_NAMMattCheatQuote = "Matt Saettler. matts@saettler.com";
|
||||
|
||||
static void doinvcheat(int32_t invidx, int32_t defaultnum, int32_t event)
|
||||
{
|
||||
defaultnum = VM_OnEventWithReturn(event, g_player[myconnectindex].ps->i, myconnectindex, defaultnum);
|
||||
|
@ -8264,7 +8266,11 @@ GAME_STATIC void G_DoCheats(void)
|
|||
|
||||
if (VOLUMEONE && !vol1inited)
|
||||
{
|
||||
Bstrcpy(CheatStrings[2],"scotty##");
|
||||
// change "scotty###" to "scotty##"
|
||||
uint32_t const warpend = Bstrlen(CheatStrings[2]);
|
||||
if (strcmp(&CheatStrings[2][warpend-3], "###") == 0)
|
||||
CheatStrings[2][warpend-1] = '\0';
|
||||
|
||||
Bstrcpy(CheatStrings[6],"<RESERVED>");
|
||||
vol1inited = 1;
|
||||
}
|
||||
|
@ -8597,7 +8603,16 @@ FOUNDCHEAT:
|
|||
return;
|
||||
|
||||
case CHEAT_TODD:
|
||||
P_DoQuote(QUOTE_CHEAT_TODD,g_player[myconnectindex].ps);
|
||||
if (NAM)
|
||||
{
|
||||
Bstrcpy(ScriptQuotes[QUOTE_RESERVED4], g_NAMMattCheatQuote);
|
||||
P_DoQuote(QUOTE_RESERVED4,g_player[myconnectindex].ps);
|
||||
}
|
||||
else
|
||||
{
|
||||
P_DoQuote(QUOTE_CHEAT_TODD,g_player[myconnectindex].ps);
|
||||
}
|
||||
|
||||
end_cheat();
|
||||
return;
|
||||
|
||||
|
@ -11621,6 +11636,65 @@ int32_t app_main(int32_t argc, const char **argv)
|
|||
Bstrcpy(GametypeNames[2],"GruntMatch (No Spawn)");
|
||||
}
|
||||
|
||||
// KEEPINSYNC: NAM_WW2GI_CHEATS
|
||||
if (WW2GI)
|
||||
{
|
||||
CheatKeys[0] = CheatKeys[1] = sc_W;
|
||||
|
||||
Bstrcpy(CheatStrings[0], "2god");
|
||||
Bstrcpy(CheatStrings[1], "2blood");
|
||||
Bstrcpy(CheatStrings[2], "2level###");
|
||||
Bstrcpy(CheatStrings[3], "2coords");
|
||||
Bstrcpy(CheatStrings[4], "2view");
|
||||
Bstrcpy(CheatStrings[5], "<RESERVED>");
|
||||
Bstrcpy(CheatStrings[7], "<RESERVED>");
|
||||
Bstrcpy(CheatStrings[8], "<RESERVED>");
|
||||
Bstrcpy(CheatStrings[9], "2rate");
|
||||
Bstrcpy(CheatStrings[10], "2skill");
|
||||
Bstrcpy(CheatStrings[11], "<RESERVED>");
|
||||
Bstrcpy(CheatStrings[12], "<RESERVED>");
|
||||
Bstrcpy(CheatStrings[13], "<RESERVED>");
|
||||
Bstrcpy(CheatStrings[16], "2matt");
|
||||
Bstrcpy(CheatStrings[17], "2showmap");
|
||||
Bstrcpy(CheatStrings[18], "2ryan");
|
||||
Bstrcpy(CheatStrings[19], "<RESERVED>");
|
||||
Bstrcpy(CheatStrings[20], "2clip");
|
||||
Bstrcpy(CheatStrings[21], "2weapons");
|
||||
Bstrcpy(CheatStrings[22], "2inventory");
|
||||
Bstrcpy(CheatStrings[23], "<RESERVED>");
|
||||
Bstrcpy(CheatStrings[24], "2debug");
|
||||
Bstrcpy(CheatStrings[26], "2cgs");
|
||||
}
|
||||
else if (NAM)
|
||||
{
|
||||
CheatKeys[0] = sc_N;
|
||||
CheatKeys[1] = sc_V;
|
||||
|
||||
Bstrcpy(CheatStrings[0], "acaleb");
|
||||
Bstrcpy(CheatStrings[1], "ablood");
|
||||
Bstrcpy(CheatStrings[2], "alevel###");
|
||||
Bstrcpy(CheatStrings[3], "acoords");
|
||||
Bstrcpy(CheatStrings[4], "aview");
|
||||
Bstrcpy(CheatStrings[5], "<RESERVED>");
|
||||
Bstrcpy(CheatStrings[7], "<RESERVED>");
|
||||
Bstrcpy(CheatStrings[8], "<RESERVED>");
|
||||
Bstrcpy(CheatStrings[9], "arate");
|
||||
Bstrcpy(CheatStrings[10], "askill");
|
||||
Bstrcpy(CheatStrings[11], "<RESERVED>");
|
||||
Bstrcpy(CheatStrings[12], "ahyper");
|
||||
Bstrcpy(CheatStrings[13], "<RESERVED>");
|
||||
Bstrcpy(CheatStrings[16], "amatt");
|
||||
Bstrcpy(CheatStrings[17], "ashowmap");
|
||||
Bstrcpy(CheatStrings[18], "agod");
|
||||
Bstrcpy(CheatStrings[19], "<RESERVED>");
|
||||
Bstrcpy(CheatStrings[20], "aclip");
|
||||
Bstrcpy(CheatStrings[21], "aweapons");
|
||||
Bstrcpy(CheatStrings[22], "ainventory");
|
||||
Bstrcpy(CheatStrings[23], "<RESERVED>");
|
||||
Bstrcpy(CheatStrings[24], "adebug");
|
||||
Bstrcpy(CheatStrings[26], "acgs");
|
||||
}
|
||||
|
||||
if (!usecwd)
|
||||
G_CleanupSearchPaths();
|
||||
|
||||
|
|
|
@ -264,6 +264,8 @@ extern const char *s_buildDate;
|
|||
extern const char *g_rtsNamePtr;
|
||||
|
||||
extern char CheatStrings[][MAXCHEATLEN];
|
||||
extern char const * const g_NAMMattCheatQuote;
|
||||
|
||||
extern char boardfilename[BMAX_PATH], currentboardfilename[BMAX_PATH];
|
||||
extern char boardfilename[BMAX_PATH];
|
||||
|
||||
|
|
|
@ -1752,8 +1752,35 @@ static void M_PreMenu(MenuID_t cm)
|
|||
|
||||
for (i = 0; i < NUMCHEATFUNCS; i++)
|
||||
{
|
||||
uint32_t cheatmask = cl_cheatmask & (1<<i);
|
||||
|
||||
// KEEPINSYNC: NAM_WW2GI_CHEATS
|
||||
if (NAM_WW2GI)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case CHEATFUNC_CASHMAN:
|
||||
case CHEATFUNC_GIVEALLITEMS:
|
||||
case CHEATFUNC_QUOTEBETA:
|
||||
case CHEATFUNC_MONSTERS:
|
||||
case CHEATFUNC_QUOTEALLEN:
|
||||
case CHEATFUNC_GIVEKEYS:
|
||||
cheatmask = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (WW2GI)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case CHEATFUNC_HYPER:
|
||||
cheatmask = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// only show cheats that have been typed in before
|
||||
MEL_CHEATS[i+1] = (cl_cheatmask & (1<<i)) ? &ME_CheatCodes[i] : NULL;
|
||||
MEL_CHEATS[i+1] = cheatmask ? &ME_CheatCodes[i] : NULL;
|
||||
|
||||
// disable outside of a single-player game
|
||||
MenuEntry_DisableOnCondition(&ME_CheatCodes[i], menucheatsdisabled);
|
||||
|
@ -1763,7 +1790,7 @@ static void M_PreMenu(MenuID_t cm)
|
|||
if (!DUKEBETA)
|
||||
{
|
||||
ME_CheatCodes[CHEATFUNC_QUOTEBETA].name = ScriptQuotes[QUOTE_CHEAT_BETA];
|
||||
ME_CheatCodes[CHEATFUNC_QUOTETODD].name = ScriptQuotes[QUOTE_CHEAT_TODD];
|
||||
ME_CheatCodes[CHEATFUNC_QUOTETODD].name = NAM ? g_NAMMattCheatQuote : ScriptQuotes[QUOTE_CHEAT_TODD];
|
||||
ME_CheatCodes[CHEATFUNC_QUOTEALLEN].name = ScriptQuotes[QUOTE_CHEAT_ALLEN];
|
||||
}
|
||||
break;
|
||||
|
@ -3132,6 +3159,23 @@ static void M_MenuVerify(int32_t input)
|
|||
}
|
||||
}
|
||||
|
||||
static int M_CheatStringMatch(char const * input, char const * cheat)
|
||||
{
|
||||
while (*cheat || *input)
|
||||
{
|
||||
if (*cheat != *input)
|
||||
{
|
||||
if (!(*cheat == '#' && Bisdigit(*input)))
|
||||
return 0;
|
||||
}
|
||||
|
||||
++cheat;
|
||||
++input;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void M_MenuTextFormSubmit(char *input)
|
||||
{
|
||||
switch (g_currentMenu)
|
||||
|
@ -3161,24 +3205,15 @@ static void M_MenuTextFormSubmit(char *input)
|
|||
{
|
||||
const size_t inputlength = Bstrlen(input);
|
||||
Bstrcpy(tempbuf, input);
|
||||
const char *numberpos = NULL;
|
||||
for (size_t i = 0; i < inputlength; i++)
|
||||
{
|
||||
tempbuf[i] = Btolower(tempbuf[i]);
|
||||
if (Bisdigit(tempbuf[i]))
|
||||
{
|
||||
if (numberpos == NULL)
|
||||
numberpos = &input[i];
|
||||
tempbuf[i] = '#';
|
||||
}
|
||||
}
|
||||
|
||||
int8_t cheatID = -1;
|
||||
|
||||
if (inputlength > 2 && tempbuf[0] == scantoasc[CheatKeys[0]] && tempbuf[1] == scantoasc[CheatKeys[1]])
|
||||
{
|
||||
for (size_t i = 0; i < NUMCHEATS; i++)
|
||||
if (!Bstrcmp(tempbuf+2, CheatStrings[i]))
|
||||
if (M_CheatStringMatch(tempbuf+2, CheatStrings[i]))
|
||||
{
|
||||
cheatID = i;
|
||||
break;
|
||||
|
@ -3191,15 +3226,33 @@ static void M_MenuTextFormSubmit(char *input)
|
|||
S_PlaySound(KICK_HIT);
|
||||
break;
|
||||
case CHEAT_SCOTTY:
|
||||
M_Cheat_Warp(numberpos);
|
||||
{
|
||||
char const * const numberpos = Bstrchr(CheatStrings[CHEAT_SCOTTY], '#');
|
||||
if (numberpos == NULL)
|
||||
{
|
||||
S_PlaySound(KICK_HIT);
|
||||
break;
|
||||
}
|
||||
|
||||
M_Cheat_Warp(input + (numberpos - CheatStrings[CHEAT_SCOTTY]) + 2);
|
||||
if (g_player[myconnectindex].ps->gm&MODE_MENU)
|
||||
S_PlaySound(DUKE_GET);
|
||||
break;
|
||||
}
|
||||
case CHEAT_SKILL:
|
||||
M_Cheat_Skill(numberpos);
|
||||
{
|
||||
char const * const numberpos = Bstrchr(CheatStrings[CHEAT_SKILL], '#');
|
||||
if (numberpos == NULL)
|
||||
{
|
||||
S_PlaySound(KICK_HIT);
|
||||
break;
|
||||
}
|
||||
|
||||
M_Cheat_Skill(input + (numberpos - CheatStrings[CHEAT_SKILL]) + 2);
|
||||
if (g_player[myconnectindex].ps->gm&MODE_MENU)
|
||||
S_PlaySound(DUKE_GET);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
M_Cheat(cheatID);
|
||||
S_PlaySound(DUKE_GET);
|
||||
|
@ -3209,7 +3262,8 @@ static void M_MenuTextFormSubmit(char *input)
|
|||
if (cheatID >= 0)
|
||||
cl_cheatmask |= CheatFunctionFlags[cheatID];
|
||||
|
||||
if ((cl_cheatmask & (1<<CHEATFUNC_QUOTEBETA)) && (cl_cheatmask & (1<<CHEATFUNC_QUOTETODD)) && (cl_cheatmask & (1<<CHEATFUNC_QUOTEALLEN)))
|
||||
if ((NAM_WW2GI && (cl_cheatmask & (1<<CHEATFUNC_QUOTETODD))) ||
|
||||
((cl_cheatmask & (1<<CHEATFUNC_QUOTEBETA)) && (cl_cheatmask & (1<<CHEATFUNC_QUOTETODD)) && (cl_cheatmask & (1<<CHEATFUNC_QUOTEALLEN))))
|
||||
cl_cheatmask = ~0;
|
||||
|
||||
M_ChangeMenu(MENU_CHEATS);
|
||||
|
|
Loading…
Reference in a new issue