mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2025-02-21 11:21:52 +00:00
Don't allow binding the "console keys" (^, ~, `) or Escape
should hopefully fix #93, which seemed to be caused by ^ and ` being bound to toggleconsole in default.cfg (as shipped with Q2) *and* in code, so it'd be called twice and cancel each other out. It even warns if someone tries to bind those keys and includes an ugly hack to *not* warn when it's done in default.cfg, to minimize confusion.
This commit is contained in:
parent
159a3b8607
commit
5232088b02
2 changed files with 24 additions and 0 deletions
|
@ -708,6 +708,10 @@ Key_Unbindall_f(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ugly hack, set in Cmd_ExecuteString() when yq2.cfg is executed
|
||||||
|
* (=> default.cfg is done) */
|
||||||
|
extern qboolean doneWithDefaultCfg;
|
||||||
|
|
||||||
void
|
void
|
||||||
Key_Bind_f(void)
|
Key_Bind_f(void)
|
||||||
{
|
{
|
||||||
|
@ -730,6 +734,17 @@ Key_Bind_f(void)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* don't allow binding escape or the special console keys */
|
||||||
|
if(b == K_ESCAPE || b == '^' || b == '`' || b == '~')
|
||||||
|
{
|
||||||
|
if(doneWithDefaultCfg)
|
||||||
|
{
|
||||||
|
/* don't warn about this when it's from default.cfg, we can't change that anyway */
|
||||||
|
Com_Printf("You can't bind the special key \"%s\"!\n", Cmd_Argv(1));
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (c == 2)
|
if (c == 2)
|
||||||
{
|
{
|
||||||
if (keybindings[b])
|
if (keybindings[b])
|
||||||
|
|
|
@ -921,6 +921,9 @@ Cmd_IsComplete(char *command)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ugly hack to suppress warnings from default.cfg in Key_Bind_f() */
|
||||||
|
qboolean doneWithDefaultCfg;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* A complete command line has been parsed, so try to execute it
|
* A complete command line has been parsed, so try to execute it
|
||||||
*/
|
*/
|
||||||
|
@ -938,6 +941,12 @@ Cmd_ExecuteString(char *text)
|
||||||
return; /* no tokens */
|
return; /* no tokens */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(Cmd_Argc() > 1 && Q_strcasecmp(cmd_argv[0], "exec") == 0 && Q_strcasecmp(cmd_argv[1], "yq2.cfg") == 0)
|
||||||
|
{
|
||||||
|
/* exec yq2.cfg is done directly after exec default.cfg, see Qcommon_Init() */
|
||||||
|
doneWithDefaultCfg = true;
|
||||||
|
}
|
||||||
|
|
||||||
/* check functions */
|
/* check functions */
|
||||||
for (cmd = cmd_functions; cmd; cmd = cmd->next)
|
for (cmd = cmd_functions; cmd; cmd = cmd->next)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue