Make the scoreboard a panel
authorterencehill <piuntn@gmail.com>
Sat, 30 Jul 2016 14:23:31 +0000 (16:23 +0200)
committerterencehill <piuntn@gmail.com>
Sat, 30 Jul 2016 14:23:31 +0000 (16:23 +0200)
15 files changed:
_hud_common.cfg
_hud_descriptions.cfg
defaultXonotic.cfg
hud_luma.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/hud.qc
qcsrc/client/hud/hud.qh
qcsrc/client/hud/panel/centerprint.qc
qcsrc/client/scoreboard.qc
qcsrc/client/view.qc

index 7bf9111..bc82ac1 100644 (file)
@@ -44,6 +44,7 @@ seta hud_panel_centerprint      1 "enable this panel"
 //seta hud_panel_mapvote          1 "enable this panel"
 seta hud_panel_itemstime        2 "enable this panel, 1 = show when spectating, 2 = even playing in warmup stage"
 //seta hud_panel_quickmenu        1 "enable this panel"
+//seta hud_panel_scoreboard       1 "enable this panel"
 
 seta hud_panel_weapons_dynamichud          1 "apply the dynamic hud effects to this panel"
 seta hud_panel_ammo_dynamichud             1 "apply the dynamic hud effects to this panel"
index ee46898..c829a22 100644 (file)
@@ -355,3 +355,12 @@ seta hud_panel_quickmenu_bg_alpha "" "if set to something else than \"\" = overr
 seta hud_panel_quickmenu_bg_border "" "if set to something else than \"\" = override default size of border around the background"
 seta hud_panel_quickmenu_bg_padding "" "if set to something else than \"\" = override default padding of contents from border"
 seta hud_panel_quickmenu_align "" "text alignment: 0 left, 0.5 center, 1 right"
+
+seta hud_panel_scoreboard_pos "" "position of this base of the panel"
+seta hud_panel_scoreboard_size "" "size of this panel"
+seta hud_panel_scoreboard_bg "" "if set to something else than \"\" = override default background"
+seta hud_panel_scoreboard_bg_color "" "if set to something else than \"\" = override default panel background color"
+seta hud_panel_scoreboard_bg_color_team "" "override panel color with team color in team based games"
+seta hud_panel_scoreboard_bg_alpha "" "if set to something else than \"\" = override default panel background alpha"
+seta hud_panel_scoreboard_bg_border "" "if set to something else than \"\" = override default size of border around the background"
+seta hud_panel_scoreboard_bg_padding "" "if set to something else than \"\" = override default padding of contents from border"
index 11ba8e4..38fcb47 100644 (file)
@@ -850,9 +850,6 @@ seta scoreboard_fadeoutspeed 5 "speed at which scoreboard fades out, higher is f
 seta scoreboard_highlight 1 "enable highlighting for rows and columns in the scoreboard"
 seta scoreboard_highlight_alpha 0.08 "highlight alpha value (depends on hud_scoreboard_highlight 1)"
 seta scoreboard_highlight_alpha_self 0.3 "self highlight alpha value"
-seta scoreboard_offset_left 0.15 "how far (by percent) the scoreboard is offset from the left screen edge"
-seta scoreboard_offset_right 0.15 "how far (by percent) the scoreboard is offset from the right screen edge"
-seta scoreboard_offset_vertical 0.05 "how far (by percent) the scoreboard is offset from the top and bottom of the screen"
 seta scoreboard_bg_scale 0.25 "scale for the tiled scoreboard background"
 seta scoreboard_respawntime_decimals 1 "decimal places to show for the respawntime countdown display on the scoreboard"
 seta scoreboard_dynamichud 0 "apply the dynamic hud effects to the scoreboard"
index 2f4f31e..95005af 100644 (file)
@@ -357,4 +357,13 @@ seta hud_panel_quickmenu_bg_border ""
 seta hud_panel_quickmenu_bg_padding ""
 seta hud_panel_quickmenu_align "0"
 
