Add weapon panel cvars to adjust the scale and alpha of noncurrent weapons, like...
authorSeverin Meyer <sev.ch@web.de>
Fri, 31 Jul 2015 18:15:43 +0000 (20:15 +0200)
committerSeverin Meyer <sev.ch@web.de>
Fri, 31 Jul 2015 18:15:43 +0000 (20:15 +0200)
_hud_descriptions.cfg
hud_luma.cfg
hud_luminos.cfg
hud_luminos_minimal.cfg
hud_luminos_minimal_xhair.cfg
hud_luminos_old.cfg
hud_nexuiz.cfg
qcsrc/client/autocvars.qh
qcsrc/client/hud.qc
qcsrc/client/hud_config.qc
qcsrc/menu/xonotic/dialog_hudpanel_weapons.qc

index a47884e..2087cc3 100644 (file)
@@ -62,6 +62,8 @@ seta hud_panel_weapons_label_scale "" "scale of the weapon text label"
 seta hud_panel_weapons_accuracy "" "show accuracy color as the weapon icon background; colors can be configured with accuracy_color* cvars"
 seta hud_panel_weapons_ammo "" "show ammo as a status bar"
 seta hud_panel_weapons_onlyowned "" "show only owned weapons"
+seta hud_panel_weapons_noncurrent_alpha "" "alpha of noncurrent weapons"
+seta hud_panel_weapons_noncurrent_scale "" "scale of noncurrent weapons, relative to the current weapon"
 
 seta hud_panel_ammo "" "enable/disable this panel"
 seta hud_panel_ammo_pos "" "position of this panel"
index 3888765..1cae2f3 100644 (file)
@@ -60,6 +60,8 @@ seta hud_panel_weapons_timeout_fadefgmin "0.4"
 seta hud_panel_weapons_timeout_speed_in "0.25"
 seta hud_panel_weapons_timeout_speed_out "0.75"
 seta hud_panel_weapons_onlyowned "1"
+seta hud_panel_weapons_noncurrent_alpha "0.8"
+seta hud_panel_weapons_noncurrent_scale "0.8"
 
 seta hud_panel_ammo 1
 seta hud_panel_ammo_pos "0.315000 0.865000"
index 34db2be..dc47c24 100644 (file)
@@ -60,6 +60,8 @@ seta hud_panel_weapons_timeout_fadefgmin "0.4"
 seta hud_panel_weapons_timeout_speed_in "0.25"
 seta hud_panel_weapons_timeout_speed_out "0.75"
 seta hud_panel_weapons_onlyowned "1"
+seta hud_panel_weapons_noncurrent_alpha "1"
+seta hud_panel_weapons_noncurrent_scale "1"
 
 seta hud_panel_ammo 1
 seta hud_panel_ammo_pos "0.330000 0.960000"
index 39a6fd2..64b2aaf 100644 (file)
@@ -60,6 +60,8 @@ seta hud_panel_weapons_timeout_fadefgmin "0"
 seta hud_panel_weapons_timeout_speed_in "0.25"
 seta hud_panel_weapons_timeout_speed_out "0.75"
 seta hud_panel_weapons_onlyowned "1"
+seta hud_panel_weapons_noncurrent_alpha "1"
+seta hud_panel_weapons_noncurrent_scale "1"
 
 seta hud_panel_ammo 1
 seta hud_panel_ammo_pos "0.650000 0.890000"
index 4b6b7e4..2fba0c3 100644 (file)
@@ -60,6 +60,8 @@ seta hud_panel_weapons_timeout_fadefgmin "0"
 seta hud_panel_weapons_timeout_speed_in "0.25"
 seta hud_panel_weapons_timeout_speed_out "0.75"
 seta hud_panel_weapons_onlyowned "1"
+seta hud_panel_weapons_noncurrent_alpha "1"
+seta hud_panel_weapons_noncurrent_scale "1"
 
 seta hud_panel_ammo 1
 seta hud_panel_ammo_pos "0.450000 0.630000"
