]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Something beautiful sounding (pitch-shift monster sounds based on their scale) 522/head
authorMario <mario@smbclan.net>
Fri, 2 Feb 2018 03:22:41 +0000 (13:22 +1000)
committerMario <mario@smbclan.net>
Fri, 2 Feb 2018 03:22:41 +0000 (13:22 +1000)
qcsrc/common/effects/qc/globalsound.qc
qcsrc/common/effects/qc/globalsound.qh
qcsrc/common/monsters/sv_monsters.qc

index edf995a0f6ccf453f64aa49ff175608aa3c6205f..874c64d5385755189e04766de0279a726cdbb70d 100644 (file)
@@ -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
index 1df0b1a42b1145eeeea104092fec1a98d5b5b25d..8c6dd86ddcd717571f32c53295f2e344083e5fb2 100644 (file)
@@ -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);
index e6eb9b03defa392e3d5fb87b03118b4eb0e76d0b..15fba0134200deccbfacf77b8f70af222558ef4f 100644 (file)
@@ -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;
 }