+seta hud_panel_scoreboard_pos "0.150000 0.150000"
+seta hud_panel_scoreboard_size "0.700000 0.700000"
+seta hud_panel_scoreboard_bg "0"
+seta hud_panel_scoreboard_bg_color ""
+seta hud_panel_scoreboard_bg_color_team ""
+seta hud_panel_scoreboard_bg_alpha ""
+seta hud_panel_scoreboard_bg_border ""
+seta hud_panel_scoreboard_bg_padding ""
+
 menu_sync
index 3d259eb..e41d6e2 100644 (file)
@@ -357,4 +357,13 @@ seta hud_panel_quickmenu_bg_border ""
 seta hud_panel_quickmenu_bg_padding ""
 seta hud_panel_quickmenu_align "0"
 
+seta hud_panel_scoreboard_pos "0.150000 0.150000"
+seta hud_panel_scoreboard_size "0.700000 0.700000"
+seta hud_panel_scoreboard_bg "0"
+seta hud_panel_scoreboard_bg_color ""
+seta hud_panel_scoreboard_bg_color_team ""
+seta hud_panel_scoreboard_bg_alpha ""
+seta hud_panel_scoreboard_bg_border ""
+seta hud_panel_scoreboard_bg_padding ""
+
 menu_sync
index c1ac51b..372c372 100644 (file)
@@ -357,4 +357,13 @@ seta hud_panel_quickmenu_bg_border ""
 seta hud_panel_quickmenu_bg_padding ""
 seta hud_panel_quickmenu_align "0"
 
+seta hud_panel_scoreboard_pos "0.150000 0.150000"
+seta hud_panel_scoreboard_size "0.700000 0.700000"
+seta hud_panel_scoreboard_bg "0"
+seta hud_panel_scoreboard_bg_color ""
+seta hud_panel_scoreboard_bg_color_team ""
+seta hud_panel_scoreboard_bg_alpha ""
+seta hud_panel_scoreboard_bg_border ""
+seta hud_panel_scoreboard_bg_padding ""
+
 menu_sync
index d612598..53d1a9b 100644 (file)
@@ -357,4 +357,13 @@ seta hud_panel_quickmenu_bg_border ""
 seta hud_panel_quickmenu_bg_padding ""
 seta hud_panel_quickmenu_align "0"
 
+seta hud_panel_scoreboard_pos "0.150000 0.150000"
+seta hud_panel_scoreboard_size "0.700000 0.700000"
+seta hud_panel_scoreboard_bg "0"
+seta hud_panel_scoreboard_bg_color ""
+seta hud_panel_scoreboard_bg_color_team ""
+seta hud_panel_scoreboard_bg_alpha ""
+seta hud_panel_scoreboard_bg_border ""
+seta hud_panel_scoreboard_bg_padding ""
+
 menu_sync
index 4ee8005..e4fe367 100644 (file)
@@ -357,4 +357,13 @@ seta hud_panel_quickmenu_bg_border ""
 seta hud_panel_quickmenu_bg_padding ""
 seta hud_panel_quickmenu_align "1"
 
+seta hud_panel_scoreboard_pos "0.150000 0.150000"
+seta hud_panel_scoreboard_size "0.700000 0.700000"
+seta hud_panel_scoreboard_bg "0"
+seta hud_panel_scoreboard_bg_color ""
+seta hud_panel_scoreboard_bg_color_team ""
+seta hud_panel_scoreboard_bg_alpha ""
+seta hud_panel_scoreboard_bg_border ""
+seta hud_panel_scoreboard_bg_padding ""
+
 menu_sync
index df565ef..d6f7741 100644 (file)
@@ -357,4 +357,13 @@ seta hud_panel_quickmenu_bg_border ""
 seta hud_panel_quickmenu_bg_padding ""
 seta hud_panel_quickmenu_align "0"
 
+seta hud_panel_scoreboard_pos "0.150000 0.150000"
+seta hud_panel_scoreboard_size "0.700000 0.700000"
+seta hud_panel_scoreboard_bg "0"
+seta hud_panel_scoreboard_bg_color ""
+seta hud_panel_scoreboard_bg_color_team ""
+seta hud_panel_scoreboard_bg_alpha ""
+seta hud_panel_scoreboard_bg_border ""
+seta hud_panel_scoreboard_bg_padding ""
+
 menu_sync
