]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - keys.c
removed 3 unused variables
[xonotic/darkplaces.git] / keys.c
diff --git a/keys.c b/keys.c
index a98f5433b1df8963608f402bf5f706cf908ae581..ba0b0dcc4550bf9a25a4832fbceb7cd18304b03d 100644 (file)
--- a/keys.c
+++ b/keys.c
@@ -32,14 +32,11 @@ int                 edit_line = 31;
 int                    history_line = 31;
 char           key_lines[32][MAX_INPUTLINE];
 int                    key_linepos;
-static int     ctrl_down = false;
-static int     key_lastpress;
 int                    key_insert = true;      // insert key toggle (for editing)
 
 keydest_t      key_dest;
 int                    key_consoleactive;
 
-static int     key_count;                                      // incremented every key event
 static int     key_bmap, key_bmap2;
 
 char                           *keybindings[8][1024];
@@ -804,8 +801,8 @@ Key_Init (void)
        consolekeys[K_KP_MINUS] = true;
        consolekeys[K_KP_DIVIDE] = true;
        consolekeys[K_KP_MULTIPLY] = true;
-       consolekeys['`'] = true;
-       consolekeys['~'] = true;
+       consolekeys['`'] = false;
+       consolekeys['~'] = false;
 
        menubound[K_ESCAPE] = true;
        for (i = 0; i < 12; i++)
@@ -835,9 +832,8 @@ Key_Event (int key, char ascii, qboolean down)
 {
 #if 1
 #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,19 +855,19 @@ 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 ) {
                if( bind && bind[ 0 ] == '+') {
-                       Cbuf_AddText( va( "-%s %i\n", bind + 1, key) ); 
+                       Cbuf_AddText( va( "-%s %i\n", bind + 1, key) );
                }
        } else {
                // 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 ) {
+                       // shift-escape is a safety measure for users who cant toggle the console otherwise
+                       if( shift_down ) {
                                Con_ToggleConsole_f();
                                return;
                        }
@@ -883,6 +879,11 @@ Key_Event (int key, char ascii, qboolean down)
                                        MR_Keydown( key, ascii );
                                        break;
                                case key_game:
+                                       if (COM_CheckParm ("-demolooponly"))
+                                       {
+                                               CL_Disconnect ();
+                                               return;
+                                       }
                                        MR_ToggleMenu_f();
                                        break;
                                default:
@@ -891,21 +892,24 @@ Key_Event (int key, char ascii, qboolean down)
                        return;
                }
 
-               if (bind && !strncmp( bind, "toggleconsole", strlen( "toggleconsole" ) ) )
-               {
+               if( !(key_consoleactive && consolekeys[ key ]) && bind && !strncmp( bind, "toggleconsole", strlen( "toggleconsole" ) ) ) {
                        Cbuf_AddText( bind );
                        Cbuf_AddText( "\n" );
+                       if( ascii != STRING_COLOR_TAG ) {
+                               return;
+                       }
                } else {
                        // during demo playback, all keys ingame bring up the main menu
                        if( cls.demoplayback && !key_consoleactive && key_dest == key_game ) {
-                               MR_ToggleMenu_f ();
+                               if (!COM_CheckParm ("-demolooponly"))
+                                       MR_ToggleMenu_f ();
                                return;
                        }
 
                        // menu bind/function keys or normal binds
                        if( (key_dest == key_menu && menubound[key]) || USERPLAYING() ) {
                                if( bind ) {
-                                       if( bind[0] == '+' ) {                  // button commands add keynum as a parm
+                                       if( bind[0] == '+' ) { // button commands add keynum as a parm
                                                Cbuf_AddText( va( "%s %i\n", bind, key ) );
                                        } else {
                                                Cbuf_AddText( bind );