]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
When below 1 fps, the fps counter instead counts spf (seconds per frame). Note that...
authorsajt <sajt@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 23 Aug 2005 21:45:11 +0000 (21:45 +0000)
committersajt <sajt@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 23 Aug 2005 21:45:11 +0000 (21:45 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@5645 d7cf8633-e32d-0410-b094-e92efae38249

sbar.c
todo

diff --git a/sbar.c b/sbar.c
index fd544d8f577e18f7979c386e7d28a969f64dd5fe..d0cb826fd9b3c57da5108db3c3ee980df6866cfd 100644 (file)
--- a/sbar.c
+++ b/sbar.c
@@ -812,12 +812,13 @@ void Sbar_ShowFPS(void)
        char fpsstring[32];
        char timestring[32];
        char datestring[32];
+       qboolean red;
        fpsstring[0] = 0;
        timestring[0] = 0;
        datestring[0] = 0;
        if (showfps.integer)
        {
-               int calc;
+               float calc;
                if (showfps.integer > 1)
                {
                        static double currtime, frametimes[32];
@@ -837,20 +838,21 @@ void Sbar_ShowFPS(void)
                        framecycle++;
                        framecycle &= 31;
                        if (showfps.integer == 2)
-                               calc = (int) (((double) count / total) + 0.5);
+                               calc = (((double)count / total) + 0.5);
                        else // showfps 3, rapid update
-                               calc = (int) ((1.0 / (newtime - currtime)) + 0.5);
+                               calc = ((1.0 / (newtime - currtime)) + 0.5);
                        currtime = newtime;
                }
                else
                {
                        static double nexttime = 0, lasttime = 0;
-                       static int framerate = 0, framecount = 0;
+                       static float framerate = 0;
+                       static int framecount = 0;
                        double newtime;
                        newtime = Sys_DoubleTime();
                        if (newtime >= nexttime)
                        {
-                               framerate = (int) (framecount / (newtime - lasttime) + 0.5);
+                               framerate = ((float)framecount / (newtime - lasttime) + 0.5);
                                lasttime = newtime;
                                nexttime = max(nexttime + 1, lasttime - 1);
                                framecount = 0;
@@ -858,7 +860,11 @@ void Sbar_ShowFPS(void)
                        framecount++;
                        calc = framerate;
                }
-               dpsnprintf(fpsstring, sizeof(fpsstring), "%4i fps", calc);
+
+               if (red = (calc < 1.0f))
+                       dpsnprintf(fpsstring, sizeof(fpsstring), "%4i spf", (int)(1.0f / calc + 0.5));
+               else
+                       dpsnprintf(fpsstring, sizeof(fpsstring), "%4i fps", (int)(calc + 0.5));
        }
        if (showtime.integer)
                strlcpy(timestring, Sys_TimeString(showtime_format.string), sizeof(timestring));
@@ -876,7 +882,10 @@ void Sbar_ShowFPS(void)
                {
                        fps_x = vid_conwidth.integer - fps_scalex * strlen(fpsstring);
                        DrawQ_Fill(fps_x, fps_y, fps_scalex * strlen(fpsstring), fps_scaley, 0, 0, 0, 0.5, 0);
-                       DrawQ_String(fps_x, fps_y, fpsstring, 0, fps_scalex, fps_scaley, 1, 1, 1, 1, 0);
+                       if (red)
+                               DrawQ_String(fps_x, fps_y, fpsstring, 0, fps_scalex, fps_scaley, 1, 0, 0, 1, 0);
+                       else
+                               DrawQ_String(fps_x, fps_y, fpsstring, 0, fps_scalex, fps_scaley, 1, 1, 1, 1, 0);
                        fps_y += fps_scaley;
                }
                if (timestring[0])
diff --git a/todo b/todo
index 284ca66761b523c02f95462da5f4b5887923b4db..aef3fdb938e39a7b98daf984a5262f351f669b9e 100644 (file)
--- a/todo
+++ b/todo
@@ -170,7 +170,6 @@ d feature darkplaces client: v_deathtilt cvar (Sajt, MauveBib)
 0 feature darkplaces sound: the new sound engine should have a cvar for random variations of pitch on sounds like in doom (RenegadeC)
 0 feature darkplaces website: add q1source.zip to downloads page and suggest that mingw/Dev-C++ users may need the dx headers from it (cpuforbrain)
 0 feature darkplaces: .vis files - like .lit but replacement vis data, note this also requires .leaf files (knghtbrd)
-0 feature darkplaces: showfps should show spf when below 1fps (Sajt)
 0 feature dpmod: add knight/hell knight swords as player weapons (TimeServ)
 0 feature dpmod: add mode with respawning monsters
 0 feature dpmod: change kill awards to use DP_SV_CLIENTFLASHPIC (Tomaz)
@@ -983,6 +982,7 @@ d feature darkplaces renderer: add q3bsp water rendering, both scrolling and wat
 d feature darkplaces renderer: add r_shadow_visiblelighting cvar which draws redish orange polygons similar to visiblevolumes for measuring number of light passes per pixel (Harbish)
 d feature darkplaces server: automatically choose a server port if the bind fails, just keep incrementing the port until it finds an available port (tell Spike)
 d feature darkplaces server: finish DP_QC_BOTCLIENT extension docs and implement it (MauveBib, Supajoe)
+d feature darkplaces: showfps should show spf when below 1fps (Sajt)
 d feature darkplaces sound: make Host_Shutdown clear sound buffer to avoid looping while quitting (up2nogood)
 d feature hmap2: make water have lightmaps (unless -nowaterlightmaps is specified)
 d hmap2 -qbsp: degenerate edge error that occurs in mrinsane's newmap.map file, tyrqbsp does not have this problem (mrinsane)