index d159cd3..7edf997 100644 (file)
@@ -414,9 +414,6 @@ float autocvar_scoreboard_fadeoutspeed = 5;
 bool autocvar_scoreboard_highlight;
 float autocvar_scoreboard_highlight_alpha = 0.10;
 float autocvar_scoreboard_highlight_alpha_self = 0.25;
-float autocvar_scoreboard_offset_left;
-float autocvar_scoreboard_offset_right;
-float autocvar_scoreboard_offset_vertical;
 float autocvar_scoreboard_respawntime_decimals;
 bool autocvar_scoreboard_dynamichud = false;
 bool autocvar_v_flipped;
index d575e8c..62f5dcb 100644 (file)
@@ -490,17 +490,24 @@ void Hud_Dynamic_Frame()
        hud_shift_current = hud_shift;
 }
 
+// Scoreboard panel
+//
+void HUD_DrawScoreboard();
+void HUD_Scoreboard(void)
+{
+       HUD_DrawScoreboard();
+}
+
 void HUD_Main()
 {
        int i;
-       // global hud alpha fade
+       // global hud alpha fade (scoreboard-related panels behave differently and override it temporarly)
        if(menu_enabled == 1)
                hud_fade_alpha = 1;
+       else if(!autocvar__hud_configure)
+               hud_fade_alpha = (1 - scoreboard_fade_alpha) * (1 - autocvar__menu_alpha);
        else
-               hud_fade_alpha = (1 - autocvar__menu_alpha);
-
-       if(scoreboard_fade_alpha)
-               hud_fade_alpha = (1 - scoreboard_fade_alpha);
+               hud_fade_alpha = 1 - autocvar__menu_alpha;
 
        HUD_Configure_Frame();
 
@@ -510,8 +517,14 @@ void HUD_Main()
        // they must fade only when the menu does
        if(scoreboard_fade_alpha == 1)
        {
-               HUD_Panel_Draw(HUD_PANEL(CENTERPRINT));
-               return;
+               if(autocvar__menu_alpha == 1)
+                       return;
+               if(scoreboard_fade_alpha == 1)
+               {
+                       HUD_Panel_Draw(HUD_PANEL(SCOREBOARD));
+                       HUD_Panel_Draw(HUD_PANEL(CENTERPRINT));
+                       return;
+               }
        }
 
        if(!autocvar__hud_configure && !hud_fade_alpha)
index 2a53444..75b7f9f 100644 (file)
@@ -235,6 +235,7 @@ REGISTER_HUD_PANEL(MINIGAME_MENU,   HUD_MinigameMenu,   minigamemenu,   PANEL_CO
 REGISTER_HUD_PANEL(MAPVOTE,         MapVote_Draw,       mapvote,        PANEL_CONFIG_NO  , PANEL_SHOW_MAPVOTE )
 REGISTER_HUD_PANEL(ITEMSTIME,       HUD_ItemsTime,      itemstime,      PANEL_CONFIG_MAIN, PANEL_SHOW_MAINGAME)
 REGISTER_HUD_PANEL(QUICKMENU,       HUD_QuickMenu,      quickmenu,      PANEL_CONFIG_MAIN, PANEL_SHOW_MAINGAME)
+REGISTER_HUD_PANEL(SCOREBOARD,      HUD_Scoreboard,     scoreboard,     PANEL_CONFIG_NO  , PANEL_SHOW_ALWAYS  )
 // always add new panels to the end of list
 
 // Because calling lots of functions in QC apparently cuts fps in half on many machines:
index e2e82ac..7dfaa90 100644 (file)
@@ -155,13 +155,14 @@ void HUD_CenterPrint ()
        }
 
        // this panel fades only when the menu does
-       float hud_fade_alpha_save = 0;
-       if(scoreboard_fade_alpha)
-       {
-               hud_fade_alpha_save = hud_fade_alpha;
+       float hud_fade_alpha_save = hud_fade_alpha;
+       if(menu_enabled == 1)
+               hud_fade_alpha = 1;
+       else
                hud_fade_alpha = 1 - autocvar__menu_alpha;
-       }
+
        HUD_Panel_UpdateCvars();
+       hud_fade_alpha = hud_fade_alpha_save;
 
        if ( HUD_Radar_Clickable() )
        {
@@ -171,17 +172,13 @@ void HUD_CenterPrint ()
                panel_pos = eY * hud_panel_radar_bottom + eX * 0.5 * (vid_conwidth - panel_size_x);
                panel_size_y = min(panel_size_y, vid_conheight - hud_panel_radar_bottom);
        }
-       else if(scoreboard_fade_alpha)
+       else if(!autocvar__hud_configure && scoreboard_fade_alpha)
        {
-               hud_fade_alpha = hud_fade_alpha_save;
-
                // move the panel below the scoreboard
                if (scoreboard_bottom >= 0.96 * vid_conheight)
                        return;
                vector target_pos;
-
                target_pos = eY * scoreboard_bottom + eX * 0.5 * (vid_conwidth - panel_size.x);
-
                if(target_pos.y > panel_pos.y)
                {
                        panel_pos = panel_pos + (target_pos - panel_pos) * sqrt(scoreboard_fade_alpha);
index b86e0d8..cc605d6 100644 (file)
@@ -989,9 +989,7 @@ vector HUD_Scoreboard_MakeTable(vector pos, entity tm, vector rgb, vector bg_siz
 }
 
 float HUD_WouldDrawScoreboard() {
-       if (autocvar__hud_configure)
-               return 0;
-       else if (QuickMenu_IsOpened())
+       if (QuickMenu_IsOpened())
                return 0;
        else if (HUD_Radar_Clickable())
                return 0;
@@ -1255,57 +1253,85 @@ float hud_woulddrawscoreboard_prev;
 float hud_woulddrawscoreboard_change; // "time" at which HUD_WouldDrawScoreboard() changed
 void HUD_DrawScoreboard()
 {
-       float hud_woulddrawscoreboard;
-       hud_woulddrawscoreboard = scoreboard_active;
-       if(hud_woulddrawscoreboard != hud_woulddrawscoreboard_prev) {
-               hud_woulddrawscoreboard_change = time;
-               hud_woulddrawscoreboard_prev = hud_woulddrawscoreboard;
-       }
+       if(!autocvar__hud_configure)
+       {
+               float hud_woulddrawscoreboard;
+               hud_woulddrawscoreboard = scoreboard_active;
+               if(hud_woulddrawscoreboard != hud_woulddrawscoreboard_prev) {
+                       hud_woulddrawscoreboard_change = time;
+                       hud_woulddrawscoreboard_prev = hud_woulddrawscoreboard;
+               }
+       
+               if(hud_woulddrawscoreboard) {
+                       if(menu_enabled == 1)
+                               scoreboard_fade_alpha = 1;
+                       float scoreboard_fadeinspeed = autocvar_scoreboard_fadeinspeed;
+                       if (scoreboard_fadeinspeed)
+                               scoreboard_fade_alpha = bound (0, (time - hud_woulddrawscoreboard_change) * scoreboard_fadeinspeed, 1);
+                       else
+                               scoreboard_fade_alpha = 1;
+               }
+               else {
+                       float scoreboard_fadeoutspeed = autocvar_scoreboard_fadeoutspeed;
+                       if (scoreboard_fadeoutspeed)
+                               scoreboard_fade_alpha = bound (0, (1/scoreboard_fadeoutspeed - (time - hud_woulddrawscoreboard_change)) * scoreboard_fadeoutspeed, 1);
+                       else
+                               scoreboard_fade_alpha = 0;
+               }
 
-       if(hud_woulddrawscoreboard) {
-               float scoreboard_fadeinspeed = autocvar_scoreboard_fadeinspeed;
-               if (scoreboard_fadeinspeed)
-                       scoreboard_fade_alpha = bound (0, (time - hud_woulddrawscoreboard_change) * scoreboard_fadeinspeed, 1);
-               else
-                       scoreboard_fade_alpha = 1;
+               if (!scoreboard_fade_alpha)
+                       return;
        }
-       else {
-               float scoreboard_fadeoutspeed = autocvar_scoreboard_fadeoutspeed;
-               if (scoreboard_fadeoutspeed)
-                       scoreboard_fade_alpha = bound (0, (1/scoreboard_fadeoutspeed - (time - hud_woulddrawscoreboard_change)) * scoreboard_fadeoutspeed, 1);
-               else
-                       scoreboard_fade_alpha = 0;
-       }
-
-       if (!scoreboard_fade_alpha)
-               return;
+       else
+               scoreboard_fade_alpha = 0;
 
        if (autocvar_scoreboard_dynamichud)
                HUD_Scale_Enable();
        else
                HUD_Scale_Disable();
 
-       HUD_UpdatePlayerTeams();
+       float hud_fade_alpha_save = hud_fade_alpha;
+       if(menu_enabled == 1)
+               hud_fade_alpha = 1;
+       else
+               hud_fade_alpha = scoreboard_fade_alpha * (1 - autocvar__menu_alpha);
+       HUD_Panel_UpdateCvars();
 
-       scoreboard_alpha_bg = autocvar_scoreboard_alpha_bg * scoreboard_fade_alpha * (1 - autocvar__menu_alpha);
-       scoreboard_alpha_fg = autocvar_scoreboard_alpha_fg * scoreboard_fade_alpha * (1 - autocvar__menu_alpha);
+       scoreboard_alpha_bg = autocvar_scoreboard_alpha_bg * panel_fg_alpha;
+       scoreboard_alpha_fg = autocvar_scoreboard_alpha_fg * panel_fg_alpha;
        scoreboard_highlight = autocvar_scoreboard_highlight;
-       scoreboard_highlight_alpha = autocvar_scoreboard_highlight_alpha * scoreboard_alpha_fg;
-       scoreboard_highlight_alpha_self = autocvar_scoreboard_highlight_alpha_self * scoreboard_alpha_fg;
-       scoreboard_alpha_name = autocvar_scoreboard_alpha_name * scoreboard_alpha_fg;
-       scoreboard_alpha_name_self = autocvar_scoreboard_alpha_name_self * scoreboard_alpha_fg;
+       scoreboard_highlight_alpha = autocvar_scoreboard_highlight_alpha * panel_fg_alpha;
+       scoreboard_highlight_alpha_self = autocvar_scoreboard_highlight_alpha_self * panel_fg_alpha;
+       scoreboard_alpha_name = autocvar_scoreboard_alpha_name * panel_fg_alpha;
+       scoreboard_alpha_name_self = autocvar_scoreboard_alpha_name_self * panel_fg_alpha;
+
+       hud_fade_alpha = hud_fade_alpha_save;
+
+       // don't overlap with con_notify
+       if(!autocvar__hud_configure)
+               panel_pos_y = max((autocvar_con_notify * autocvar_con_notifysize), panel_pos_y);
+
+       HUD_Panel_DrawBg(scoreboard_fade_alpha);
+
+       if(panel_bg_padding)
+       {
+               panel_pos += '1 1 0' * panel_bg_padding;
+               panel_size -= '2 2 0' * panel_bg_padding;
+       }
+
+       HUD_UpdatePlayerTeams();
 
        vector rgb, pos, tmp;
        entity pl, tm;
        string str;
 
-       xmin = (autocvar_scoreboard_offset_left * vid_conwidth);
-       ymin = max((autocvar_con_notify * autocvar_con_notifysize), (autocvar_scoreboard_offset_vertical * vid_conwidth));
+       xmin = panel_pos_x;
+       ymin = panel_pos_y;
 
-       xmax = ((1 - autocvar_scoreboard_offset_right) * vid_conwidth);
-       ymax = (vid_conheight - ymin);
+       xmax = panel_pos_x + panel_size_x;
+       ymax = panel_pos_y + panel_size_y;
 
-       sbwidth = xmax - xmin;
+       sbwidth = panel_size_x;
 
        // Initializes position
        pos.x = xmin;
index 1458efe..47cf933 100644 (file)
@@ -1350,7 +1350,6 @@ void HUD_Draw(entity this)
                                Accuracy_LoadLevels();
 
                        HUD_Main();
-                       HUD_DrawScoreboard();
                        HUD_Scale_Disable();
                }