]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - keys.c
damn, revert the accidental change to makefile.inc
[xonotic/darkplaces.git] / keys.c
diff --git a/keys.c b/keys.c
index 81cc1beeac5aee48df0e81b26a052145e3a7c154..fce61a985fcffcb512d82d9af5ca54ef5f084488 100644 (file)
--- a/keys.c
+++ b/keys.c
@@ -233,7 +233,7 @@ Interactive line editing and console scrollback
 ====================
 */
 static void
-Key_Console (int key, char ascii)
+Key_Console (int key, int ascii)
 {
        // LordHavoc: copied most of this from Q2 to improve keyboard handling
        switch (key)
@@ -530,13 +530,13 @@ unsigned int      chat_bufferlen = 0;
 extern int Nicks_CompleteChatLine(char *buffer, size_t size, unsigned int pos);
 
 static void
-Key_Message (int key, char ascii)
+Key_Message (int key, int ascii)
 {
 
        if (key == K_ENTER || ascii == 10 || ascii == 13)
        {
                if(chat_mode < 0)
-                       Cbuf_AddText(va("%s\n", chat_buffer));
+                       Cmd_ExecuteString(chat_buffer, src_command); // not Cbuf_AddText to allow semiclons in args; however, this allows no variables then. Use aliases!
                else
                        Cmd_ForwardStringToServer(va("%s %s", chat_mode ? "say_team" : "say ", chat_buffer));
 
@@ -905,7 +905,7 @@ static char tbl_keyascii[MAX_KEYS];
 static keydest_t tbl_keydest[MAX_KEYS];
 
 void
-Key_Event (int key, char ascii, qboolean down)
+Key_Event (int key, int ascii, qboolean down)
 {
        const char *bind;
        qboolean q;
@@ -1060,6 +1060,16 @@ Key_Event (int key, char ascii, qboolean down)
                return;
        }
 
+       // handle toggleconsole in menu too
+       if (keydest == key_menu)
+       {
+               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)
+                       return;
+               }
+       }
 
        // ignore binds while a video is played, let the video system handle the key event
        if (cl_videoplaying)