]> de.git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
changed sbar stats (Monsters/Secrets/Time/map title) around a bit, inspired by a...
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Fri, 26 Jan 2007 05:58:43 +0000 (05:58 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Fri, 26 Jan 2007 05:58:43 +0000 (05:58 +0000)
specific changes: Monsters/Secrets are now on top row (rather than left side), map filename (minus path/extension) and map title are shown, time moved to far right of second row

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@6757 d7cf8633-e32d-0410-b094-e92efae38249

sbar.c

diff --git a/sbar.c b/sbar.c
index 88a6ba998ce3c965cfa8df0771c382bf0e7936b5..95fb089d8c98271c1cfa418034d2d009058f4578 100644 (file)
--- a/sbar.c
+++ b/sbar.c
@@ -622,6 +622,45 @@ Sbar_SoloScoreboard
 */
 void Sbar_SoloScoreboard (void)
 {
+#if 1
+       char    str[80], timestr[40];
+       int             i, max;
+       int             minutes, seconds;
+
+       minutes = (int)(cl.time / 60);
+       seconds = (int)(cl.time - 60*floor(cl.time/60));
+
+       // monsters and secrets are now both on the top row
+       if (gamemode != GAME_NEXUIZ)
+               Sbar_DrawString(8, 4, va("Monsters:%3i /%3i    Secrets :%3i /%3i", cl.stats[STAT_MONSTERS], cl.stats[STAT_TOTALMONSTERS], cl.stats[STAT_SECRETS], cl.stats[STAT_TOTALSECRETS]));
+
+       // 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));
+
+       // make the time string
+       max = 38 - sprintf(timestr, " %i:%02i", minutes, seconds);
+
+       // if there's a newline character, terminate the string there
+       if (strchr(str, '\n'))
+               *(strchr(str, '\n')) = 0;
+
+       // pad with spaces to fill the allotted space and append the time
+       i = bound(0, (int)strlen(str), max);
+       while (i < max)
+               str[i++] = ' ';
+       str[i] = 0;
+       strlcat(str, timestr, sizeof(str));
+
+       // print the line of text
+       Sbar_DrawString(8, 12, str);
+
+#else
        char    str[80];
        int             minutes, seconds, tens, units;
        int             l;
@@ -650,6 +689,7 @@ void Sbar_SoloScoreboard (void)
                l = (int) strlen (cl.levelname);
                Sbar_DrawString (232 - l*4, 12, cl.levelname);
        }
+#endif
 }
 
 /*