mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-25 11:10:47 +00:00
Change the way gamefuncs are handled to support and ignore entries named as the empty string.
git-svn-id: https://svn.eduke32.com/eduke32@6185 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
6d11c01fd7
commit
a10893d75f
5 changed files with 41 additions and 13 deletions
|
@ -122,6 +122,9 @@ void CONFIG_SetDefaultKeys(const char (*keyptr)[MAXGAMEFUNCLEN])
|
|||
|
||||
for (size_t i=0; i < ARRAY_SIZE(keydefaults); i+=2)
|
||||
{
|
||||
if (gamefunctions[i][0] == '\0')
|
||||
continue;
|
||||
|
||||
f = CONFIG_FunctionNameToNum(gamefunctions[i>>1]);
|
||||
if (f == -1) continue;
|
||||
ud.config.KeyboardKeys[f][0] = KB_StringToScanCode(keyptr[i]);
|
||||
|
|
|
@ -6139,6 +6139,9 @@ int app_main(int argc, char const * const * argv)
|
|||
hash_init(&h_gamefuncs);
|
||||
for (bssize_t i=NUMGAMEFUNCTIONS-1; i>=0; i--)
|
||||
{
|
||||
if (gamefunctions[i][0] == '\0')
|
||||
continue;
|
||||
|
||||
char *str = Bstrtolower(Xstrdup(gamefunctions[i]));
|
||||
hash_add(&h_gamefuncs,gamefunctions[i],i,0);
|
||||
hash_add(&h_gamefuncs,str,i,0);
|
||||
|
|
|
@ -6105,11 +6105,14 @@ static void C_AddDefaultDefinitions(void)
|
|||
{
|
||||
int32_t j;
|
||||
|
||||
if (!Bstrcmp(gamefunctions[i],"Show_Console")) continue;
|
||||
if (gamefunctions[i][0] == '\0')
|
||||
continue;
|
||||
|
||||
Bsprintf(tempbuf,"GAMEFUNC_%s", gamefunctions[i]);
|
||||
// if (!Bstrcmp(gamefunctions[i],"Show_Console")) continue;
|
||||
|
||||
for (j=Bstrlen(tempbuf); j>=0; j--)
|
||||
j = Bsprintf(tempbuf,"GAMEFUNC_%s", gamefunctions[i]);
|
||||
|
||||
for (; j>=0; j--)
|
||||
tempbuf[j] = Btoupper(tempbuf[j]);
|
||||
|
||||
C_AddDefinition(tempbuf, i, LABEL_DEFINE);
|
||||
|
|
|
@ -236,7 +236,8 @@ static MenuOptionSet_t MEOS_YesNo = MAKE_MENUOPTIONSET( MEOSN_YesNo, NULL, 0x3 )
|
|||
static char MenuGameFuncs[NUMGAMEFUNCTIONS][MAXGAMEFUNCLEN];
|
||||
static char const *MenuGameFuncNone = " -None-";
|
||||
static char const *MEOSN_Gamefuncs[NUMGAMEFUNCTIONS+1];
|
||||
static MenuOptionSet_t MEOS_Gamefuncs = MAKE_MENUOPTIONSET( MEOSN_Gamefuncs, NULL, 0x1 );
|
||||
static int32_t MEOSV_Gamefuncs[NUMGAMEFUNCTIONS+1];
|
||||
static MenuOptionSet_t MEOS_Gamefuncs = MAKE_MENUOPTIONSET( MEOSN_Gamefuncs, MEOSV_Gamefuncs, 0x1 );
|
||||
|
||||
|
||||
|
||||
|
@ -1426,6 +1427,9 @@ void Menu_Init(void)
|
|||
}
|
||||
|
||||
// prepare gamefuncs and keys
|
||||
MEOSN_Gamefuncs[0] = MenuGameFuncNone;
|
||||
MEOSV_Gamefuncs[0] = -1;
|
||||
k = 1;
|
||||
for (i = 0; i < NUMGAMEFUNCTIONS; ++i)
|
||||
{
|
||||
Bstrcpy(MenuGameFuncs[i], gamefunctions[i]);
|
||||
|
@ -1434,9 +1438,15 @@ void Menu_Init(void)
|
|||
if (MenuGameFuncs[i][j] == '_')
|
||||
MenuGameFuncs[i][j] = ' ';
|
||||
|
||||
MEOSN_Gamefuncs[i] = MenuGameFuncs[i];
|
||||
if (gamefunctions[i][0] != '\0')
|
||||
{
|
||||
MEOSN_Gamefuncs[k] = MenuGameFuncs[i];
|
||||
MEOSV_Gamefuncs[k] = i;
|
||||
++k;
|
||||
}
|
||||
MEOSN_Gamefuncs[NUMGAMEFUNCTIONS] = MenuGameFuncNone;
|
||||
}
|
||||
MEOS_Gamefuncs.numOptions = k;
|
||||
|
||||
for (i = 0; i < NUMKEYS; ++i)
|
||||
MEOSN_Keys[i] = key_names[i];
|
||||
MEOSN_Keys[NUMKEYS-1] = MenuKeyNone;
|
||||
|
@ -1543,16 +1553,22 @@ void Menu_Init(void)
|
|||
}
|
||||
|
||||
// prepare input
|
||||
k = 0;
|
||||
for (i = 0; i < NUMGAMEFUNCTIONS; ++i)
|
||||
{
|
||||
MEL_KEYBOARDSETUPFUNCS[i] = &ME_KEYBOARDSETUPFUNCS[i];
|
||||
ME_KEYBOARDSETUPFUNCS[i] = ME_KEYBOARDSETUPFUNCS_TEMPLATE;
|
||||
ME_KEYBOARDSETUPFUNCS[i].name = MenuGameFuncs[i];
|
||||
ME_KEYBOARDSETUPFUNCS[i].entry = &MEO_KEYBOARDSETUPFUNCS[i];
|
||||
MEO_KEYBOARDSETUPFUNCS[i] = MEO_KEYBOARDSETUPFUNCS_TEMPLATE;
|
||||
MEO_KEYBOARDSETUPFUNCS[i].column[0] = &ud.config.KeyboardKeys[i][0];
|
||||
MEO_KEYBOARDSETUPFUNCS[i].column[1] = &ud.config.KeyboardKeys[i][1];
|
||||
if (MenuGameFuncs[i][0] == '\0')
|
||||
continue;
|
||||
|
||||
MEL_KEYBOARDSETUPFUNCS[k] = &ME_KEYBOARDSETUPFUNCS[k];
|
||||
ME_KEYBOARDSETUPFUNCS[k] = ME_KEYBOARDSETUPFUNCS_TEMPLATE;
|
||||
ME_KEYBOARDSETUPFUNCS[k].name = MenuGameFuncs[i];
|
||||
ME_KEYBOARDSETUPFUNCS[k].entry = &MEO_KEYBOARDSETUPFUNCS[k];
|
||||
MEO_KEYBOARDSETUPFUNCS[k] = MEO_KEYBOARDSETUPFUNCS_TEMPLATE;
|
||||
MEO_KEYBOARDSETUPFUNCS[k].column[0] = &ud.config.KeyboardKeys[i][0];
|
||||
MEO_KEYBOARDSETUPFUNCS[k].column[1] = &ud.config.KeyboardKeys[i][1];
|
||||
++k;
|
||||
}
|
||||
M_KEYBOARDKEYS.numEntries = k;
|
||||
for (i = 0; i < MENUMOUSEFUNCTIONS; ++i)
|
||||
{
|
||||
MEL_MOUSESETUPBTNS[i] = &ME_MOUSESETUPBTNS[i];
|
||||
|
|
|
@ -1700,6 +1700,9 @@ int32_t registerosdcommands(void)
|
|||
char *t;
|
||||
int32_t j;
|
||||
|
||||
if (gamefunctions[i][0] == '\0')
|
||||
continue;
|
||||
|
||||
// if (!Bstrcmp(gamefunctions[i],"Show_Console")) continue;
|
||||
|
||||
Bsprintf(tempbuf,"gamefunc_%s",gamefunctions[i]);
|
||||
|
|
Loading…
Reference in a new issue