1
0
Fork 0
forked from fte/fteqw

negative values of show_fps show milliseconds per frame instead of FPS

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@2291 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
TimeServ 2006-05-19 19:54:03 +00:00
parent d2584c26b9
commit 52393e83ae

View file

@ -1193,6 +1193,8 @@ void SCR_DrawFPS (void)
extern int fps_count; extern int fps_count;
static float lastfps; static float lastfps;
char str[80]; char str[80];
int sfps;
qboolean usemsecs = false;
if (!show_fps.value) if (!show_fps.value)
return; return;
@ -1205,31 +1207,41 @@ void SCR_DrawFPS (void)
lastframetime = t; lastframetime = t;
} }
if (show_fps.value == 2) //alternate mode that displays the lowest noticed sfps = show_fps.value;
if (sfps < 0)
{ {
sfps = -sfps;
usemsecs = true;
}
switch (sfps)
{
case 2: // lowest FPS, highest MS encountered
if (lastfps > 1/host_frametime) if (lastfps > 1/host_frametime)
{ {
lastfps = 1/host_frametime; lastfps = 1/host_frametime;
fps_count = 0; fps_count = 0;
lastframetime = t; lastframetime = t;
} }
} break;
else if (show_fps.value == 3) //alternate mode that displays the highest noticed case 3: // highest FPS, lowest MS encountered
{
if (lastfps < 1/host_frametime) if (lastfps < 1/host_frametime)
{ {
lastfps = 1/host_frametime; lastfps = 1/host_frametime;
fps_count = 0; fps_count = 0;
lastframetime = t; lastframetime = t;
} }
} break;
else if (show_fps.value == 4) //alternate mode that displays the highest noticed case 4:
{
lastfps = 1/host_frametime; lastfps = 1/host_frametime;
lastframetime = t; lastframetime = t;
break;
} }
sprintf(str, "%3.1f FPS", lastfps); if (usemsecs)
sprintf(str, "%4.1f MS", 1000.0/lastfps);
else
sprintf(str, "%3.1f FPS", lastfps);
SCR_StringXY(str, show_fps_x.value, show_fps_y.value); SCR_StringXY(str, show_fps_x.value, show_fps_y.value);
} }