From: bones_was_here Date: Tue, 27 Sep 2022 17:05:34 +0000 (+1000) Subject: Display untimed Warmup or min players requirement (g_warmup -1) in HUD timer and... X-Git-Tag: xonotic-v0.8.6~348^2~9 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=397f7d01e80ed7def775e53a857f1346eef422aa;p=xonotic%2Fxonotic-data.pk3dir.git Display untimed Warmup or min players requirement (g_warmup -1) in HUD timer and info panels Adds numplayers client global as it will also be used in Scoreboard_Draw(). Slightly increases default timer panel width. --- diff --git a/hud_luma.cfg b/hud_luma.cfg index 0903a0584..384024e34 100644 --- a/hud_luma.cfg +++ b/hud_luma.cfg @@ -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 "" diff --git a/hud_luminos.cfg b/hud_luminos.cfg index a0849e5aa..82b07077f 100644 --- a/hud_luminos.cfg +++ b/hud_luminos.cfg @@ -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 "" diff --git a/qcsrc/client/hud/panel/infomessages.qc b/qcsrc/client/hud/panel/infomessages.qc index 554a05a47..0f0325eeb 100644 --- a/qcsrc/client/hud/panel/infomessages.qc +++ b/qcsrc/client/hud/panel/infomessages.qc @@ -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) { diff --git a/qcsrc/client/hud/panel/infomessages.qh b/qcsrc/client/hud/panel/infomessages.qh index 197662640..880f5930c 100644 --- a/qcsrc/client/hud/panel/infomessages.qh +++ b/qcsrc/client/hud/panel/infomessages.qh @@ -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; diff --git a/qcsrc/client/hud/panel/scoreboard.qc b/qcsrc/client/hud/panel/scoreboard.qc index 83c487419..7704e2015 100644 --- a/qcsrc/client/hud/panel/scoreboard.qc +++ b/qcsrc/client/hud/panel/scoreboard.qc @@ -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)) diff --git a/qcsrc/client/hud/panel/scoreboard.qh b/qcsrc/client/hud/panel/scoreboard.qh index dbf54e4b2..2e13de65b 100644 --- a/qcsrc/client/hud/panel/scoreboard.qh +++ b/qcsrc/client/hud/panel/scoreboard.qh @@ -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(); diff --git a/qcsrc/client/hud/panel/timer.qc b/qcsrc/client/hud/panel/timer.qc index 5209aa07d..00a231b7c 100644 --- a/qcsrc/client/hud/panel/timer.qc +++ b/qcsrc/client/hud/panel/timer.qc @@ -1,4 +1,5 @@ #include "timer.qh" +#include "scoreboard.qh" #include #include @@ -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)