* 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:
parent
26641226a4
commit
5692e30fa9
9 changed files with 79 additions and 71 deletions
|
@ -72,7 +72,7 @@ Con_ToggleConsole_f
|
|||
*/
|
||||
void Con_ToggleConsole_f (void) {
|
||||
// Can't toggle the console when it's the only thing available
|
||||
if ( cls.state == CA_DISCONNECTED && cls.keyCatchers == KEYCATCH_CONSOLE ) {
|
||||
if ( cls.state == CA_DISCONNECTED && Key_GetCatcher( ) == KEYCATCH_CONSOLE ) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -80,7 +80,7 @@ void Con_ToggleConsole_f (void) {
|
|||
g_consoleField.widthInChars = g_console_field_width;
|
||||
|
||||
Con_ClearNotify ();
|
||||
cls.keyCatchers ^= KEYCATCH_CONSOLE;
|
||||
Key_SetCatcher( Key_GetCatcher( ) ^ KEYCATCH_CONSOLE );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -94,7 +94,7 @@ void Con_MessageMode_f (void) {
|
|||
Field_Clear( &chatField );
|
||||
chatField.widthInChars = 30;
|
||||
|
||||
cls.keyCatchers ^= KEYCATCH_MESSAGE;
|
||||
Key_SetCatcher( Key_GetCatcher( ) ^ KEYCATCH_MESSAGE );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -107,7 +107,7 @@ void Con_MessageMode2_f (void) {
|
|||
chat_team = qtrue;
|
||||
Field_Clear( &chatField );
|
||||
chatField.widthInChars = 25;
|
||||
cls.keyCatchers ^= KEYCATCH_MESSAGE;
|
||||
Key_SetCatcher( Key_GetCatcher( ) ^ KEYCATCH_MESSAGE );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -124,7 +124,7 @@ void Con_MessageMode3_f (void) {
|
|||
chat_team = qfalse;
|
||||
Field_Clear( &chatField );
|
||||
chatField.widthInChars = 30;
|
||||
cls.keyCatchers ^= KEYCATCH_MESSAGE;
|
||||
Key_SetCatcher( Key_GetCatcher( ) ^ KEYCATCH_MESSAGE );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -141,7 +141,7 @@ void Con_MessageMode4_f (void) {
|
|||
chat_team = qfalse;
|
||||
Field_Clear( &chatField );
|
||||
chatField.widthInChars = 30;
|
||||
cls.keyCatchers ^= KEYCATCH_MESSAGE;
|
||||
Key_SetCatcher( Key_GetCatcher( ) ^ KEYCATCH_MESSAGE );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -477,7 +477,7 @@ Draw the editline after a ] prompt
|
|||
void Con_DrawInput (void) {
|
||||
int y;
|
||||
|
||||
if ( cls.state != CA_DISCONNECTED && !(cls.keyCatchers & KEYCATCH_CONSOLE ) ) {
|
||||
if ( cls.state != CA_DISCONNECTED && !(Key_GetCatcher( ) & KEYCATCH_CONSOLE ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -524,7 +524,7 @@ void Con_DrawNotify (void)
|
|||
continue;
|
||||
text = con.text + (i % con.totallines)*con.linewidth;
|
||||
|
||||
if (cl.snap.ps.pm_type != PM_INTERMISSION && cls.keyCatchers & (KEYCATCH_UI | KEYCATCH_CGAME) ) {
|
||||
if (cl.snap.ps.pm_type != PM_INTERMISSION && Key_GetCatcher( ) & (KEYCATCH_UI | KEYCATCH_CGAME) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -544,12 +544,12 @@ void Con_DrawNotify (void)
|
|||
|
||||
re.SetColor( NULL );
|
||||
|
||||
if (cls.keyCatchers & (KEYCATCH_UI | KEYCATCH_CGAME) ) {
|
||||
if (Key_GetCatcher( ) & (KEYCATCH_UI | KEYCATCH_CGAME) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// draw the chat line
|
||||
if ( cls.keyCatchers & KEYCATCH_MESSAGE )
|
||||
if ( Key_GetCatcher( ) & KEYCATCH_MESSAGE )
|
||||
{
|
||||
if (chat_team)
|
||||
{
|
||||
|
@ -697,7 +697,7 @@ void Con_DrawConsole( void ) {
|
|||
|
||||
// if disconnected, render console full screen
|
||||
if ( cls.state == CA_DISCONNECTED ) {
|
||||
if ( !( cls.keyCatchers & (KEYCATCH_UI | KEYCATCH_CGAME)) ) {
|
||||
if ( !( Key_GetCatcher( ) & (KEYCATCH_UI | KEYCATCH_CGAME)) ) {
|
||||
Con_DrawSolidConsole( 1.0 );
|
||||
return;
|
||||
}
|
||||
|
@ -724,7 +724,7 @@ Scroll it up or down
|
|||
*/
|
||||
void Con_RunConsole (void) {
|
||||
// decide on the destination height of the console
|
||||
if ( cls.keyCatchers & KEYCATCH_CONSOLE )
|
||||
if ( Key_GetCatcher( ) & KEYCATCH_CONSOLE )
|
||||
con.finalFrac = 0.5; // half screen
|
||||
else
|
||||
con.finalFrac = 0; // none visible
|
||||
|
@ -779,7 +779,7 @@ void Con_Close( void ) {
|
|||
}
|
||||
Field_Clear( &g_consoleField );
|
||||
Con_ClearNotify ();
|
||||
cls.keyCatchers &= ~KEYCATCH_CONSOLE;
|
||||
Key_SetCatcher( Key_GetCatcher( ) & ~KEYCATCH_CONSOLE );
|
||||
con.finalFrac = 0; // none visible
|
||||
con.displayFrac = 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue