mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2024-11-26 06:20:48 +00:00
Rewrite the Shift+Escape code a bit (somewhat cleaner)
This commit is contained in:
parent
317355f7ca
commit
d07735b831
1 changed files with 14 additions and 12 deletions
|
@ -148,18 +148,7 @@ IN_TranslateSDLtoQ2Key(unsigned int keysym)
|
||||||
key = K_UPARROW;
|
key = K_UPARROW;
|
||||||
break;
|
break;
|
||||||
case SDLK_ESCAPE:
|
case SDLK_ESCAPE:
|
||||||
/* Make Shift+Escape toggle the console. This
|
|
||||||
really belongs in Key_Event(), but since
|
|
||||||
Key_ClearStates() can mess up the internal
|
|
||||||
K_SHIFT state let's do it here instead. */
|
|
||||||
if (KeyStates[SDLK_LSHIFT] || KeyStates[SDLK_RSHIFT])
|
|
||||||
{
|
|
||||||
key = '~';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
key = K_ESCAPE;
|
key = K_ESCAPE;
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case SDLK_KP_ENTER:
|
case SDLK_KP_ENTER:
|
||||||
key = K_KP_ENTER;
|
key = K_KP_ENTER;
|
||||||
|
@ -383,6 +372,19 @@ IN_GetEvent(SDL_Event *event)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Make Shift+Escape toggle the console. This
|
||||||
|
really belongs in Key_Event(), but since
|
||||||
|
Key_ClearStates() can mess up the internal
|
||||||
|
K_SHIFT state let's do it here instead. */
|
||||||
|
if ((KeyStates[SDLK_LSHIFT] ||
|
||||||
|
KeyStates[SDLK_RSHIFT]) &&
|
||||||
|
(event->key.keysym.sym == SDLK_ESCAPE))
|
||||||
|
{
|
||||||
|
ri.Cmd_ExecuteText(EXEC_NOW, "toggleconsole");
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
KeyStates[event->key.keysym.sym] = 1;
|
KeyStates[event->key.keysym.sym] = 1;
|
||||||
|
|
||||||
/* Get the pressed key and add it to the key list */
|
/* Get the pressed key and add it to the key list */
|
||||||
|
|
Loading…
Reference in a new issue