]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - sbar.c
add a "freeslots" field to the host cache
[xonotic/darkplaces.git] / sbar.c
diff --git a/sbar.c b/sbar.c
index bc14b3842448f95bcaac046cd31c42d0e6a5dfa8..4ceda890bfac528e79c5cd08d1a595f773bef4de 100644 (file)
--- a/sbar.c
+++ b/sbar.c
@@ -110,6 +110,8 @@ void Sbar_DeathmatchOverlay (void);
 void Sbar_IntermissionOverlay (void);
 void Sbar_FinaleOverlay (void);
 
+void CL_VM_UpdateShowingScoresState (int showingscores);
+
 
 /*
 ===============
@@ -123,6 +125,7 @@ void Sbar_ShowScores (void)
        if (sb_showscores)
                return;
        sb_showscores = true;
+       CL_VM_UpdateShowingScoresState(sb_showscores);
 }
 
 /*
@@ -135,6 +138,7 @@ Tab key up
 void Sbar_DontShowScores (void)
 {
        sb_showscores = false;
+       CL_VM_UpdateShowingScoresState(sb_showscores);
 }
 
 void sbar_start(void)
@@ -871,7 +875,7 @@ void Sbar_DrawInventory (void)
                if (num[2] != ' ')
                        Sbar_DrawCharacter ( (6*i+2)*8 - 2, -24, 18 + num[2] - '0');
                if (num[3] != ' ')
-                       Sbar_DrawCharacter ( (6*i+3)*8 - 2, -24, 18 + num[2] - '0');
+                       Sbar_DrawCharacter ( (6*i+3)*8 - 2, -24, 18 + num[3] - '0');
        }
 
        // items
@@ -935,9 +939,9 @@ void Sbar_DrawFrags (void)
                s = &cl.scores[k];
 
                // draw background
-               c = (unsigned char *)&palette_complete[(s->colors & 0xf0) + 8];
+               c = (unsigned char *)&palette_pantsscoreboard[(s->colors & 0xf0) >> 4];
                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];
+               c = (unsigned char *)&palette_shirtscoreboard[s->colors & 0xf];
                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
@@ -979,9 +983,9 @@ void Sbar_DrawFace (void)
                s = &cl.scores[cl.viewentity - 1];
                // draw background
                Sbar_DrawPic (112, 0, rsb_teambord);
-               c = (unsigned char *)&palette_complete[(s->colors & 0xf0) + 8];
+               c = (unsigned char *)&palette_pantsscoreboard[(s->colors & 0xf0) >> 4];
                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];
+               c = (unsigned char *)&palette_shirtscoreboard[s->colors & 0xf];
                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
@@ -1234,10 +1238,14 @@ void Sbar_Draw (void)
                                if (cl.stats[STAT_ARMOR] > 0)
                                {
                                        Sbar_DrawStretchPic (0, 0, sb_armor[0], sbar_alpha_fg.value, 24, 24);
-                                       if(cl.stats[STAT_ARMOR] > 100)
-                                               Sbar_DrawXNum(24,0,cl.stats[STAT_ARMOR],3,24,1,1,0,1,0);
-                                       else if(cl.stats[STAT_ARMOR] > 25)
+                                       if(cl.stats[STAT_ARMOR] > 200)
+                                               Sbar_DrawXNum(24,0,cl.stats[STAT_ARMOR],3,24,0,1,0,1,0);
+                                       else if(cl.stats[STAT_ARMOR] > 100)
+                                               Sbar_DrawXNum(24,0,cl.stats[STAT_ARMOR],3,24,0.2,1,0.2,1,0);
+                                       else if(cl.stats[STAT_ARMOR] > 50)
                                                Sbar_DrawXNum(24,0,cl.stats[STAT_ARMOR],3,24,0.6,0.7,0.8,1,0);
+                                       else if(cl.stats[STAT_ARMOR] > 25)
+                                               Sbar_DrawXNum(24,0,cl.stats[STAT_ARMOR],3,24,1,1,0.2,1,0);
                                        else
                                                Sbar_DrawXNum(24,0,cl.stats[STAT_ARMOR],3,24,0.7,0,0,1,0);
                                }
@@ -1246,10 +1254,14 @@ void Sbar_Draw (void)
                                if (cl.stats[STAT_HEALTH] != 0)
                                {
                                        Sbar_DrawStretchPic (112, 0, sb_health, sbar_alpha_fg.value, 24, 24);
-                                       if(cl.stats[STAT_HEALTH] > 100)
-                                               Sbar_DrawXNum(136,0,cl.stats[STAT_HEALTH],3,24,1,1,0,1,0);
-                                       else if(cl.stats[STAT_HEALTH] > 25)
+                                       if(cl.stats[STAT_HEALTH] > 200)
+                                               Sbar_DrawXNum(136,0,cl.stats[STAT_HEALTH],3,24,0,1,0,1,0);
+                                       else if(cl.stats[STAT_HEALTH] > 100)
+                                               Sbar_DrawXNum(136,0,cl.stats[STAT_HEALTH],3,24,0.2,1,0.2,1,0);
+                                       else if(cl.stats[STAT_HEALTH] > 50)
                                                Sbar_DrawXNum(136,0,cl.stats[STAT_HEALTH],3,24,0.6,0.7,0.8,1,0);
+                                       else if(cl.stats[STAT_HEALTH] > 25)
+                                               Sbar_DrawXNum(136,0,cl.stats[STAT_HEALTH],3,24,1,1,0.2,1,0);
                                        else
                                                Sbar_DrawXNum(136,0,cl.stats[STAT_HEALTH],3,24,0.7,0,0,1,0);
                                }
@@ -1599,9 +1611,14 @@ float Sbar_PrintScoreboardItem(scoreboard_t *s, float x, float y)
                else
                {
                        // draw colors behind score
-                       c = (unsigned char *)&palette_complete[(s->colors & 0xf0) + 8];
+                       //
+                       //
+                       //
+                       //
+                       //
+                       c = (unsigned char *)&palette_pantsscoreboard[(s->colors & 0xf0) >> 4];
                        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];
+                       c = (unsigned char *)&palette_shirtscoreboard[s->colors & 0xf];
                        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", myself ? 13 : ' ', (int) s->frags, s->name), 0, 8, 8, 1, 1, 1, 1 * sbar_alpha_fg.value, 0, NULL, true);
@@ -1623,9 +1640,9 @@ float Sbar_PrintScoreboardItem(scoreboard_t *s, float x, float y)
                else
                {
                        // draw colors behind score
-                       c = (unsigned char *)&palette_complete[(s->colors & 0xf0) + 8];
+                       c = (unsigned char *)&palette_pantsscoreboard[(s->colors & 0xf0) >> 4];
                        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];
+                       c = (unsigned char *)&palette_shirtscoreboard[s->colors & 0xf];
                        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", myself ? 13 : ' ', (int) s->frags, s->name), 0, 8, 8, 1, 1, 1, 1 * sbar_alpha_fg.value, 0, NULL, true);
@@ -1651,7 +1668,7 @@ 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*/)
+               else if (cls.protocol == PROTOCOL_QUAKE || cls.protocol == PROTOCOL_QUAKEDP || cls.protocol == PROTOCOL_NEHAHRAMOVIE || cls.protocol == PROTOCOL_NEHAHRABJP || cls.protocol == PROTOCOL_NEHAHRABJP2 || cls.protocol == PROTOCOL_NEHAHRABJP3 || 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;
@@ -1856,7 +1873,7 @@ void Sbar_Score (int margin)
                        for(i = 0; i < teamlines; ++i)
                        {
                                int cindex = teamcolorsort[i]->colors & 15;
-                               unsigned char *c = (unsigned char *)&palette_complete[(cindex << 4) + 8];
+                               unsigned char *c = (unsigned char *)&palette_shirtscoreboard[cindex];
                                float cm = max(max(c[0], c[1]), c[2]);
                                float cr = c[0] / cm;
                                float cg = c[1] / cm;
@@ -1969,9 +1986,7 @@ void Sbar_IntermissionOverlay (void)
        int             dig;
        int             num;
 
-       // LordHavoc: changed to draw the deathmatch overlays in any multiplayer mode
-       //if (cl.gametype == GAME_DEATHMATCH)
-       if (!cl.islocalgame)
+       if (cl.gametype == GAME_DEATHMATCH)
        {
                Sbar_DeathmatchOverlay ();
                return;