]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Re-write a bit of how weapons panel fading animation is done
authorSamual Lenks <samual@xonotic.org>
Tue, 1 Jan 2013 15:44:02 +0000 (10:44 -0500)
committerSamual Lenks <samual@xonotic.org>
Tue, 1 Jan 2013 15:44:02 +0000 (10:44 -0500)
_hud_descriptions.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.c

index cb95f968132ba7145549310b491ec98885459a7a..4c832ef1e9b9a6208be14c874f302a93528ff300 100644 (file)
@@ -52,7 +52,11 @@ seta hud_panel_weapons_complainbubble_color_unavailable "" "color of the complai
 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"
index 6472a257963fad8c9526546031d3d6e7c716779f..c70e1b103a79bfe75504c9c8a86c4696b28f0387 100644 (file)
@@ -52,8 +52,12 @@ seta hud_panel_weapons_ammo "1"
 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
index bb7e0662e32e3bcbce1060385a3f0d42a6961549..4c0a7f46d06ad9159dce70b715d982dfd8abb5b1 100644 (file)
@@ -54,6 +54,10 @@ seta hud_panel_weapons_ammo_alpha "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
index e0921ad35337d272f8e0c91a0032864349981cac..56ec31c8091c5566957fcb7f2112cd9f8ef7a398 100644 (file)
@@ -54,6 +54,10 @@ seta hud_panel_weapons_ammo_alpha "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
index 119f7b18f6f8cd3f163e7e6ac172db53ed4516ad..263412734311e3e73c1015f5b90596674257da7c 100644 (file)
@@ -54,6 +54,10 @@ seta hud_panel_weapons_ammo_alpha "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
index 3cf0feb753e5e08b748ce408a03f42affc78393d..42a0571bb3d96f3d92e7c87ff965f60ff982177c 100644 (file)
@@ -54,6 +54,10 @@ seta hud_panel_weapons_ammo_alpha "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
index ed56f718381cc0e2ecfe61c29d8e3ed2a59a261c..eb35425f51e0e99dc5eb91d0ebb38a8dc9428e51 100644 (file)
@@ -315,11 +315,14 @@ string autocvar_hud_panel_weapons_complainbubble_color_unavailable;
 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;
index 607130ea20c09611360515fff7bf09fd89a86fb7..35a0a0448026ea2b06d7ed5b6ad81533fccd3dca 100644 (file)
@@ -439,15 +439,15 @@ void HUD_Weapons(void)
        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;
@@ -468,7 +468,7 @@ void HUD_Weapons(void)
        {
                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;
@@ -483,15 +483,6 @@ void HUD_Weapons(void)
 
        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])
        {
@@ -572,12 +563,21 @@ void HUD_Weapons(void)
        {
                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
@@ -603,12 +603,21 @@ void HUD_Weapons(void)
                }
                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
@@ -701,7 +710,7 @@ void HUD_Weapons(void)
 
                // 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)
@@ -727,7 +736,7 @@ void HUD_Weapons(void)
                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)
index d4bb5de23a8517013fc1f3c07295d62bd696403a..acff2892da506f53bdef49d0bb8f77baa73735ea 100644 (file)
@@ -80,6 +80,10 @@ void HUD_Panel_ExportCfg(string cfgname)
                                        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:
index b31622f67390e02f1d1465b02c5b55652fab1907..e3cd78eb6a56ba17f982a9c24456176f724c4502 100644 (file)
@@ -33,8 +33,8 @@ void XonoticHUDWeaponsDialog_fill(entity me)
                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");