]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Loops
authorMario <mario@smbclan.net>
Thu, 24 Dec 2015 05:39:12 +0000 (15:39 +1000)
committerMario <mario@smbclan.net>
Thu, 24 Dec 2015 05:39:12 +0000 (15:39 +1000)
qcsrc/common/effects/all.qc
qcsrc/server/sv_main.qc
qcsrc/server/weapons/tracing.qc

index 8c13a68f6819c535e23e1fb9bdeb2578a24d4274..663526bcc6ed2889445234b443b3e8c0c4b88654 100644 (file)
@@ -76,7 +76,7 @@ void Send_Effect(entity eff, vector eff_loc, vector eff_vel, int eff_cnt)
        net_eff.eent_net_count = eff_cnt;
        net_eff.eent_eff_trail = eff.eent_eff_trail;
 
-       entity e; FOR_EACH_REALCLIENT(e) Net_Write_Effect(net_eff, e, 0);
+       FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it), LAMBDA(Net_Write_Effect(net_eff, it, 0)));
        remove(net_eff);
 }
 
index 2433dc163d7275fdf85cbc3d47f56dc756ab1293..3ecd4714b17589ce71fd1aec580246faba1a071f 100644 (file)
@@ -127,12 +127,10 @@ void CreatureFrame_All()
 void Pause_TryPause(bool ispaused)
 {
        int n = 0;
-       entity it;
-       FOR_EACH_REALPLAYER(it)
-       {
+       FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it), LAMBDA(
                if (PHYS_INPUT_BUTTON_CHAT(it) != ispaused) return;
                ++n;
-       }
+       ));
        if (!n) return;
        setpause(ispaused);
 }
@@ -173,14 +171,12 @@ void StartFrame()
                LOG_INFO("CEFC time: ", ftos(t * 1000), "ms; ");
                int c_seeing = 0;
                int c_seen = 0;
-               entity cl;
-               FOR_EACH_CLIENT(cl)
-               {
-                       if(IS_REAL_CLIENT(cl))
+               FOREACH_CLIENT(true, LAMBDA(
+                       if(IS_REAL_CLIENT(it))
                                ++c_seeing;
-                       if(IS_PLAYER(cl))
+                       if(IS_PLAYER(it))
                                ++c_seen;
-               }
+               ));
                LOG_INFO("CEFC calls per second: ", ftos(c_seeing * (c_seen - 1) / t), "; ");
                LOG_INFO("CEFC 100% load at: ", ftos(solve_quadratic(t, -t, -1) * '0 1 0'), "\n");
 
index def2477c78bdec65adf6690ef94c2c4f8149eb8a..9827f0abe4e0952adef6541e1e98e3f4b34d5f8b 100644 (file)
@@ -277,23 +277,31 @@ void FireRailgunBullet (vector start, vector end, float bdamage, float bforce, f
        // Find all non-hit players the beam passed close by
        if(deathtype == WEP_VAPORIZER.m_id || deathtype == WEP_VORTEX.m_id)
        {
+               FOREACH_CLIENT(IS_REAL_CLIENT(it) && it != self, LAMBDA(
+                       if(!it.railgunhit)
+                       if(!(IS_SPEC(it) && it.enemy == self))
+                       {
+                               msg_entity = it;
+                               // nearest point on the beam
+                               beampos = start + dir * bound(0, (msg_entity.origin - start) * dir, length);
+
+                               f = bound(0, 1 - vlen(beampos - msg_entity.origin) / 512, 1);
+                               if(f <= 0)
+                                       continue;
+
+                               snd = SND(NEXWHOOSH_RANDOM());
+
+                               if(!pseudoprojectile)
+                                       pseudoprojectile = spawn(); // we need this so the sound uses the "entchannel4" volume
+                               soundtoat(MSG_ONE, pseudoprojectile, beampos, CH_SHOTS, snd, VOL_BASE * f, ATTEN_NONE);
+                       }
+               ));
                FOR_EACH_REALCLIENT(msg_entity)
                if(msg_entity != self)
                if(!msg_entity.railgunhit)
                if(!(IS_SPEC(msg_entity) && msg_entity.enemy == self)) // we use realclient, so spectators can hear the whoosh too
                {
-                       // nearest point on the beam
-                       beampos = start + dir * bound(0, (msg_entity.origin - start) * dir, length);
-
-                       f = bound(0, 1 - vlen(beampos - msg_entity.origin) / 512, 1);
-                       if(f <= 0)
-                               continue;
-
-                       snd = SND(NEXWHOOSH_RANDOM());
-
-                       if(!pseudoprojectile)
-                               pseudoprojectile = spawn(); // we need this so the sound uses the "entchannel4" volume
-                       soundtoat(MSG_ONE, pseudoprojectile, beampos, CH_SHOTS, snd, VOL_BASE * f, ATTEN_NONE);
+                       
                }
 
                if(pseudoprojectile)