]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'terencehill/hud_notify_panel_update' into 'master'
authorterencehill <piuntn@gmail.com>
Mon, 24 May 2021 13:08:32 +0000 (13:08 +0000)
committerterencehill <piuntn@gmail.com>
Mon, 24 May 2021 13:08:32 +0000 (13:08 +0000)
Notify panel update

Closes #2581

See merge request xonotic/xonotic-data.pk3dir!904

qcsrc/client/hud/hud.qh
qcsrc/client/hud/panel/notify.qc
qcsrc/client/hud/panel/scoreboard.qc
qcsrc/client/hud/panel/scoreboard.qh

index 14e1af0a0df3f0ba27f6a43ce5cc53f063da8394..a7080f90cf31415ebd07439ddebe16fb06c12d0a 100644 (file)
@@ -107,7 +107,6 @@ entity highlightedPanel;
 float highlightedAction; // 0 = nothing, 1 = move, 2 = resize
 
 const float BORDER_MULTIPLIER = 4;
-float scoreboard_bottom;
 int weapon_accuracy[REGISTRY_MAX(Weapons)];
 
 entity complain_weapon;
@@ -252,7 +251,7 @@ REGISTER_HUD_PANEL(WEAPONS,         HUD_Weapons,        PANEL_CONFIG_MAIN | PANE
 REGISTER_HUD_PANEL(AMMO,            HUD_Ammo,           PANEL_CONFIG_MAIN | PANEL_CONFIG_CANBEOFF, PANEL_SHOW_MAINGAME                                                                ) // AMMO
 REGISTER_HUD_PANEL(POWERUPS,        HUD_Powerups,       PANEL_CONFIG_MAIN | PANEL_CONFIG_CANBEOFF, PANEL_SHOW_MAINGAME                                                                ) // POWERUPS
 REGISTER_HUD_PANEL(HEALTHARMOR,     HUD_HealthArmor,    PANEL_CONFIG_MAIN | PANEL_CONFIG_CANBEOFF, PANEL_SHOW_MAINGAME                                                                ) // HEALTHARMOR
-REGISTER_HUD_PANEL(NOTIFY,          HUD_Notify,         PANEL_CONFIG_MAIN | PANEL_CONFIG_CANBEOFF, PANEL_SHOW_MAINGAME | PANEL_SHOW_MINIGAME                                          ) // NOTIFY
+REGISTER_HUD_PANEL(NOTIFY,          HUD_Notify,         PANEL_CONFIG_MAIN | PANEL_CONFIG_CANBEOFF, PANEL_SHOW_MAINGAME | PANEL_SHOW_MINIGAME                      | PANEL_SHOW_WITH_SB) // NOTIFY
 REGISTER_HUD_PANEL(TIMER,           HUD_Timer,          PANEL_CONFIG_MAIN | PANEL_CONFIG_CANBEOFF, PANEL_SHOW_MAINGAME | PANEL_SHOW_MINIGAME                      | PANEL_SHOW_WITH_SB) // TIMER
 REGISTER_HUD_PANEL(RADAR,           HUD_Radar,          PANEL_CONFIG_MAIN | PANEL_CONFIG_CANBEOFF, PANEL_SHOW_MAINGAME                                                                ) // RADAR
 REGISTER_HUD_PANEL(SCORE,           HUD_Score,          PANEL_CONFIG_MAIN | PANEL_CONFIG_CANBEOFF, PANEL_SHOW_MAINGAME | PANEL_SHOW_MINIGAME                                          ) // SCORE
index c2692da081143524442a671fe3d880aa37c0eda7..ae4b92211d8bbb0fb621e43861aceda193bb5d6f 100644 (file)
@@ -1,6 +1,8 @@
 #include "notify.qh"
 
 #include <client/draw.qh>
+#include <client/hud/panel/scoreboard.qh>
+#include <client/view.qh>
 
 // Notifications (#4)
 
@@ -62,6 +64,23 @@ void HUD_Notify()
 
        HUD_Panel_LoadCvars();
 
+       if (scoreboard_fade_alpha)
+       {
+               float minalpha = 1;
+               if (notify_count == 0)
+                       minalpha = 0; // hide if empty
+               else if (boxesoverlap(panel_pos, panel_pos + panel_size,
+                       eX * scoreboard_left + eY * scoreboard_top, eX * scoreboard_right + eY * scoreboard_bottom))
+               {
+                       minalpha = 0.5; // transparent if it may overlap the scoreboard
+               }
+               float f = max(minalpha, (1 - scoreboard_fade_alpha));
+               if (f <= 0)
+                       return;
+               panel_bg_alpha *= f;
+               panel_fg_alpha *= f;
+       }
+
        if (autocvar_hud_panel_notify_dynamichud)
                HUD_Scale_Enable();
        else
@@ -83,6 +102,8 @@ void HUD_Notify()
        }
 
        float fade_start = max(0, autocvar_hud_panel_notify_time);
