r1431 - in trunk: . code/qcommon code/sdl code/sys
DONOTREPLY at icculus.org
DONOTREPLY at icculus.org
Mon Jul 21 18:02:55 EDT 2008
Author: tma
Date: 2008-07-21 18:02:54 -0400 (Mon, 21 Jul 2008)
New Revision: 1431
Modified:
trunk/README
trunk/code/qcommon/common.c
trunk/code/qcommon/qcommon.h
trunk/code/sdl/sdl_input.c
trunk/code/sys/sys_main.c
trunk/code/sys/sys_unix.c
trunk/code/sys/sys_win32.c
Log:
* Use Sys_Sleep to limit FPS, which will save CPU
* Add com_maxfpsUnfocused and com_maxfpsMinimized; self explanatory
* Fix reopening of bug 3703, I hope
Modified: trunk/README
===================================================================
--- trunk/README 2008-07-20 17:42:34 UTC (rev 1430)
+++ trunk/README 2008-07-21 22:02:54 UTC (rev 1431)
@@ -116,7 +116,7 @@
s_alRolloff - the value of AL_ROLLOFF_FACTOR for each
source
s_alGraceDistance - after having passed MaxDistance, length
- until sounds are completely inaudible.
+ until sounds are completely inaudible
s_alDriver - which OpenAL library to use
s_alDevice - which OpenAL device to use
s_alAvailableDevices - list of available OpenAL devices
@@ -129,7 +129,9 @@
com_ansiColor - enable use of ANSI escape codes in the tty
com_altivec - enable use of altivec on PowerPC systems
- com_standalone - Run in standalone mode.
+ com_standalone - Run in standalone mode
+ com_maxfpsUnfocused - Maximum frames per second when unfocused
+ com_maxfpsMinimized - Maximum frames per second when minimized
s_backend - read only, indicates the current sound
backend
s_muteWhenMinimized - mute sound when minimized
@@ -165,13 +167,13 @@
just add 3 to the value for the wanted
color combination. For red-blue and
red-green you probably want to enable
- r_greyscale.
+ r_greyscale
r_stereoSeparation - Control eye separation. Resulting
separation is r_zProj divided by this
value in quake3 standard units.
See also
http://wiki.ioquake3.org/Stereo_Rendering
- for more information.
+ for more information
New commands
video [filename] - start video capture (use with demo command)
Modified: trunk/code/qcommon/common.c
===================================================================
--- trunk/code/qcommon/common.c 2008-07-20 17:42:34 UTC (rev 1430)
+++ trunk/code/qcommon/common.c 2008-07-21 22:02:54 UTC (rev 1431)
@@ -81,7 +81,9 @@
cvar_t *com_cameraMode;
cvar_t *com_ansiColor;
cvar_t *com_unfocused;
+cvar_t *com_maxfpsUnfocused;
cvar_t *com_minimized;
+cvar_t *com_maxfpsMinimized;
cvar_t *com_standalone;
// com_speeds times
@@ -2604,7 +2606,9 @@
com_ansiColor = Cvar_Get( "com_ansiColor", "0", CVAR_ARCHIVE );
com_unfocused = Cvar_Get( "com_unfocused", "0", CVAR_ROM );
+ com_maxfpsUnfocused = Cvar_Get( "com_maxfpsUnfocused", "0", CVAR_ARCHIVE );
com_minimized = Cvar_Get( "com_minimized", "0", CVAR_ROM );
+ com_maxfpsMinimized = Cvar_Get( "com_maxfpsMinimized", "0", CVAR_ARCHIVE );
com_standalone = Cvar_Get( "com_standalone", "0", CVAR_INIT );
com_introPlayed = Cvar_Get( "com_introplayed", "0", CVAR_ARCHIVE);
@@ -2844,12 +2848,23 @@
}
// we may want to spin here if things are going too fast
- if ( !com_dedicated->integer && com_maxfps->integer > 0 && !com_timedemo->integer ) {
- minMsec = 1000 / com_maxfps->integer;
+ if ( !com_dedicated->integer && !com_timedemo->integer ) {
+ if( com_minimized->integer && com_maxfpsMinimized->integer ) {
+ minMsec = 1000 / com_maxfpsMinimized->integer;
+ } else if( com_unfocused->integer && com_maxfpsUnfocused->integer ) {
+ minMsec = 1000 / com_maxfpsUnfocused->integer;
+ } else if( com_maxfps->integer ) {
+ minMsec = 1000 / com_maxfps->integer;
+ } else {
+ minMsec = 1;
+ }
} else {
minMsec = 1;
}
+
+ msec = minMsec;
do {
+ Sys_Sleep( minMsec - msec );
com_frameTime = Com_EventLoop();
if ( lastTime > com_frameTime ) {
lastTime = com_frameTime; // possible on first frame
Modified: trunk/code/qcommon/qcommon.h
===================================================================
--- trunk/code/qcommon/qcommon.h 2008-07-20 17:42:34 UTC (rev 1430)
+++ trunk/code/qcommon/qcommon.h 2008-07-21 22:02:54 UTC (rev 1431)
@@ -803,7 +803,9 @@
extern cvar_t *com_cameraMode;
extern cvar_t *com_ansiColor;
extern cvar_t *com_unfocused;
+extern cvar_t *com_maxfpsUnfocused;
extern cvar_t *com_minimized;
+extern cvar_t *com_maxfpsMinimized;
extern cvar_t *com_altivec;
// both client and server must agree to pause
Modified: trunk/code/sdl/sdl_input.c
===================================================================
--- trunk/code/sdl/sdl_input.c 2008-07-20 17:42:34 UTC (rev 1430)
+++ trunk/code/sdl/sdl_input.c 2008-07-21 22:02:54 UTC (rev 1431)
@@ -348,7 +348,7 @@
if( mouseActive )
{
SDL_WM_GrabInput( SDL_GRAB_OFF );
- SDL_WarpMouse( glConfig.vidWidth >> 1, glConfig.vidHeight >> 1 );
+ SDL_WarpMouse( glConfig.vidWidth / 2, glConfig.vidHeight / 2 );
SDL_ShowCursor( 1 );
mouseActive = qfalse;
@@ -716,15 +716,6 @@
}
break;
- case SDL_ACTIVEEVENT:
- if( e.active.state == SDL_APPINPUTFOCUS ) {
- if( e.active.gain )
- IN_ActivateMouse();
- else
- IN_DeactivateMouse();
- }
- break;
-
case SDL_QUIT:
Sys_Quit();
break;
Modified: trunk/code/sys/sys_main.c
===================================================================
--- trunk/code/sys/sys_main.c 2008-07-20 17:42:34 UTC (rev 1430)
+++ trunk/code/sys/sys_main.c 2008-07-21 22:02:54 UTC (rev 1431)
@@ -441,42 +441,6 @@
/*
=================
-Sys_Idle
-=================
-*/
-static void Sys_Idle( void )
-{
-#ifndef DEDICATED
- int appState = SDL_GetAppState( );
- int sleep = 0;
-
- // If we have no input focus at all, sleep a bit
- if( !( appState & ( SDL_APPMOUSEFOCUS | SDL_APPINPUTFOCUS ) ) )
- {
- Cvar_SetValue( "com_unfocused", 1 );
- sleep += 16;
- }
- else
- Cvar_SetValue( "com_unfocused", 0 );
-
- // If we're minimised, sleep a bit more
- if( !( appState & SDL_APPACTIVE ) )
- {
- Cvar_SetValue( "com_minimized", 1 );
- sleep += 32;
- }
- else
- Cvar_SetValue( "com_minimized", 0 );
-
- if( !com_dedicated->integer && sleep )
- SDL_Delay( sleep );
-#else
- // Dedicated server idles via NET_Sleep
-#endif
-}
-
-/*
-=================
Sys_ParseArgs
=================
*/
@@ -602,7 +566,13 @@
while( 1 )
{
- Sys_Idle( );
+#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( );
}
Modified: trunk/code/sys/sys_unix.c
===================================================================
--- trunk/code/sys/sys_unix.c 2008-07-20 17:42:34 UTC (rev 1430)
+++ trunk/code/sys/sys_unix.c 2008-07-21 22:02:54 UTC (rev 1431)
@@ -463,6 +463,9 @@
{
fd_set fdset;
+ if( msec == 0 )
+ return;
+
FD_ZERO(&fdset);
FD_SET(fileno(stdin), &fdset);
if( msec < 0 )
Modified: trunk/code/sys/sys_win32.c
===================================================================
--- trunk/code/sys/sys_win32.c 2008-07-20 17:42:34 UTC (rev 1430)
+++ trunk/code/sys/sys_win32.c 2008-07-21 22:02:54 UTC (rev 1431)
@@ -519,6 +519,9 @@
*/
void Sys_Sleep( int msec )
{
+ if( msec == 0 )
+ return;
+
if( msec < 0 )
WaitForSingleObject( GetStdHandle( STD_INPUT_HANDLE ), INFINITE );
else
More information about the quake3-commits
mailing list