From: TimePath Date: Sun, 6 Dec 2015 04:57:55 +0000 (+1100) Subject: GlobalSound: fix incorrect channels X-Git-Tag: xonotic-v0.8.2~1544 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=9b803402982e90a9b3dd30e9b0a1667169e36fa9;p=xonotic%2Fxonotic-data.pk3dir.git GlobalSound: fix incorrect channels --- diff --git a/qcsrc/common/effects/qc/globalsound.qc b/qcsrc/common/effects/qc/globalsound.qc index 6e0e461f2..71f6a2a26 100644 --- a/qcsrc/common/effects/qc/globalsound.qc +++ b/qcsrc/common/effects/qc/globalsound.qc @@ -71,8 +71,7 @@ string sample = GlobalSound_sample(gs.m_globalsoundstr, r); int who = ReadByte(); entity e = entcs_receiver(who - 1); - int chan = ReadByte(); - chan = (chan & BIT(7) ? -1 : 1) * (chan & BITS(7)); + int chan = ReadSByte(); float vol = ReadByte() / 255; float atten = ReadByte() / 64; vector o; @@ -104,8 +103,7 @@ UpdatePlayerSounds(e); string s = e.(ps.m_playersoundfld); string sample = GlobalSound_sample(s, r); - int chan = ReadByte(); - chan = (chan & BIT(7) ? -1 : 1) * (chan & BITS(7)); + int chan = ReadSByte(); float vol = ReadByte() / 255; float atten = ReadByte() / 64; vector o; diff --git a/qcsrc/lib/net.qh b/qcsrc/lib/net.qh index 1e3d511c6..eb0366786 100644 --- a/qcsrc/lib/net.qh +++ b/qcsrc/lib/net.qh @@ -191,6 +191,8 @@ STATIC_INIT(RegisterTempEntities_renumber) return v; } + int _ReadSByte; + #define ReadSByte() (_ReadSByte = ReadByte(), (_ReadSByte & BIT(7) ? -128 : 0) + (_ReadSByte & BITS(7))) #define ReadFloat() ReadCoord() vector ReadVector() { vector v; v.x = ReadFloat(); v.y = ReadFloat(); v.z = ReadFloat(); return v; } vector ReadVector2D() { vector v; v.x = ReadFloat(); v.y = ReadFloat(); v.z = 0; return v; }