]> de.git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
cleaned up scoreboard printing loops a bit (they don't need to check if the name...
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 19 Oct 2004 08:14:33 +0000 (08:14 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 19 Oct 2004 08:14:33 +0000 (08:14 +0000)
fixed (I think, after much testing) the duplicate names bug in the mini scoreboard by changing a bound to a separate max and min (evidently the loop index was starting < 0)

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

sbar.c

diff --git a/sbar.c b/sbar.c
index fad52b54a307e4a8ff769323327f7e4376757608..016a1dfb798091962310f38f8bcb95c5dae542bf 100644 (file)
--- a/sbar.c
+++ b/sbar.c
@@ -696,8 +696,6 @@ void Sbar_DrawFrags (void)
        {
                k = fragsort[i];
                s = &cl.scores[k];
-               if (!s->name[0])
-                       continue;
 
                // draw background
                c = (qbyte *)&palette_complete[(s->colors & 0xf0) + 8];
@@ -1159,19 +1157,14 @@ Sbar_DeathmatchOverlay
 float Sbar_PrintScoreboardItem(scoreboard_t *s, float x, float y)
 {
        qbyte *c;
-       if (s->name[0] || s->frags || s->colors || (s - cl.scores) == cl.playerentity - 1)
-       {
-               // draw colors behind score
-               c = (qbyte *)&palette_complete[(s->colors & 0xf0) + 8];
-               DrawQ_Fill(x + 8, y+1, 32, 3, c[0] * (1.0f / 255.0f), c[1] * (1.0f / 255.0f), c[2] * (1.0f / 255.0f), c[3] * (1.0f / 255.0f) * sbar_alpha_fg.value, 0);
-               c = (qbyte *)&palette_complete[((s->colors & 15)<<4) + 8];
-               DrawQ_Fill(x + 8, y+4, 32, 3, c[0] * (1.0f / 255.0f), c[1] * (1.0f / 255.0f), c[2] * (1.0f / 255.0f), c[3] * (1.0f / 255.0f) * sbar_alpha_fg.value, 0);
-               // print the text
-               DrawQ_String(x, y, va("%c%4i %s", (s - cl.scores) == cl.playerentity - 1 ? 13 : ' ', (int) s->frags, s->name), 0, 8, 8, 1, 1, 1, 1 * sbar_alpha_fg.value, 0);
-               return 8;
-       }
-       else
-               return 0;
+       // draw colors behind score
+       c = (qbyte *)&palette_complete[(s->colors & 0xf0) + 8];
+       DrawQ_Fill(x + 8, y+1, 32, 3, c[0] * (1.0f / 255.0f), c[1] * (1.0f / 255.0f), c[2] * (1.0f / 255.0f), c[3] * (1.0f / 255.0f) * sbar_alpha_fg.value, 0);
+       c = (qbyte *)&palette_complete[((s->colors & 15)<<4) + 8];
+       DrawQ_Fill(x + 8, y+4, 32, 3, c[0] * (1.0f / 255.0f), c[1] * (1.0f / 255.0f), c[2] * (1.0f / 255.0f), c[3] * (1.0f / 255.0f) * sbar_alpha_fg.value, 0);
+       // print the text
+       DrawQ_String(x, y, va("%c%4i %s", (s - cl.scores) == cl.playerentity - 1 ? 13 : ' ', (int) s->frags, s->name), 0, 8, 8, 1, 1, 1, 1 * sbar_alpha_fg.value, 0);
+       return 8;
 }
 
 void Sbar_DeathmatchOverlay (void)
@@ -1221,7 +1214,8 @@ void Sbar_MiniDeathmatchOverlay (int x, int y)
 
        // figure out start
        i -= numlines/2;
-       i = bound(0, i, scoreboardlines - numlines);
+       i = min(i, scoreboardlines - numlines);
+       i = max(i, 0);
 
        if (gamemode == GAME_TRANSFUSION)
        {