]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/client/hud.qc
Lots and lots of updates, mainly involving spectators (waypoints are now not shown...
[xonotic/xonotic-data.pk3dir.git] / qcsrc / client / hud.qc
index ddffdcc8d1075c41d706d507f7ed19f43e3bee46..cc8b21e74f4aac03b011fb014b18debc045d64ab 100644 (file)
@@ -2974,6 +2974,17 @@ void HUD_KillNotify(string s1, string s2, string s3, float type, float msg) // s
                else if(type == RACE_FAIL) {
                        HUD_KillNotify_Push(s1, s2, 1, RACE_FAIL);
                }
+       } else if(msg == MSG_KA) {
+               if(type == KA_PICKUPBALL) {
+                       HUD_KillNotify_Push(s1, s2, 0, KA_PICKUPBALL);
+                       if(alsoprint)
+                               print (s1, "^7 has picked up the ball!\n");
+               }
+               else if(type == KA_DROPBALL) {
+                       HUD_KillNotify_Push(s1, s2, 0, KA_DROPBALL);
+                       if(alsoprint)
+                               print(s1, "^7 has dropped the ball!\n");
+               }
        }
 }
 
@@ -3253,6 +3264,15 @@ void HUD_Notify (void)
                                        s = "notify_blue_captured";
                                }
                        }
+                       else if(killnotify_deathtype[j] == KA_DROPBALL)
+                       {
+                               s = "notify_balldropped";
+                       }
+                       else if(killnotify_deathtype[j] == KA_PICKUPBALL)
+                       {
+                               s = "notify_ballpickedup";
+                       }
+                       
                        attacker = textShortenToWidth(killnotify_attackers[j], 0.48 * mySize_x - height, fontsize, stringwidth_colors);
                        pos_attacker = pos + eX * (0.52 * mySize_x + height) + eY * (0.5 * fontsize_y + i * height);
                        weap_pos = pos + eX * 0.5 * mySize_x - eX * height + eY * i * height;
@@ -4304,15 +4324,40 @@ void HUD_Mod_KH(vector pos, vector mySize)
 }
 
 // Keepaway HUD mod icon
-void HUD_Mod_Keepaway(vector pos, vector mySize)
-{
-       float stat_items;
-       stat_items = getstati(STAT_ITEMS);
+float kaball_prevstatus; // last remembered status
+float kaball_statuschange_time; // time when the status changed
 
-       mod_active = 1;
+// we don't need to reset for keepaway since it immediately 
+// autocorrects prevstatus as to if the player has the ball or not
 
-       if(stat_items & IT_KEY1)
-               drawpic_aspect_skin(pos, "keepawayball_carrying", eX * mySize_x + eY * mySize_y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
+void HUD_Mod_Keepaway(vector pos, vector mySize)
+{
+       mod_active = 1; // keepaway should always show the mod HUD
+       
+       float BLINK_FACTOR = 0.15;
+       float BLINK_BASE = 0.85;
+       float BLINK_FREQ = 5; 
+       float kaball_alpha = BLINK_BASE + BLINK_FACTOR * cos(time * BLINK_FREQ);
+       
+       float stat_items = getstati(STAT_ITEMS);
+       float kaball = (stat_items/IT_KEY1) & 1;
+       
+       if(kaball != kaball_prevstatus)
+       {
+               kaball_statuschange_time = time;
+               kaball_prevstatus = kaball;
+       }
+       
+       // todo: Fix the sizing with the expanding image
+       
+       float kaball_statuschange_elapsedtime = time - kaball_statuschange_time;
+       float f = bound(0, kaball_statuschange_elapsedtime*2, 1);
+       
+       if(kaball_prevstatus && f < 1)
+               drawpic_aspect_skin_expanding(pos + eY * 0.25 * mySize_y, "keepawayball_carrying", eX * mySize_x + eY * mySize_y * 0.5, '1 1 1', panel_fg_alpha * kaball_alpha, DRAWFLAG_NORMAL, f);
+       
+       if(kaball)
+               drawpic_aspect_skin(pos, "keepawayball_carrying", eX * mySize_x + eY * mySize_y, '1 1 1', panel_fg_alpha * kaball_alpha * f, DRAWFLAG_NORMAL);
 }