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