]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
GlobalSound: fix incorrect channels
authorTimePath <andrew.hardaker1995@gmail.com>
Sun, 6 Dec 2015 04:57:55 +0000 (15:57 +1100)
committerTimePath <andrew.hardaker1995@gmail.com>
Sun, 6 Dec 2015 04:57:55 +0000 (15:57 +1100)
qcsrc/common/effects/qc/globalsound.qc
qcsrc/lib/net.qh

index 6e0e461f2b8e707ce776ec07b57e964efe3be9d4..71f6a2a267a340ae55bb0565e207884aaaa5cde6 100644 (file)
@@ -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;
                        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;
index 1e3d511c6ef00d00c2e18711bc59efeff38b9088..eb0366786359d32ddcfdd9ee1a0441f8f13fd227 100644 (file)
@@ -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; }