]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - sbar.c
show more detail in "has no triangles" and "has no vertexes" warning
[xonotic/darkplaces.git] / sbar.c
diff --git a/sbar.c b/sbar.c
index 81c72f8d55cffbae5db10494af1033e47ccbfbbd..a461e849356ecc05395e028074edc00ae9d6caa9 100644 (file)
--- a/sbar.c
+++ b/sbar.c
@@ -407,7 +407,7 @@ void Sbar_Init (void)
                Cvar_RegisterVariable(&sbar_flagstatus_pos); // this cvar makes no sense in other games
        }
 
-       R_RegisterModule("sbar", sbar_start, sbar_shutdown, sbar_newmap);
+       R_RegisterModule("sbar", sbar_start, sbar_shutdown, sbar_newmap, NULL, NULL);
 }
 
 
@@ -684,14 +684,8 @@ void Sbar_SoloScoreboard (void)
        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));
-       if (strrchr(str, '.'))
-               *(strrchr(str, '.')) = 0;
-
-       // append a : separator and then the full title
-       strlcat(str, ":", sizeof(str));
-       strlcat(str, cl.levelname, sizeof(str));
+       // format is like this: e1m1:The Sligpate Complex
+       dpsnprintf(str, sizeof(str), "%s:%s", cl.worldbasename, cl.worldmessage);
 
        // if there's a newline character, terminate the string there
        if (strchr(str, '\n'))
@@ -734,11 +728,11 @@ void Sbar_SoloScoreboard (void)
 
 // draw level name
        if (gamemode == GAME_NEXUIZ) {
-               l = (int) strlen (cl.worldmodel->name);
-               Sbar_DrawString (232 - l*4, 12, cl.worldmodel->name);
+               l = (int) strlen (cl.worldname);
+               Sbar_DrawString (232 - l*4, 12, cl.worldname);
        } else {
-               l = (int) strlen (cl.levelname);
-               Sbar_DrawString (232 - l*4, 12, cl.levelname);
+               l = (int) strlen (cl.worldmessage);
+               Sbar_DrawString (232 - l*4, 12, cl.worldmessage);
        }
 #endif
 }
