]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Display untimed Warmup or min players requirement (g_warmup -1) in HUD timer and...
authorbones_was_here <bones_was_here@xonotic.au>
Tue, 27 Sep 2022 17:05:34 +0000 (03:05 +1000)
committerbones_was_here <bones_was_here@xonotic.au>
Tue, 27 Sep 2022 17:05:34 +0000 (03:05 +1000)
Adds numplayers client global as it will also be used in Scoreboard_Draw().

Slightly increases default timer panel width.

hud_luma.cfg
hud_luminos.cfg
qcsrc/client/hud/panel/infomessages.qc
qcsrc/client/hud/panel/infomessages.qh
qcsrc/client/hud/panel/scoreboard.qc
qcsrc/client/hud/panel/scoreboard.qh
qcsrc/client/hud/panel/timer.qc

index 0903a0584b40b7ed482ec29efc79fbff5ae86966..384024e34536a8f91e2cd0941f5f20d32d4c3ef3 100644 (file)
@@ -133,8 +133,8 @@ seta hud_panel_notify_time "10"
 seta hud_panel_notify_fadetime "3"
 seta hud_panel_notify_icon_aspect "1"
 
-seta hud_panel_timer_pos "0.455000 0"
-seta hud_panel_timer_size "0.090000 0.050000"
+seta hud_panel_timer_pos "0.450000 0"
+seta hud_panel_timer_size "0.100000 0.050000"
 seta hud_panel_timer_bg "border_plain_north"
 seta hud_panel_timer_bg_color ""
 seta hud_panel_timer_bg_color_team ""
index a0849e5aabf9c4c55acf5cd00264f77f6830d5c4..82b07077fecd7da6dda4d5cc8bcd50176be1aee0 100644 (file)
@@ -134,7 +134,7 @@ seta hud_panel_notify_fadetime "3"
 seta hud_panel_notify_icon_aspect "2"
 
 seta hud_panel_timer_pos "0.790000 0.040000"
-seta hud_panel_timer_size "0.090000 0.050000"
+seta hud_panel_timer_size "0.100000 0.050000"
 seta hud_panel_timer_bg "border_small_timer"
 seta hud_panel_timer_bg_color ""
 seta hud_panel_timer_bg_color_team ""
index 554a05a475259ec38ef52300bcf81649e4f77af2..0f0325eeba18bfd3b1a429422c7cbd41071120e2 100644 (file)
@@ -150,7 +150,16 @@ void HUD_InfoMessages()
                else
                        blinkcolor = "^3";
 
-               if(ready_waiting && !spectatee_status)
+               if(warmup_stage && STAT(WARMUP_TIMELIMIT) <= 0 && srv_minplayers)
+               {
+                       Scoreboard_UpdatePlayerTeams(); // ensure numplayers is current
+                       if(srv_minplayers - numplayers == 1)
+                               s = _("^31^2 more player is needed for the match to start.");
+                       else
+                               s = sprintf(_("^3%d^2 more players are needed for the match to start."), srv_minplayers - numplayers);
+                       InfoMessage(s);
+               }
+               else if(ready_waiting && !spectatee_status)
                {
                        if(ready_waiting_for_me)
                        {
index 197662640dc24a9994ac5d02c5251f4a89be88fd..880f5930c8c4d27250c6b2fb224072dc40507893 100644 (file)
@@ -1,5 +1,6 @@
 #pragma once
 #include "../panel.qh"
+#include "scoreboard.qh" // for Scoreboard_UpdatePlayerTeams()
 
 bool autocvar_hud_panel_infomessages;
 bool autocvar_hud_panel_infomessages_dynamichud = false;
index 83c487419b7fe00a35b053594abbec9fca64a095..7704e20156cd1df64cea40c422a0cbc063e4ca9c 100644 (file)
@@ -547,9 +547,11 @@ void Scoreboard_UpdatePlayerTeams()
        update_time = time;
 
        entity pl, tmp;
+       numplayers = 0;
        //int num = 0;
        for(pl = players.sort_next; pl; pl = pl.sort_next)
        {
+               numplayers += pl.team != NUM_SPECTATOR;
                //num += 1;
                int Team = entcs_GetScoreTeam(pl.sv_entnum);
                if(SetTeam(pl, Team))
index dbf54e4b2eed0bf05076695dae330f22c7156602..2e13de65ba91c5cd1007bee5f1b9f685198cc89b 100644 (file)
@@ -17,6 +17,8 @@ float scoreboard_bottom;
 float scoreboard_left;
 float scoreboard_right;
 
+int numplayers;
+
 void Cmd_Scoreboard_SetFields(int argc);
 void Scoreboard_Draw();
 void Scoreboard_InitScores();
index 5209aa07d07662f2996ea5086f14fe712a2aeaf3..00a231b7cf44607d70fd56e338784f2fe3fdbdb5 100644 (file)
@@ -1,4 +1,5 @@
 #include "timer.qh"
+#include "scoreboard.qh"
 
 #include <client/draw.qh>
 #include <client/view.qh>
@@ -123,7 +124,12 @@ void HUD_Timer()
        int overtimes = STAT(OVERTIMES);
 
        if(warmup_stage || autocvar__hud_configure)
-               subtext = _("Warmup");
+       {
+               if (STAT(WARMUP_TIMELIMIT) > 0)
+                       subtext = _("Warmup");
+               else
+                       subtext = srv_minplayers ? _("Warmup: too few players") : _("Warmup: no time limit");
+       }
        else if(STAT(TIMEOUT_STATUS) == 2)
                subtext = _("Timeout");
        else if (overtimes == -1)