index 2065089..3be1fb3 100644 (file)
@@ -60,6 +60,8 @@ seta hud_panel_weapons_timeout_fadefgmin "0"
 seta hud_panel_weapons_timeout_speed_in "0.25"
 seta hud_panel_weapons_timeout_speed_out "0.75"
 seta hud_panel_weapons_onlyowned "1"
+seta hud_panel_weapons_noncurrent_alpha "1"
+seta hud_panel_weapons_noncurrent_scale "1"
 
 seta hud_panel_ammo 1
 seta hud_panel_ammo_pos "0.190000 0.920000"
index 2d86881..6b6a6ce 100644 (file)
@@ -60,6 +60,8 @@ seta hud_panel_weapons_timeout_fadefgmin "0"
 seta hud_panel_weapons_timeout_speed_in "0.25"
 seta hud_panel_weapons_timeout_speed_out "0.75"
 seta hud_panel_weapons_onlyowned "0"
+seta hud_panel_weapons_noncurrent_alpha "1"
+seta hud_panel_weapons_noncurrent_scale "1"
 
 seta hud_panel_ammo 1
 seta hud_panel_ammo_pos "0.160000 0.910000"
index 90faef9..e77efdc 100644 (file)
@@ -354,6 +354,8 @@ float autocvar_hud_panel_weapons_complainbubble_time;
 int autocvar_hud_panel_weapons_label;
 float autocvar_hud_panel_weapons_label_scale = 0.5;
 bool autocvar_hud_panel_weapons_onlyowned;
+float autocvar_hud_panel_weapons_noncurrent_alpha = 1;
+float autocvar_hud_panel_weapons_noncurrent_scale = 1;
 float autocvar_hud_panel_weapons_timeout;
 int autocvar_hud_panel_weapons_timeout_effect;
 float autocvar_hud_panel_weapons_timeout_fadebgmin;
index b61fe2a..b945527 100644 (file)
@@ -797,11 +797,17 @@ void HUD_Weapons(void)
        // draw items
        row = column = 0;
        vector label_size = '1 1 0' * min(weapon_size.x, weapon_size.y) * bound(0, autocvar_hud_panel_weapons_label_scale, 1);
