* Fix bug that prevented key up events getting to cgame/ui when not in game

* Use Key_[GS]etCatcher everywhere to set keycatcher
* Clear all key states when the catcher changes
This commit is contained in:
Tim Angus 2007-10-02 14:14:45 +00:00
parent 26641226a4
commit 5692e30fa9
9 changed files with 79 additions and 71 deletions

View file

@ -351,9 +351,9 @@ CL_MouseEvent
=================
*/
void CL_MouseEvent( int dx, int dy, int time ) {
if ( cls.keyCatchers & KEYCATCH_UI ) {
if ( Key_GetCatcher( ) & KEYCATCH_UI ) {
VM_Call( uivm, UI_MOUSE_EVENT, dx, dy );
} else if (cls.keyCatchers & KEYCATCH_CGAME) {
} else if (Key_GetCatcher( ) & KEYCATCH_CGAME) {
VM_Call (cgvm, CG_MOUSE_EVENT, dx, dy);
} else {
cl.mouseDx[cl.mouseIndex] += dx;
@ -487,13 +487,13 @@ void CL_CmdButtons( usercmd_t *cmd ) {
in_buttons[i].wasPressed = qfalse;
}
if ( cls.keyCatchers ) {
if ( Key_GetCatcher( ) ) {
cmd->buttons |= BUTTON_TALK;
}
// allow the game to know if any key at all is
// currently pressed, even if it isn't bound to anything
if ( anykeydown && !cls.keyCatchers ) {
if ( anykeydown && Key_GetCatcher( ) == 0 ) {
cmd->buttons |= BUTTON_ANY;
}
}