mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-24 10:40:46 +00:00
Fix issue with definegamefuncname and undefinegamefunc
git-svn-id: https://svn.eduke32.com/eduke32@7317 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
0a3b840d4e
commit
d52151c2e8
2 changed files with 25 additions and 1 deletions
|
@ -118,6 +118,9 @@ const char *CONFIG_AnalogNumToName(int32_t func)
|
|||
|
||||
void CONFIG_SetDefaultKeys(const char (*keyptr)[MAXGAMEFUNCLEN], bool lazy/*=false*/)
|
||||
{
|
||||
static char const s_gamefunc_[] = "gamefunc_";
|
||||
int constexpr strlen_gamefunc_ = ARRAY_SIZE(s_gamefunc_) - 1;
|
||||
|
||||
if (!lazy)
|
||||
{
|
||||
Bmemset(ud.config.KeyboardKeys, 0xff, sizeof(ud.config.KeyboardKeys));
|
||||
|
@ -136,8 +139,15 @@ void CONFIG_SetDefaultKeys(const char (*keyptr)[MAXGAMEFUNCLEN], bool lazy/*=fal
|
|||
|
||||
// skip the function if the default key is already used
|
||||
// or the function is assigned to another key
|
||||
if (lazy && (CONTROL_KeyIsBound(default0) || key[0] != 0xff))
|
||||
if (lazy && (key[0] != 0xff || (CONTROL_KeyIsBound(default0) && Bstrlen(CONTROL_KeyBinds[default0].cmdstr) > strlen_gamefunc_
|
||||
&& CONFIG_FunctionNameToNum(CONTROL_KeyBinds[default0].cmdstr + strlen_gamefunc_) >= 0)))
|
||||
{
|
||||
#if 0 // defined(DEBUGGINGAIDS)
|
||||
if (key[0] != 0xff)
|
||||
initprintf("Skipping %s bound to %s\n", keyptr[i<<1], CONTROL_KeyBinds[default0].cmdstr);
|
||||
#endif
|
||||
continue;
|
||||
}
|
||||
|
||||
key[0] = default0;
|
||||
key[1] = default1;
|
||||
|
|
|
@ -5202,6 +5202,13 @@ repeatcase:
|
|||
|
||||
i = 0;
|
||||
|
||||
{
|
||||
hash_delete(&h_gamefuncs, gamefunctions[j]);
|
||||
char *str = Bstrtolower(Xstrdup(gamefunctions[j]));
|
||||
hash_delete(&h_gamefuncs, str);
|
||||
Bfree(str);
|
||||
}
|
||||
|
||||
while (*textptr != 0x0a && *textptr != 0x0d && *textptr != 0)
|
||||
{
|
||||
gamefunctions[j][i] = *textptr;
|
||||
|
@ -5248,6 +5255,13 @@ repeatcase:
|
|||
continue;
|
||||
}
|
||||
|
||||
{
|
||||
hash_delete(&h_gamefuncs, gamefunctions[j]);
|
||||
char *str = Bstrtolower(Xstrdup(gamefunctions[j]));
|
||||
hash_delete(&h_gamefuncs, str);
|
||||
Bfree(str);
|
||||
}
|
||||
|
||||
gamefunctions[j][0] = '\0';
|
||||
|
||||
continue;
|
||||
|
|
Loading…
Reference in a new issue