From: z411 Date: Wed, 28 Jul 2021 22:17:53 +0000 (-0400) Subject: Adding configurable timedown sound X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=01a88dfa9e032e282e0001b4211099e35efefd18;p=xonotic%2Fxonotic-data.pk3dir.git Adding configurable timedown sound --- diff --git a/qcsrc/client/hud/panel/timer.qc b/qcsrc/client/hud/panel/timer.qc index a48776602..08ff9e736 100644 --- a/qcsrc/client/hud/panel/timer.qc +++ b/qcsrc/client/hud/panel/timer.qc @@ -5,7 +5,7 @@ // Timer (#5) float last_timeleft; -bool autocvar_hud_panel_timer_count = true; +int autocvar_cl_timer_countdown = 3; // 0 = disabled, 1 = always on, 2 = only spec, 3 = as dictated by server void HUD_Timer_Export(int fh) { @@ -49,9 +49,18 @@ void HUD_Timer() timeleft = ceil(timeleft); // countdown sound - if(autocvar_hud_panel_timer_count && timeleft > 0 && timeleft != last_timeleft && timeleft <= 10) + // if 3 use server dictated option, otherwise the client's + int countdown_type; + if(autocvar_cl_timer_countdown == 3) + countdown_type = sv_timer_countdown; + else + countdown_type = autocvar_cl_timer_countdown; + + if(countdown_type && !warmup_stage && timeleft > 0 && timeleft != last_timeleft && timeleft <= 10) { - sound(NULL, CH_INFO, SND_ENDCOUNT, VOL_BASE, ATTN_NONE); + if(countdown_type == 1 || (countdown_type == 2 && spectatee_status)) + sound(NULL, CH_INFO, SND_ENDCOUNT, VOL_BASE, ATTN_NONE); + last_timeleft = timeleft; } diff --git a/qcsrc/client/main.qc b/qcsrc/client/main.qc index 4d9f48ac5..86b9c974f 100644 --- a/qcsrc/client/main.qc +++ b/qcsrc/client/main.qc @@ -1063,6 +1063,8 @@ NET_HANDLE(ENT_CLIENT_INIT, bool isnew) strcpy(hostname_full, ReadString()); strcpy(motd_permanent, ReadString()); + + sv_timer_countdown = ReadByte(); return = true; diff --git a/qcsrc/client/main.qh b/qcsrc/client/main.qh index 1820fe369..9d0f6ef2d 100644 --- a/qcsrc/client/main.qh +++ b/qcsrc/client/main.qh @@ -7,6 +7,7 @@ // z411 string hostname_full; string motd_permanent; +int sv_timer_countdown; bool autocvar_cl_db_saveasdump; bool autocvar_cl_spawn_event_particles; diff --git a/qcsrc/server/client.qc b/qcsrc/server/client.qc index d24007729..4ac79f00e 100644 --- a/qcsrc/server/client.qc +++ b/qcsrc/server/client.qc @@ -898,6 +898,9 @@ void ClientInit_misc(entity this) // z411 send full hostname WriteString(channel, (autocvar_hostname_full != "" ? autocvar_hostname_full : autocvar_hostname)); WriteString(channel, autocvar_sv_motd_permanent); + + // z411 send client countdown type + WriteByte(channel, autocvar_sv_timer_countdown); } void ClientInit_CheckUpdate(entity this) diff --git a/qcsrc/server/client.qh b/qcsrc/server/client.qh index 4a358287a..ce2090e11 100644 --- a/qcsrc/server/client.qh +++ b/qcsrc/server/client.qh @@ -65,6 +65,9 @@ string autocvar_g_teamnames_pink; // Medals float autocvar_g_medals_excellent_time = 2; +// Timer +int autocvar_sv_timer_countdown = 1; // 0 = disabled, 1 = enabled, 2 = spect only + // WEAPONTODO .string weaponorder_byimpulse;