@@ -1060,7 +1054,7 @@ static void get_showspeed_unit(int unitnumber, double *conversion_factor, const
        {
                default:
                case 1:
-                       if(gamemode == GAME_NEXUIZ)
+                       if(gamemode == GAME_NEXUIZ || gamemode == GAME_XONOTIC)
                                *unit = "in/s";
                        else
                                *unit = "qu/s";
@@ -1069,23 +1063,23 @@ static void get_showspeed_unit(int unitnumber, double *conversion_factor, const
                case 2:
                        *unit = "m/s";
                        *conversion_factor = 0.0254;
-                       if(gamemode != GAME_NEXUIZ) *conversion_factor *= 1.5;
-                       // 1qu=1.5in is for non-Nexuiz only - Nexuiz players are overly large, but 1qu=1in fixes that
+                       if(gamemode != GAME_NEXUIZ && gamemode != GAME_XONOTIC) *conversion_factor *= 1.5;
+                       // 1qu=1.5in is for non-Nexuiz/Xonotic only - Nexuiz/Xonotic players are overly large, but 1qu=1in fixes that
                        break;
                case 3:
                        *unit = "km/h";
                        *conversion_factor = 0.0254 * 3.6;
-                       if(gamemode != GAME_NEXUIZ) *conversion_factor *= 1.5;
+                       if(gamemode != GAME_NEXUIZ && gamemode != GAME_XONOTIC) *conversion_factor *= 1.5;
                        break;
                case 4:
                        *unit = "mph";
                        *conversion_factor = 0.0254 * 3.6 * 0.6213711922;
-                       if(gamemode != GAME_NEXUIZ) *conversion_factor *= 1.5;
+                       if(gamemode != GAME_NEXUIZ && gamemode != GAME_XONOTIC) *conversion_factor *= 1.5;
                        break;
                case 5:
                        *unit = "knots";
                        *conversion_factor = 0.0254 * 1.943844492; // 1 m/s = 1.943844492 knots, because 1 knot = 1.852 km/h
-                       if(gamemode != GAME_NEXUIZ) *conversion_factor *= 1.5;
+                       if(gamemode != GAME_NEXUIZ && gamemode != GAME_XONOTIC) *conversion_factor *= 1.5;
                        break;
        }
 }
@@ -1113,7 +1107,7 @@ void Sbar_ShowFPS_Update(void)
 
 void Sbar_ShowFPS(void)
 {
-       float fps_x, fps_y, fps_scalex, fps_scaley, fps_height;
+       float fps_x, fps_y, fps_scalex, fps_scaley, fps_strings = 0;
        char soundstring[32];
        char fpsstring[32];
        char timestring[32];
@@ -1142,20 +1136,35 @@ void Sbar_ShowFPS(void)
                        dpsnprintf(fpsstring, sizeof(fpsstring), "%4i spf", (int)(1.0 / showfps_framerate + 0.5));
                else
                        dpsnprintf(fpsstring, sizeof(fpsstring), "%4i fps", (int)(showfps_framerate + 0.5));
+               fps_strings++;
                if (cls.timedemo)
                {
                        dpsnprintf(timedemostring1, sizeof(timedemostring1), "frame%4i %f", cls.td_frames, realtime - cls.td_starttime);
                        dpsnprintf(timedemostring2, sizeof(timedemostring2), "%i seconds %3.0f/%3.0f/%3.0f fps", cls.td_onesecondavgcount, cls.td_onesecondminfps, cls.td_onesecondavgfps / max(1, cls.td_onesecondavgcount), cls.td_onesecondmaxfps);
+                       fps_strings++;
+                       fps_strings++;
                }
        }
        if (showtime.integer)
+       {
                strlcpy(timestring, Sys_TimeString(showtime_format.string), sizeof(timestring));
+               fps_strings++;
+       }
        if (showdate.integer)
+       {
                strlcpy(datestring, Sys_TimeString(showdate_format.string), sizeof(datestring));
+               fps_strings++;
+       }
        if (showblur.integer)
+       {
                dpsnprintf(blurstring, sizeof(blurstring), "%3i%% blur", (int)(cl.motionbluralpha * 100));
+               fps_strings++;
+       }
        if (showsound.integer)
+       {
                dpsnprintf(soundstring, sizeof(soundstring), "%4i/4%i at %3ims", cls.soundstats.mixedsounds, cls.soundstats.totalsounds, cls.soundstats.latency_milliseconds);
+               fps_strings++;
+       }
        if (showspeed.integer || showtopspeed.integer)
        {
                double speed, speedxy, f;
@@ -1166,6 +1175,7 @@ void Sbar_ShowFPS(void)
                {
                        get_showspeed_unit(showspeed.integer, &f, &unit);
                        dpsnprintf(speedstring, sizeof(speedstring), "%.0f (%.0f) %s", f*speed, f*speedxy, unit);
+                       fps_strings++;
                }
                if (showtopspeed.integer)
                {
@@ -1190,16 +1200,16 @@ void Sbar_ShowFPS(void)
                                topspeedxy_latched ? "^1" : "^xf88", f*topspeedxy, "^xf88",
                                unit);
                        time(&current_time);
+                       fps_strings++;
                }
        }
-       if (fpsstring[0] || timedemostring1[0] || timedemostring2[0] || timestring[0] || datestring[0] || speedstring[0] || blurstring[0] || topspeedstring[0])
+       if (fps_strings)
        {
                fps_scalex = 12;
                fps_scaley = 12;
-               fps_height = fps_scaley * ((soundstring[0] != 0) + (blurstring[0] != 0) + (fpsstring[0] != 0) + (timedemostring1[0] != 0) + (timedemostring2[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;
+               //fps_y = bound(0, fps_y, vid_conheight.integer - fps_strings*fps_scaley);
+               fps_y = vid_conheight.integer - sbar_info_pos.integer - fps_strings*fps_scaley;
                if (soundstring[0])
                {
                        fps_x = vid_conwidth.integer - DrawQ_TextWidth(soundstring, 0, fps_scalex, fps_scaley, true, FONT_INFOBAR);
@@ -1209,6 +1219,7 @@ void Sbar_ShowFPS(void)
                }
                if (fpsstring[0])
                {
+                       r_draw2d_force = true;
                        fps_x = vid_conwidth.integer - DrawQ_TextWidth(fpsstring, 0, fps_scalex, fps_scaley, true, FONT_INFOBAR);
                        DrawQ_Fill(fps_x, fps_y, vid_conwidth.integer - fps_x, fps_scaley, 0, 0, 0, 0.5, 0);
                        if (red)
@@ -1216,6 +1227,7 @@ void Sbar_ShowFPS(void)
                        else
                                DrawQ_String(fps_x, fps_y, fpsstring, 0, fps_scalex, fps_scaley, 1, 1, 1, 1, 0, NULL, true, FONT_INFOBAR);
                        fps_y += fps_scaley;
+                       r_draw2d_force = false;
                }
                if (timedemostring1[0])
                {