From: Mario Date: Wed, 5 Oct 2016 11:52:41 +0000 (+1000) Subject: Find arc if held, to support hit sounds X-Git-Tag: xonotic-v0.8.2~326^2~55 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=11ac0d23b5ad3e7dc02389550f53b708cc13afce;p=xonotic%2Fxonotic-data.pk3dir.git Find arc if held, to support hit sounds --- diff --git a/qcsrc/client/view.qc b/qcsrc/client/view.qc index 93c632e70..f83dfab36 100644 --- a/qcsrc/client/view.qc +++ b/qcsrc/client/view.qc @@ -817,11 +817,18 @@ void HitSound() { // varying sound pitch - entity wepent = viewmodels[0]; // TODO: unhardcode + bool have_arc = false; + for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) + { + entity wepent = viewmodels[slot]; + + if(wepent.activeweapon == WEP_ARC) + have_arc = true; + } static float hitsound_time_prev = 0; // HACK: the only way to get the arc to sound consistent with pitch shift is to ignore cl_hitsound_antispam_time - float arc_hack = wepent.activeweapon == WEP_ARC && autocvar_cl_hitsound >= 2; + bool arc_hack = have_arc && autocvar_cl_hitsound >= 2; if (arc_hack || COMPARE_INCREASING(time, hitsound_time_prev) > autocvar_cl_hitsound_antispam_time) { if (autocvar_cl_hitsound && unaccounted_damage)