]> de.git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
My Key_Event is disabled (yet).
authorblack <black@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 7 Jun 2005 20:55:08 +0000 (20:55 +0000)
committerblack <black@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 7 Jun 2005 20:55:08 +0000 (20:55 +0000)
-Changed it to only toggle the console with ESCAPE when you're in the console,
 so binding toggleconsole to a normal key wont toggle it while typing.
-Changed the panic console key to shift-escape since ctrl-escape open the start
 menu.
Feel free to test it.
@ETG: since I can probably only reach you this way: it is intended that the console
toggle key now appears in the console input line and is also send to e.g. message.
This is because the color tag ^ key opens the console on some keyboard layouts and
couldnt be typed in otherwise.

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@5408 d7cf8633-e32d-0410-b094-e92efae38249

keys.c

diff --git a/keys.c b/keys.c
index be721de86f9c8ac0598fe834d55742bb37586ab8..e11ea703591f95b14ae091354acc4a2224d7f43f 100644 (file)
--- a/keys.c
+++ b/keys.c
@@ -835,9 +835,8 @@ Key_Event (int key, char ascii, qboolean down)
 {
 #if 0
 #define USERPLAYING()  ( !key_consoleactive && key_dest == key_game && (cls.state == ca_connected && cls.signon == SIGNONS) )
-//#define CONSOLEKEY() (key_consoleactive && !consolekeys[key])
-#define CONSOLEKEY()   ( key_dest == key_console)
        const char *bind;
+       static qboolean shift_down = false;
 
        // get key binding
        bind = keybindings[ key_bmap ][ key ];
@@ -859,8 +858,8 @@ Key_Event (int key, char ascii, qboolean down)
                key_repeats[ key ] = 0;
        }
 
-       if( key == K_CTRL ) {
-               ctrl_down = down;
+       if( key == K_SHIFT ) {
+               shift_down = down;
        }
 
        if( !down ) {
@@ -871,7 +870,7 @@ Key_Event (int key, char ascii, qboolean down)
                // handle ESCAPE specially, so unbinding wont help
                if( key == K_ESCAPE ) {
                        // ctrl-escape is a safety measure for users who cant toggle the console otherwise
-                       if( ctrl_down ) {
+                       if( shift_down || key_consoleactive ) {
                                Con_ToggleConsole_f();
                                return;
                        }
@@ -891,6 +890,11 @@ Key_Event (int key, char ascii, qboolean down)
                        return;
                }
 
+               if( key_consoleactive ) {
+                               Key_Console( key, ascii );
+                               return;
+               }
+
                if (bind && !strncmp( bind, "toggleconsole", strlen( "toggleconsole" ) ) )
                {
                        Cbuf_AddText( bind );
@@ -917,22 +921,18 @@ Key_Event (int key, char ascii, qboolean down)
                }
 
                // either console or game state key functions
-               if( key_consoleactive ) {
-                               Key_Console( key, ascii );
-               } else {
-                       switch (key_dest) {
-                               case key_message:
-                                       Key_Message( key, ascii );
-                                       break;
-                               case key_menu:
-                                       MR_Keydown( key, ascii );
-                                       break;
-                               case key_game:
-                                       // unbound key
-                                       break;
-                               default:
-                                       Sys_Error( "Bad key_dest" );
-                       }
+               switch (key_dest) {
+                       case key_message:
+                               Key_Message( key, ascii );
+                               break;
+                       case key_menu:
+                               MR_Keydown( key, ascii );
+                               break;
+                       case key_game:
+                               // unbound key
+                               break;
+                       default:
+                               Sys_Error( "Bad key_dest" );
                }
        }
 #else