fixed key release of bind '+vstr a b' wrongly executing 'b' when key press didn't execute 'a'

This commit is contained in:
myT 2017-11-29 18:25:09 +01:00
parent 3c4a71faaf
commit 8900291f0d
2 changed files with 11 additions and 4 deletions

View file

@ -1,6 +1,8 @@
DD Mmm 17 - 1.49
fix: the release of a key bound to "+vstr a b" would execute "b" even though the key press didn't execute "a"
chg: r_brightness <0.25..32.0> (default: 2) replaces r_overBrightBits
r_mapBrightness <0.25..32.0> (default: 2) replaces r_mapOverBrightBits
the new cvars use floating-point values (more control) and a linear scale (more intuitive)

View file

@ -41,6 +41,7 @@ static qbool key_overstrikeMode;
typedef struct {
qbool down;
qbool sendMinusCmd; // if +cmd was sent on first key press
int repeats; // if > 1, it is autorepeating
char *binding;
} qkey_t;
@ -966,7 +967,7 @@ static void CL_AddKeyUpCommands( int key, const char* kb )
for ( i = 0; ; i++ ) {
if ( kb[i] == ';' || !kb[i] ) {
*buttonPtr = '\0';
if ( button[0] == '+') {
if ( button[0] == '+' && keys[key].sendMinusCmd ) {
// button commands add keynum and time as parms so that multiple
// sources can be discriminated and subframe corrected
char cmd[1024];
@ -1007,6 +1008,9 @@ void CL_KeyEvent( int key, qbool down, unsigned time )
if (down) {
keys[key].repeats++;
if ( keys[key].repeats == 1) {
const qbool cgameForwarding = (cls.cgameForwardInput & 2) && cgvm;
const qbool disconnected = cls.state == CA_DISCONNECTED;
keys[key].sendMinusCmd = !cls.keyCatchers && !cgameForwarding && !disconnected;
anykeydown++;
}
} else {
@ -1201,7 +1205,8 @@ void Key_ClearStates()
if ( keys[i].down ) {
CL_KeyEvent( i, qfalse, 0 );
}
keys[i].down = 0;
keys[i].down = qfalse;
keys[i].sendMinusCmd = qfalse;
keys[i].repeats = 0;
}