mirror of
https://github.com/Shpoike/Quakespasm.git
synced 2024-11-10 07:21:58 +00:00
input: Remove unneeded key_repeats array, some input grab tuning.
git-svn-id: svn+ssh://svn.code.sf.net/p/quakespasm/code/trunk@1083 af15c1b1-3010-417e-b628-4374ebc0bcbd
This commit is contained in:
parent
695eb2c60f
commit
b24e750ad9
1 changed files with 17 additions and 21 deletions
|
@ -43,7 +43,6 @@ keydest_t key_dest;
|
|||
#define MAX_KEYS 256
|
||||
|
||||
char *keybindings[MAX_KEYS];
|
||||
int key_repeats[MAX_KEYS]; // if > 1, it is autorepeating
|
||||
qboolean consolekeys[MAX_KEYS]; // if true, can't be rebound while in console
|
||||
qboolean menubound[MAX_KEYS]; // if true, can't be rebound while in menu
|
||||
qboolean ignoretext[MAX_KEYS]; // if true, should never cause text input
|
||||
|
@ -912,6 +911,8 @@ Key_BeginInputGrab
|
|||
*/
|
||||
void Key_BeginInputGrab (void)
|
||||
{
|
||||
Key_ClearStates ();
|
||||
|
||||
key_inputgrab.active = true;
|
||||
key_inputgrab.lastkey = 0;
|
||||
key_inputgrab.lastchar = 0;
|
||||
|
@ -926,6 +927,8 @@ Key_EndInputGrab
|
|||
*/
|
||||
void Key_EndInputGrab (void)
|
||||
{
|
||||
Key_ClearStates ();
|
||||
|
||||
key_inputgrab.active = false;
|
||||
|
||||
IN_UpdateInputMode ();
|
||||
|
@ -960,15 +963,21 @@ void Key_Event (int key, qboolean down)
|
|||
if (key < 0 || key >= MAX_KEYS)
|
||||
return;
|
||||
|
||||
keydown[key] = down;
|
||||
|
||||
if (!down)
|
||||
// handle autorepeats and stray key up events
|
||||
if (down)
|
||||
{
|
||||
if (key_repeats[key] == 0)
|
||||
return;
|
||||
|
||||
key_repeats[key] = 0;
|
||||
if (keydown[key])
|
||||
{
|
||||
if (key_dest == key_game && !con_forcedup)
|
||||
return; // ignore autorepeats in game mode
|
||||
}
|
||||
else if (key >= 200 && !keybindings[key])
|
||||
Con_Printf ("%s is unbound, hit F4 to set.\n", Key_KeynumToString(key));
|
||||
}
|
||||
else if (!keydown[key])
|
||||
return; // ignore stray key up events
|
||||
|
||||
keydown[key] = down;
|
||||
|
||||
if (key_inputgrab.active)
|
||||
{
|
||||
|
@ -976,19 +985,6 @@ void Key_Event (int key, qboolean down)
|
|||
return;
|
||||
}
|
||||
|
||||
// update auto-repeat status
|
||||
if (down)
|
||||
{
|
||||
key_repeats[key]++;
|
||||
if (key_repeats[key] > 1)
|
||||
{
|
||||
if (key_dest == key_game && !con_forcedup)
|
||||
return; // ignore autorepeats in game mode
|
||||
}
|
||||
else if (key >= 200 && !keybindings[key])
|
||||
Con_Printf ("%s is unbound, hit F4 to set.\n", Key_KeynumToString(key));
|
||||
}
|
||||
|
||||
// handle escape specialy, so the user can never unbind it
|
||||
if (key == K_ESCAPE)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue