Rewrite the Shift+Escape code a bit (somewhat cleaner)

This commit is contained in:
svdijk 2013-03-18 19:37:26 +01:00
parent 317355f7ca
commit d07735b831

View file

@ -148,18 +148,7 @@ IN_TranslateSDLtoQ2Key(unsigned int keysym)
key = K_UPARROW;
break;
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;
}
break;
case SDLK_KP_ENTER:
key = K_KP_ENTER;
@ -383,6 +372,19 @@ IN_GetEvent(SDL_Event *event)
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;
/* Get the pressed key and add it to the key list */