- //
- // key up events only generate commands if the game key binding is a button
- // command (leading + sign). These will occur even in console mode, to
- // keep the character from continuing an action started before a console
- // switch. Button commands include the kenum as a parameter, so multiple
- // downs can be matched with ups
- //
- if (!down) {
- if (!(kb = keybindings[key_bmap][key]))
- kb = keybindings[key_bmap2][key];
-
- if (kb && kb[0] == '+') {
- snprintf (cmd, sizeof(cmd), "-%s %i\n", kb + 1, key);
- Cbuf_AddText (cmd);
- }
- return;
- }
-
- //
- // during demo playback, most keys bring up the main menu
- //
- if (cls.demoplayback && down && consolekeys[key] && key_dest == key_game) {
- MR_ToggleMenu_f ();
- return;
- }
-
- //
- // if not a consolekey, send to the interpreter no matter what mode is
- //
- if ((key_dest == key_menu && menubound[key])
- || (key_consoleactive && !consolekeys[key])
- || (key_dest == key_game &&
- ((cls.state == ca_connected) || !consolekeys[key]))) {
- if (!(kb = keybindings[key_bmap][key]))
- kb = keybindings[key_bmap2][key];
- if (kb) {
- if (kb[0] == '+') { // button commands add keynum as a parm
- snprintf (cmd, sizeof(cmd), "%s %i\n", kb, key);
- Cbuf_AddText (cmd);
- } else {
- Cbuf_AddText (kb);
- Cbuf_AddText ("\n");
- }
- }
+ if (down && con_closeontoggleconsole.integer && bind && !strncmp(bind, "toggleconsole", strlen("toggleconsole")) && ascii != STRING_COLOR_TAG)
+ {
+ Con_ToggleConsole_f ();
+ tbl_keydest[key] = key_void; // key release should go nowhere (especially not to key_menu or key_game)