]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
add fade stuff to the menu, make default fade at 3 sec
authorFruitieX <rasse@rasse-lappy.localdomain>
Sun, 15 Aug 2010 10:20:57 +0000 (13:20 +0300)
committerFruitieX <rasse@rasse-lappy.localdomain>
Sun, 15 Aug 2010 10:20:57 +0000 (13:20 +0300)
defaultXonotic.cfg
qcsrc/client/Main.qc
qcsrc/client/hud.qc
qcsrc/client/hud.qh
qcsrc/menu/xonotic/dialog_hudpanel_weapons.c

index eff54aaa006f14ad5d3537f1090c13973193f82a..c9b5cd7df79c91123bc9b5a1ed9d7b90cf417f37 100644 (file)
@@ -1339,6 +1339,7 @@ seta sbar_info_pos 0 "Y-axis distance from lower right corner for engine info pr
 // hud cvar descriptions
 exec _hud_descriptions.cfg
 // exec the default skin config. remember, NO menu_restart in the deafault cfg (dp segfaults at startup otherwise)
+// please add any new cvars into the hud_save script in qcsrc/client/hud.qc for consistency
 exec hud_default.cfg
 
 // user preference cvars (i.e. shouldn't be adjusted by a skin config) 
@@ -1356,7 +1357,7 @@ seta hud_panel_weapons_ammo_full_nails 200 "show 100% of the status bar at this
 seta hud_panel_weapons_ammo_full_cells 80 "show 100% of the status bar at this ammo count"
 seta hud_panel_weapons_ammo_full_rockets 80 "show 100% of the status bar at this ammo count"
 seta hud_panel_weapons_ammo_full_fuel 100 "show 100% of the status bar at this ammo count"
-seta hud_panel_weapons_timeout "10" "panel disappears if you don't switch weapon for this amount of seconds"
+seta hud_panel_weapons_timeout "3" "panel disappears if you don't switch weapon for this amount of seconds"
 seta hud_panel_weapons_timeout_effect "1" "disappearance effect: 0) no effect; 1) panel moves out of screen; 2) panel fades out"
 
 seta hud_panel_notify_time 10 "time that a new entry stays until it fades out"
index d1a76320f429527c6f454d7709d470dab357d6e8..2fc1ce308bee3c0d7fd49907249f8dbd25dc205b 100644 (file)
@@ -1278,6 +1278,7 @@ void Net_WeaponComplain() {
        complain_weapon_type = ReadByte();
 
        complain_weapon_time = time;
+       weapontime = time; // ping the weapon panel
 }
 
 // CSQC_Parse_TempEntity : Handles all temporary entity network data in the CSQC layer.
index 6dc62337d52dea5e320795bdd1c847ba454cd7fe..5dcca2588045f463e19d325de00c44ee8a3b266c 100644 (file)
@@ -1491,29 +1491,71 @@ void HUD_Weapons(void)
                return;
 
        float timeout = cvar("hud_panel_weapons_timeout");
-       float timeout_effect_lenght;
+       float timeout_effect_length, timein_effect_length;
        if (cvar("hud_panel_weapons_timeout_effect") == 0)
-               timeout_effect_lenght = 0;
+       {
+               timeout_effect_length = 0;
+               timein_effect_length = 0;
+       }
        else
-               timeout_effect_lenght = 0.75;
+       {
+               timeout_effect_length = 0.75;
+               timein_effect_length = 0.375;
+       }
 
