From 257e50517fda2dd24dd2b9a651ee68b405da2a25 Mon Sep 17 00:00:00 2001 From: havoc Date: Tue, 19 Oct 2004 08:14:33 +0000 Subject: [PATCH] cleaned up scoreboard printing loops a bit (they don't need to check if the name is empty) 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 | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/sbar.c b/sbar.c index fad52b54..016a1dfb 100644 --- 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) { -- 2.39.2