1 #include "cl_keepaway.qh"
3 #include <client/hud/panel/modicons.qh>
5 // Keepaway HUD mod icon
6 int kaball_prevstatus; // last remembered status
7 float kaball_statuschange_time; // time when the status changed
9 // we don't need to reset for keepaway since it immediately
10 // autocorrects prevstatus as to if the player has the ball or not
12 void HUD_Mod_Keepaway(vector pos, vector mySize)
14 mod_active = 1; // keepaway should always show the mod HUD
16 float kaball_alpha = blink(0.85, 0.15, 5);
18 int stat_items = STAT(ITEMS);
19 int kaball = (stat_items/IT_KEY1) & 1;
21 if(kaball != kaball_prevstatus)
23 kaball_statuschange_time = time;
24 kaball_prevstatus = kaball;
27 vector kaball_pos, kaball_size;
29 if(mySize.x > mySize.y) {
30 kaball_pos = pos + eX * 0.25 * mySize.x;
31 kaball_size = vec2(0.5 * mySize.x, mySize.y);
33 kaball_pos = pos + eY * 0.25 * mySize.y;
34 kaball_size = vec2(mySize.x, 0.5 * mySize.y);
37 float kaball_statuschange_elapsedtime = time - kaball_statuschange_time;
38 float f = bound(0, kaball_statuschange_elapsedtime*2, 1);
40 if(kaball_prevstatus && f < 1)
41 drawpic_aspect_skin_expanding(kaball_pos, "keepawayball_carrying", kaball_size, '1 1 1', panel_fg_alpha * kaball_alpha, DRAWFLAG_NORMAL, f);
44 drawpic_aspect_skin(pos, "keepawayball_carrying", vec2(mySize.x, mySize.y), '1 1 1', panel_fg_alpha * kaball_alpha * f, DRAWFLAG_NORMAL);