]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Scoreboard UI: ctrl-c to change default / all / custom columns layout. Other minor...
authorterencehill <piuntn@gmail.com>
Sun, 22 May 2022 19:37:30 +0000 (21:37 +0200)
committerterencehill <piuntn@gmail.com>
Sun, 22 May 2022 21:48:22 +0000 (23:48 +0200)
qcsrc/client/hud/panel/radar.qc
qcsrc/client/hud/panel/scoreboard.qc
qcsrc/client/hud/panel/scoreboard.qh

index 598b44d9cd9031e3700b55755194274071311fd2..cf395e7634228b27075fe5ef74af03deec4548e5 100644 (file)
@@ -1,6 +1,7 @@
 #include "radar.qh"
 
 #include <client/draw.qh>
 #include "radar.qh"
 
 #include <client/draw.qh>
+#include <client/hud/panel/scoreboard.qh>
 #include <client/mapvoting.qh>
 #include <client/teamradar.qh>
 #include <common/ent_cs.qh>
 #include <client/mapvoting.qh>
 #include <client/teamradar.qh>
 #include <common/ent_cs.qh>
index d34bdc35e95f25ade65caf58bab0a2c4d3b00b3a..a2921ac9809b8e1134332d08c419da27c8d1ef44 100644 (file)
@@ -412,7 +412,7 @@ float HUD_Scoreboard_InputEvent(float bInputType, float nPrimary, float nSeconda
                                        team_name = "auto";
                                else
                                        team_name = Static_Team_ColorName(scoreboard_selected_team.team);
                                        team_name = "auto";
                                else
                                        team_name = Static_Team_ColorName(scoreboard_selected_team.team);
-                               localcmd(sprintf("cmd selectteam %s; cmd join", team_name));
+                               localcmd(sprintf("cmd selectteam %s; cmd join\n", team_name));
                                HUD_Scoreboard_UI_Disable();
                        }
                        else if (!scoreboard_selected_player || (hudShiftState & S_SHIFT))
                                HUD_Scoreboard_UI_Disable();
                        }
                        else if (!scoreboard_selected_player || (hudShiftState & S_SHIFT))
@@ -421,7 +421,34 @@ float HUD_Scoreboard_InputEvent(float bInputType, float nPrimary, float nSeconda
                                HUD_Scoreboard_UI_Disable();
                        }
                        else
                                HUD_Scoreboard_UI_Disable();
                        }
                        else
-                               localcmd(sprintf("spectate %d", scoreboard_selected_player.sv_entnum + 1));
+                               localcmd(sprintf("spectate %d\n", scoreboard_selected_player.sv_entnum + 1));
+               }
+       }
+       else if(nPrimary == 'c' && (hudShiftState & S_CTRL))
+       {
+               if (!key_pressed)
+                       return true;
+               if (scoreboard_ui_enabled == 1 && scoreboard_selected_panel == SB_PANEL_SCOREBOARD)
+               {
+                       switch (scoreboard_selected_columns_layout)
+                       {
+                               case 0:
+                                       if (autocvar_scoreboard_columns != "" && autocvar_scoreboard_columns != "all" && autocvar_scoreboard_columns != "default")
+                                       {
+                                               localcmd(sprintf("scoreboard_columns_set\n")); // sets the layout saved in scoreboard_columns
+                                               scoreboard_selected_columns_layout = 1;
+                                               break;
+                                       }
+                                       // fallthrough
+                               case 1:
+                                       localcmd(sprintf("scoreboard_columns_set default\n"));
+                                       scoreboard_selected_columns_layout = 2;
+                                       break;
+                               case 2:
+                                       localcmd(sprintf("scoreboard_columns_set all\n"));
+                                       scoreboard_selected_columns_layout = 0;
+                                       break;
+                       }
                }
        }
        else if(nPrimary == 't' && (hudShiftState & S_CTRL))
                }
        }
        else if(nPrimary == 't' && (hudShiftState & S_CTRL))
@@ -432,7 +459,7 @@ float HUD_Scoreboard_InputEvent(float bInputType, float nPrimary, float nSeconda
                {
                        if (scoreboard_selected_player)
                        {
                {
                        if (scoreboard_selected_player)
                        {
-                               localcmd(sprintf("commandmode tell \"%s^7\"", entcs_GetName(scoreboard_selected_player.sv_entnum)));
+                               localcmd(sprintf("commandmode tell \"%s^7\"\n", entcs_GetName(scoreboard_selected_player.sv_entnum)));
                                HUD_Scoreboard_UI_Disable();
                        }
                }
                                HUD_Scoreboard_UI_Disable();
                        }
                }
@@ -444,7 +471,7 @@ float HUD_Scoreboard_InputEvent(float bInputType, float nPrimary, float nSeconda
                if (scoreboard_selected_panel == SB_PANEL_SCOREBOARD)
                {
                        if (scoreboard_selected_player)
                if (scoreboard_selected_panel == SB_PANEL_SCOREBOARD)
                {
                        if (scoreboard_selected_player)
-                               localcmd(sprintf("vcall kick \"%s^7\"", entcs_GetName(scoreboard_selected_player.sv_entnum)));
+                               localcmd(sprintf("vcall kick \"%s^7\"\n", entcs_GetName(scoreboard_selected_player.sv_entnum)));
                }
        }
        else if(hit_con_bind || nPrimary == K_PAUSE)
                }
        }
        else if(hit_con_bind || nPrimary == K_PAUSE)
@@ -2207,9 +2234,9 @@ void Scoreboard_Draw()
        if (scoreboard_ui_enabled == 2)
        {
                if (scoreboard_selected_team)
        if (scoreboard_ui_enabled == 2)
        {
                if (scoreboard_selected_team)
-                       str = sprintf(_("^7Press ^3%s ^7to join the selected team"), getcommandkey(_("jump"), "+jump"));
+                       str = sprintf(_("^7Press ^3%s^7 to join the selected team"), getcommandkey(_("jump"), "+jump"));
                else
                else
-                       str = sprintf(_("^7Press ^3%s ^7 to auto-select a team and join"), getcommandkey(_("jump"), "+jump"));
+                       str = sprintf(_("^7Press ^3%s^7 to auto-select a team and join"), getcommandkey(_("jump"), "+jump"));
                drawcolorcodedstring(pos + '0.5 0 0' * (panel_size.x - stringwidth(str, true, sb_gameinfo_detail_fontsize)), str, sb_gameinfo_detail_fontsize, panel_fg_alpha, DRAWFLAG_NORMAL);
 
                pos.y += sb_gameinfo_detail_fontsize.y + hud_fontsize.y * 0.3;
                drawcolorcodedstring(pos + '0.5 0 0' * (panel_size.x - stringwidth(str, true, sb_gameinfo_detail_fontsize)), str, sb_gameinfo_detail_fontsize, panel_fg_alpha, DRAWFLAG_NORMAL);
 
                pos.y += sb_gameinfo_detail_fontsize.y + hud_fontsize.y * 0.3;
index 8e01c6a66998a91c38ff193b9c3462a56e20147c..77f324554969102d0285dcf724807f36c77496b3 100644 (file)
@@ -34,6 +34,7 @@ int scoreboard_selected_panel;
 float scoreboard_selected_panel_time;
 entity scoreboard_selected_player;
 entity scoreboard_selected_team;
 float scoreboard_selected_panel_time;
 entity scoreboard_selected_player;
 entity scoreboard_selected_team;
+int scoreboard_selected_columns_layout;
 
 // start from 1
 int SB_PANEL_FIRST = 1;
 
 // start from 1
 int SB_PANEL_FIRST = 1;