]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
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 7bf9111cd4dab6c5d3d655e4ed3bc765c074ce49..bc82ac12fec5ef7215e00858f5191938c1a4317f 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 ee46898904a77f6d992b974f867c8fa798169aa8..c829a22d91cd220007c9454372767c60cf1b4c60 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 11ba8e4ff3428a486bd95b67d71d032b77c63f4f..38fcb477cf5de2bde5aa9f2c0ecb898d783a0416 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 2f4f31e92b7290f7f2852a69ffdc1dc8272915ff..95005af0bf02973d6ecc48914a8222f86602a608 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 3d259ebf394d7b104f848c37e8a35058c8b6aec0..e41d6e20778dfaf51efbc523d949850a8079905b 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 c1ac51b7ab854ddf345f7e11023b64713dccc810..372c37297e61db7cbe002d7f113a1261c839cb7a 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 d6125985b8a42e180e753e91a4b3ee584bddf932..53d1a9b9c4e218f23bd740b624f6909a917b3138 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 4ee8005213de354475b006596b82655b7c5408f9..e4fe3675fad20ead0593e6d206a86789f9321c79 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 df565ef686ebf47a92f2541f74183dfa937c2aa8..d6f7741c03e9d2bf7ff0a6e9c16324d570196789 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 d159cd3170e27426c5d40653f8f6141c463e6ccb..7edf9970e91557b381fd6df11c6f7d218f2e6875 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 d575e8cb546eb06ee5ded7a65ef60a864d7db649..62f5dcb6d82a66a115b478c81bf6bb7235ef0f45 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 2a53444669b7829c9818ca342ae8bf6484f0fafa..75b7f9ffc7f8123d625ba787199fdcc7a344a40d 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 e2e82acffe4efa33ab7275d2bfdb776399da0f70..7dfaa909e3ae7760ec9af933852354222adf437e 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 b86e0d8f6ad51a29f0f4159c39ff00f19f52d6e8..cc605d630a49b14e39ceb7e5a74ace0a5184fac7 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 1458efe15f13563e9e869cb653c9e5c80791318c..47cf9337d9a98e3375aa3dae1e0ed5f706c89f57 100644 (file)
@@ -1350,7 +1350,6 @@ void HUD_Draw(entity this)
                                Accuracy_LoadLevels();
 
                        HUD_Main();
-                       HUD_DrawScoreboard();
                        HUD_Scale_Disable();
                }