]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/common/gamemodes/gamemode/nexball/cl_nexball.qc
Merge branch 'Mario/buff_timer' into 'master'
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / gamemodes / gamemode / nexball / cl_nexball.qc
1 #include "cl_nexball.qh"
2
3 #include <client/hud/panel/modicons.qh>
4
5 // Nexball HUD mod icon
6 void HUD_Mod_NexBall(vector pos, vector mySize)
7 {
8         float nb_pb_starttime, dt, p;
9         int stat_items;
10
11         stat_items = STAT(ITEMS);
12         nb_pb_starttime = STAT(NB_METERSTART);
13
14         if (stat_items & IT_KEY1)
15                 mod_active = 1;
16         else
17                 mod_active = 0;
18
19         //Manage the progress bar if any
20         if (nb_pb_starttime > 0)
21         {
22                 dt = (time - nb_pb_starttime) % nb_pb_period;
23                 // one period of positive triangle
24                 p = 2 * dt / nb_pb_period;
25                 if (p > 1)
26                         p = 2 - p;
27
28                 HUD_Panel_DrawProgressBar(pos, mySize, "progressbar", p, (mySize.x <= mySize.y), 0, autocvar_hud_progressbar_nexball_color, autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
29         }
30
31         if (stat_items & IT_KEY1)
32                 drawpic_aspect_skin(pos, "nexball_carrying", eX * mySize.x + eY * mySize.y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
33 }
34
35 int autocvar_cl_eventchase_nexball = 1;
36
37 REGISTER_MUTATOR(cl_nb, true);
38
39 MUTATOR_HOOKFUNCTION(cl_nb, WantEventchase)
40 {
41         if(autocvar_cl_eventchase_nexball && ISGAMETYPE(NEXBALL) && !(WepSet_GetFromStat() & WEPSET(NEXBALL)))
42                 return true;
43         return false;
44 }