]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/client/hud/panel/notify.qc
Duel centerprint title: slightly extend underline under the longest name, use the...
[xonotic/xonotic-data.pk3dir.git] / qcsrc / client / hud / panel / notify.qc
index 82690bee73a3d494a84a69762f7749f75806ce49..2f1b254b23fe9712df41297104e02fd69fdecb28 100644 (file)
@@ -1,10 +1,21 @@
 #include "notify.qh"
 
-#include <client/autocvars.qh>
-#include <client/miscfunctions.qh>
+#include <client/draw.qh>
+#include <client/hud/panel/scoreboard.qh>
+#include <client/view.qh>
 
 // Notifications (#4)
 
+void HUD_Notify_Export(int fh)
+{
+       // allow saving cvars that aesthetically change the panel into hud skin files
+       HUD_Write_Cvar("hud_panel_notify_flip");
+       HUD_Write_Cvar("hud_panel_notify_fontsize");
+       HUD_Write_Cvar("hud_panel_notify_time");
+       HUD_Write_Cvar("hud_panel_notify_fadetime");
+       HUD_Write_Cvar("hud_panel_notify_icon_aspect");
+}
+
 void HUD_Notify_Push(string icon, string attacker, string victim)
 {
        if (icon == "")
@@ -47,21 +58,36 @@ void HUD_Notify_Push(string icon, string attacker, string victim)
 
 void HUD_Notify()
 {
-       if (!autocvar__hud_configure)
-               if (!autocvar_hud_panel_notify)
-                       return;
+       if (!autocvar__hud_configure && !autocvar_hud_panel_notify)
+               return;
 
        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
                HUD_Scale_Disable();
        HUD_Panel_DrawBg();
 
-       if (!autocvar__hud_configure)
-               if (notify_count == 0)
-                       return;
+       if (!autocvar__hud_configure && notify_count == 0)
+               return;
 
        vector pos, size;
        pos  = panel_pos;
@@ -74,6 +100,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);
 
@@ -116,7 +144,7 @@ void HUD_Notify()
                {
                        attacker = sprintf(_("Player %d"), count + 1);
                        victim = sprintf(_("Player %d"), count + 2);
-                       icon = Weapons_from(min(WEP_FIRST + count * 2, WEP_LAST)).model2;
+                       icon = REGISTRY_GET(Weapons, min(WEP_FIRST + count * 2, WEP_LAST)).model2;
                        alpha = bound(0, 1.2 - count / entry_count, 1);
                }
                else