From: havoc Date: Fri, 26 Jan 2007 05:58:43 +0000 (+0000) Subject: changed sbar stats (Monsters/Secrets/Time/map title) around a bit, inspired by a... X-Git-Tag: xonotic-v0.1.0preview~3653 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=cf15a848a84d5950b55c6ac3fa381bc8fd548513;p=xonotic%2Fdarkplaces.git changed sbar stats (Monsters/Secrets/Time/map title) around a bit, inspired by a patch from steven a but not directly based on it 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 --- diff --git a/sbar.c b/sbar.c index 88a6ba99..95fb089d 100644 --- 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 } /*