X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fcommon%2Fsounds%2Fall.qc;h=fdbf411801511ffd503a0285d478a238b61a80bf;hp=203b643854c5d5cf6b7cf0aaba762390ec6fa7e4;hb=8e5d3750fe6c2938222b1a6547b0d26b7a1ede60;hpb=63de1215428d078d5fb2021c49edf59a7900cef9 diff --git a/qcsrc/common/sounds/all.qc b/qcsrc/common/sounds/all.qc index 203b643854..fdbf411801 100644 --- a/qcsrc/common/sounds/all.qc +++ b/qcsrc/common/sounds/all.qc @@ -1,11 +1,14 @@ #include "all.qh" #ifdef SVQC +#include + bool autocvar_bot_sound_monopoly; .entity realowner; bool sound_allowed(int to, entity e) { + if(!e) return true; // save on a few checks for ( ; ; ) { if (e.classname == "body") e = e.enemy; @@ -31,8 +34,9 @@ const int SND_VOLUME = BIT(0); const int SND_ATTENUATION = BIT(1); const int SND_LARGEENTITY = BIT(3); const int SND_LARGESOUND = BIT(4); +const int SND_SPEEDUSHORT4000 = BIT(5); -void soundtoat(int to, entity e, vector o, int chan, string samp, float vol, float attenu) +void soundtoat(int to, entity e, vector o, int chan, string samp, float vol, float attenu, float _pitch) { if (!sound_allowed(to, e)) return; int entno = etof(e); @@ -40,14 +44,17 @@ void soundtoat(int to, entity e, vector o, int chan, string samp, float vol, flo attenu = floor(attenu * 64); vol = floor(vol * 255); int sflags = 0; + int speed4000 = floor((_pitch * 0.01) * 4000 + 0.5); if (vol != 255) sflags |= SND_VOLUME; if (attenu != 64) sflags |= SND_ATTENUATION; if (entno >= 8192 || chan < 0 || chan > 7) sflags |= SND_LARGEENTITY; if (idx >= 256) sflags |= SND_LARGESOUND; + if (speed4000 && speed4000 != 4000) sflags |= SND_SPEEDUSHORT4000; WriteByte(to, SVC_SOUND); WriteByte(to, sflags); if (sflags & SND_VOLUME) WriteByte(to, vol); if (sflags & SND_ATTENUATION) WriteByte(to, attenu); + if (sflags & SND_SPEEDUSHORT4000) WriteShort(to, speed4000); if (sflags & SND_LARGEENTITY) { WriteShort(to, entno); @@ -64,15 +71,15 @@ void soundtoat(int to, entity e, vector o, int chan, string samp, float vol, flo WriteCoord(to, o.z); } -void soundto(int _dest, entity e, int chan, string samp, float vol, float _atten) +void soundto(int _dest, entity e, int chan, string samp, float vol, float _atten, float _pitch) { if (!sound_allowed(_dest, e)) return; vector o = e.origin + 0.5 * (e.mins + e.maxs); - soundtoat(_dest, e, o, chan, samp, vol, _atten); + soundtoat(_dest, e, o, chan, samp, vol, _atten, _pitch); } void soundat(entity e, vector o, int chan, string samp, float vol, float _atten) { - soundtoat(((chan & 8) ? MSG_ALL : MSG_BROADCAST), e, o, chan, samp, vol, _atten); + soundtoat(((chan & 8) ? MSG_ALL : MSG_BROADCAST), e, o, chan, samp, vol, _atten, 0); } void stopsoundto(int _dest, entity e, int chan) { @@ -109,7 +116,7 @@ void stopsound(entity e, int chan) void play2(entity e, string filename) { msg_entity = e; - soundtoat(MSG_ONE, NULL, '0 0 0', CH_INFO, filename, VOL_BASE, ATTEN_NONE); + soundtoat(MSG_ONE, NULL, '0 0 0', CH_INFO, filename, VOL_BASE, ATTEN_NONE, 0); } .float spamtime;