cvar'ize the game loop throttling by adding the new sys_throttle with

a default value of 0.02.  changing its value to 0 disables throttling.


git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@427 af15c1b1-3010-417e-b628-4374ebc0bcbd
This commit is contained in:
Ozkan Sezer 2011-02-27 07:05:18 +00:00
parent 7ae84d838c
commit c53dd74e4d
5 changed files with 8 additions and 2 deletions

View file

@ -242,6 +242,7 @@ void Host_InitLocal (void)
Cvar_RegisterVariable (&devstats, NULL); //johnfitz
Cvar_RegisterVariable (&sys_ticrate, NULL);
Cvar_RegisterVariable (&sys_throttle, NULL);
Cvar_RegisterVariable (&serverprofile, NULL);
Cvar_RegisterVariable (&fraglimit, NULL);

View file

@ -170,8 +170,10 @@ int main(int argc, char *argv[])
time = newtime - oldtime;
Host_Frame(time);
// throttle the game loop just a little bit - noone needs more than 1000fps, I think
if (newtime - oldtime < 1)
/* throttle the game loop just a little bit
and make the game run a little cooler:
noone needs more than 1000fps, I think */
if (time < sys_throttle.value)
SDL_Delay(1);
oldtime = newtime;

View file

@ -268,6 +268,7 @@ extern qboolean noclip_anglehack;
extern quakeparms_t host_parms;
extern cvar_t sys_ticrate;
extern cvar_t sys_throttle;
extern cvar_t sys_nostdout;
extern cvar_t developer;
extern cvar_t max_edicts; //johnfitz

View file

@ -34,6 +34,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
qboolean isDedicated;
cvar_t sys_throttle = {"sys_throttle", "0.02", true};
#define MAX_HANDLES 32 /* johnfitz -- was 10 */
static FILE *sys_handles[MAX_HANDLES];

View file

@ -37,6 +37,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
qboolean isDedicated;
qboolean Win95, Win95old, WinNT, WinVista;
cvar_t sys_throttle = {"sys_throttle", "0.02", true};
static HANDLE hinput, houtput;