+       vector noncurrent_pos = '0 0 0';
+       vector noncurrent_size = weapon_size * bound(0, autocvar_hud_panel_weapons_noncurrent_scale, 1);
+       float noncurrent_alpha = panel_fg_alpha * bound(0, autocvar_hud_panel_weapons_noncurrent_alpha, 1);
+       bool isCurrent;
+
        for(i = 0; i <= WEP_LAST-WEP_FIRST; ++i)
        {
                // retrieve information about the current weapon to be drawn
                self = weaponorder[i];
                weapon_id = self.impulse;
+               isCurrent = (self.weapon == switchweapon);
 
                // skip if this weapon doesn't exist
                if(!self || weapon_id < 0) { continue; }
@@ -812,12 +818,12 @@ void HUD_Weapons(void)
                        continue;
 
                // figure out the drawing position of weapon
-               weapon_pos = (panel_pos
-                       + eX * column * weapon_size.x
-                       + eY * row * weapon_size.y);
+               weapon_pos = (panel_pos + eX * column * weapon_size.x + eY * row * weapon_size.y);
+               noncurrent_pos.x = weapon_pos.x + (weapon_size.x - noncurrent_size.x) / 2;
+               noncurrent_pos.y = weapon_pos.y + (weapon_size.y - noncurrent_size.y) / 2;
 
                // draw background behind currently selected weapon
-               if(self.weapon == switchweapon)
+               if(isCurrent)
                        drawpic_aspect_skin(weapon_pos, "weapon_current_bg", weapon_size, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
 
                // draw the weapon accuracy
@@ -835,7 +841,10 @@ void HUD_Weapons(void)
                if(weapons_stat & WepSet_FromWeapon(self.weapon))
                {
                        // draw the weapon image
-                       drawpic_aspect_skin(weapon_pos, self.model2, weapon_size, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
+                       if(isCurrent)
+                               drawpic_aspect_skin(weapon_pos, self.model2, weapon_size, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
+                       else
+                               drawpic_aspect_skin(noncurrent_pos, self.model2, noncurrent_size, '1 1 1', noncurrent_alpha, DRAWFLAG_NORMAL);
 
                        // draw weapon label string
                        switch(autocvar_hud_panel_weapons_label)
@@ -897,7 +906,7 @@ void HUD_Weapons(void)
                }
                else // draw a "ghost weapon icon" if you don't have the weapon
                {
-                       drawpic_aspect_skin(weapon_pos, self.model2, weapon_size, '0 0 0', panel_fg_alpha * 0.5, DRAWFLAG_NORMAL);
+                       drawpic_aspect_skin(noncurrent_pos, self.model2, noncurrent_size, '0.2 0.2 0.2', panel_fg_alpha * 0.5, DRAWFLAG_NORMAL);
                }
 
                // draw the complain message
index 4b55bb4..2bce443 100644 (file)
@@ -96,6 +96,8 @@ void HUD_Panel_ExportCfg(string cfgname)
                                        HUD_Write_PanelCvar_q("_timeout_speed_in");
                                        HUD_Write_PanelCvar_q("_timeout_speed_out");
                                        HUD_Write_PanelCvar_q("_onlyowned");
+                                       HUD_Write_PanelCvar_q("_noncurrent_alpha");
+                                       HUD_Write_PanelCvar_q("_noncurrent_scale");
                                        break;
                                case HUD_PANEL_AMMO:
                                        HUD_Write_PanelCvar_q("_onlycurrent");
index 7f58e6c..a78effc 100644 (file)
@@ -6,7 +6,7 @@ CLASS(XonoticHUDWeaponsDialog, XonoticRootDialog)
        ATTRIB(XonoticHUDWeaponsDialog, title, string, _("Weapons Panel"))
        ATTRIB(XonoticHUDWeaponsDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
        ATTRIB(XonoticHUDWeaponsDialog, intendedWidth, float, 0.4)
-       ATTRIB(XonoticHUDWeaponsDialog, rows, float, 19)
+       ATTRIB(XonoticHUDWeaponsDialog, rows, float, 21)
        ATTRIB(XonoticHUDWeaponsDialog, columns, float, 4)
        ATTRIB(XonoticHUDWeaponsDialog, name, string, "HUDweapons")
        ATTRIB(XonoticHUDWeaponsDialog, requiresConnection, float, true)
@@ -48,6 +48,14 @@ void XonoticHUDWeaponsDialog_fill(entity me)
                me.TD(me, 1, 3.8, e = makeXonoticCheckBox(0, "hud_panel_weapons_onlyowned", _("Show only owned weapons")));
        me.TR(me);
                me.TDempty(me, 0.2);
+               me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, _("Noncurrent alpha:")));
+               me.TD(me, 1, 2.6, e = makeXonoticSlider(0, 1, 0.1, "hud_panel_weapons_noncurrent_alpha"));
+       me.TR(me);
+               me.TDempty(me, 0.2);
+               me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, _("Noncurrent scale:")));
+               me.TD(me, 1, 2.6, e = makeXonoticSlider(0, 1, 0.1, "hud_panel_weapons_noncurrent_scale"));
+       me.TR(me);
+               me.TDempty(me, 0.2);
                me.TD(me, 1, 1.4, e = makeXonoticTextLabel(0, _("Show weapon ID as:")));
                        me.TD(me, 1, 0.8, e = makeXonoticRadioButton(2, "hud_panel_weapons_label", "0", ZCTX(_("SHOWAS^None"))));
                        me.TD(me, 1, 0.8, e = makeXonoticRadioButton(2, "hud_panel_weapons_label", "1", _("Number")));