[go: nahoru, domu]

Skip to content

Commit

Permalink
Always stop bind command when key is released
Browse files Browse the repository at this point in the history
Previously the "keyup" command notifying that the key was released was
only sent if the UI does not have focus.

This makes no difference in practice because the Unvanquished gamelogic
always calls Key_ClearStates, which stops all bind commands, when
setting KEYCATCH_UI.
  • Loading branch information
slipher committed Jan 24, 2024
1 parent d5f0b72 commit b561a47
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions src/engine/client/cl_keys.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -603,6 +603,14 @@ void CL_KeyEvent( const Keyboard::Key& key, bool down, unsigned time )
return;
}

// key up events only perform actions if the game key binding is
// a button command (leading + sign).
if ( !down )
{
// Handle any +commands which were invoked on the corresponding key-down
Cmd::BufferCommandText(Str::Format("keyup %d %s %u", plusCommand.check, Cmd::Escape(KeyToString(key)), time));
}

// Don't do anything if libRocket menus have focus
// Everything is handled by libRocket. Also we don't want
// to run any binds (since they won't be found).
Expand All @@ -612,17 +620,8 @@ void CL_KeyEvent( const Keyboard::Key& key, bool down, unsigned time )
return;
}

//
// key up events only perform actions if the game key binding is
// a button command (leading + sign). These will be processed even in
// console mode and menu mode, to keep the character from continuing
// an action started before a mode switch.
//
if ( !down )
{
// Handle any +commands which were invoked on the corresponding key-down
Cmd::BufferCommandText(Str::Format("keyup %d %s %u", plusCommand.check, Cmd::Escape(KeyToString(key)), time));

return;
}

Expand Down

0 comments on commit b561a47

Please sign in to comment.