seta hud_panel_weapons_ammo_color "" "color of status bar"
seta hud_panel_weapons_ammo_alpha "" "alpha of status bar"
seta hud_panel_weapons_timeout "" "panel disappears if you don't switch weapon for this amount of seconds"
-seta hud_panel_weapons_timeout_effect "" "disappearance effect: 0) no effect; 1) panel moves out of screen; 2) panel fades out"
+seta hud_panel_weapons_timeout_effect "" "disappearance effect: 0) no effect; 1) panel fades out; 2) panel moves off the screen; 3) combination of 1 and 2"
+seta hud_panel_weapons_timeout_fadebgmin "" "minimum alpha of the panel background while in effect mode 1"
+seta hud_panel_weapons_timeout_fadefgmin "" "minimum alpha of the panel foreground while in effect mode 1"
+seta hud_panel_weapons_timeout_speed_in "" "speed that fading/moving onto the screen occurs"
+seta hud_panel_weapons_timeout_speed_out "" "speed that fading/moving off of the screen occurs"
seta hud_panel_weapons_label "" "1 = show number of weapon, 2 = show bound key of weapon"
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_ammo_color "0 1 0"
seta hud_panel_weapons_ammo_alpha "1"
seta hud_panel_weapons_aspect "2"
-seta hud_panel_weapons_timeout "5"
-seta hud_panel_weapons_timeout_effect "3"
+seta hud_panel_weapons_timeout "1"
+seta hud_panel_weapons_timeout_effect "1"
+seta hud_panel_weapons_timeout_fadebgmin "0.4"
+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_ammo 1
seta hud_panel_weapons_aspect "2"
seta hud_panel_weapons_timeout "0"
seta hud_panel_weapons_timeout_effect "0"
+seta hud_panel_weapons_timeout_fadebgmin "0"
+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_ammo 1
seta hud_panel_weapons_aspect "2"
seta hud_panel_weapons_timeout "0"
seta hud_panel_weapons_timeout_effect "0"
+seta hud_panel_weapons_timeout_fadebgmin "0"
+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_ammo 1
seta hud_panel_weapons_aspect "2"
seta hud_panel_weapons_timeout "3"
seta hud_panel_weapons_timeout_effect "1"
+seta hud_panel_weapons_timeout_fadebgmin "0"
+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_ammo 1
seta hud_panel_weapons_aspect "2"
seta hud_panel_weapons_timeout "0"
seta hud_panel_weapons_timeout_effect "0"
+seta hud_panel_weapons_timeout_fadebgmin "0"
+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_ammo 1
float autocvar_hud_panel_weapons_complainbubble_fadetime;
float autocvar_hud_panel_weapons_complainbubble_padding;
float autocvar_hud_panel_weapons_complainbubble_time;
-var float autocvar_hud_panel_weapons_fade = 1;
float autocvar_hud_panel_weapons_label;
float autocvar_hud_panel_weapons_onlyowned;
float autocvar_hud_panel_weapons_timeout;
float autocvar_hud_panel_weapons_timeout_effect;
+float autocvar_hud_panel_weapons_timeout_fadebgmin;
+float autocvar_hud_panel_weapons_timeout_fadefgmin;
+var float autocvar_hud_panel_weapons_timeout_speed_in = 0.25;
+var float autocvar_hud_panel_weapons_timeout_speed_out = 0.75;
float autocvar_hud_progressbar_alpha;
float autocvar_hud_showbinds;
float autocvar_hud_showbinds_limit;
WEPSET_COPY_AS(weapons_stat);
float i, f, a, j, factor;
float screen_ar, center_x, center_y;
- float weapon_count, weapon_id, weapon_alpha;
+ float weapon_count, weapon_id;
float row, column, rows, columns;
float aspect = autocvar_hud_panel_weapons_aspect;
float show_accuracy = false, panel_weapon_accuracy;
float timeout = autocvar_hud_panel_weapons_timeout;
- float timein_effect_length = (autocvar_hud_panel_weapons_timeout_effect ? 0.375 : 0);
- float timeout_effect_length = (autocvar_hud_panel_weapons_timeout_effect ? 0.75 : 0);
+ float timein_effect_length = autocvar_hud_panel_weapons_timeout_speed_in; //? 0.375 : 0);
+ float timeout_effect_length = autocvar_hud_panel_weapons_timeout_speed_out; //? 0.75 : 0);
float ammo_type, ammo_full;
float barsize_x = 0, barsize_y = 0, baroffset_x = 0, baroffset_y = 0;
{
if((!autocvar_hud_panel_weapons) || (spectatee_status == -1))
return;
- else if(timeout && time >= weapontime + timeout + timeout_effect_length)
+ else if(timeout && time >= weapontime + timeout + timeout_effect_length && ((autocvar_hud_panel_weapons_timeout_effect != 1) && !(autocvar_hud_panel_weapons_timeout_fadebgmin + autocvar_hud_panel_weapons_timeout_fadefgmin)))
{
weaponprevtime = time;
return;
draw_beginBoldFont();
- // calculate fading effect to weapon images for when the panel is idle
- if(autocvar_hud_panel_weapons_fade)
- {
- weapon_alpha = 3.2 - 2 * (time - weapontime);
- weapon_alpha = bound(0.7, weapon_alpha, 1) * panel_fg_alpha;
- }
- else
- weapon_alpha = panel_fg_alpha;
-
// figure out weapon order (how the weapons are sorted) // TODO make this configurable
if(weaponorder_bypriority != autocvar_cl_weaponpriority || !weaponorder[0])
{
{
if (timeout && time >= weapontime + timeout) // apply timeout effect if needed
{
- f = (time - (weapontime + timeout)) / timeout_effect_length;
- if (autocvar_hud_panel_weapons_timeout_effect == 1 || autocvar_hud_panel_weapons_timeout_effect == 3)
+ f = bound(0, (time - (weapontime + timeout)) / timeout_effect_length, 1);
+
+ // fade the panel alpha
+ if(autocvar_hud_panel_weapons_timeout_effect == 1)
+ {
+ panel_bg_alpha *= (autocvar_hud_panel_weapons_timeout_fadebgmin * f + (1 - f));
+ panel_fg_alpha *= (autocvar_hud_panel_weapons_timeout_fadefgmin * f + (1 - f));
+ }
+ else if(autocvar_hud_panel_weapons_timeout_effect == 3)
{
panel_bg_alpha *= (1 - f);
panel_fg_alpha *= (1 - f);
}
+
+ // move the panel off the screen
if (autocvar_hud_panel_weapons_timeout_effect == 2 || autocvar_hud_panel_weapons_timeout_effect == 3)
{
f *= f; // for a cooler movement
}
else if (timeout && time < weaponprevtime + timein_effect_length) // apply timein effect if needed
{
- f = (time - weaponprevtime) / timein_effect_length;
- if (autocvar_hud_panel_weapons_timeout_effect == 1 || autocvar_hud_panel_weapons_timeout_effect == 3)
+ f = bound(0, (time - weaponprevtime) / timein_effect_length, 1);
+
+ // fade the panel alpha
+ if(autocvar_hud_panel_weapons_timeout_effect == 1)
+ {
+ panel_bg_alpha *= (autocvar_hud_panel_weapons_timeout_fadebgmin * (1 - f) + f);
+ panel_fg_alpha *= (autocvar_hud_panel_weapons_timeout_fadefgmin * (1 - f) + f);
+ }
+ else if(autocvar_hud_panel_weapons_timeout_effect == 3)
{
panel_bg_alpha *= (f);
panel_fg_alpha *= (f);
}
+
+ // move the panel back on screen
if (autocvar_hud_panel_weapons_timeout_effect == 2 || autocvar_hud_panel_weapons_timeout_effect == 3)
{
f *= f; // for a cooler movement
// draw background behind currently selected weapon
if(self.weapon == switchweapon)
- drawpic_aspect_skin(weapon_pos, "weapon_current_bg", weapon_size, '1 1 1', weapon_alpha, DRAWFLAG_NORMAL);
+ drawpic_aspect_skin(weapon_pos, "weapon_current_bg", weapon_size, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
// draw the weapon accuracy
if(show_accuracy)
if(WEPSET_CONTAINS_AW(weapons_stat, self.weapon))
{
// draw the weapon image
- drawpic_aspect_skin(weapon_pos, strcat("weapon", self.netname), weapon_size, '1 1 1', weapon_alpha, DRAWFLAG_NORMAL);
+ drawpic_aspect_skin(weapon_pos, strcat("weapon", self.netname), weapon_size, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
// draw weapon label string
switch(autocvar_hud_panel_weapons_label)
HUD_Write_PanelCvar_q("_aspect");
HUD_Write_PanelCvar_q("_timeout");
HUD_Write_PanelCvar_q("_timeout_effect");
+ HUD_Write_PanelCvar_q("_timeout_fadebgmin");
+ HUD_Write_PanelCvar_q("_timeout_fadefgmin");
+ HUD_Write_PanelCvar_q("_timeout_speed_in");
+ HUD_Write_PanelCvar_q("_timeout_speed_out");
HUD_Write_PanelCvar_q("_onlyowned");
break;
case HUD_PANEL_AMMO:
setDependentStringNotEqual(e, strzone(strcat("hud_panel_", panelname, "_timeout")), "0");
me.TD(me, 1, 2.6, e = makeXonoticTextSlider(strzone(strcat("hud_panel_", panelname, "_timeout_effect"))));
e.addValue(e, ZCTX(_("EF^None")), "0");
- e.addValue(e, _("Slide"), "1");
- e.addValue(e, _("Alpha"), "2");
+ e.addValue(e, _("Alpha"), "1");
+ e.addValue(e, _("Slide"), "2");
e.addValue(e, ZCTX(_("EF^Both")), "3");
e.configureXonoticTextSliderValues(e);
setDependentStringNotEqual(e, strzone(strcat("hud_panel_", panelname, "_timeout")), "0");