]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - sbar.c
fix v_flipped in cs_unproject (it was correct in cs_project) if a view port is set up
[xonotic/darkplaces.git] / sbar.c
diff --git a/sbar.c b/sbar.c
index bc73eba4b8d5f456969b4c3654eb4ad4d680bf05..2ef95dfbf944f917ba9bb69f9cf1f9074f8e5d51 100644 (file)
--- a/sbar.c
+++ b/sbar.c
@@ -674,8 +674,13 @@ void Sbar_SoloScoreboard (void)
        // monsters and secrets are now both on the top row
        if (cl.stats[STAT_TOTALMONSTERS])
                Sbar_DrawString(8, 4, va("Monsters:%3i /%3i", cl.stats[STAT_MONSTERS], cl.stats[STAT_TOTALMONSTERS]));
+       else if (cl.stats[STAT_MONSTERS]) // LA: Display something if monsters_killed is non-zero, but total_monsters is zero
+               Sbar_DrawString(8, 4, va("Monsters:%3i", cl.stats[STAT_MONSTERS]));
+
        if (cl.stats[STAT_TOTALSECRETS])
                Sbar_DrawString(8+22*8, 4, va("Secrets:%3i /%3i", cl.stats[STAT_SECRETS], cl.stats[STAT_TOTALSECRETS]));
+       else if (cl.stats[STAT_SECRETS]) // LA: And similarly for secrets
+               Sbar_DrawString(8+22*8, 4, va("Secrets:%3i", cl.stats[STAT_SECRETS]));
 
        // figure out the map's filename without path or extension
        strlcpy(str, FS_FileWithoutPath(cl.worldmodel ? cl.worldmodel->name : ""), sizeof(str));
@@ -1105,12 +1110,15 @@ void Sbar_ShowFPS(void)
                static double nexttime = 0, lasttime = 0;
                static double framerate = 0;
                static int framecount = 0;
-               double interval = 0.25;
+               double interval = 1;
                double newtime;
-               newtime = realtime;
+               newtime = Sys_DoubleTime();
                if (newtime >= nexttime)
                {
-                       framerate = framecount / (newtime - lasttime);
+                       if (framecount > 1) // frames per second
+                               framerate = framecount / interval;
+                       else // seconds per frame
+                               framerate = framecount / (newtime - lasttime);
                        if (nexttime < newtime - interval * 1.5)
                                nexttime = newtime;
                        lasttime = newtime;
@@ -1121,7 +1129,7 @@ void Sbar_ShowFPS(void)
                calc = framerate;
 
                if ((red = (calc < 1.0f)))
-                       dpsnprintf(fpsstring, sizeof(fpsstring), "%4i spf", (int)(1.0f / calc + 0.5));
+                       dpsnprintf(fpsstring, sizeof(fpsstring), "%4i spf", (int)(1.0 / calc + 0.5));
                else
                        dpsnprintf(fpsstring, sizeof(fpsstring), "%4i fps", (int)(calc + 0.5));
        }
@@ -1130,7 +1138,7 @@ void Sbar_ShowFPS(void)
        if (showdate.integer)
                strlcpy(datestring, Sys_TimeString(showdate_format.string), sizeof(datestring));
        if (showsound.integer)
-               dpsnprintf(soundstring, sizeof(soundstring), "%4i/%4i at %3ims\n", cls.soundstats.mixedsounds, cls.soundstats.totalsounds, cls.soundstats.latency_milliseconds);
+               dpsnprintf(soundstring, sizeof(soundstring), "%4i/4%i at %3ims", cls.soundstats.mixedsounds, cls.soundstats.totalsounds, cls.soundstats.latency_milliseconds);
        if (showspeed.integer || showtopspeed.integer)
        {
                double speed, speedxy, f;
@@ -2148,16 +2156,30 @@ void Sbar_IntermissionOverlay (void)
        Sbar_DrawPic (246,64,sb_nums[0][num/10]);
        Sbar_DrawPic (266,64,sb_nums[0][num%10]);
 
-       Sbar_DrawNum (160, 104, cl.stats[STAT_SECRETS], 3, 0);
-       if (gamemode != GAME_NEXUIZ)
-               Sbar_DrawPic (232, 104, sb_slash);
-       Sbar_DrawNum (240, 104, cl.stats[STAT_TOTALSECRETS], 3, 0);
-
-       Sbar_DrawNum (160, 144, cl.stats[STAT_MONSTERS], 3, 0);
-       if (gamemode != GAME_NEXUIZ)
-               Sbar_DrawPic (232, 144, sb_slash);
-       Sbar_DrawNum (240, 144, cl.stats[STAT_TOTALMONSTERS], 3, 0);
+// LA: Display as "a" instead of "a/b" if b is 0
+       if(cl.stats[STAT_TOTALSECRETS])
+       {
+               Sbar_DrawNum (160, 104, cl.stats[STAT_SECRETS], 3, 0);
+               if (gamemode != GAME_NEXUIZ)
+                       Sbar_DrawPic (232, 104, sb_slash);
+               Sbar_DrawNum (240, 104, cl.stats[STAT_TOTALSECRETS], 3, 0);
+       }
+       else
+       {
+               Sbar_DrawNum (240, 104, cl.stats[STAT_SECRETS], 3, 0);
+       }
 
+       if(cl.stats[STAT_TOTALMONSTERS])
+       {
+               Sbar_DrawNum (160, 144, cl.stats[STAT_MONSTERS], 3, 0);
+               if (gamemode != GAME_NEXUIZ)
+                       Sbar_DrawPic (232, 144, sb_slash);
+               Sbar_DrawNum (240, 144, cl.stats[STAT_TOTALMONSTERS], 3, 0);
+       }
+       else
+       {
+               Sbar_DrawNum (240, 144, cl.stats[STAT_MONSTERS], 3, 0);
+       }
 }