]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - keys.c
Merge branch 'master' into Mario/wrath-darkplaces_extra
[xonotic/darkplaces.git] / keys.c
diff --git a/keys.c b/keys.c
index 3038eba6498bfa4c963b1018baa96bc28038939c..442267c321a4f0473a072c6754217a0e8f8ca976 100644 (file)
--- a/keys.c
+++ b/keys.c
@@ -782,7 +782,8 @@ int Key_Parse_CommonKeys(cmd_state_t *cmd, qbool is_console, int key, int unicod
                                }
                                else if (*p == '\n' || *p == '\r' || *p == '\b')
                                        *p++ = ';';
-                               p++;
+                               else
+                                       p++;
                        }
 #else
                        strtok(cbd, "\n\r\b");
@@ -1831,15 +1832,27 @@ void Key_EventQueue_Unblock(void)
 void
 Key_Event (int key, int ascii, qbool down)
 {
-       cmd_state_t *cmd = &cmd_client;
+       cmd_state_t *cmd = cmd_local;
        const char *bind;
        qbool q;
        keydest_t keydest = key_dest;
        char vabuf[1024];
+       long curtime;
+       static long pausetime = 0; // HACK: prevent double unpause      
 
        if (key < 0 || key >= MAX_KEYS)
                return;
 
+       // HACK: allow unpause by any key for the "press any key" screen
+       if (SCR_LoadingScreenWaiting() && sv.paused && down && (curtime = Sys_DirtyTime()) > pausetime)
+       {
+               key_consoleactive &= ~KEY_CONSOLEACTIVE_USER; // close the console if opened
+               Cbuf_InsertText(cmd,"pause\n"); // unpause
+               SCR_ClearLoadingScreen(false);
+               pausetime = curtime + 2;
+               return; // eat the key
+       }
+
        if(events_blocked)
        {
                Key_EventQueue_Add(key, ascii, down);
@@ -1909,7 +1922,7 @@ Key_Event (int key, int ascii, qbool down)
                {
                        if(down)
                        {
-                               Con_ToggleConsole_f(&cmd_client);
+                               Con_ToggleConsole_f(cmd_local);
                                tbl_keydest[key] = key_void; // esc release should go nowhere (especially not to key_menu or key_game)
                        }
                        return;
@@ -1928,7 +1941,7 @@ Key_Event (int key, int ascii, qbool down)
 #endif
                                        }
                                        else
-                                               Con_ToggleConsole_f(&cmd_client);
+                                               Con_ToggleConsole_f(cmd_local);
                                }
                                break;
 
@@ -1992,7 +2005,7 @@ Key_Event (int key, int ascii, qbool down)
                // (special exemption for german keyboard layouts)
                if (con_closeontoggleconsole.integer && bind && !strncmp(bind, "toggleconsole", strlen("toggleconsole")) && (key_consoleactive & KEY_CONSOLEACTIVE_USER) && (con_closeontoggleconsole.integer >= ((ascii != STRING_COLOR_TAG) ? 2 : 3) || key_linepos == 1))
                {
-                       Con_ToggleConsole_f(&cmd_client);
+                       Con_ToggleConsole_f(cmd_local);
                        return;
                }