Merge branch 'master' into Mario/killsound
authorMario <mario@smbclan.net>
Sun, 12 Mar 2017 03:13:00 +0000 (13:13 +1000)
committerMario <mario@smbclan.net>
Sun, 12 Mar 2017 03:13:00 +0000 (13:13 +1000)
qcsrc/client/view.qc
qcsrc/common/sounds/all.inc
qcsrc/common/stats.qh
qcsrc/server/defs.qh
qcsrc/server/g_damage.qc
qcsrc/server/g_world.qc
sound/misc/kill.ogg [new file with mode: 0644]

index 104405b3973616eb2ce156a97fe06a90ac34e536..65df30fd89ff5ec10f4eb3804cac9e7d3776c384 100644 (file)
@@ -875,6 +875,14 @@ void HitSound()
                sound(NULL, CH_INFO, SND_TYPEHIT, VOL_BASE, ATTN_NONE);
                typehit_time_prev = typehit_time;
        }
+
+       static float kill_time_prev = 0;
+       float kill_time = STAT(KILL_TIME);
+       if (COMPARE_INCREASING(kill_time, kill_time_prev) > autocvar_cl_hitsound_antispam_time)
+       {
+               sound(NULL, CH_INFO, SND_KILL, VOL_BASE, ATTN_NONE);
+               kill_time_prev = kill_time;
+       }
 }
 
 vector crosshair_getcolor(entity this, float health_stat)
index 4394e174067ab93c12236e3f7b00fa574ffb65c6..7462239f7701d88886e59387b5dec24d3721996b 100644 (file)
@@ -266,6 +266,7 @@ Sound SND_GIB_SPLAT_RANDOM() {
 
 SOUND(HIT, "misc/hit");
 SOUND(TYPEHIT, "misc/typehit");
+SOUND(KILL, "misc/kill");
 
 SOUND(SPAWN, "misc/spawn");
 
index afde743241e8a78af627d8c298923a996fb402c7..44efee885ee2912487a68d1708e8cc3ddc623d88 100644 (file)
@@ -118,6 +118,7 @@ REGISTER_STAT(CAPTURE_PROGRESS, float)
 REGISTER_STAT(ENTRAP_ORB, float)
 REGISTER_STAT(ENTRAP_ORB_ALPHA, float)
 REGISTER_STAT(ITEMSTIME, int, autocvar_sv_itemstime)
+REGISTER_STAT(KILL_TIME, float)
 
 #ifdef SVQC
 bool autocvar_g_ctf_leaderboard;
index 3f1867758d0adf86bcdb2cf9dc7af04c3207df01..ccb361ea6908d573a09c173dac06098d0341cefa 100644 (file)
@@ -94,7 +94,7 @@ const float MAX_DAMAGEEXTRARADIUS = 16;
 .float         dmgtime;
 
 .float         killcount;
-.float damage_dealt, typehitsound;
+.float damage_dealt, typehitsound, killsound;
 
 .float watersound_finished;
 .float iscreature;
@@ -317,6 +317,7 @@ string matchid;
 
 .float hit_time = _STAT(HIT_TIME);
 .float typehit_time = _STAT(TYPEHIT_TIME);
+.float kill_time = _STAT(KILL_TIME);
 
 .float damage_dealt_total = _STAT(DAMAGE_DEALT_TOTAL);
 
index a8f365cbc25e811df1b296c629dbbb095e06e2f3..7f5ffaf79bd64688327c5e24b1e5cd79dc539642 100644 (file)
@@ -375,6 +375,8 @@ void Obituary(entity attacker, entity inflictor, entity targ, int deathtype)
                        attacker.taunt_soundtime = time + 1;
                        attacker.killcount = attacker.killcount + 1;
 
+                       attacker.killsound += 1;
+
                        #define SPREE_ITEM(counta,countb,center,normal,gentle) \
                                case counta: \
                                { \
index 2e7ae5fa754442a6bf18272921ab11306cdd5efc..71c731a308e830ac59d3d3b323b177edc4444e8e 100644 (file)
@@ -2086,6 +2086,8 @@ void EndFrame()
                entity e = IS_SPEC(it) ? it.enemy : it;
                if (e.typehitsound) {
                        it.typehit_time = time;
+               } else if (e.killsound) {
+                       it.kill_time = time;
                } else if (e.damage_dealt) {
                        it.hit_time = time;
                        it.damage_dealt_total += ceil(e.damage_dealt);
@@ -2100,6 +2102,7 @@ void EndFrame()
        FOREACH_CLIENT(true, {
                it.typehitsound = false;
                it.damage_dealt = 0;
+               it.killsound = false;
                antilag_record(it, CS(it), altime);
        });
        IL_EACH(g_monsters, true,
diff --git a/sound/misc/kill.ogg b/sound/misc/kill.ogg
new file mode 100644 (file)
index 0000000..7ef2bab
Binary files /dev/null and b/sound/misc/kill.ogg differ