From 0dfd0b1df9633d0f6378cc5096b7e8114d009a28 Mon Sep 17 00:00:00 2001 From: /dev/humancontroller Date: Sat, 12 Jul 2014 23:07:02 +0200 Subject: do not close the console "from time to time" alter a bunch of cases where Key_SetCatcher() turns off the KEYCATCH_CONSOLE flag. remove all uses of Con_Close() and the function itself altogether. the console is now only togglable by a console key or with the toggleconsole command. --- src/client/cl_cgame.c | 11 ++++------- src/client/cl_cin.c | 2 -- src/client/cl_main.c | 12 ++++-------- src/client/cl_parse.c | 2 -- src/client/cl_ui.c | 4 ++-- 5 files changed, 10 insertions(+), 21 deletions(-) (limited to 'src/client') diff --git a/src/client/cl_cgame.c b/src/client/cl_cgame.c index 23f3010c..9ce67455 100644 --- a/src/client/cl_cgame.c +++ b/src/client/cl_cgame.c @@ -619,10 +619,10 @@ intptr_t CL_CgameSystemCalls( intptr_t *args ) { return Key_IsDown( args[1] ); case CG_KEY_GETCATCHER: return Key_GetCatcher(); - case CG_KEY_SETCATCHER: - // Don't allow the cgame module to close the console - Key_SetCatcher( args[1] | ( Key_GetCatcher( ) & KEYCATCH_CONSOLE ) ); - return 0; + case CG_KEY_SETCATCHER: + // don't allow the cgame module to toggle the console + Key_SetCatcher( ( args[1] & ~KEYCATCH_CONSOLE ) | ( Key_GetCatcher() & KEYCATCH_CONSOLE ) ); + return 0; case CG_KEY_GETKEY: return Key_GetKey( VMA(1) ); @@ -755,9 +755,6 @@ void CL_InitCGame( void ) { t1 = Sys_Milliseconds(); - // put away the console - Con_Close(); - // find the current mapname info = cl.gameState.stringData + cl.gameState.stringOffsets[ CS_SERVERINFO ]; mapname = Info_ValueForKey( info, "mapname" ); diff --git a/src/client/cl_cin.c b/src/client/cl_cin.c index 74660ed5..72176f42 100644 --- a/src/client/cl_cin.c +++ b/src/client/cl_cin.c @@ -1470,8 +1470,6 @@ int CIN_PlayCinematic( const char *arg, int x, int y, int w, int h, int systemBi clc.state = CA_CINEMATIC; } - Con_Close(); - if (!cinTable[currentHandle].silent) { s_rawend[0] = s_soundtime; } diff --git a/src/client/cl_main.c b/src/client/cl_main.c index 00dc6640..203e90d5 100644 --- a/src/client/cl_main.c +++ b/src/client/cl_main.c @@ -1094,8 +1094,6 @@ void CL_PlayDemo_f( void ) { } Q_strncpyz( clc.demoName, arg, sizeof( clc.demoName ) ); - Con_Close(); - clc.state = CA_CONNECTED; clc.demoplaying = qtrue; Q_strncpyz( clc.servername, arg, sizeof( clc.servername ) ); @@ -1120,7 +1118,7 @@ Closing the main menu will restart the demo loop void CL_StartDemoLoop( void ) { // start the demo loop again Cbuf_AddText ("d1\n"); - Key_SetCatcher( 0 ); + Key_SetCatcher( Key_GetCatcher() & KEYCATCH_CONSOLE ); } /* @@ -1291,8 +1289,7 @@ void CL_MapLoading( void ) { return; } - Con_Close(); - Key_SetCatcher( 0 ); + Key_SetCatcher( Key_GetCatcher() & KEYCATCH_CONSOLE ); // if we are already connected to the local host, stay connected if ( clc.state >= CA_CONNECTED && !Q_stricmp( clc.servername, "localhost" ) ) { @@ -1306,7 +1303,7 @@ void CL_MapLoading( void ) { CL_Disconnect( qtrue ); Q_strncpyz( clc.servername, "localhost", sizeof(clc.servername) ); clc.state = CA_CHALLENGING; // so the connect screen is drawn - Key_SetCatcher( 0 ); + Key_SetCatcher( Key_GetCatcher() & KEYCATCH_CONSOLE ); SCR_UpdateScreen(); clc.connectTime = -RETRANSMIT_TIMEOUT; NET_StringToAdr( clc.servername, &clc.serverAddress, NA_UNSPEC); @@ -1651,7 +1648,6 @@ void CL_Connect_f( void ) { noGameRestart = qtrue; CL_Disconnect( qtrue ); - Con_Close(); Q_strncpyz( clc.servername, server, sizeof(clc.servername) ); @@ -1685,7 +1681,7 @@ void CL_Connect_f( void ) { clc.challenge = ((rand() << 16) ^ rand()) ^ Com_Milliseconds(); } - Key_SetCatcher( 0 ); + Key_SetCatcher( Key_GetCatcher() & KEYCATCH_CONSOLE ); clc.connectTime = -99999; // CL_CheckForResend() will fire immediately clc.connectPacketCount = 0; diff --git a/src/client/cl_parse.c b/src/client/cl_parse.c index 981d21c6..1b96c3ad 100644 --- a/src/client/cl_parse.c +++ b/src/client/cl_parse.c @@ -462,8 +462,6 @@ void CL_ParseGamestate( msg_t *msg ) { char *s; char oldGame[MAX_QPATH]; - Con_Close(); - clc.connectPacketCount = 0; // wipe local client state diff --git a/src/client/cl_ui.c b/src/client/cl_ui.c index 5ad8e916..f122067f 100644 --- a/src/client/cl_ui.c +++ b/src/client/cl_ui.c @@ -860,8 +860,8 @@ intptr_t CL_UISystemCalls( intptr_t *args ) { return Key_GetCatcher(); case UI_KEY_SETCATCHER: - // Don't allow the ui module to close the console - Key_SetCatcher( args[1] | ( Key_GetCatcher( ) & KEYCATCH_CONSOLE ) ); + // don't allow the ui module to toggle the console + Key_SetCatcher( ( args[1] & ~KEYCATCH_CONSOLE ) | ( Key_GetCatcher() & KEYCATCH_CONSOLE ) ); return 0; case UI_GETCLIPBOARDDATA: -- cgit