]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
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 a47884ef05f586d66da20ad330a33b864eb3d017..2087cc35bfe4f76e4e322cfb6fd694f2b656dfac 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 3888765cb8fd7113781254455866cad2d3353d0e..1cae2f34173472f8f41a5f19559f63c0b1cb114d 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 34db2beb663e7cdf118e8cdb3814575a18529ef1..dc47c24611a4bbbaed5ecc24d03438ca2a6d24f9 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 39a6fd2eddbcb8547c9be24ca5cc983ad6ac0c7c..64b2aaf81abd97c8c17e1ed6cd10846adea4fce7 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 4b6b7e4a74288362ce8761363045f4d2e8767042..2fba0c3f534ea138a5caf050d9750d8ffcbf2509 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 20650899e77de25e7e1e33d485fbeb5beb2e243f..3be1fb3764ca03fd3d5baefc991fabe5c0607a52 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 2d86881f5fa81c7827cf133718987757fd0da4df..6b6a6ce52f1d2eaa83885fe66d240ad5bfa0501a 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 90faef9411e7a23bee108316cad225b3e4b5e723..e77efdcd2b9184cf1f2b4b4acd9b72585f1892ec 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 b61fe2a5da685f95d66b3a766fdaded8d63cf2ca..b94552710744aca27c6161498689bdbf7e1b6c02 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 4b55bb40e9850ab92c104210f6d2fb3712373c93..2bce4439241156d6b38bf93c50de62d4febf40e5 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 7f58e6c4abe904435eaa553c1ab14cc3715149df..a78effc6ed1e421dc50ae36ca185dbce5084470a 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)
@@ -46,6 +46,14 @@ void XonoticHUDWeaponsDialog_fill(entity me)
        me.TR(me);
                me.TDempty(me, 0.2);
                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:")));