-       if (timeout && time >= weapontime + timeout + timeout_effect_lenght && !autocvar__hud_configure)
+       if (timeout && time >= weapontime + timeout + timeout_effect_length && !autocvar__hud_configure)
+       {
+               weaponprevtime = time;
                return;
+       }
 
        active_panel = HUD_PANEL_WEAPONS;
        HUD_Panel_UpdateCvars(weapons);
 
        if (timeout && time >= weapontime + timeout && !autocvar__hud_configure)
        {
-               float f = (time - (weapontime + timeout)) / timeout_effect_lenght;
-               if (cvar("hud_panel_weapons_timeout_effect") == 2)
+               float f = (time - (weapontime + timeout)) / timeout_effect_length;
+               if (cvar("hud_panel_weapons_timeout_effect"))
                {
                        panel_bg_alpha *= (1 - f);
                        panel_fg_alpha *= (1 - f);
                }
-               else
+               if (cvar("hud_panel_weapons_timeout_effect") == 1)
+               {
+                       f *= f; // for a cooler movement
+                       vector center;
+                       center_x = panel_pos_x + panel_size_x/2;
+                       center_y = panel_pos_y + panel_size_y/2;
+                       float screen_ar = vid_conwidth/vid_conheight;
+                       if (center_x/center_y < screen_ar) //bottom left
+                       {
+                               if ((vid_conwidth - center_x)/center_y < screen_ar) //bottom
+                                       panel_pos_y += f * (vid_conheight - panel_pos_y);
+                               else //left
+                                       panel_pos_x -= f * (panel_pos_x + panel_size_x);
+                       }
+                       else //top right
+                       {
+                               if ((vid_conwidth - center_x)/center_y < screen_ar) //right
+                                       panel_pos_x += f * (vid_conwidth - panel_pos_x);
+                               else //top
+                                       panel_pos_y -= f * (panel_pos_y + panel_size_y);
+                       }
+               }
+               weaponprevtime = time - (1 - f) * timein_effect_length;
+       }
+       else if (timeout && time < weaponprevtime + timein_effect_length && !autocvar__hud_configure)
+       {
+               float f = (time - weaponprevtime) / timein_effect_length;
+               if (cvar("hud_panel_weapons_timeout_effect"))
+               {
+                       panel_bg_alpha *= (f);
+                       panel_fg_alpha *= (f);
+               }
+               if (cvar("hud_panel_weapons_timeout_effect") == 1)
                {
                        f *= f; // for a cooler movement
+                       f = 1 - f;
                        vector center;
                        center_x = panel_pos_x + panel_size_x/2;
                        center_y = panel_pos_y + panel_size_y/2;
index e416da62aee32babca9ad8e437e039eda9c74575..0f1cbdc2b4f54bab8d7fd6f71a70a981203fd1e5 100644 (file)
@@ -33,6 +33,7 @@ float ts_primary, ts_secondary;
 
 float last_weapon;
 float weapontime;
+float weaponprevtime;
 
 float teamnagger;
 float hud_accuracy_hud;
index a32099d9d8124b6933d1ca63b375929f6e37ef85..538723bce1c945462614af9926f080266df22007 100644 (file)
@@ -4,7 +4,7 @@ CLASS(XonoticHUDWeaponsDialog) EXTENDS(XonoticRootDialog)
        ATTRIB(XonoticHUDWeaponsDialog, title, string, "Weapons Panel")
        ATTRIB(XonoticHUDWeaponsDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
        ATTRIB(XonoticHUDWeaponsDialog, intendedWidth, float, 0.4)
-       ATTRIB(XonoticHUDWeaponsDialog, rows, float, 15)
+       ATTRIB(XonoticHUDWeaponsDialog, rows, float, 17)
        ATTRIB(XonoticHUDWeaponsDialog, columns, float, 4)
        ATTRIB(XonoticHUDWeaponsDialog, name, string, "HUDweapons")
 ENDCLASS(XonoticHUDWeaponsDialog)
@@ -71,6 +71,23 @@ void XonoticHUDWeaponsDialog_fill(entity me)
                                for(i = 0; i <= 10; ++i)
                                        e.addValue(e, strzone(ftos_decimals(i - 5, 0)), strzone(ftos(i - 5)));
                                e.configureXonoticTextSliderValues(e);
+       me.TR(me);
+               me.TDempty(me, 0.2);
+               me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, "Fade out after:"));
+                       me.TD(me, 1, 2.6, e = makeXonoticTextSlider(strzone(strcat("hud_panel_", panelname, "_timeout"))));
+                               e.addValue(e, "Never", "0");
+                               for(i = 1; i <= 10; ++i)
+                                       e.addValue(e, strzone(strcat(ftos_decimals(i, 0), "s")), strzone(ftos(i)));
+                               e.configureXonoticTextSliderValues(e);
+       me.TR(me);
+               me.TDempty(me, 0.2);
+               me.TD(me, 1, 1.4, e = makeXonoticTextLabel(0, "Fade effect:"));
+               me.TD(me, 1, 0.8, e = makeXonoticRadioButton(3, "hud_panel_weapons_timeout_effect", "0", "None"));
+                       setDependentStringNotEqual(e, strzone(strcat("hud_panel_", panelname, "_timeout")), "0");
+               me.TD(me, 1, 0.8, e = makeXonoticRadioButton(3, "hud_panel_weapons_timeout_effect", "1", "Slide"));
+                       setDependentStringNotEqual(e, strzone(strcat("hud_panel_", panelname, "_timeout")), "0");
+               me.TD(me, 1, 0.8, e = makeXonoticRadioButton(3, "hud_panel_weapons_timeout_effect", "2", "Alpha"));
+                       setDependentStringNotEqual(e, strzone(strcat("hud_panel_", panelname, "_timeout")), "0");
        me.TR(me);
                me.TD(me, 1, 2, e = makeXonoticTextLabel(0, "Weapon icons:"));
        me.TR(me);