From: Severin Meyer Date: Fri, 31 Jul 2015 18:15:43 +0000 (+0200) Subject: Add weapon panel cvars to adjust the scale and alpha of noncurrent weapons, like... X-Git-Tag: xonotic-v0.8.1~28^2~2 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=0bb8fc5dc3fff725c7cf178c1535dd77db89a54b;p=xonotic%2Fxonotic-data.pk3dir.git Add weapon panel cvars to adjust the scale and alpha of noncurrent weapons, like they already exist for the ammo panel --- diff --git a/_hud_descriptions.cfg b/_hud_descriptions.cfg index a47884ef0..2087cc35b 100644 --- a/_hud_descriptions.cfg +++ b/_hud_descriptions.cfg @@ -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" diff --git a/hud_luma.cfg b/hud_luma.cfg index 3888765cb..1cae2f341 100644 --- a/hud_luma.cfg +++ b/hud_luma.cfg @@ -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" diff --git a/hud_luminos.cfg b/hud_luminos.cfg index 34db2beb6..dc47c2461 100644 --- a/hud_luminos.cfg +++ b/hud_luminos.cfg @@ -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" diff --git a/hud_luminos_minimal.cfg b/hud_luminos_minimal.cfg index 39a6fd2ed..64b2aaf81 100644 --- a/hud_luminos_minimal.cfg +++ b/hud_luminos_minimal.cfg @@ -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" diff --git a/hud_luminos_minimal_xhair.cfg b/hud_luminos_minimal_xhair.cfg index 4b6b7e4a7..2fba0c3f5 100644 --- a/hud_luminos_minimal_xhair.cfg +++ b/hud_luminos_minimal_xhair.cfg @@ -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" diff --git a/hud_luminos_old.cfg b/hud_luminos_old.cfg index 20650899e..3be1fb376 100644 --- a/hud_luminos_old.cfg +++ b/hud_luminos_old.cfg @@ -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" diff --git a/hud_nexuiz.cfg b/hud_nexuiz.cfg index 2d86881f5..6b6a6ce52 100644 --- a/hud_nexuiz.cfg +++ b/hud_nexuiz.cfg @@ -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" diff --git a/qcsrc/client/autocvars.qh b/qcsrc/client/autocvars.qh index 90faef941..e77efdcd2 100644 --- a/qcsrc/client/autocvars.qh +++ b/qcsrc/client/autocvars.qh @@ -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; diff --git a/qcsrc/client/hud.qc b/qcsrc/client/hud.qc index b61fe2a5d..b94552710 100644 --- a/qcsrc/client/hud.qc +++ b/qcsrc/client/hud.qc @@ -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 diff --git a/qcsrc/client/hud_config.qc b/qcsrc/client/hud_config.qc index 4b55bb40e..2bce44392 100644 --- a/qcsrc/client/hud_config.qc +++ b/qcsrc/client/hud_config.qc @@ -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"); diff --git a/qcsrc/menu/xonotic/dialog_hudpanel_weapons.qc b/qcsrc/menu/xonotic/dialog_hudpanel_weapons.qc index 7f58e6c4a..a78effc6e 100644 --- a/qcsrc/menu/xonotic/dialog_hudpanel_weapons.qc +++ b/qcsrc/menu/xonotic/dialog_hudpanel_weapons.qc @@ -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:")));