From: z411 Date: Fri, 16 Oct 2020 20:08:55 +0000 (-0300) Subject: Fixed sound disabling and medal screening X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=7068a70da24de358985f0101233b6701345ef022;p=xonotic%2Fxonotic-data.pk3dir.git Fixed sound disabling and medal screening --- diff --git a/qcsrc/client/hud/panel/centerprint.qc b/qcsrc/client/hud/panel/centerprint.qc index a5c557a70..971391c68 100644 --- a/qcsrc/client/hud/panel/centerprint.qc +++ b/qcsrc/client/hud/panel/centerprint.qc @@ -288,7 +288,7 @@ void HUD_CenterPrint() tmp_in.x += (panel_size.x - newsize.x) / 2; // center medal icon - if(centerprint_medal_times <= MSG_MEDAL_SCREEN) { + if(centerprint_medal_times < MSG_MEDAL_SCREEN) { tmp_in.x -= ((newsize.x * 1.1) * (centerprint_medal_times - 1) / 2); for(int t = 0; t < centerprint_medal_times; t++) { drawpic(tmp_in, centerprint_medal_icon, newsize, '1 1 1', a, DRAWFLAG_NORMAL); diff --git a/qcsrc/client/main.qc b/qcsrc/client/main.qc index f81bfc1a4..947ae18b0 100644 --- a/qcsrc/client/main.qc +++ b/qcsrc/client/main.qc @@ -957,6 +957,17 @@ NET_HANDLE(TE_CSQC_TEAMNAMES, bool isNew) return = true; } +NET_HANDLE(TE_CSQC_CHATSOUND, bool isNew) +{ + string snd = ReadString(); + snd = strcat("chat/", snd, ".ogg"); + + precache_sound(snd); + _sound(NULL, CH_INFO, snd, VOL_BASE, ATTN_NONE); + + return = true; +} + float GetSpeedUnitFactor(int speed_unit) { switch(speed_unit) diff --git a/qcsrc/common/net_linked.qh b/qcsrc/common/net_linked.qh index 125c01f96..c431c601d 100644 --- a/qcsrc/common/net_linked.qh +++ b/qcsrc/common/net_linked.qh @@ -8,6 +8,7 @@ REGISTER_NET_TEMP(TE_CSQC_WEAPONCOMPLAIN) REGISTER_NET_TEMP(TE_CSQC_VEHICLESETUP) REGISTER_NET_TEMP(TE_CSQC_TEAMNAMES) +REGISTER_NET_TEMP(TE_CSQC_CHATSOUND) const int RACE_NET_CHECKPOINT_HIT_QUALIFYING = 0; // byte checkpoint, short time, short recordtime, string recordholder const int RACE_NET_CHECKPOINT_CLEAR = 1; diff --git a/qcsrc/server/client.qc b/qcsrc/server/client.qc index 2aaab0fb7..70ff57e3f 100644 --- a/qcsrc/server/client.qc +++ b/qcsrc/server/client.qc @@ -3219,9 +3219,7 @@ int Say(entity source, int teamsay, entity privatesay, string msgin, bool floodc bool play_chatsound(entity source, string msgin) { - //bprintf("Source (%s) has cl_chat_sounds = %d\n", source.netname, CS(source).cvar_cl_chat_sounds); - //if(autocvar_sv_chat_sounds && CS(source).cvar_cl_chat_sounds) { - if(autocvar_sv_chat_sounds) { + if(autocvar_sv_chat_sounds && CS(source).cvar_cl_chat_sounds) { var .float flood_sound = floodcontrol_chatsound; if (source.(flood_sound) < time - autocvar_sv_chat_sounds_flood) { @@ -3229,21 +3227,11 @@ bool play_chatsound(entity source, string msgin) rawmsg = strreplace("\n", " ", msgin); if (findinlist_abbrev(rawmsg, autocvar_sv_chat_sounds_list)) { - string sndname = strcat("sound/chat/", rawmsg, ".ogg"); - - /*FOREACH_CLIENT(true, { - if(IS_REAL_CLIENT(it)) { - bprintf("Destination (%s) has cl_chat_sounds = %d\n", it.netname, CS(it).cvar_cl_chat_sounds); - if(CS(it).cvar_cl_chat_sounds) { - precache_sound(sndname); - play2(it, sndname); - } - } else { - bprintf("Destination (%s) has cl_chat_sounds = %d but it's not a real client\n", it.netname, CS(it).cvar_cl_chat_sounds); - } - });*/ - play2all(sndname); - + FOREACH_CLIENT(IS_REAL_CLIENT(it) && CS(it).cvar_cl_chat_sounds, { + msg_entity = it; + WriteHeader(MSG_ONE, TE_CSQC_CHATSOUND); + WriteString(MSG_ONE, rawmsg); + }); source.(flood_sound) = time; return true; } diff --git a/qcsrc/server/command/common.qc b/qcsrc/server/command/common.qc index 94ea014e9..981e79206 100644 --- a/qcsrc/server/command/common.qc +++ b/qcsrc/server/command/common.qc @@ -238,7 +238,7 @@ void timeout_handler_think(entity this) if(round_handler && round_handler_GetEndTime() > 0) round_handler.round_endtime += total_time; - LOG_INFOF("timeout lasted %d secs", total_time); + LOG_INFOF("Timeout lasted %d secs", total_time); // unlock the view for players so they can move around again FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it), {