mirror of
https://github.com/DrBeef/ioq3quest.git
synced 2024-11-22 20:11:40 +00:00
* 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
This commit is contained in:
parent
4ceb51e6ba
commit
0124371c01
7 changed files with 39 additions and 53 deletions
10
README
10
README
|
@ -116,7 +116,7 @@ New cvars
|
|||
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 @@ New cvars
|
|||
|
||||
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 @@ New cvars
|
|||
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)
|
||||
|
|
|
@ -81,7 +81,9 @@ cvar_t *sv_packetdelay;
|
|||
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 @@ void Com_Init( char *commandLine ) {
|
|||
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 @@ void Com_Frame( void ) {
|
|||
}
|
||||
|
||||
// we may want to spin here if things are going too fast
|
||||
if ( !com_dedicated->integer && com_maxfps->integer > 0 && !com_timedemo->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
|
||||
|
|
|
@ -803,7 +803,9 @@ extern cvar_t *com_journal;
|
|||
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
|
||||
|
|
|
@ -348,7 +348,7 @@ static void IN_DeactivateMouse( void )
|
|||
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 @@ static void IN_ProcessEvents( void )
|
|||
}
|
||||
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;
|
||||
|
|
|
@ -439,42 +439,6 @@ void *Sys_LoadDll( const char *name, char *fqpath ,
|
|||
return libHandle;
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
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( );
|
||||
}
|
||||
|
|
|
@ -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 )
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue