Index: trunk/code/client/cl_keys.c =================================================================== --- trunk/code/client/cl_keys.c (revision 1249) +++ trunk/code/client/cl_keys.c (working copy) @@ -1089,58 +1089,16 @@ /* =================== -CL_AddKeyUpCommands -=================== -*/ -void CL_AddKeyUpCommands( int key, char *kb, unsigned time) { - int i; - char button[1024], *buttonPtr; - char cmd[1024]; - qboolean keyevent; - - if ( !kb ) { - return; - } - keyevent = qfalse; - buttonPtr = button; - for ( i = 0; ; i++ ) { - if ( kb[i] == ';' || !kb[i] ) { - *buttonPtr = '\0'; - if ( button[0] == '+') { - // button commands add keynum and time as parms so that multiple - // sources can be discriminated and subframe corrected - Com_sprintf (cmd, sizeof(cmd), "-%s %i %i\n", button+1, key, time); - Cbuf_AddText (cmd); - keyevent = qtrue; - } else { - if (keyevent) { - // down-only command - Cbuf_AddText (button); - Cbuf_AddText ("\n"); - } - } - buttonPtr = button; - while ( (kb[i] <= ' ' || kb[i] == ';') && kb[i] != 0 ) { - i++; - } - } - *buttonPtr++ = kb[i]; - if ( !kb[i] ) { - break; - } - } -} - -/* -=================== CL_KeyEvent Called by the system for both key up and key down events =================== */ void CL_KeyEvent (int key, qboolean down, unsigned time) { - char *kb; - char cmd[1024]; + int i; + char *kb; + char cmd[1024]; + char button[1024], *buttonPtr; // update auto-repeat status and BUTTON_ANY status keys[key].down = down; @@ -1232,11 +1190,29 @@ // console mode and menu mode, to keep the character from continuing // an action started before a mode switch. // - if (!down ) { - if ( cls.state != CA_DISCONNECTED ) { - kb = keys[key].binding; - - CL_AddKeyUpCommands( key, kb, time ); + if ( !down ) { + kb = keys[key].binding; + if( kb && kb[0] && cls.state != CA_DISCONNECTED ) { + buttonPtr = button; + for ( i = 0; ; i++ ) { + if ( kb[i] == ';' || !kb[i] ) { + *buttonPtr = '\0'; + if ( button[0] == '+') { + // button commands add keynum and time as parms so that multiple + // sources can be discriminated and subframe corrected + Com_sprintf (cmd, sizeof(cmd), "-%s %i %i\n", button+1, key, time); + Cbuf_AddText (cmd); + } + buttonPtr = button; + while ( (kb[i] <= ' ' || kb[i] == ';') && kb[i] ) { + i++; + } + } + *buttonPtr++ = kb[i]; + if ( !kb[i] ) { + break; + } + } } if ( Key_GetCatcher( ) & KEYCATCH_UI && uivm ) { @@ -1248,7 +1224,6 @@ return; } - // distribute the key down event to the apropriate handler if ( Key_GetCatcher( ) & KEYCATCH_CONSOLE ) { Console_Key( key ); @@ -1265,16 +1240,9 @@ } else if ( cls.state == CA_DISCONNECTED ) { Console_Key( key ); } else { - // send the bound action kb = keys[key].binding; - if ( !kb ) { - if (key >= 200) { - Com_Printf ("%s is unbound, use controls menu to set.\n" - , Key_KeynumToString( key ) ); - } - } else if (kb[0] == '+') { - int i; - char button[1024], *buttonPtr; + // send the bound action + if( kb && kb[0] ) { buttonPtr = button; for ( i = 0; ; i++ ) { if ( kb[i] == ';' || !kb[i] ) { @@ -1299,15 +1267,10 @@ break; } } - } else { - // down-only command - Cbuf_AddText (kb); - Cbuf_AddText ("\n"); } } } - /* =================== CL_CharEvent