From 14dddfd63c3472d1110fce4c51935af290c2a12f Mon Sep 17 00:00:00 2001 From: Spoike Date: Sat, 3 Jul 2021 01:47:04 +0000 Subject: [PATCH] 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 --- plugins/ezhud/ezquakeisms.c | 48 +++++++++++++++++++------------------ 1 file changed, 25 insertions(+), 23 deletions(-) diff --git a/plugins/ezhud/ezquakeisms.c b/plugins/ezhud/ezquakeisms.c index bb027c13d..ce080da38 100644 --- a/plugins/ezhud/ezquakeisms.c +++ b/plugins/ezhud/ezquakeisms.c @@ -554,31 +554,8 @@ vrect_t scr_vrect; 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.frametime = cls.realtime - oldtime; - 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) { @@ -630,6 +607,31 @@ int EZHud_Draw(int seat, float viewx, float viewy, float viewwidth, float viewhe char serverinfo[4096]; char val[64]; 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; scr_vrect.x = viewx; scr_vrect.y = viewy;