[quake3-commits] r1769 - in trunk/code: client sdl sys

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Wed Jan 6 08:47:42 EST 2010


Author: ludwig
Date: 2010-01-06 08:47:41 -0500 (Wed, 06 Jan 2010)
New Revision: 1769

Modified:
   trunk/code/client/cl_main.c
   trunk/code/client/cl_parse.c
   trunk/code/client/cl_scrn.c
   trunk/code/sdl/sdl_input.c
   trunk/code/sys/sys_main.c
Log:
avoid setting cvars by name each frame

Modified: trunk/code/client/cl_main.c
===================================================================
--- trunk/code/client/cl_main.c	2010-01-06 13:47:38 UTC (rev 1768)
+++ trunk/code/client/cl_main.c	2010-01-06 13:47:41 UTC (rev 1769)
@@ -321,8 +321,6 @@
 			dontCapture = qtrue;  // not connected to a server.
 		else if (!cl_connectedToVoipServer)
 			dontCapture = qtrue;  // server doesn't support VoIP.
-		else if ( Cvar_VariableValue( "g_gametype" ) == GT_SINGLE_PLAYER || Cvar_VariableValue("ui_singlePlayerActive"))
-			dontCapture = qtrue;  // single player game.
 		else if (clc.demoplaying)
 			dontCapture = qtrue;  // playing back a demo.
 		else if ( cl_voip->integer == 0 )

Modified: trunk/code/client/cl_parse.c
===================================================================
--- trunk/code/client/cl_parse.c	2010-01-06 13:47:38 UTC (rev 1768)
+++ trunk/code/client/cl_parse.c	2010-01-06 13:47:41 UTC (rev 1769)
@@ -366,7 +366,11 @@
 	// in the future, (val) will be a protocol version string, so only
 	//  accept explicitly 1, not generally non-zero.
 	s = Info_ValueForKey( systemInfo, "sv_voip" );
-	cl_connectedToVoipServer = (atoi( s ) == 1);
+	if ( Cvar_VariableValue( "g_gametype" ) == GT_SINGLE_PLAYER || Cvar_VariableValue("ui_singlePlayerActive"))
+		cl_connectedToVoipServer = qfalse;
+	else
+		cl_connectedToVoipServer = (atoi( s ) == 1);
+
 #endif
 
 	s = Info_ValueForKey( systemInfo, "sv_cheats" );

Modified: trunk/code/client/cl_scrn.c
===================================================================
--- trunk/code/client/cl_scrn.c	2010-01-06 13:47:38 UTC (rev 1768)
+++ trunk/code/client/cl_scrn.c	2010-01-06 13:47:41 UTC (rev 1769)
@@ -364,8 +364,6 @@
 		return;  // not connected to a server.
 	else if (!cl_connectedToVoipServer)
 		return;  // server doesn't support VoIP.
-	else if ( Cvar_VariableValue( "g_gametype" ) == GT_SINGLE_PLAYER || Cvar_VariableValue("ui_singlePlayerActive"))
-		return;  // single player game.
 	else if (clc.demoplaying)
 		return;  // playing back a demo.
 	else if (!cl_voip->integer)
@@ -577,8 +575,10 @@
 	// that case.
 	if( uivm || com_dedicated->integer )
 	{
+		// XXX
+		extern cvar_t* r_anaglyphMode;
 		// if running in stereo, we need to draw the frame twice
-		if ( cls.glconfig.stereoEnabled || Cvar_VariableIntegerValue("r_anaglyphMode")) {
+		if ( cls.glconfig.stereoEnabled || r_anaglyphMode->integer) {
 			SCR_DrawScreenField( STEREO_LEFT );
 			SCR_DrawScreenField( STEREO_RIGHT );
 		} else {

Modified: trunk/code/sdl/sdl_input.c
===================================================================
--- trunk/code/sdl/sdl_input.c	2010-01-06 13:47:38 UTC (rev 1768)
+++ trunk/code/sdl/sdl_input.c	2010-01-06 13:47:41 UTC (rev 1769)
@@ -917,6 +917,14 @@
 				vidRestartTime = Sys_Milliseconds() + 1000;
 			}
 			break;
+			case SDL_ACTIVEEVENT:
+				if (e.active.state & SDL_APPINPUTFOCUS) {
+					Cvar_SetValue( "com_unfocused",	!e.active.gain);
+				}
+				if (e.active.state & SDL_APPACTIVE) {
+					Cvar_SetValue( "com_minimized", !e.active.gain);
+				}
+				break;
 
 			default:
 				break;
@@ -972,6 +980,8 @@
 */
 void IN_Init( void )
 {
+	int appState;
+
 	if( !SDL_WasInit( SDL_INIT_VIDEO ) )
 	{
 		Com_Error( ERR_FATAL, "IN_Init called before SDL_Init( SDL_INIT_VIDEO )\n" );
@@ -1009,6 +1019,10 @@
 		mouseAvailable = qfalse;
 	}
 
+	appState = SDL_GetAppState( );
+	Cvar_SetValue( "com_unfocused",	!( appState & SDL_APPINPUTFOCUS ) );
+	Cvar_SetValue( "com_minimized", !( appState & SDL_APPACTIVE ) );
+
 	IN_InitJoystick( );
 	Com_DPrintf( "------------------------------------\n" );
 }

Modified: trunk/code/sys/sys_main.c
===================================================================
--- trunk/code/sys/sys_main.c	2010-01-06 13:47:38 UTC (rev 1768)
+++ trunk/code/sys/sys_main.c	2010-01-06 13:47:41 UTC (rev 1769)
@@ -561,13 +561,6 @@
 
 	while( 1 )
 	{
-#ifndef DEDICATED
-		int appState = SDL_GetAppState( );
-
-		Cvar_SetValue( "com_unfocused",	!( appState & SDL_APPINPUTFOCUS ) );
-		Cvar_SetValue( "com_minimized", !( appState & SDL_APPACTIVE ) );
-#endif
-
 		IN_Frame( );
 		Com_Frame( );
 	}



More information about the quake3-commits mailing list