]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Fixed sound disabling and medal screening
authorz411 <z411@omaera.org>
Fri, 16 Oct 2020 20:08:55 +0000 (17:08 -0300)
committerz411 <z411@omaera.org>
Fri, 16 Oct 2020 20:08:55 +0000 (17:08 -0300)
qcsrc/client/hud/panel/centerprint.qc
qcsrc/client/main.qc
qcsrc/common/net_linked.qh
qcsrc/server/client.qc
qcsrc/server/command/common.qc

index a5c557a7088565a2d4387b134500c903b02640d7..971391c685f5615599e5e0d16e94a4771522284e 100644 (file)
@@ -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);
index f81bfc1a4e13fa7bfc045e5c8dd583c999e38131..947ae18b026ab34be70ce7d5ac020bcb077bc40c 100644 (file)
@@ -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)
index 125c01f96169bbe7d48f621e8356cbafb2b05e75..c431c601d815095cb2ce8affcb87df5f70f65f6c 100644 (file)
@@ -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;
index 2aaab0fb750f81e26a0509b1aeac6528436cc9a5..70ff57e3f721306fb12e76b06a18ec011474e204 100644 (file)
@@ -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;
                        }
index 94ea014e9f204ddbfcada905921a09371df93d2f..981e79206248612ee01caf836ba06303b9be853d 100644 (file)
@@ -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), {