mirror of
https://bitbucket.org/CPMADevs/cnq3
synced 2025-02-08 16:32:45 +00:00
fixed key release of bind '+vstr a b' wrongly executing 'b' when key press didn't execute 'a'
This commit is contained in:
parent
3c4a71faaf
commit
8900291f0d
2 changed files with 11 additions and 4 deletions
|
@ -1,6 +1,8 @@
|
||||||
|
|
||||||
DD Mmm 17 - 1.49
|
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
|
chg: r_brightness <0.25..32.0> (default: 2) replaces r_overBrightBits
|
||||||
r_mapBrightness <0.25..32.0> (default: 2) replaces r_mapOverBrightBits
|
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)
|
the new cvars use floating-point values (more control) and a linear scale (more intuitive)
|
||||||
|
|
|
@ -41,8 +41,9 @@ static qbool key_overstrikeMode;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
qbool down;
|
qbool down;
|
||||||
int repeats; // if > 1, it is autorepeating
|
qbool sendMinusCmd; // if +cmd was sent on first key press
|
||||||
char *binding;
|
int repeats; // if > 1, it is autorepeating
|
||||||
|
char *binding;
|
||||||
} qkey_t;
|
} qkey_t;
|
||||||
|
|
||||||
#define MAX_KEYS 256
|
#define MAX_KEYS 256
|
||||||
|
@ -966,7 +967,7 @@ static void CL_AddKeyUpCommands( int key, const char* kb )
|
||||||
for ( i = 0; ; i++ ) {
|
for ( i = 0; ; i++ ) {
|
||||||
if ( kb[i] == ';' || !kb[i] ) {
|
if ( kb[i] == ';' || !kb[i] ) {
|
||||||
*buttonPtr = '\0';
|
*buttonPtr = '\0';
|
||||||
if ( button[0] == '+') {
|
if ( button[0] == '+' && keys[key].sendMinusCmd ) {
|
||||||
// button commands add keynum and time as parms so that multiple
|
// button commands add keynum and time as parms so that multiple
|
||||||
// sources can be discriminated and subframe corrected
|
// sources can be discriminated and subframe corrected
|
||||||
char cmd[1024];
|
char cmd[1024];
|
||||||
|
@ -1007,6 +1008,9 @@ void CL_KeyEvent( int key, qbool down, unsigned time )
|
||||||
if (down) {
|
if (down) {
|
||||||
keys[key].repeats++;
|
keys[key].repeats++;
|
||||||
if ( keys[key].repeats == 1) {
|
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++;
|
anykeydown++;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -1201,7 +1205,8 @@ void Key_ClearStates()
|
||||||
if ( keys[i].down ) {
|
if ( keys[i].down ) {
|
||||||
CL_KeyEvent( i, qfalse, 0 );
|
CL_KeyEvent( i, qfalse, 0 );
|
||||||
}
|
}
|
||||||
keys[i].down = 0;
|
keys[i].down = qfalse;
|
||||||
|
keys[i].sendMinusCmd = qfalse;
|
||||||
keys[i].repeats = 0;
|
keys[i].repeats = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue