]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
GlobalSound: uncrustify
authorTimePath <andrew.hardaker1995@gmail.com>
Sun, 8 Nov 2015 07:29:04 +0000 (18:29 +1100)
committerTimePath <andrew.hardaker1995@gmail.com>
Sun, 8 Nov 2015 07:29:04 +0000 (18:29 +1100)
qcsrc/common/effects/qc/globalsound.qc

index 27a0ead222fe2adc8c0b3516395dd6242288d0e7..b2b2e5f06ac3bbe57a719d84339b3c2788fd462b 100644 (file)
@@ -1,41 +1,41 @@
 #include "globalsound.qh"
 #ifdef IMPLEMENTATION
-    #include "../../animdecide.qh"
+       #include "../../animdecide.qh"
 
-    #ifdef SVQC
-        #include "../../../server/cl_player.qh"
-    #endif
+       #ifdef SVQC
+               #include "../../../server/cl_player.qh"
+       #endif
 
        REGISTER_NET_TEMP(globalsound)
        REGISTER_NET_TEMP(playersound)
 
-    #ifdef SVQC
-        /**
-         * @param from the source entity, its position is sent
-         * @param gs the global sound def
-         * @param r a random number in 0..1
-         */
-        void globalsound(int channel, entity from, entity gs, float r, int chan, float vol, float atten)
-        {
-            if (channel == MSG_ONE && !IS_REAL_CLIENT(msg_entity)) return;
-            WriteHeader(channel, globalsound);
-            WriteByte(channel, gs.m_id);
-            WriteByte(channel, r * 255);
-            WriteByte(channel, etof(from));
-            WriteByte(channel, fabs(chan));
-            WriteByte(channel, floor(vol * 255));
-            WriteByte(channel, floor(atten * 64));
+       #ifdef SVQC
+               /**
+                * @param from the source entity, its position is sent
+                * @param gs the global sound def
+                * @param r a random number in 0..1
+                */
+               void globalsound(int channel, entity from, entity gs, float r, int chan, float vol, float atten)
+               {
+                       if (channel == MSG_ONE && !IS_REAL_CLIENT(msg_entity)) return;
+                       WriteHeader(channel, globalsound);
+                       WriteByte(channel, gs.m_id);
+                       WriteByte(channel, r * 255);
+                       WriteByte(channel, etof(from));
+                       WriteByte(channel, fabs(chan));
+                       WriteByte(channel, floor(vol * 255));
+                       WriteByte(channel, floor(atten * 64));
                        vector o = from.origin + 0.5 * (from.mins + from.maxs);
                        WriteCoord(channel, o.x);
                        WriteCoord(channel, o.y);
                        WriteCoord(channel, o.z);
-        }
+               }
 
-        /**
-                * @param from the source entity, its position is sent
-                * @param ps the player sound def
-                * @param r a random number in 0..1
-                */
+               /**
+               * @param from the source entity, its position is sent
+               * @param ps the player sound def
+               * @param r a random number in 0..1
+               */
                void playersound(int channel, entity from, entity ps, float r, int chan, float vol, float atten)
                {
                        if (channel == MSG_ONE && !IS_REAL_CLIENT(msg_entity)) return;
                }
        #endif
 
-    string GlobalSound_sample(string pair, float r);
+       string GlobalSound_sample(string pair, float r);
 
        #ifdef CSQC
 
                NET_HANDLE(globalsound, bool isnew)
                {
-                   entity gs = GlobalSounds_from(ReadByte());
-                   float r = ReadByte() / 255;
-                   string sample = GlobalSound_sample(gs.m_globalsoundstr, r);
-                   int who = ReadByte();
-                   int chan = ReadByte();
-                   float vol = ReadByte() / 255;
-                   float atten = ReadByte() / 64;
+                       entity gs = GlobalSounds_from(ReadByte());
+                       float r = ReadByte() / 255;
+                       string sample = GlobalSound_sample(gs.m_globalsoundstr, r);
+                       int who = ReadByte();
+                       int chan = ReadByte();
+                       float vol = ReadByte() / 255;
+                       float atten = ReadByte() / 64;
                        vector o;
                        o.x = ReadCoord();
                        o.y = ReadCoord();
                        o.z = ReadCoord();
-                   if (who == player_currententnum)
-                   {
-                       // client knows better, play at current position to unlag
-                       entity e = findfloat(world, entnum, who);
+                       if (who == player_currententnum)
+                       {
+                               // client knows better, play at current position to unlag
+                               entity e = findfloat(world, entnum, who);
                                sound7(e, chan, sample, vol, atten, 0, 0);
-                   }
-                   else
-                   {
+                       }
+                       else
+                       {
                                entity e = new(globalsound);
                                e.origin = o;
                                sound8(e, o, chan, sample, vol, atten, 0, 0);
 
                NET_HANDLE(playersound, bool isnew)
                {
-                       entity ps; ps = PlayerSounds_from(ReadByte());
+                       entity ps;
+                       ps = PlayerSounds_from(ReadByte());
                        float r = ReadByte() / 255;
                        int who = ReadByte();
                        entity e = findfloat(world, entnum, autocvar_cl_forceplayermodels ? player_currententnum : who);
-                       string s = e.(ps.m_playersoundfld); // TODO: populate this field
+                       string s = e.(ps.m_playersoundfld);  // TODO: populate this field
                        string sample = GlobalSound_sample(s, r);
                        int chan = ReadByte();
                        float vol = ReadByte() / 255;
 
        #endif
 
-    string GlobalSound_sample(string pair, float r)
-    {
-        int n;
-        {
-            string s = cdr(pair);
-            if (s) n = stof(s);
-            else n = 0;
-        }
-        string sample = car(pair);
-        if (n > 0) sample = sprintf("%s%d.wav", sample, floor(r * n + 1));  // randomization
-        else sample = sprintf("%s.wav", sample);
-        return sample;
-    }
+       string GlobalSound_sample(string pair, float r)
+       {
+               int n;
+               {
+                       string s = cdr(pair);
+                       if (s) n = stof(s);
+                       else n = 0;
+               }
+               string sample = car(pair);
+               if (n > 0) sample = sprintf("%s%d.wav", sample, floor(r * n + 1));  // randomization
+               else sample = sprintf("%s.wav", sample);
+               return sample;
+       }
 
        void PrecacheGlobalSound(string sample)
        {
                        {
                                FOREACH(PlayerSounds, it.instanceOfVoiceMessage, LAMBDA(
                                        allvoicesamples = strcat(allvoicesamples, " ", it.m_playersoundstr)
-                               ));
+                                                                                          ));
                                allvoicesamples = strzone(substring(allvoicesamples, 1, -1));
                        }
                }
                        FOREACH(PlayerSounds, true, LAMBDA(
                                .string fld = it.m_playersoundfld;
                                if (this.(fld))
-                               {
-                                       strunzone(this.(fld));
-                                       this.(fld) = string_null;
-                               }
-                       ));
+       {
+               strunzone(this.(fld));
+               this.(fld) = string_null;
+       }
+                                                             ));
                }
 
                bool LoadPlayerSounds(entity this, string f, bool strict)
                                        msg_entity = this;
                                        if (IS_REAL_CLIENT(msg_entity))
                                        {
-                                           if (gs) globalsound(MSG_ONE, this, gs, r, chan, VOL_BASE, ATTEN_NONE);
-                                           else if (ps) playersound(MSG_ONE, this, ps, r, chan, VOL_BASE, ATTEN_NONE);
-                                           else soundto(MSG_ONE, this, chan, sample, VOL_BASE, ATTEN_NONE);
+                                               if (gs) globalsound(MSG_ONE, this, gs, r, chan, VOL_BASE, ATTEN_NONE);
+                                               else if (ps) playersound(MSG_ONE, this, ps, r, chan, VOL_BASE, ATTEN_NONE);
+                                               else soundto(MSG_ONE, this, chan, sample, VOL_BASE, ATTEN_NONE);
                                        }
                                        break;
                                }
                                                                        : ATTEN_NONE; \
                                                                if (gs) globalsound(MSG_ONE, this, gs, r, chan, VOL_BASEVOICE, atten); \
                                                                else if (ps) playersound(MSG_ONE, this, ps, r, chan, VOL_BASEVOICE, atten); \
-                                else soundto(MSG_ONE, this, chan, sample, VOL_BASEVOICE, atten); \
+                                                               else soundto(MSG_ONE, this, chan, sample, VOL_BASEVOICE, atten); \
                                                        } \
                                                } \
                                                while (0)
                                        {
                                                if (gs) globalsound(MSG_ONE, this, gs, r, chan, VOL_BASE, ATTEN_NORM);
                                                else if (ps) playersound(MSG_ONE, this, ps, r, chan, VOL_BASE, ATTEN_NORM);
-                        else soundto(MSG_ONE, this, chan, sample, VOL_BASE, ATTEN_NORM);
+                                               else soundto(MSG_ONE, this, chan, sample, VOL_BASE, ATTEN_NORM);
                                        }
                                        else
                                        {
-                                       if (gs) globalsound(MSG_ALL, this, gs, r, chan, VOL_BASE, ATTEN_NORM);
-                                       else if (ps) playersound(MSG_ALL, this, ps, r, chan, VOL_BASE, ATTEN_NORM);
-                        else _sound(this, chan, sample, VOL_BASE, ATTEN_NORM);
+                                               if (gs) globalsound(MSG_ALL, this, gs, r, chan, VOL_BASE, ATTEN_NORM);
+                                               else if (ps) playersound(MSG_ALL, this, ps, r, chan, VOL_BASE, ATTEN_NORM);
+                                               else _sound(this, chan, sample, VOL_BASE, ATTEN_NORM);
                                        }
                                        break;
                                }