Try to fix up fps rates reported by ezhud.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5942 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2021-07-03 01:47:04 +00:00
parent 61b13c7b8e
commit 14dddfd63c

View file

@ -554,31 +554,8 @@ vrect_t scr_vrect;
void EZHud_Tick(double realtime, double gametime) void EZHud_Tick(double realtime, double gametime)
{ {
static float lasttime, lasttime_min = 99999;
static int framecount;
//realtime(ms), realtime(secs), servertime
float oldtime = cls.realtime;
cls.realtime = realtime; cls.realtime = realtime;
cls.frametime = cls.realtime - oldtime;
cl.time = gametime; cl.time = gametime;
if (cls.realtime - lasttime > 1)
{
cls.fps = framecount/(cls.realtime - lasttime);
lasttime = cls.realtime;
framecount = 0;
if (cls.realtime - lasttime_min > 30)
{
cls.min_fps = cls.fps;
lasttime_min = cls.realtime;
}
else if (cls.min_fps > cls.fps)
cls.min_fps = cls.fps;
}
framecount++;
} }
char *findinfo(char *info, char *findkey) char *findinfo(char *info, char *findkey)
{ {
@ -630,6 +607,31 @@ int EZHud_Draw(int seat, float viewx, float viewy, float viewwidth, float viewhe
char serverinfo[4096]; char serverinfo[4096];
char val[64]; char val[64];
int i; int i;
static float lasttime, lasttime_min = 99999;
static int framecount;
static float oldtime;
if (cls.realtime - lasttime > 1)
{
cls.fps = framecount/(cls.realtime - lasttime);
lasttime = cls.realtime;
framecount = 0;
if (cls.realtime - lasttime_min > 30)
{
cls.min_fps = cls.fps;
lasttime_min = cls.realtime;
}
else if (cls.min_fps > cls.fps)
cls.min_fps = cls.fps;
}
if (!seat)
{
cls.frametime = cls.realtime - oldtime;
framecount++;
oldtime = cls.realtime;
}
cl.splitscreenview = seat; cl.splitscreenview = seat;
scr_vrect.x = viewx; scr_vrect.x = viewx;
scr_vrect.y = viewy; scr_vrect.y = viewy;