Move cheat descriptions from menus.cpp to cheats.cpp

git-svn-id: https://svn.eduke32.com/eduke32@7895 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
hendricks266 2019-08-07 19:12:11 +00:00 committed by Christoph Oelckers
parent 29d4a7e634
commit ba91dd0120
3 changed files with 63 additions and 36 deletions

View file

@ -24,7 +24,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "osdcmds.h" #include "osdcmds.h"
#include "cheats.h" #include "cheats.h"
// KEEPINSYNC game.h: enum cheatindex_t
char CheatStrings [NUMCHEATS][MAXCHEATLEN] = char CheatStrings [NUMCHEATS][MAXCHEATLEN] =
{ {
#ifndef EDUKE32_STANDALONE #ifndef EDUKE32_STANDALONE
@ -58,6 +57,37 @@ char CheatStrings [NUMCHEATS][MAXCHEATLEN] =
#endif #endif
}; };
char CheatDescriptions[NUMCHEATS][MAXCHEATDESC] =
{
"Toggle God Mode",
"Give Everything",
"Level Warp",
"Toggle Coordinate Display",
"Toggle 3rd-Person View",
"", // time
"Toggle All Locks",
"Toggle Cashman",
"Give All Items",
"Toggle Framerate Display",
"Change Skill",
"", // beta
"Toggle Hyper",
"Toggle Monsters",
"", // <RESERVED>
"", // <RESERVED>
"Matt Saettler. matts@saettler.com", // todd
"Toggle Show All Map",
"", // kroz
"", // allen
"Toggle Clipping",
"Give Weapons",
"Give Inventory",
"Give Keys",
"Toggle Debug Data Dump",
"", // <RESERVED>
"", // cgs
};
const uint32_t CheatFunctionFlags [NUMCHEATS] = const uint32_t CheatFunctionFlags [NUMCHEATS] =
{ {
1 << CHEATFUNC_GOD, 1 << CHEATFUNC_GOD,
@ -89,8 +119,8 @@ const uint32_t CheatFunctionFlags [NUMCHEATS] =
(1 << CHEATFUNC_GOD) | (1 << CHEATFUNC_GIVEEVERYTHING), (1 << CHEATFUNC_GOD) | (1 << CHEATFUNC_GIVEEVERYTHING),
}; };
// KEEPINSYNC game.h: enum CheatCodeFunctions // KEEPINSYNC cheats.h: enum CheatCodeFunctions
// KEEPINSYNC menus.c: MenuEntry_t ME_CheatCodes[] // KEEPINSYNC menus.cpp: MenuEntry_t ME_CheatCodes[]
const uint8_t CheatFunctionIDs[NUMCHEATS] = const uint8_t CheatFunctionIDs[NUMCHEATS] =
{ {
CHEAT_CASHMAN, CHEAT_CASHMAN,
@ -116,8 +146,6 @@ const uint8_t CheatFunctionIDs[NUMCHEATS] =
CHEAT_DEBUG, CHEAT_DEBUG,
}; };
char const * const g_NAMMattCheatQuote = "Matt Saettler. matts@saettler.com";
#ifndef EDUKE32_STANDALONE #ifndef EDUKE32_STANDALONE
void G_SetupCheats(void) void G_SetupCheats(void)
{ {
@ -626,7 +654,7 @@ void G_DoCheats(void)
case CHEAT_TODD: case CHEAT_TODD:
if (NAM) if (NAM)
{ {
Bstrcpy(apStrings[QUOTE_RESERVED4], g_NAMMattCheatQuote); Bstrcpy(apStrings[QUOTE_RESERVED4], CheatDescriptions[CHEAT_TODD]);
P_DoQuote(QUOTE_RESERVED4, pPlayer); P_DoQuote(QUOTE_RESERVED4, pPlayer);
} }
else else

View file

@ -23,15 +23,12 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#pragma once #pragma once
#define MAXCHEATLEN 20 #define MAXCHEATLEN 20
#define MAXCHEATDESC 64
#define NUMCHEATCODES (int32_t) ARRAY_SIZE(CheatStrings) #define NUMCHEATCODES (int32_t) ARRAY_SIZE(CheatStrings)
extern void G_DoCheats(void); extern void G_DoCheats(void);
extern void G_SetupCheats(void); extern void G_SetupCheats(void);
extern char const * const g_NAMMattCheatQuote;
// Cheats
// KEEPINSYNC game.c: char CheatStrings[][]
enum cheatindex_t enum cheatindex_t
{ {
CHEAT_CORNHOLIO, // 0 CHEAT_CORNHOLIO, // 0
@ -65,9 +62,10 @@ enum cheatindex_t
}; };
extern char CheatStrings[NUMCHEATS][MAXCHEATLEN]; extern char CheatStrings[NUMCHEATS][MAXCHEATLEN];
extern char CheatDescriptions[NUMCHEATS][MAXCHEATDESC];
// KEEPINSYNC game.c: uint8_t CheatFunctionIDs[] // KEEPINSYNC cheats.cpp: uint8_t CheatFunctionIDs[]
// KEEPINSYNC menus.c: MenuEntry_t ME_CheatCodes[] // KEEPINSYNC menus.cpp: MenuEntry_t ME_CheatCodes[]
enum CheatCodeFunctions enum CheatCodeFunctions
{ {
CHEATFUNC_CASHMAN, CHEATFUNC_CASHMAN,

View file

@ -643,31 +643,31 @@ static MenuEntry_t ME_ENTERCHEAT = MAKE_MENUENTRY( "Enter Cheat Code", &MF_Redfo
static MenuLink_t MEO_CHEAT_WARP = { MENU_CHEAT_WARP, MA_None, }; static MenuLink_t MEO_CHEAT_WARP = { MENU_CHEAT_WARP, MA_None, };
static MenuLink_t MEO_CHEAT_SKILL = { MENU_CHEAT_SKILL, MA_None, }; static MenuLink_t MEO_CHEAT_SKILL = { MENU_CHEAT_SKILL, MA_None, };
// KEEPINSYNC game.h: enum CheatCodeFunctions // KEEPINSYNC cheats.h: enum CheatCodeFunctions
// KEEPINSYNC game.c: uint8_t CheatFunctionIDs[] // KEEPINSYNC cheats.cpp: uint8_t CheatFunctionIDs[]
#define MAKE_MENUCHEAT( Name ) MAKE_MENUENTRY( Name, &MF_Bluefont, &MEF_Cheats, &MEO_NULL, Link ) #define MAKE_MENUCHEAT( Name ) MAKE_MENUENTRY( Name, &MF_Bluefont, &MEF_Cheats, &MEO_NULL, Link )
static MenuEntry_t ME_CheatCodes[] = { static MenuEntry_t ME_CheatCodes[] = {
MAKE_MENUCHEAT( "Toggle Cashman" ), MAKE_MENUCHEAT( CheatDescriptions[CHEAT_CASHMAN] ),
MAKE_MENUCHEAT( "Toggle God Mode" ), MAKE_MENUCHEAT( CheatDescriptions[CHEAT_CORNHOLIO] ),
MAKE_MENUCHEAT( "Give Everything" ), MAKE_MENUCHEAT( CheatDescriptions[CHEAT_STUFF] ),
MAKE_MENUCHEAT( "Give Weapons" ), MAKE_MENUCHEAT( CheatDescriptions[CHEAT_WEAPONS] ),
MAKE_MENUCHEAT( "Give All Items" ), MAKE_MENUCHEAT( CheatDescriptions[CHEAT_ITEMS] ),
MAKE_MENUCHEAT( "Give Inventory" ), MAKE_MENUCHEAT( CheatDescriptions[CHEAT_INVENTORY] ),
MAKE_MENUCHEAT( "Give Keys" ), MAKE_MENUCHEAT( CheatDescriptions[CHEAT_KEYS] ),
MAKE_MENUCHEAT( "Toggle Hyper" ), MAKE_MENUCHEAT( CheatDescriptions[CHEAT_HYPER] ),
MAKE_MENUCHEAT( "Toggle 3rd-Person View" ), MAKE_MENUCHEAT( CheatDescriptions[CHEAT_VIEW] ),
MAKE_MENUCHEAT( "Toggle Show All Map" ), MAKE_MENUCHEAT( CheatDescriptions[CHEAT_SHOWMAP] ),
MAKE_MENUCHEAT( "Toggle All Locks" ), MAKE_MENUCHEAT( CheatDescriptions[CHEAT_UNLOCK] ),
MAKE_MENUCHEAT( "Toggle Clipping" ), MAKE_MENUCHEAT( CheatDescriptions[CHEAT_CLIP] ),
MAKE_MENUENTRY( "Level Warp", &MF_Bluefont, &MEF_Cheats, &MEO_CHEAT_WARP, Link ), MAKE_MENUENTRY( CheatDescriptions[CHEAT_SCOTTY], &MF_Bluefont, &MEF_Cheats, &MEO_CHEAT_WARP, Link ),
MAKE_MENUENTRY( "Change Skill", &MF_Bluefont, &MEF_Cheats, &MEO_CHEAT_SKILL, Link ), MAKE_MENUENTRY( CheatDescriptions[CHEAT_SKILL], &MF_Bluefont, &MEF_Cheats, &MEO_CHEAT_SKILL, Link ),
MAKE_MENUCHEAT( "Toggle Monsters" ), MAKE_MENUCHEAT( CheatDescriptions[CHEAT_MONSTERS] ),
MAKE_MENUCHEAT( "Toggle Framerate Display" ), MAKE_MENUCHEAT( CheatDescriptions[CHEAT_RATE] ),
MAKE_MENUCHEAT( NULL ), MAKE_MENUCHEAT( CheatDescriptions[CHEAT_BETA] ),
MAKE_MENUCHEAT( NULL ), MAKE_MENUCHEAT( CheatDescriptions[CHEAT_TODD] ),
MAKE_MENUCHEAT( NULL ), MAKE_MENUCHEAT( CheatDescriptions[CHEAT_ALLEN] ),
MAKE_MENUCHEAT( "Toggle Coordinate Display" ), MAKE_MENUCHEAT( CheatDescriptions[CHEAT_COORDS] ),
MAKE_MENUCHEAT( "Toggle Debug Data Dump" ), MAKE_MENUCHEAT( CheatDescriptions[CHEAT_DEBUG] ),
}; };
static MenuEntry_t *MEL_OPTIONS[] = { static MenuEntry_t *MEL_OPTIONS[] = {
@ -2013,7 +2013,8 @@ static void Menu_Pre(MenuID_t cm)
if (!DUKEBETA) if (!DUKEBETA)
{ {
ME_CheatCodes[CHEATFUNC_QUOTEBETA].name = apStrings[QUOTE_CHEAT_BETA]; ME_CheatCodes[CHEATFUNC_QUOTEBETA].name = apStrings[QUOTE_CHEAT_BETA];
ME_CheatCodes[CHEATFUNC_QUOTETODD].name = NAM ? g_NAMMattCheatQuote : apStrings[QUOTE_CHEAT_TODD]; if (!NAM)
ME_CheatCodes[CHEATFUNC_QUOTETODD].name = apStrings[QUOTE_CHEAT_TODD];
ME_CheatCodes[CHEATFUNC_QUOTEALLEN].name = apStrings[QUOTE_CHEAT_ALLEN]; ME_CheatCodes[CHEATFUNC_QUOTEALLEN].name = apStrings[QUOTE_CHEAT_ALLEN];
} }