]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - sbar.c
changed server to not send pingplreport in response to "ping" command,
[xonotic/darkplaces.git] / sbar.c
diff --git a/sbar.c b/sbar.c
index af30d244691b2aefd51801b9715b788e95df5025..28cae4d601e6ae49fbc854d020d41476d2eaadbe 100644 (file)
--- a/sbar.c
+++ b/sbar.c
@@ -176,6 +176,7 @@ void sbar_start(void)
                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[14] = Draw_CachePic ("gfx/sb_key_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);
@@ -715,11 +716,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_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);
-
-       if (active)
-               DrawQ_Fill(vid_conwidth.integer - (w_width + w_space) * w_scale, (w_height + w_space) * w_scale * nr + w_space, w_width * w_scale, w_height * w_scale, 0.3, 0.3, 0.3, fade * sbar_alpha_fg.value, DRAWFLAG_ADDITIVE);
 }
 
 /*
@@ -1157,15 +1155,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 = max(0, 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]));
@@ -1184,11 +1181,20 @@ void Sbar_Draw (void)
 
                                // 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]);
+                               if (redflag == 3 && blueflag == 3)
+                               {
+                                       // The Impossible Combination[tm]
+                                       // Can only happen in Key Hunt mode...
+                                       Sbar_DrawPic (10 - sbar_x, -179, sb_items[14]);
+                               }
+                               else
+                               {
+                                       if (redflag)
+                                               Sbar_DrawPic (10 - sbar_x, -109, sb_items[redflag+10]);
+                                       if (blueflag)
+                                               Sbar_DrawPic (10 - sbar_x, -169, 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);
@@ -1499,7 +1505,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_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;
@@ -1519,7 +1525,7 @@ void Sbar_DeathmatchOverlay (void)
                }
                else
                {
-                       // newer server definitely has pings command, so use it for more efficiency
+                       // newer server definitely has pings command, so use it for more efficiency, avoids ping reports spamming the console if they are misparsed, and saves a little bandwidth
                        MSG_WriteByte(&cls.netcon->message, clc_stringcmd);
                        MSG_WriteString(&cls.netcon->message, "pings");
                }