From: MirceaKitsune Date: Tue, 2 Aug 2011 14:40:51 +0000 (+0300) Subject: Make gib sound volume dependent on gib size X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=96d776e50d587c3d221c864c39316c2e86953f66;p=voretournament%2Fvoretournament.git Make gib sound volume dependent on gib size --- diff --git a/data/qcsrc/client/gibs.qc b/data/qcsrc/client/gibs.qc index 12a07753..3e228f64 100644 --- a/data/qcsrc/client/gibs.qc +++ b/data/qcsrc/client/gibs.qc @@ -72,7 +72,15 @@ void Gib_Touch() } if(!self.silent) - sound(self, CHAN_PAIN, strcat("misc/gib_splat0", ftos(floor(prandom() * 4 + 1)), ".wav"), VOL_BASE, ATTN_NORM); + { + float vol; + vol = VOL_BASE; + if(self.scale) // sound volume dependent on gib size + vol *= self.scale; + vol = bound(0, vol, 1); + + sound(self, CHAN_PAIN, strcat("misc/gib_splat0", ftos(floor(prandom() * 4 + 1)), ".wav"), vol, ATTN_NORM); + } pointparticles(particleeffectnum(strcat(species_prefix(self.cnt), "blood")), self.origin + '0 0 1', '0 0 30', 10); Gib_Delete(); @@ -188,7 +196,15 @@ void Ent_GibSplash(float isNew) { case 0x01: if(!issilent) - sound (self, CHAN_PAIN, "misc/gib.wav", VOL_BASE, ATTN_NORM); + { + float vol; + vol = VOL_BASE; + if(sz) // sound volume dependent on gib size + vol *= sz; + vol = bound(0, vol, 1); + + sound (self, CHAN_PAIN, "misc/gib.wav", vol, ATTN_NORM); + } if(prandom() < amount) TossGib ("models/gibs/eye.md3", org, vel, prandomvec() * 150, specnum, sz, 0, issilent);