From 376aef220ca0cf662fe843c50e39e89d39eca6ba Mon Sep 17 00:00:00 2001
From: divverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Date: Fri, 2 Sep 2011 21:09:25 +0000
Subject: [PATCH] add -noconsole option to block console input and display

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11321 d7cf8633-e32d-0410-b094-e92efae38249
::stable-branch::merge=114bbf72f19c5757278b5f00f7bd757c790e9f60
---
 cl_screen.c | 4 ++++
 console.c   | 4 ++++
 keys.c      | 4 ++++
 3 files changed, 12 insertions(+)

diff --git a/cl_screen.c b/cl_screen.c
index d5ca01e6..049e011d 100644
--- a/cl_screen.c
+++ b/cl_screen.c
@@ -966,6 +966,10 @@ void CL_Screen_Init(void)
 	Cvar_RegisterVariable(&vid_touchscreen_outlinealpha);
 	Cvar_RegisterVariable(&vid_touchscreen_overlayalpha);
 
+	// if we want no console, turn it off here too
+	if (COM_CheckParm ("-noconsole"))
+		Cvar_SetQuick(&scr_conforcewhiledisconnected, "0");
+
 	Cmd_AddCommand ("sizeup",SCR_SizeUp_f, "increase view size (increases viewsize cvar)");
 	Cmd_AddCommand ("sizedown",SCR_SizeDown_f, "decrease view size (decreases viewsize cvar)");
 	Cmd_AddCommand ("screenshot",SCR_ScreenShot_f, "takes a screenshot of the next rendered frame");
diff --git a/console.c b/console.c
index 48dcac3d..b604fe13 100644
--- a/console.c
+++ b/console.c
@@ -596,6 +596,10 @@ Con_ToggleConsole_f
 */
 void Con_ToggleConsole_f (void)
 {
+	if (COM_CheckParm ("-noconsole"))
+		if (!(key_consoleactive & KEY_CONSOLEACTIVE_USER))
+			return; // only allow the key bind to turn off console
+
 	// toggle the 'user wants console' bit
 	key_consoleactive ^= KEY_CONSOLEACTIVE_USER;
 	Con_ClearNotify();
diff --git a/keys.c b/keys.c
index 817ce92d..ad36b7aa 100644
--- a/keys.c
+++ b/keys.c
@@ -1899,6 +1899,10 @@ Key_Event (int key, int ascii, qboolean down)
 			Con_ToggleConsole_f ();
 			return;
 		}
+
+		if (COM_CheckParm ("-noconsole"))
+			return; // only allow the key bind to turn off console
+
 		Key_Console (key, ascii);
 		return;
 	}
-- 
2.39.5