]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - sbar.c
fixed bug where animated mdl skins (such as Tomaz's health box and
[xonotic/darkplaces.git] / sbar.c
diff --git a/sbar.c b/sbar.c
index 01df2be4947e2bc004a919f5546c3e2ae5d21955..c660db8833cc24f81db406d12a284cff6013728a 100644 (file)
--- a/sbar.c
+++ b/sbar.c
@@ -173,6 +173,13 @@ void sbar_start(void)
                sb_items[4] = Draw_CachePic ("gfx/sb_energy", true);
                sb_items[5] = Draw_CachePic ("gfx/sb_str", true);
 
+               sb_items[11] = Draw_CachePic ("gfx/sb_flag_red_taken", true);
+               sb_items[12] = Draw_CachePic ("gfx/sb_flag_red_lost", true);
+               sb_items[13] = Draw_CachePic ("gfx/sb_flag_red_carrying", true);
+               sb_items[15] = Draw_CachePic ("gfx/sb_flag_blue_taken", true);
+               sb_items[16] = Draw_CachePic ("gfx/sb_flag_blue_lost", true);
+               sb_items[17] = Draw_CachePic ("gfx/sb_flag_blue_carrying", true);
+
                sb_sbar = Draw_CachePic("gfx/sbar", true);
                sb_sbar_minimal = Draw_CachePic("gfx/sbar_minimal", true);
                sb_sbar_overlay = Draw_CachePic("gfx/sbar_overlay", true);
@@ -394,7 +401,7 @@ Draws one solid graphics character
 */
 void Sbar_DrawCharacter (int x, int y, int num)
 {
-       DrawQ_String (sbar_x + x + 4 , sbar_y + y, va("%c", num), 0, 8, 8, 1, 1, 1, sbar_alpha_fg.value, 0);
+       DrawQ_String (sbar_x + x + 4 , sbar_y + y, va("%c", num), 0, 8, 8, 1, 1, 1, sbar_alpha_fg.value, 0, NULL, true);
 }
 
 /*
@@ -404,7 +411,7 @@ Sbar_DrawString
 */
 void Sbar_DrawString (int x, int y, char *str)
 {
-       DrawQ_String (sbar_x + x, sbar_y + y, str, 0, 8, 8, 1, 1, 1, sbar_alpha_fg.value, 0);
+       DrawQ_String (sbar_x + x, sbar_y + y, str, 0, 8, 8, 1, 1, 1, sbar_alpha_fg.value, 0, NULL, true);
 }
 
 /*
@@ -553,19 +560,30 @@ void Sbar_SortFrags (void)
                {
                        if (color != (cl.scores[fragsort[i]].colors & 15))
                        {
+                               const char* teamname;
+
                                color = cl.scores[fragsort[i]].colors & 15;
                                teamlines++;
 
-                               if (color == 4)
-                                       strcpy(teams[teamlines-1].name, "^1Red Team");
-                               else if (color == 13)
-                                       strcpy(teams[teamlines-1].name, "^4Blue Team");
-                               else if (color == 9)
-                                       strcpy(teams[teamlines-1].name, "^6Pink Team");
-                               else if (color == 12)
-                                       strcpy(teams[teamlines-1].name, "^3Yellow Team");
-                               else
-                                       strcpy(teams[teamlines-1].name, "Total Team Score");
+                               switch (color)
+                               {
+                                       case 4:
+                                               teamname = "^1Red Team";
+                                               break;
+                                       case 13:
+                                               teamname = "^4Blue Team";
+                                               break;
+                                       case 9:
+                                               teamname = "^6Pink Team";
+                                               break;
+                                       case 12:
+                                               teamname = "^3Yellow Team";
+                                               break;
+                                       default:
+                                               teamname = "Total Team Score";
+                                               break;
+                               }
+                               strlcpy(teams[teamlines-1].name, teamname, sizeof(teams[teamlines-1].name));
 
                                teams[teamlines-1].frags = 0;
                                teams[teamlines-1].colors = color + 16 * color;
@@ -604,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;
@@ -632,6 +689,7 @@ void Sbar_SoloScoreboard (void)
                l = (int) strlen (cl.levelname);
                Sbar_DrawString (232 - l*4, 12, cl.levelname);
        }
+#endif
 }
 
 /*
@@ -642,7 +700,9 @@ Sbar_DrawScoreboard
 void Sbar_DrawScoreboard (void)
 {
        Sbar_SoloScoreboard ();
-       if (cl.gametype == GAME_DEATHMATCH)
+       // LordHavoc: changed to draw the deathmatch overlays in any multiplayer mode
+       //if (cl.gametype == GAME_DEATHMATCH)
+       if (!cl.islocalgame)
                Sbar_DeathmatchOverlay ();
 }
 
@@ -655,11 +715,8 @@ static void Sbar_DrawWeapon(int nr, float fade, int active)
        const int w_width = 300, w_height = 100, w_space = 10;
        const float w_scale = 0.4;
 
-       DrawQ_Pic(vid_conwidth.integer - (w_width + w_space) * w_scale, (w_height + w_space) * w_scale * nr + w_space, sb_weapons[0][nr], w_width * w_scale, w_height * w_scale, (active) ? 1 : 0.6, active ? 1 : 0.6, active ? 1 : 1, fade * sbar_alpha_fg.value, DRAWFLAG_ADDITIVE);
-       //DrawQ_String(vid_conwidth.integer - (w_space + font_size ), (w_height + w_space) * w_scale * nr + w_space, va("%i",nr+1), 0, font_size, font_size, 1, 0, 0, fade, 0);
-
-       if (active)
-               DrawQ_Pic(vid_conwidth.integer - (w_width + w_space) * w_scale, (w_height + w_space) * w_scale * nr + w_space, NULL, w_width * w_scale, w_height * w_scale, 0.3, 0.3, 0.3, fade * sbar_alpha_fg.value, DRAWFLAG_ADDITIVE);
+       DrawQ_Pic(vid_conwidth.integer - (w_width + w_space) * w_scale, (w_height + w_space) * w_scale * nr + w_space, sb_weapons[0][nr], w_width * w_scale, w_height * w_scale, (active) ? 1 : 0.6, active ? 1 : 0.6, active ? 1 : 1, fade * sbar_alpha_fg.value, DRAWFLAG_NORMAL);
+       //DrawQ_String(vid_conwidth.integer - (w_space + font_size ), (w_height + w_space) * w_scale * nr + w_space, va("%i",nr+1), 0, font_size, font_size, 1, 0, 0, fade, 0, NULL, true);
 }
 
 /*
@@ -690,7 +747,7 @@ void Sbar_DrawInventory (void)
                if (cl.stats[STAT_ITEMS] & (IT_SHOTGUN<<i) )
                {
                        time = cl.item_gettime[i];
-                       flashon = (int)((cl.time - time)*10);
+                       flashon = (int)(max(0, cl.time - time)*10);
                        if (flashon >= 10)
                        {
                                if ( cl.stats[STAT_ACTIVEWEAPON] == (IT_SHOTGUN<<i)  )
@@ -714,7 +771,7 @@ void Sbar_DrawInventory (void)
                {
                        if (cl.stats[STAT_ITEMS] & (1<<hipweapons[i]) )
                        {
-                               time = cl.item_gettime[hipweapons[i]];
+                               time = max(0, cl.item_gettime[hipweapons[i]]);
                                flashon = (int)((cl.time - time)*10);
                                if (flashon >= 10)
                                {
@@ -837,9 +894,9 @@ void Sbar_DrawFrags (void)
 
                // draw background
                c = (unsigned char *)&palette_complete[(s->colors & 0xf0) + 8];
-               DrawQ_Pic (sbar_x + x + 10, sbar_y     - 23, NULL, 28, 4, 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);
+               DrawQ_Fill (sbar_x + x + 10, sbar_y     - 23, 28, 4, 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 = (unsigned char *)&palette_complete[((s->colors & 15)<<4) + 8];
-               DrawQ_Pic (sbar_x + x + 10, sbar_y + 4 - 23, NULL, 28, 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);
+               DrawQ_Fill (sbar_x + x + 10, sbar_y + 4 - 23, 28, 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);
 
                // draw number
                f = s->frags;
@@ -881,9 +938,9 @@ void Sbar_DrawFace (void)
                // draw background
                Sbar_DrawPic (112, 0, rsb_teambord);
                c = (unsigned char *)&palette_complete[(s->colors & 0xf0) + 8];
-               DrawQ_Pic (sbar_x + 113, vid_conheight.integer-SBAR_HEIGHT+3, NULL, 22, 9, 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);
+               DrawQ_Fill (sbar_x + 113, vid_conheight.integer-SBAR_HEIGHT+3, 22, 9, 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 = (unsigned char *)&palette_complete[((s->colors & 15)<<4) + 8];
-               DrawQ_Pic (sbar_x + 113, vid_conheight.integer-SBAR_HEIGHT+12, NULL, 22, 9, 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);
+               DrawQ_Fill (sbar_x + 113, vid_conheight.integer-SBAR_HEIGHT+12, 22, 9, 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);
 
                // draw number
                f = s->frags;
@@ -942,7 +999,7 @@ void Sbar_ShowFPS(void)
                static double framerate = 0;
                static int framecount = 0;
                double newtime;
-               newtime = Sys_DoubleTime();
+               newtime = realtime;
                if (newtime >= nexttime)
                {
                        framerate = framecount / (newtime - lasttime);
@@ -973,25 +1030,25 @@ void Sbar_ShowFPS(void)
                if (fpsstring[0])
                {
                        fps_x = vid_conwidth.integer - fps_scalex * strlen(fpsstring);
-                       DrawQ_Pic(fps_x, fps_y, NULL, fps_scalex * strlen(fpsstring), fps_scaley, 0, 0, 0, 0.5, 0);
+                       DrawQ_Fill(fps_x, fps_y, fps_scalex * strlen(fpsstring), fps_scaley, 0, 0, 0, 0.5, 0);
                        if (red)
-                               DrawQ_String(fps_x, fps_y, fpsstring, 0, fps_scalex, fps_scaley, 1, 0, 0, 1, 0);
+                               DrawQ_String(fps_x, fps_y, fpsstring, 0, fps_scalex, fps_scaley, 1, 0, 0, 1, 0, NULL, true);
                        else
-                               DrawQ_String(fps_x, fps_y, fpsstring, 0, fps_scalex, fps_scaley, 1, 1, 1, 1, 0);
+                               DrawQ_String(fps_x, fps_y, fpsstring, 0, fps_scalex, fps_scaley, 1, 1, 1, 1, 0, NULL, true);
                        fps_y += fps_scaley;
                }
                if (timestring[0])
                {
                        fps_x = vid_conwidth.integer - fps_scalex * strlen(timestring);
-                       DrawQ_Pic(fps_x, fps_y, NULL, fps_scalex * strlen(timestring), fps_scaley, 0, 0, 0, 0.5, 0);
-                       DrawQ_String(fps_x, fps_y, timestring, 0, fps_scalex, fps_scaley, 1, 1, 1, 1, 0);
+                       DrawQ_Fill(fps_x, fps_y, fps_scalex * strlen(timestring), fps_scaley, 0, 0, 0, 0.5, 0);
+                       DrawQ_String(fps_x, fps_y, timestring, 0, fps_scalex, fps_scaley, 1, 1, 1, 1, 0, NULL, true);
                        fps_y += fps_scaley;
                }
                if (datestring[0])
                {
                        fps_x = vid_conwidth.integer - fps_scalex * strlen(datestring);
-                       DrawQ_Pic(fps_x, fps_y, NULL, fps_scalex * strlen(datestring), fps_scaley, 0, 0, 0, 0.5, 0);
-                       DrawQ_String(fps_x, fps_y, datestring, 0, fps_scalex, fps_scaley, 1, 1, 1, 1, 0);
+                       DrawQ_Fill(fps_x, fps_y, fps_scalex * strlen(datestring), fps_scaley, 0, 0, 0, 0.5, 0);
+                       DrawQ_String(fps_x, fps_y, datestring, 0, fps_scalex, fps_scaley, 1, 1, 1, 1, 0, NULL, true);
                        fps_y += fps_scaley;
                }
        }
@@ -1097,14 +1154,14 @@ void Sbar_Draw (void)
                        else if (sb_lines)
                        {
                                int i;
-                               double time;
                                float fade;
+                               int redflag, blueflag;
 
-                               // we have a max time 2s (min time = 0)
-                               if ((time = cl.time - cl.weapontime) < 2)
+                               // calculate intensity to draw weapons bar at
+                               fade = 3 - 2 * (cl.time - cl.weapontime);
+                               if (fade > 0)
                                {
-                                       fade = (1.0 - 0.5 * time);
-                                       fade *= fade;
+                                       fade = min(fade, 1);
                                        for (i = 0; i < 8;i++)
                                                if (cl.stats[STAT_ITEMS] & (1 << i))
                                                        Sbar_DrawWeapon(i + 1, fade, (i + 2 == cl.stats[STAT_ACTIVEWEAPON]));
@@ -1121,14 +1178,13 @@ void Sbar_Draw (void)
                                else
                                        Sbar_DrawAlphaPic (0, 0, sb_sbar_minimal, sbar_alpha_fg.value);
 
-                               // special items
-                               if (cl.stats[STAT_ITEMS] & IT_INVULNERABILITY)
-                               {
-                                       // Nexuiz has no anum pics
-                                       //Sbar_DrawNum (36, 0, 666, 3, 1);
-                                       // Nexuiz has no disc pic
-                                       //Sbar_DrawPic (0, 0, sb_disc);
-                               }
+                               // flag icons
+                               redflag = ((cl.stats[STAT_ITEMS]>>15) & 3);
+                               if (redflag)
+                                       Sbar_DrawPic (10 - sbar_x, -85, sb_items[redflag+10]);
+                               blueflag = ((cl.stats[STAT_ITEMS]>>17) & 3);
+                               if (blueflag)
+                                       Sbar_DrawPic (10 - sbar_x, -145, sb_items[blueflag+14]);
 
                                // armor
                                Sbar_DrawXNum ((340-3*24), 12, cl.stats[STAT_ARMOR], 3, 24, 0.6,0.7,0.8,1,0);
@@ -1234,7 +1290,9 @@ void Sbar_Draw (void)
                else // Quake and others
                {
                        sbar_y = vid_conheight.integer - SBAR_HEIGHT;
-                       if (cl.gametype == GAME_DEATHMATCH && gamemode != GAME_TRANSFUSION)
+                       // LordHavoc: changed to draw the deathmatch overlays in any multiplayer mode
+                       //if (cl.gametype == GAME_DEATHMATCH && gamemode != GAME_TRANSFUSION)
+                       if (!cl.islocalgame && gamemode != GAME_TRANSFUSION)
                                sbar_x = 0;
                        else
                                sbar_x = (vid_conwidth.integer - 320)/2;
@@ -1303,7 +1361,7 @@ void Sbar_Draw (void)
                                Sbar_DrawFace ();
 
                                // health
-                               Sbar_DrawNum (154, 0, cl.stats[STAT_HEALTH], 3, cl.stats[STAT_HEALTH] <= 25);
+                               Sbar_DrawNum (136, 0, cl.stats[STAT_HEALTH], 3, cl.stats[STAT_HEALTH] <= 25);
 
                                // ammo icon
                                if (gamemode == GAME_ROGUE)
@@ -1339,7 +1397,9 @@ void Sbar_Draw (void)
 
                        }
 
-                       if (vid_conwidth.integer > 320 && cl.gametype == GAME_DEATHMATCH)
+                       // LordHavoc: changed to draw the deathmatch overlays in any multiplayer mode
+                       //if (vid_conwidth.integer > 320 && cl.gametype == GAME_DEATHMATCH)
+                       if (!cl.islocalgame && vid_conwidth.integer > 320)
                        {
                                if (gamemode == GAME_TRANSFUSION)
                                        Sbar_MiniDeathmatchOverlay (0, 0);
@@ -1370,19 +1430,54 @@ float Sbar_PrintScoreboardItem(scoreboard_t *s, float x, float y)
 {
        int minutes;
        unsigned char *c;
-       minutes = (int)((cl.intermission ? cl.completed_time - s->qw_entertime : realtime - s->qw_entertime) / 60.0);
-       if (s->qw_spectator)
-               DrawQ_ColoredString(x, y, va("%4i %3i %4i spect %-4s %c%s", bound(0, s->qw_ping, 9999), bound(0, s->qw_packetloss, 99), minutes, cl.qw_teamplay ? s->qw_team : "", (s - cl.scores) == cl.playerentity - 1 ? 13 : ' ', s->name), 0, 8, 8, 1, 1, 1, 1 * sbar_alpha_fg.value, 0, NULL );
+       minutes = (int)((cl.intermission ? cl.completed_time - s->qw_entertime : cl.time - s->qw_entertime) / 60.0);
+       if (cls.protocol == PROTOCOL_QUAKEWORLD)
+       {
+               if (s->qw_spectator)
+               {
+                       if (s->qw_ping || s->qw_packetloss)
+                               DrawQ_String(x, y, va("%4i %3i %4i spectator  %c%s", bound(0, s->qw_ping, 9999), bound(0, s->qw_packetloss, 99), minutes, (s - cl.scores) == cl.playerentity - 1 ? 13 : ' ', s->name), 0, 8, 8, 1, 1, 1, 1 * sbar_alpha_fg.value, 0, NULL, false );
+                       else
+                               DrawQ_String(x, y, va("         %4i spectator  %c%s", minutes, (s - cl.scores) == cl.playerentity - 1 ? 13 : ' ', s->name), 0, 8, 8, 1, 1, 1, 1 * sbar_alpha_fg.value, 0, NULL, false );
+               }
+               else
+               {
+                       // draw colors behind score
+                       c = (unsigned char *)&palette_complete[(s->colors & 0xf0) + 8];
+                       DrawQ_Fill(x + 14*8, y+1, 40, 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 = (unsigned char *)&palette_complete[((s->colors & 15)<<4) + 8];
+                       DrawQ_Fill(x + 14*8, y+4, 40, 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, NULL, true);
+                       if (s->qw_ping || s->qw_packetloss)
+                               DrawQ_String(x, y, va("%4i %3i %4i %5i %-4s %c%s", bound(0, s->qw_ping, 9999), bound(0, s->qw_packetloss, 99), minutes,(int) s->frags, cl.qw_teamplay ? s->qw_team : "", (s - cl.scores) == cl.playerentity - 1 ? 13 : ' ', s->name), 0, 8, 8, 1, 1, 1, 1 * sbar_alpha_fg.value, 0, NULL, false );
+                       else
+                               DrawQ_String(x, y, va("         %4i %5i %-4s %c%s", minutes,(int) s->frags, cl.qw_teamplay ? s->qw_team : "", (s - cl.scores) == cl.playerentity - 1 ? 13 : ' ', s->name), 0, 8, 8, 1, 1, 1, 1 * sbar_alpha_fg.value, 0, NULL, false );
+               }
+       }
        else
        {
-               // draw colors behind score
-               c = (unsigned char *)&palette_complete[(s->colors & 0xf0) + 8];
-               DrawQ_Pic(x + 14*8, y+1, NULL, 40, 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 = (unsigned char *)&palette_complete[((s->colors & 15)<<4) + 8];
-               DrawQ_Pic(x + 14*8, y+4, NULL, 40, 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);
-               DrawQ_ColoredString(x, y, va("%4i %3i %4i %5i %-4s %c%s", bound(0, s->qw_ping, 9999), bound(0, s->qw_packetloss, 99), minutes,(int) s->frags, cl.qw_teamplay ? s->qw_team : "", (s - cl.scores) == cl.playerentity - 1 ? 13 : ' ', s->name), 0, 8, 8, 1, 1, 1, 1 * sbar_alpha_fg.value, 0, NULL );
+               if (s->qw_spectator)
+               {
+                       if (s->qw_ping || s->qw_packetloss)
+                               DrawQ_String(x, y, va("%4i %3i spect %c%s", bound(0, s->qw_ping, 9999), bound(0, s->qw_packetloss, 99), (s - cl.scores) == cl.playerentity - 1 ? 13 : ' ', s->name), 0, 8, 8, 1, 1, 1, 1 * sbar_alpha_fg.value, 0, NULL, false );
+                       else
+                               DrawQ_String(x, y, va("         spect %c%s", (s - cl.scores) == cl.playerentity - 1 ? 13 : ' ', s->name), 0, 8, 8, 1, 1, 1, 1 * sbar_alpha_fg.value, 0, NULL, false );
+               }
+               else
+               {
+                       // draw colors behind score
+                       c = (unsigned char *)&palette_complete[(s->colors & 0xf0) + 8];
+                       DrawQ_Fill(x + 9*8, y+1, 40, 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 = (unsigned char *)&palette_complete[((s->colors & 15)<<4) + 8];
+                       DrawQ_Fill(x + 9*8, y+4, 40, 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, NULL, true);
+                       if (s->qw_ping || s->qw_packetloss)
+                               DrawQ_String(x, y, va("%4i %3i %5i %c%s", bound(0, s->qw_ping, 9999), bound(0, s->qw_packetloss, 99), (int) s->frags, (s - cl.scores) == cl.playerentity - 1 ? 13 : ' ', s->name), 0, 8, 8, 1, 1, 1, 1 * sbar_alpha_fg.value, 0, NULL, false );
+                       else
+                               DrawQ_String(x, y, va("         %5i %c%s", (int) s->frags, (s - cl.scores) == cl.playerentity - 1 ? 13 : ' ', s->name), 0, 8, 8, 1, 1, 1, 1 * sbar_alpha_fg.value, 0, NULL, false );
+               }
        }
        return 8;
 }
@@ -1400,8 +1495,27 @@ void Sbar_DeathmatchOverlay (void)
                        MSG_WriteByte(&cls.netcon->message, qw_clc_stringcmd);
                        MSG_WriteString(&cls.netcon->message, "pings");
                }
+               else if (cls.protocol == PROTOCOL_QUAKE || cls.protocol == PROTOCOL_QUAKEDP || cls.protocol == PROTOCOL_NEHAHRAMOVIE || cls.protocol == PROTOCOL_DARKPLACES1 || cls.protocol == PROTOCOL_DARKPLACES2 || cls.protocol == PROTOCOL_DARKPLACES3 || cls.protocol == PROTOCOL_DARKPLACES4 || cls.protocol == PROTOCOL_DARKPLACES5 || cls.protocol == PROTOCOL_DARKPLACES6 || cls.protocol == PROTOCOL_DARKPLACES7)
+               {
+                       // these servers usually lack the pings command and so a less efficient "ping" command must be sent, which on modern DP servers will also reply with a pingplreport command after the ping listing
+                       static int ping_anyway_counter = 0;
+                       if(cl.parsingtextexpectingpingforscores == 1)
+                       {
+                               Con_DPrintf("want to send ping, but still waiting for other reply\n");
+                               if(++ping_anyway_counter >= 5)
+                                       cl.parsingtextexpectingpingforscores = 0;
+                       }
+                       if(cl.parsingtextexpectingpingforscores != 1)
+                       {
+                               ping_anyway_counter = 0;
+                               cl.parsingtextexpectingpingforscores = 1; // hide the output of the next ping report
+                               MSG_WriteByte(&cls.netcon->message, clc_stringcmd);
+                               MSG_WriteString(&cls.netcon->message, "ping");
+                       }
+               }
                else
                {
+                       // newer server definitely has pings command, so use it for more efficiency
                        MSG_WriteByte(&cls.netcon->message, clc_stringcmd);
                        MSG_WriteString(&cls.netcon->message, "pings");
                }
@@ -1412,9 +1526,17 @@ void Sbar_DeathmatchOverlay (void)
        // scores
        Sbar_SortFrags ();
        // draw the text
-       x = (vid_conwidth.integer - (6 + 18 + 15) * 8) / 2;
        y = 40;
-       DrawQ_ColoredString(x, y, va("ping pl%% time frags team  name"), 0, 8, 8, 1, 1, 1, 1 * sbar_alpha_fg.value, 0, NULL );
+       if (cls.protocol == PROTOCOL_QUAKEWORLD)
+       {
+               x = (vid_conwidth.integer - (26 + 15) * 8) / 2; // 26 characters until name, then we assume 15 character names (they can be longer but usually aren't)
+               DrawQ_String(x, y, va("ping pl%% time frags team  name"), 0, 8, 8, 1, 1, 1, 1 * sbar_alpha_fg.value, 0, NULL, false );
+       }
+       else
+       {
+               x = (vid_conwidth.integer - (16 + 15) * 8) / 2; // 16 characters until name, then we assume 15 character names (they can be longer but usually aren't)
+               DrawQ_String(x, y, va("ping pl%% frags  name"), 0, 8, 8, 1, 1, 1, 1 * sbar_alpha_fg.value, 0, NULL, false );
+       }
        y += 8;
 
        if (Sbar_IsTeammatch ())
@@ -1485,7 +1607,9 @@ void Sbar_IntermissionOverlay (void)
        int             dig;
        int             num;
 
-       if (cl.gametype == GAME_DEATHMATCH)
+       // LordHavoc: changed to draw the deathmatch overlays in any multiplayer mode
+       //if (cl.gametype == GAME_DEATHMATCH)
+       if (!cl.islocalgame)
        {
                Sbar_DeathmatchOverlay ();
                return;