Menus: Hide blank cheats

git-svn-id: https://svn.eduke32.com/eduke32@6678 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
hendricks266 2018-02-20 11:55:16 +00:00
parent 26749bf881
commit 5bd6f6e28f
1 changed files with 10 additions and 10 deletions

View File

@ -1998,6 +1998,14 @@ static void Menu_Pre(MenuID_t cm)
{
const int32_t menucheatsdisabled = numplayers != 1 || !(g_player[myconnectindex].ps->gm & MODE_GAME);
// refresh display names of quote cheats
if (!DUKEBETA)
{
ME_CheatCodes[CHEATFUNC_QUOTEBETA].name = apStrings[QUOTE_CHEAT_BETA];
ME_CheatCodes[CHEATFUNC_QUOTETODD].name = NAM ? g_NAMMattCheatQuote : apStrings[QUOTE_CHEAT_TODD];
ME_CheatCodes[CHEATFUNC_QUOTEALLEN].name = apStrings[QUOTE_CHEAT_ALLEN];
}
for (i = 0; i < NUMCHEATFUNCS; i++)
{
uint32_t cheatmask = cl_cheatmask & (1<<i);
@ -2029,21 +2037,13 @@ static void Menu_Pre(MenuID_t cm)
MenuEntry_t & entry = ME_CheatCodes[i];
// only show cheats that have been typed in before
MenuEntry_HideOnCondition(&entry, !cheatmask);
// only show cheats that have been typed in before and are not undefined
MenuEntry_HideOnCondition(&entry, !cheatmask || CheatStrings[CheatFunctionIDs[i]][0] == '\0');
// disable outside of a single-player game
MenuEntry_DisableOnCondition(&entry, menucheatsdisabled);
}
// refresh display names of quote cheats
if (!DUKEBETA)
{
ME_CheatCodes[CHEATFUNC_QUOTEBETA].name = apStrings[QUOTE_CHEAT_BETA];
ME_CheatCodes[CHEATFUNC_QUOTETODD].name = NAM ? g_NAMMattCheatQuote : apStrings[QUOTE_CHEAT_TODD];
ME_CheatCodes[CHEATFUNC_QUOTEALLEN].name = apStrings[QUOTE_CHEAT_ALLEN];
}
MenuEntry_DisableOnCondition(&ME_ENTERCHEAT, (cl_cheatmask == UINT32_MAX));
break;