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