From: Mario Date: Fri, 2 Feb 2018 03:22:41 +0000 (+1000) Subject: Something beautiful sounding (pitch-shift monster sounds based on their scale) X-Git-Tag: xonotic-v0.8.5~2354 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=f1ead602997113ae2cb58dbd08ce456e5c712b3b;p=xonotic%2Fxonotic-data.pk3dir.git Something beautiful sounding (pitch-shift monster sounds based on their scale) --- diff --git a/qcsrc/common/effects/qc/globalsound.qc b/qcsrc/common/effects/qc/globalsound.qc index edf995a0f..874c64d53 100644 --- a/qcsrc/common/effects/qc/globalsound.qc +++ b/qcsrc/common/effects/qc/globalsound.qc @@ -11,8 +11,6 @@ REGISTER_NET_TEMP(globalsound) REGISTER_NET_TEMP(playersound) - string GlobalSound_sample(string pair, float r); - #ifdef SVQC /** * @param from the source entity, its position is sent diff --git a/qcsrc/common/effects/qc/globalsound.qh b/qcsrc/common/effects/qc/globalsound.qh index 1df0b1a42..8c6dd86dd 100644 --- a/qcsrc/common/effects/qc/globalsound.qh +++ b/qcsrc/common/effects/qc/globalsound.qh @@ -119,6 +119,8 @@ void PrecachePlayerSounds(string f); //#endif entity GetVoiceMessage(string type); +string GlobalSound_sample(string pair, float r); + #ifdef SVQC void _GlobalSound(entity this, entity gs, entity ps, string sample, float chan, float vol, float voicetype, bool fake); diff --git a/qcsrc/common/monsters/sv_monsters.qc b/qcsrc/common/monsters/sv_monsters.qc index e6eb9b03d..15fba0134 100644 --- a/qcsrc/common/monsters/sv_monsters.qc +++ b/qcsrc/common/monsters/sv_monsters.qc @@ -336,7 +336,12 @@ void Monster_Sound(entity this, .string samplefield, float sound_delay, bool del if(delaytoo) if(time < this.msound_delay) return; // too early - GlobalSound_string(this, this.(samplefield), chan, VOL_BASE, VOICETYPE_PLAYERSOUND); + string sample = this.(samplefield); + if (sample != "") sample = GlobalSound_sample(sample, random()); + float myscale = ((this.scale) ? this.scale : 1); // safety net + float scale_inverse = 1 / myscale; + // TODO: change volume depending on size too? + sound7(this, chan, sample, VOL_BASE, ATTEN_NORM, scale_inverse * 100, 0); this.msound_delay = time + sound_delay; }