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