]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - sbar.c
remove r_motionblur_debug, and replace with showblur which has been added to sbar.c
[xonotic/darkplaces.git] / sbar.c
diff --git a/sbar.c b/sbar.c
index d98a44879457cf21ff0d028091151bc7bfd1600b..d93f0304809ebb4f2baebb181847de46f3e37699 100644 (file)
--- a/sbar.c
+++ b/sbar.c
@@ -90,6 +90,7 @@ cachepic_t *sb_finale;
 
 cvar_t showfps = {CVAR_SAVE, "showfps", "0", "shows your rendered fps (frames per second)"};
 cvar_t showsound = {CVAR_SAVE, "showsound", "0", "shows number of active sound sources, sound latency, and other statistics"};
+cvar_t showblur = {CVAR_SAVE, "showblur", "0", "shows the current alpha level of motionblur"};
 cvar_t showspeed = {CVAR_SAVE, "showspeed", "0", "shows your current speed (qu per second); number selects unit: 1 = qu/s, 2 = m/s, 3 = km/h, 4 = mph, 5 = knots"};
 cvar_t showtopspeed = {CVAR_SAVE, "showtopspeed", "0", "shows your top speed (kept on screen for max 3 seconds); value -1 takes over the unit from showspeed, otherwise it's an unit number just like in showspeed"};
 cvar_t showtime = {CVAR_SAVE, "showtime", "0", "shows current time of day (useful on screenshots)"};
@@ -378,6 +379,7 @@ void Sbar_Init (void)
        Cmd_AddCommand("-showscores", Sbar_DontShowScores, "hide scoreboard");
        Cvar_RegisterVariable(&showfps);
        Cvar_RegisterVariable(&showsound);
+       Cvar_RegisterVariable(&showblur);
        Cvar_RegisterVariable(&showspeed);
        Cvar_RegisterVariable(&showtopspeed);
        Cvar_RegisterVariable(&showtime);
@@ -1096,6 +1098,7 @@ void Sbar_ShowFPS(void)
        char timestring[32];
        char datestring[32];
        char speedstring[32];
+       char blurstring[32];
        char topspeedstring[48];
        qboolean red = false;
        soundstring[0] = 0;
@@ -1103,6 +1106,7 @@ void Sbar_ShowFPS(void)
        timestring[0] = 0;
        datestring[0] = 0;
        speedstring[0] = 0;
+       blurstring[0] = 0;
        topspeedstring[0] = 0;
        if (showfps.integer)
        {
@@ -1137,6 +1141,8 @@ void Sbar_ShowFPS(void)
                strlcpy(timestring, Sys_TimeString(showtime_format.string), sizeof(timestring));
        if (showdate.integer)
                strlcpy(datestring, Sys_TimeString(showdate_format.string), sizeof(datestring));
+       if (showblur.integer)
+               dpsnprintf(blurstring, sizeof(blurstring), "%3i%% blur", (int)(cl.motionbluralpha * 100));
        if (showsound.integer)
                dpsnprintf(soundstring, sizeof(soundstring), "%4i/4%i at %3ims", cls.soundstats.mixedsounds, cls.soundstats.totalsounds, cls.soundstats.latency_milliseconds);
        if (showspeed.integer || showtopspeed.integer)
@@ -1175,11 +1181,11 @@ void Sbar_ShowFPS(void)
                        time(&current_time);
                }
        }
-       if (fpsstring[0] || timestring[0] || datestring[0] || speedstring[0] || topspeedstring[0])
+       if (fpsstring[0] || timestring[0] || datestring[0] || speedstring[0] || blurstring[0] || topspeedstring[0])
        {
                fps_scalex = 12;
                fps_scaley = 12;
-               fps_height = fps_scaley * ((soundstring[0] != 0) + (fpsstring[0] != 0) + (timestring[0] != 0) + (datestring[0] != 0) + (speedstring[0] != 0) + (topspeedstring[0] != 0));
+               fps_height = fps_scaley * ((soundstring[0] != 0) + (blurstring[0] != 0) + (fpsstring[0] != 0) + (timestring[0] != 0) + (datestring[0] != 0) + (speedstring[0] != 0) + (topspeedstring[0] != 0));
                //fps_y = vid_conheight.integer - sb_lines; // yes this may draw over the sbar
                //fps_y = bound(0, fps_y, vid_conheight.integer - fps_height);
                fps_y = vid_conheight.integer - sbar_info_pos.integer - fps_height;
@@ -1228,6 +1234,13 @@ void Sbar_ShowFPS(void)
                        DrawQ_String_Font(fps_x, fps_y, topspeedstring, 0, fps_scalex, fps_scaley, 1, 1, 1, 1, 0, NULL, false, FONT_INFOBAR);
                        fps_y += fps_scaley;
                }
+               if (blurstring[0])
+               {
+                       fps_x = vid_conwidth.integer - DrawQ_TextWidth_Font(blurstring, 0, true, FONT_INFOBAR) * fps_scalex;
+                       DrawQ_Fill(fps_x, fps_y, vid_conwidth.integer - fps_x, fps_scaley, 0, 0, 0, 0.5, 0);
+                       DrawQ_String_Font(fps_x, fps_y, blurstring, 0, fps_scalex, fps_scaley, 1, 1, 1, 1, 0, NULL, true, FONT_INFOBAR);
+                       fps_y += fps_scaley;
+               }
        }
 }