+       if (intermission) // fade out in half the time
+               fade_start -= (time - intermission_time);
        float fade_time = max(0, autocvar_hud_panel_notify_fadetime);
        float icon_aspect = max(1, autocvar_hud_panel_notify_icon_aspect);
 
index b70513f44b7ae127a9822ef2c125de7a19e22c8b..2db57485b948815f946d3921c295375c20b44c28 100644 (file)
@@ -1830,12 +1830,14 @@ void Scoreboard_Draw()
 
        float excess = max(0, max_namesize - autocvar_hud_panel_scoreboard_namesize * hud_fontsize.x);
        float fixed_scoreboard_width = bound(vid_conwidth * autocvar_hud_panel_scoreboard_minwidth, vid_conwidth - excess, vid_conwidth * 0.93);
-       panel_pos.x = 0.5 * (vid_conwidth - fixed_scoreboard_width);
+       scoreboard_left = 0.5 * (vid_conwidth - fixed_scoreboard_width);
+       scoreboard_right = scoreboard_left + fixed_scoreboard_width;
+       panel_pos.x = scoreboard_left;
        panel_size.x = fixed_scoreboard_width;
 
        Scoreboard_UpdatePlayerTeams();
 
-       float initial_pos_y = panel_pos.y;
+       scoreboard_top = panel_pos.y;
        vector pos = panel_pos;
        entity tm;
        string str;
@@ -2129,12 +2131,12 @@ void Scoreboard_Draw()
 
        pos.y += 2 * hud_fontsize.y;
        if (scoreboard_fade_alpha < 1)
-               scoreboard_bottom = initial_pos_y + (pos.y - initial_pos_y) * scoreboard_fade_alpha;
+               scoreboard_bottom = scoreboard_top + (pos.y - scoreboard_top) * scoreboard_fade_alpha;
        else if (pos.y != scoreboard_bottom)
        {
                if (pos.y > scoreboard_bottom)
-                       scoreboard_bottom = min(pos.y, scoreboard_bottom + frametime * 10 * (pos.y - initial_pos_y));
+                       scoreboard_bottom = min(pos.y, scoreboard_bottom + frametime * 10 * (pos.y - scoreboard_top));
                else
-                       scoreboard_bottom = max(pos.y, scoreboard_bottom - frametime * 10 * (pos.y - initial_pos_y));
+                       scoreboard_bottom = max(pos.y, scoreboard_bottom - frametime * 10 * (pos.y - scoreboard_top));
        }
 }
index 7189143e669831af26eb7576c6ff43453f214ba6..cd43b341ec78ab041ab7a04db67b1135decb7a64 100644 (file)
@@ -11,6 +11,11 @@ float scoreboard_fade_alpha;
 float scoreboard_acc_fade_alpha;
 float scoreboard_itemstats_fade_alpha;
 
+float scoreboard_top;
+float scoreboard_bottom;
+float scoreboard_left;
+float scoreboard_right;
+
 void Cmd_Scoreboard_SetFields(int argc);
 void Scoreboard_Draw();
 void Scoreboard_InitScores();