aboutsummaryrefslogtreecommitdiffstats
path: root/code/sys
diff options
context:
space:
mode:
authortma <tma@edf5b092-35ff-0310-97b2-ce42778d08ea>2008-07-21 22:02:54 +0000
committertma <tma@edf5b092-35ff-0310-97b2-ce42778d08ea>2008-07-21 22:02:54 +0000
commit98228cce0dfe6591dc1b3a1c44852be0ca2adb4f (patch)
treebc6877fd3c06a4b8fc246d874737f195ec9713b5 /code/sys
parentae6f1c7f5d75be89cb177c114fb184f0ed34ef6e (diff)
downloadioquake3-aero-98228cce0dfe6591dc1b3a1c44852be0ca2adb4f.tar.gz
ioquake3-aero-98228cce0dfe6591dc1b3a1c44852be0ca2adb4f.zip
* 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 git-svn-id: svn://svn.icculus.org/quake3/trunk@1431 edf5b092-35ff-0310-97b2-ce42778d08ea
Diffstat (limited to 'code/sys')
-rw-r--r--code/sys/sys_main.c44
-rw-r--r--code/sys/sys_unix.c3
-rw-r--r--code/sys/sys_win32.c3
3 files changed, 13 insertions, 37 deletions
diff --git a/code/sys/sys_main.c b/code/sys/sys_main.c
index a1a57b4..dc846dd 100644
--- a/code/sys/sys_main.c
+++ b/code/sys/sys_main.c
@@ -441,42 +441,6 @@ void *Sys_LoadDll( const char *name, char *fqpath ,
/*
=================
-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 @@ int main( int argc, char **argv )
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( );
}
diff --git a/code/sys/sys_unix.c b/code/sys/sys_unix.c
index 9d9d5aa..40479b9 100644
--- a/code/sys/sys_unix.c
+++ b/code/sys/sys_unix.c
@@ -463,6 +463,9 @@ void Sys_Sleep( int msec )
{
fd_set fdset;
+ if( msec == 0 )
+ return;
+
FD_ZERO(&fdset);
FD_SET(fileno(stdin), &fdset);
if( msec < 0 )
diff --git a/code/sys/sys_win32.c b/code/sys/sys_win32.c
index 18724b3..fb924e6 100644
--- a/code/sys/sys_win32.c
+++ b/code/sys/sys_win32.c
@@ -519,6 +519,9 @@ Block execution for msec or until input is recieved.
*/
void Sys_Sleep( int msec )
{
+ if( msec == 0 )
+ return;
+
if( msec < 0 )
WaitForSingleObject( GetStdHandle( STD_INPUT_HANDLE ), INFINITE );
else