]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - sbar.c
No longer gives fail message when skybox loads properly, and no longer gives two...
[xonotic/darkplaces.git] / sbar.c
diff --git a/sbar.c b/sbar.c
index 6c2c680d27f0c06caf1dcf6f4819195c88d7cb57..b1008c2bd528d44ee0d1b72066db0426835b27da 100644 (file)
--- a/sbar.c
+++ b/sbar.c
@@ -97,6 +97,8 @@ cvar_t        showdate_format = {CVAR_SAVE, "showdate_format", "%Y-%m-%d"};
 cvar_t sbar_alpha_bg = {CVAR_SAVE, "sbar_alpha_bg", "0.4"};
 cvar_t sbar_alpha_fg = {CVAR_SAVE, "sbar_alpha_fg", "1"};
 
+cvar_t cl_deathscoreboard = {0, "cl_deathscoreboard", "1"};
+
 void Sbar_MiniDeathmatchOverlay (int x, int y);
 void Sbar_DeathmatchOverlay (void);
 void Sbar_IntermissionOverlay (void);
@@ -329,6 +331,7 @@ void Sbar_Init (void)
        Cvar_RegisterVariable (&showdate_format);
        Cvar_RegisterVariable (&sbar_alpha_bg);
        Cvar_RegisterVariable (&sbar_alpha_fg);
+       Cvar_RegisterVariable (&cl_deathscoreboard);
 
        R_RegisterModule("sbar", sbar_start, sbar_shutdown, sbar_newmap);
 }
@@ -809,12 +812,13 @@ void Sbar_ShowFPS(void)
        char fpsstring[32];
        char timestring[32];
        char datestring[32];
+       qboolean red = false;
        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];
@@ -834,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;
@@ -855,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));
@@ -873,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])
@@ -913,7 +925,7 @@ void Sbar_Draw (void)
 
        if (gamemode == GAME_SOM)
        {
-               if (sb_showscores || cl.stats[STAT_HEALTH] <= 0)
+               if (sb_showscores || (cl.stats[STAT_HEALTH] <= 0 && cl_deathscoreboard.integer))
                        Sbar_DrawScoreboard ();
                else if (sb_lines)
                {
@@ -956,7 +968,7 @@ void Sbar_Draw (void)
                sbar_y = vid_conheight.integer - 47;
                sbar_x = (vid_conwidth.integer - 640)/2;
 
-               if (sb_showscores || cl.stats[STAT_HEALTH] <= 0)
+               if (sb_showscores || (cl.stats[STAT_HEALTH] <= 0 && cl_deathscoreboard.integer))
                {
                        Sbar_DrawAlphaPic (0, 0, sb_scorebar, sbar_alpha_bg.value);
                        Sbar_DrawScoreboard ();
@@ -1050,7 +1062,7 @@ void Sbar_Draw (void)
                                Sbar_DrawFrags ();
                }
 
-               if (sb_showscores || cl.stats[STAT_HEALTH] <= 0)
+               if (sb_showscores || (cl.stats[STAT_HEALTH] <= 0 && cl_deathscoreboard.integer))
                {
                        if (gamemode != GAME_GOODVSBAD2)
                                Sbar_DrawAlphaPic (0, 0, sb_scorebar, sbar_alpha_bg.value);