mirror of
https://github.com/DrBeef/ioq3quest.git
synced 2025-01-31 04:50:42 +00:00
* 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
|
@ -387,7 +387,7 @@ CL_ShutdonwCGame
|
||||||
====================
|
====================
|
||||||
*/
|
*/
|
||||||
void CL_ShutdownCGame( void ) {
|
void CL_ShutdownCGame( void ) {
|
||||||
cls.keyCatchers &= ~KEYCATCH_CGAME;
|
Key_SetCatcher( Key_GetCatcher( ) & ~KEYCATCH_CGAME );
|
||||||
cls.cgameStarted = qfalse;
|
cls.cgameStarted = qfalse;
|
||||||
if ( !cgvm ) {
|
if ( !cgvm ) {
|
||||||
return;
|
return;
|
||||||
|
@ -607,7 +607,8 @@ intptr_t CL_CgameSystemCalls( intptr_t *args ) {
|
||||||
case CG_KEY_GETCATCHER:
|
case CG_KEY_GETCATCHER:
|
||||||
return Key_GetCatcher();
|
return Key_GetCatcher();
|
||||||
case CG_KEY_SETCATCHER:
|
case CG_KEY_SETCATCHER:
|
||||||
Key_SetCatcher( args[1] );
|
// Don't allow the cgame module to close the console
|
||||||
|
Key_SetCatcher( args[1] | ( Key_GetCatcher( ) & KEYCATCH_CONSOLE ) );
|
||||||
return 0;
|
return 0;
|
||||||
case CG_KEY_GETKEY:
|
case CG_KEY_GETKEY:
|
||||||
return Key_GetKey( VMA(1) );
|
return Key_GetKey( VMA(1) );
|
||||||
|
|
|
@ -72,7 +72,7 @@ Con_ToggleConsole_f
|
||||||
*/
|
*/
|
||||||
void Con_ToggleConsole_f (void) {
|
void Con_ToggleConsole_f (void) {
|
||||||
// Can't toggle the console when it's the only thing available
|
// 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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,7 +80,7 @@ void Con_ToggleConsole_f (void) {
|
||||||
g_consoleField.widthInChars = g_console_field_width;
|
g_consoleField.widthInChars = g_console_field_width;
|
||||||
|
|
||||||
Con_ClearNotify ();
|
Con_ClearNotify ();
|
||||||
cls.keyCatchers ^= KEYCATCH_CONSOLE;
|
Key_SetCatcher( Key_GetCatcher( ) ^ KEYCATCH_CONSOLE );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -94,7 +94,7 @@ void Con_MessageMode_f (void) {
|
||||||
Field_Clear( &chatField );
|
Field_Clear( &chatField );
|
||||||
chatField.widthInChars = 30;
|
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;
|
chat_team = qtrue;
|
||||||
Field_Clear( &chatField );
|
Field_Clear( &chatField );
|
||||||
chatField.widthInChars = 25;
|
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;
|
chat_team = qfalse;
|
||||||
Field_Clear( &chatField );
|
Field_Clear( &chatField );
|
||||||
chatField.widthInChars = 30;
|
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;
|
chat_team = qfalse;
|
||||||
Field_Clear( &chatField );
|
Field_Clear( &chatField );
|
||||||
chatField.widthInChars = 30;
|
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) {
|
void Con_DrawInput (void) {
|
||||||
int y;
|
int y;
|
||||||
|
|
||||||
if ( cls.state != CA_DISCONNECTED && !(cls.keyCatchers & KEYCATCH_CONSOLE ) ) {
|
if ( cls.state != CA_DISCONNECTED && !(Key_GetCatcher( ) & KEYCATCH_CONSOLE ) ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -524,7 +524,7 @@ void Con_DrawNotify (void)
|
||||||
continue;
|
continue;
|
||||||
text = con.text + (i % con.totallines)*con.linewidth;
|
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;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -544,12 +544,12 @@ void Con_DrawNotify (void)
|
||||||
|
|
||||||
re.SetColor( NULL );
|
re.SetColor( NULL );
|
||||||
|
|
||||||
if (cls.keyCatchers & (KEYCATCH_UI | KEYCATCH_CGAME) ) {
|
if (Key_GetCatcher( ) & (KEYCATCH_UI | KEYCATCH_CGAME) ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// draw the chat line
|
// draw the chat line
|
||||||
if ( cls.keyCatchers & KEYCATCH_MESSAGE )
|
if ( Key_GetCatcher( ) & KEYCATCH_MESSAGE )
|
||||||
{
|
{
|
||||||
if (chat_team)
|
if (chat_team)
|
||||||
{
|
{
|
||||||
|
@ -697,7 +697,7 @@ void Con_DrawConsole( void ) {
|
||||||
|
|
||||||
// if disconnected, render console full screen
|
// if disconnected, render console full screen
|
||||||
if ( cls.state == CA_DISCONNECTED ) {
|
if ( cls.state == CA_DISCONNECTED ) {
|
||||||
if ( !( cls.keyCatchers & (KEYCATCH_UI | KEYCATCH_CGAME)) ) {
|
if ( !( Key_GetCatcher( ) & (KEYCATCH_UI | KEYCATCH_CGAME)) ) {
|
||||||
Con_DrawSolidConsole( 1.0 );
|
Con_DrawSolidConsole( 1.0 );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -724,7 +724,7 @@ Scroll it up or down
|
||||||
*/
|
*/
|
||||||
void Con_RunConsole (void) {
|
void Con_RunConsole (void) {
|
||||||
// decide on the destination height of the console
|
// decide on the destination height of the console
|
||||||
if ( cls.keyCatchers & KEYCATCH_CONSOLE )
|
if ( Key_GetCatcher( ) & KEYCATCH_CONSOLE )
|
||||||
con.finalFrac = 0.5; // half screen
|
con.finalFrac = 0.5; // half screen
|
||||||
else
|
else
|
||||||
con.finalFrac = 0; // none visible
|
con.finalFrac = 0; // none visible
|
||||||
|
@ -779,7 +779,7 @@ void Con_Close( void ) {
|
||||||
}
|
}
|
||||||
Field_Clear( &g_consoleField );
|
Field_Clear( &g_consoleField );
|
||||||
Con_ClearNotify ();
|
Con_ClearNotify ();
|
||||||
cls.keyCatchers &= ~KEYCATCH_CONSOLE;
|
Key_SetCatcher( Key_GetCatcher( ) & ~KEYCATCH_CONSOLE );
|
||||||
con.finalFrac = 0; // none visible
|
con.finalFrac = 0; // none visible
|
||||||
con.displayFrac = 0;
|
con.displayFrac = 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -351,9 +351,9 @@ CL_MouseEvent
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
void CL_MouseEvent( int dx, int dy, int time ) {
|
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 );
|
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);
|
VM_Call (cgvm, CG_MOUSE_EVENT, dx, dy);
|
||||||
} else {
|
} else {
|
||||||
cl.mouseDx[cl.mouseIndex] += dx;
|
cl.mouseDx[cl.mouseIndex] += dx;
|
||||||
|
@ -487,13 +487,13 @@ void CL_CmdButtons( usercmd_t *cmd ) {
|
||||||
in_buttons[i].wasPressed = qfalse;
|
in_buttons[i].wasPressed = qfalse;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( cls.keyCatchers ) {
|
if ( Key_GetCatcher( ) ) {
|
||||||
cmd->buttons |= BUTTON_TALK;
|
cmd->buttons |= BUTTON_TALK;
|
||||||
}
|
}
|
||||||
|
|
||||||
// allow the game to know if any key at all is
|
// allow the game to know if any key at all is
|
||||||
// currently pressed, even if it isn't bound to anything
|
// currently pressed, even if it isn't bound to anything
|
||||||
if ( anykeydown && !cls.keyCatchers ) {
|
if ( anykeydown && Key_GetCatcher( ) == 0 ) {
|
||||||
cmd->buttons |= BUTTON_ANY;
|
cmd->buttons |= BUTTON_ANY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -720,7 +720,7 @@ void Message_Key( int key ) {
|
||||||
|
|
||||||
|
|
||||||
if (key == K_ESCAPE) {
|
if (key == K_ESCAPE) {
|
||||||
cls.keyCatchers &= ~KEYCATCH_MESSAGE;
|
Key_SetCatcher( Key_GetCatcher( ) & ~KEYCATCH_MESSAGE );
|
||||||
Field_Clear( &chatField );
|
Field_Clear( &chatField );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -742,7 +742,7 @@ void Message_Key( int key ) {
|
||||||
|
|
||||||
CL_AddReliableCommand( buffer );
|
CL_AddReliableCommand( buffer );
|
||||||
}
|
}
|
||||||
cls.keyCatchers &= ~KEYCATCH_MESSAGE;
|
Key_SetCatcher( Key_GetCatcher( ) & ~KEYCATCH_MESSAGE );
|
||||||
Field_Clear( &chatField );
|
Field_Clear( &chatField );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1173,7 +1173,8 @@ void CL_KeyEvent (int key, qboolean down, unsigned time) {
|
||||||
|
|
||||||
|
|
||||||
// keys can still be used for bound actions
|
// keys can still be used for bound actions
|
||||||
if ( down && ( key < 128 || key == K_MOUSE1 ) && ( clc.demoplaying || cls.state == CA_CINEMATIC ) && !cls.keyCatchers) {
|
if ( down && ( key < 128 || key == K_MOUSE1 ) &&
|
||||||
|
( clc.demoplaying || cls.state == CA_CINEMATIC ) && Key_GetCatcher( ) == 0 ) {
|
||||||
|
|
||||||
if (Cvar_VariableValue ("com_cameraMode") == 0) {
|
if (Cvar_VariableValue ("com_cameraMode") == 0) {
|
||||||
Cvar_Set ("nextdemo","");
|
Cvar_Set ("nextdemo","");
|
||||||
|
@ -1184,20 +1185,20 @@ void CL_KeyEvent (int key, qboolean down, unsigned time) {
|
||||||
|
|
||||||
// escape is always handled special
|
// escape is always handled special
|
||||||
if ( key == K_ESCAPE && down ) {
|
if ( key == K_ESCAPE && down ) {
|
||||||
if ( cls.keyCatchers & KEYCATCH_MESSAGE ) {
|
if ( Key_GetCatcher( ) & KEYCATCH_MESSAGE ) {
|
||||||
// clear message mode
|
// clear message mode
|
||||||
Message_Key( key );
|
Message_Key( key );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// escape always gets out of CGAME stuff
|
// escape always gets out of CGAME stuff
|
||||||
if (cls.keyCatchers & KEYCATCH_CGAME) {
|
if (Key_GetCatcher( ) & KEYCATCH_CGAME) {
|
||||||
cls.keyCatchers &= ~KEYCATCH_CGAME;
|
Key_SetCatcher( Key_GetCatcher( ) & ~KEYCATCH_CGAME );
|
||||||
VM_Call (cgvm, CG_EVENT_HANDLING, CGAME_EVENT_NONE);
|
VM_Call (cgvm, CG_EVENT_HANDLING, CGAME_EVENT_NONE);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !( cls.keyCatchers & KEYCATCH_UI ) ) {
|
if ( !( Key_GetCatcher( ) & KEYCATCH_UI ) ) {
|
||||||
if ( cls.state == CA_ACTIVE && !clc.demoplaying ) {
|
if ( cls.state == CA_ACTIVE && !clc.demoplaying ) {
|
||||||
VM_Call( uivm, UI_SET_ACTIVE_MENU, UIMENU_INGAME );
|
VM_Call( uivm, UI_SET_ACTIVE_MENU, UIMENU_INGAME );
|
||||||
}
|
}
|
||||||
|
@ -1224,12 +1225,12 @@ void CL_KeyEvent (int key, qboolean down, unsigned time) {
|
||||||
kb = keys[key].binding;
|
kb = keys[key].binding;
|
||||||
|
|
||||||
CL_AddKeyUpCommands( key, kb, time );
|
CL_AddKeyUpCommands( key, kb, time );
|
||||||
|
}
|
||||||
|
|
||||||
if ( cls.keyCatchers & KEYCATCH_UI && uivm ) {
|
if ( Key_GetCatcher( ) & KEYCATCH_UI && uivm ) {
|
||||||
VM_Call( uivm, UI_KEY_EVENT, key, down );
|
VM_Call( uivm, UI_KEY_EVENT, key, down );
|
||||||
} else if ( cls.keyCatchers & KEYCATCH_CGAME && cgvm ) {
|
} else if ( Key_GetCatcher( ) & KEYCATCH_CGAME && cgvm ) {
|
||||||
VM_Call( cgvm, CG_KEY_EVENT, key, down );
|
VM_Call( cgvm, CG_KEY_EVENT, key, down );
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -1237,17 +1238,17 @@ void CL_KeyEvent (int key, qboolean down, unsigned time) {
|
||||||
|
|
||||||
|
|
||||||
// distribute the key down event to the apropriate handler
|
// distribute the key down event to the apropriate handler
|
||||||
if ( cls.keyCatchers & KEYCATCH_CONSOLE ) {
|
if ( Key_GetCatcher( ) & KEYCATCH_CONSOLE ) {
|
||||||
Console_Key( key );
|
Console_Key( key );
|
||||||
} else if ( cls.keyCatchers & KEYCATCH_UI ) {
|
} else if ( Key_GetCatcher( ) & KEYCATCH_UI ) {
|
||||||
if ( uivm ) {
|
if ( uivm ) {
|
||||||
VM_Call( uivm, UI_KEY_EVENT, key, down );
|
VM_Call( uivm, UI_KEY_EVENT, key, down );
|
||||||
}
|
}
|
||||||
} else if ( cls.keyCatchers & KEYCATCH_CGAME ) {
|
} else if ( Key_GetCatcher( ) & KEYCATCH_CGAME ) {
|
||||||
if ( cgvm ) {
|
if ( cgvm ) {
|
||||||
VM_Call( cgvm, CG_KEY_EVENT, key, down );
|
VM_Call( cgvm, CG_KEY_EVENT, key, down );
|
||||||
}
|
}
|
||||||
} else if ( cls.keyCatchers & KEYCATCH_MESSAGE ) {
|
} else if ( Key_GetCatcher( ) & KEYCATCH_MESSAGE ) {
|
||||||
Message_Key( key );
|
Message_Key( key );
|
||||||
} else if ( cls.state == CA_DISCONNECTED ) {
|
} else if ( cls.state == CA_DISCONNECTED ) {
|
||||||
Console_Key( key );
|
Console_Key( key );
|
||||||
|
@ -1315,15 +1316,15 @@ void CL_CharEvent( int key ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// distribute the key down event to the apropriate handler
|
// distribute the key down event to the apropriate handler
|
||||||
if ( cls.keyCatchers & KEYCATCH_CONSOLE )
|
if ( Key_GetCatcher( ) & KEYCATCH_CONSOLE )
|
||||||
{
|
{
|
||||||
Field_CharEvent( &g_consoleField, key );
|
Field_CharEvent( &g_consoleField, key );
|
||||||
}
|
}
|
||||||
else if ( cls.keyCatchers & KEYCATCH_UI )
|
else if ( Key_GetCatcher( ) & KEYCATCH_UI )
|
||||||
{
|
{
|
||||||
VM_Call( uivm, UI_KEY_EVENT, key | K_CHAR_FLAG, qtrue );
|
VM_Call( uivm, UI_KEY_EVENT, key | K_CHAR_FLAG, qtrue );
|
||||||
}
|
}
|
||||||
else if ( cls.keyCatchers & KEYCATCH_MESSAGE )
|
else if ( Key_GetCatcher( ) & KEYCATCH_MESSAGE )
|
||||||
{
|
{
|
||||||
Field_CharEvent( &chatField, key );
|
Field_CharEvent( &chatField, key );
|
||||||
}
|
}
|
||||||
|
@ -1355,6 +1356,30 @@ void Key_ClearStates (void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int keyCatchers = 0;
|
||||||
|
|
||||||
|
/*
|
||||||
|
====================
|
||||||
|
Key_GetCatcher
|
||||||
|
====================
|
||||||
|
*/
|
||||||
|
int Key_GetCatcher( void ) {
|
||||||
|
return keyCatchers;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
====================
|
||||||
|
Key_SetCatcher
|
||||||
|
====================
|
||||||
|
*/
|
||||||
|
void Key_SetCatcher( int catcher ) {
|
||||||
|
// If the catcher state is changing, clear all key states
|
||||||
|
if( catcher != keyCatchers )
|
||||||
|
Key_ClearStates( );
|
||||||
|
|
||||||
|
keyCatchers = catcher;
|
||||||
|
}
|
||||||
|
|
||||||
// This must not exceed MAX_CMD_LINE
|
// This must not exceed MAX_CMD_LINE
|
||||||
#define MAX_CONSOLE_SAVE_BUFFER 1024
|
#define MAX_CONSOLE_SAVE_BUFFER 1024
|
||||||
#define CONSOLE_HISTORY_FILE "q3history"
|
#define CONSOLE_HISTORY_FILE "q3history"
|
||||||
|
|
|
@ -652,7 +652,7 @@ Closing the main menu will restart the demo loop
|
||||||
void CL_StartDemoLoop( void ) {
|
void CL_StartDemoLoop( void ) {
|
||||||
// start the demo loop again
|
// start the demo loop again
|
||||||
Cbuf_AddText ("d1\n");
|
Cbuf_AddText ("d1\n");
|
||||||
cls.keyCatchers = 0;
|
Key_SetCatcher( 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -751,7 +751,7 @@ memory on the hunk from cgame, ui, and renderer
|
||||||
void CL_MapLoading( void ) {
|
void CL_MapLoading( void ) {
|
||||||
if ( com_dedicated->integer ) {
|
if ( com_dedicated->integer ) {
|
||||||
cls.state = CA_DISCONNECTED;
|
cls.state = CA_DISCONNECTED;
|
||||||
cls.keyCatchers = KEYCATCH_CONSOLE;
|
Key_SetCatcher( KEYCATCH_CONSOLE );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -760,7 +760,7 @@ void CL_MapLoading( void ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
Con_Close();
|
Con_Close();
|
||||||
cls.keyCatchers = 0;
|
Key_SetCatcher( 0 );
|
||||||
|
|
||||||
// if we are already connected to the local host, stay connected
|
// if we are already connected to the local host, stay connected
|
||||||
if ( cls.state >= CA_CONNECTED && !Q_stricmp( cls.servername, "localhost" ) ) {
|
if ( cls.state >= CA_CONNECTED && !Q_stricmp( cls.servername, "localhost" ) ) {
|
||||||
|
@ -776,7 +776,7 @@ void CL_MapLoading( void ) {
|
||||||
CL_Disconnect( qtrue );
|
CL_Disconnect( qtrue );
|
||||||
Q_strncpyz( cls.servername, "localhost", sizeof(cls.servername) );
|
Q_strncpyz( cls.servername, "localhost", sizeof(cls.servername) );
|
||||||
cls.state = CA_CHALLENGING; // so the connect screen is drawn
|
cls.state = CA_CHALLENGING; // so the connect screen is drawn
|
||||||
cls.keyCatchers = 0;
|
Key_SetCatcher( 0 );
|
||||||
SCR_UpdateScreen();
|
SCR_UpdateScreen();
|
||||||
clc.connectTime = -RETRANSMIT_TIMEOUT;
|
clc.connectTime = -RETRANSMIT_TIMEOUT;
|
||||||
NET_StringToAdr( cls.servername, &clc.serverAddress);
|
NET_StringToAdr( cls.servername, &clc.serverAddress);
|
||||||
|
@ -1205,7 +1205,7 @@ void CL_Connect_f( void ) {
|
||||||
cls.state = CA_CONNECTING;
|
cls.state = CA_CONNECTING;
|
||||||
}
|
}
|
||||||
|
|
||||||
cls.keyCatchers = 0;
|
Key_SetCatcher( 0 );
|
||||||
clc.connectTime = -99999; // CL_CheckForResend() will fire immediately
|
clc.connectTime = -99999; // CL_CheckForResend() will fire immediately
|
||||||
clc.connectPacketCount = 0;
|
clc.connectPacketCount = 0;
|
||||||
|
|
||||||
|
@ -2228,7 +2228,7 @@ void CL_Frame ( int msec ) {
|
||||||
// bring up the cd error dialog if needed
|
// bring up the cd error dialog if needed
|
||||||
cls.cddialog = qfalse;
|
cls.cddialog = qfalse;
|
||||||
VM_Call( uivm, UI_SET_ACTIVE_MENU, UIMENU_NEED_CD );
|
VM_Call( uivm, UI_SET_ACTIVE_MENU, UIMENU_NEED_CD );
|
||||||
} else if ( cls.state == CA_DISCONNECTED && !( cls.keyCatchers & KEYCATCH_UI )
|
} else if ( cls.state == CA_DISCONNECTED && !( Key_GetCatcher( ) & KEYCATCH_UI )
|
||||||
&& !com_sv_running->integer ) {
|
&& !com_sv_running->integer ) {
|
||||||
// if disconnected, bring up the menu
|
// if disconnected, bring up the menu
|
||||||
S_StopAllSounds();
|
S_StopAllSounds();
|
||||||
|
@ -2857,6 +2857,7 @@ void CL_Shutdown( void ) {
|
||||||
recursive = qfalse;
|
recursive = qfalse;
|
||||||
|
|
||||||
Com_Memset( &cls, 0, sizeof( cls ) );
|
Com_Memset( &cls, 0, sizeof( cls ) );
|
||||||
|
Key_SetCatcher( 0 );
|
||||||
|
|
||||||
Com_Printf( "-----------------------\n" );
|
Com_Printf( "-----------------------\n" );
|
||||||
|
|
||||||
|
|
|
@ -490,7 +490,7 @@ void SCR_DrawScreenField( stereoFrame_t stereoFrame ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// the menu draws next
|
// the menu draws next
|
||||||
if ( cls.keyCatchers & KEYCATCH_UI && uivm ) {
|
if ( Key_GetCatcher( ) & KEYCATCH_UI && uivm ) {
|
||||||
VM_Call( uivm, UI_REFRESH, cls.realtime );
|
VM_Call( uivm, UI_REFRESH, cls.realtime );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -662,27 +662,6 @@ static void Key_GetBindingBuf( int keynum, char *buf, int buflen ) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
====================
|
|
||||||
Key_GetCatcher
|
|
||||||
====================
|
|
||||||
*/
|
|
||||||
int Key_GetCatcher( void ) {
|
|
||||||
return cls.keyCatchers;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
====================
|
|
||||||
Ket_SetCatcher
|
|
||||||
====================
|
|
||||||
*/
|
|
||||||
void Key_SetCatcher( int catcher ) {
|
|
||||||
// prevent console from being closed
|
|
||||||
catcher |= cls.keyCatchers & KEYCATCH_CONSOLE;
|
|
||||||
cls.keyCatchers = catcher;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
====================
|
====================
|
||||||
CLUI_GetCDKey
|
CLUI_GetCDKey
|
||||||
|
@ -932,7 +911,8 @@ intptr_t CL_UISystemCalls( intptr_t *args ) {
|
||||||
return Key_GetCatcher();
|
return Key_GetCatcher();
|
||||||
|
|
||||||
case UI_KEY_SETCATCHER:
|
case UI_KEY_SETCATCHER:
|
||||||
Key_SetCatcher( args[1] );
|
// Don't allow the ui module to close the console
|
||||||
|
Key_SetCatcher( args[1] | ( Key_GetCatcher( ) & KEYCATCH_CONSOLE ) );
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case UI_GETCLIPBOARDDATA:
|
case UI_GETCLIPBOARDDATA:
|
||||||
|
@ -1124,7 +1104,7 @@ CL_ShutdownUI
|
||||||
====================
|
====================
|
||||||
*/
|
*/
|
||||||
void CL_ShutdownUI( void ) {
|
void CL_ShutdownUI( void ) {
|
||||||
cls.keyCatchers &= ~KEYCATCH_UI;
|
Key_SetCatcher( Key_GetCatcher( ) & ~KEYCATCH_UI );
|
||||||
cls.uiStarted = qfalse;
|
cls.uiStarted = qfalse;
|
||||||
if ( !uivm ) {
|
if ( !uivm ) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -270,7 +270,6 @@ typedef struct {
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
connstate_t state; // connection status
|
connstate_t state; // connection status
|
||||||
int keyCatchers; // bit flags
|
|
||||||
|
|
||||||
qboolean cddialog; // bring up the cd needed dialog next frame
|
qboolean cddialog; // bring up the cd needed dialog next frame
|
||||||
|
|
||||||
|
@ -442,6 +441,8 @@ void CL_VerifyCode( void );
|
||||||
|
|
||||||
float CL_KeyState (kbutton_t *key);
|
float CL_KeyState (kbutton_t *key);
|
||||||
char *Key_KeynumToString (int keynum);
|
char *Key_KeynumToString (int keynum);
|
||||||
|
int Key_GetCatcher( void );
|
||||||
|
void Key_SetCatcher( int catcher );
|
||||||
|
|
||||||
//
|
//
|
||||||
// cl_parse.c
|
// cl_parse.c
|
||||||
|
|
|
@ -651,7 +651,7 @@ static void IN_ProcessEvents( void )
|
||||||
if( !SDL_WasInit( SDL_INIT_VIDEO ) )
|
if( !SDL_WasInit( SDL_INIT_VIDEO ) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if( cls.keyCatchers == 0 && keyRepeatEnabled )
|
if( Key_GetCatcher( ) == 0 && keyRepeatEnabled )
|
||||||
{
|
{
|
||||||
SDL_EnableKeyRepeat( 0, 0 );
|
SDL_EnableKeyRepeat( 0, 0 );
|
||||||
keyRepeatEnabled = qfalse;
|
keyRepeatEnabled = qfalse;
|
||||||
|
@ -730,7 +730,7 @@ void IN_Frame (void)
|
||||||
IN_JoyMove( );
|
IN_JoyMove( );
|
||||||
|
|
||||||
// Release the mouse if the console if down and we're windowed
|
// Release the mouse if the console if down and we're windowed
|
||||||
if( ( cls.keyCatchers & KEYCATCH_CONSOLE ) && !r_fullscreen->integer )
|
if( ( Key_GetCatcher( ) & KEYCATCH_CONSOLE ) && !r_fullscreen->integer )
|
||||||
IN_DeactivateMouse( );
|
IN_DeactivateMouse( );
|
||||||
else
|
else
|
||||||
IN_ActivateMouse( );
|
IN_ActivateMouse( );
|
||||||
|
|
Loading…
Reference in a new issue