]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/client/hud/panel/modicons.qc
Merge branch 'master' into terencehill/lms_updates
[xonotic/xonotic-data.pk3dir.git] / qcsrc / client / hud / panel / modicons.qc
1 #include "modicons.qh"
2
3 #include <client/draw.qh>
4 #include <common/ent_cs.qh>
5 #include <common/gamemodes/_mod.qh>
6 #include <common/gamemodes/gamemode/ctf/cl_ctf.qh>
7 #include <common/mapinfo.qh>
8 #include <common/scores.qh>
9
10 // Mod icons (#10)
11
12 void HUD_ModIcons_Export(int fh)
13 {
14         // allow saving cvars that aesthetically change the panel into hud skin files
15
16         FOREACH(Gametypes, it.m_modicons_export, it.m_modicons_export(fh));
17 }
18
19 void HUD_ModIcons_SetFunc()
20 {
21         HUD_ModIcons_GameType = gametype.m_modicons;
22 }
23
24 float mod_alpha;
25
26 void HUD_ModIcons()
27 {
28         if(!autocvar__hud_configure)
29         {
30                 if(!autocvar_hud_panel_modicons) return;
31                 if(!HUD_ModIcons_GameType) return;
32         }
33
34         if(mod_active || autocvar__hud_configure)
35                 mod_alpha = min(mod_alpha + frametime * 2, 1);
36         else
37                 mod_alpha = max(mod_alpha - frametime * 2, 0);
38
39         //if(mod_alpha <= 0)
40         //      return;
41         panel_fade_alpha *= mod_alpha;
42         HUD_Panel_LoadCvars();
43
44         draw_beginBoldFont();
45
46         if (autocvar_hud_panel_modicons_dynamichud)
47                 HUD_Scale_Enable();
48         else
49                 HUD_Scale_Disable();
50
51         HUD_Panel_DrawBg();
52
53         if(panel_bg_padding)
54         {
55                 panel_pos += '1 1 0' * panel_bg_padding;
56                 panel_size -= '2 2 0' * panel_bg_padding;
57         }
58
59         if(autocvar__hud_configure)
60                 HUD_Mod_CTF(panel_pos, panel_size);
61         else
62                 HUD_ModIcons_GameType(panel_pos, panel_size);
63
64         draw_endBoldFont();
65 }