mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2024-11-10 15:21:44 +00:00
Throttle the client to 1000 FPS.
This is more than enough for everyone and prevents wasting CPU time. Without this change as many client frames as possible are rendered, Quake II uses a complete core.
This commit is contained in:
parent
7ea4db4ace
commit
2baf97bdf6
4 changed files with 26 additions and 1 deletions
|
@ -99,6 +99,12 @@ Sys_Milliseconds(void)
|
|||
return curtime;
|
||||
}
|
||||
|
||||
void
|
||||
Sys_Sleep(int msec)
|
||||
{
|
||||
usleep((unsigned int)1000 * msec);
|
||||
}
|
||||
|
||||
void
|
||||
Sys_Mkdir(char *path)
|
||||
{
|
||||
|
|
|
@ -429,6 +429,12 @@ Sys_Milliseconds(void)
|
|||
return curtime;
|
||||
}
|
||||
|
||||
void
|
||||
Sys_Sleep(int msec)
|
||||
{
|
||||
Sleep(msec);
|
||||
}
|
||||
|
||||
/* ======================================================================= */
|
||||
|
||||
static qboolean
|
||||
|
|
|
@ -807,7 +807,19 @@ CL_Frame(int msec)
|
|||
miscframe = false;
|
||||
}
|
||||
|
||||
// TODO: Do we need the cl_sleep stuff?
|
||||
// Throttle the game a little bit. 1000 FPS are enough.
|
||||
if (!packetframe && !renderframe && !cls.forcePacket && !userinfo_modified)
|
||||
{
|
||||
double frametime = (1000.0 / cl_maxfps->value - packetdelta) <= (1000.0 / gl_maxfps->value - renderdelta) ?
|
||||
(1000.0 / cl_maxfps->value - packetdelta) : (1000.0 / gl_maxfps->value - renderdelta);
|
||||
|
||||
if (frametime > 1)
|
||||
{
|
||||
Sys_Sleep(1);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (msec < 1)
|
||||
{
|
||||
|
|
|
@ -764,6 +764,7 @@ void Sys_Error(char *error, ...);
|
|||
void Sys_Quit(void);
|
||||
char *Sys_GetHomeDir(void);
|
||||
const char *Sys_GetBinaryDir(void);
|
||||
void Sys_Sleep(int msec);
|
||||
|
||||
void Sys_FreeLibrary(void *handle);
|
||||
void *Sys_LoadLibrary(const char *path, const char *sym, void **handle);
|
||||
|
|
Loading…
Reference in a new issue