]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/effects/all.qc
Make sure casing physics isn't run if the casing isn't visible. This change should...
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / effects / all.qc
index 663526bcc6ed2889445234b443b3e8c0c4b88654..9732be2e3bf65e82f125b176f8ed2f709d2879d6 100644 (file)
@@ -11,24 +11,17 @@ NET_HANDLE(net_effect, bool isNew)
        vector vel = '0 0 0';
        int eff_cnt = 1;
        bool eff_trail = eff.eent_eff_trail;
-       vector v;
-       v_x = ReadCoord();
-       v_y = ReadCoord();
-       v_z = ReadCoord();
+       vector v = ReadVector();
 
        bool use_vel = ReadByte();
        if(use_vel)
-       {
-               vel_x = ReadCoord();
-               vel_y = ReadCoord();
-               vel_z = ReadCoord();
-       }
+               vel = ReadVector();
 
        if(!eff_trail)
                eff_cnt = ReadByte();
 
        if(eff_trail)
-               WarpZone_TrailParticles(world, particleeffectnum(eff), v, vel);
+               WarpZone_TrailParticles(NULL, particleeffectnum(eff), v, vel);
        else
                pointparticles(eff, v, vel, eff_cnt);
        return true;
@@ -44,17 +37,13 @@ bool Net_Write_Effect(entity this, entity client, int sf)
        (Effects_COUNT >= 255)
        ? WriteShort(channel, this.m_id)
        : WriteByte(channel, this.m_id);
-       WriteCoord(channel, this.eent_net_location_x);
-       WriteCoord(channel, this.eent_net_location_y);
-       WriteCoord(channel, this.eent_net_location_z);
+       WriteVector(channel, this.eent_net_location);
 
        // attempt to save a tiny bit more bandwidth by not sending velocity if it isn't set
        if(this.eent_net_velocity)
        {
                WriteByte(channel, true);
-               WriteCoord(channel, this.eent_net_velocity_x);
-               WriteCoord(channel, this.eent_net_velocity_y);
-               WriteCoord(channel, this.eent_net_velocity_z);
+               WriteVector(channel, this.eent_net_velocity);
        }
        else { WriteByte(channel, false); }
 
@@ -66,8 +55,7 @@ void Send_Effect(entity eff, vector eff_loc, vector eff_vel, int eff_cnt)
 {
        if(!eff) { return; }
        if(!eff.eent_eff_trail && !eff_cnt) { return; } // effect has no count!
-       entity net_eff = new(net_effect);
-       make_pure(net_eff);
+       entity net_eff = new_pure(net_effect);
        net_eff.owner = eff;
        //net_eff.eent_broadcast = broadcast;
        net_eff.m_id = eff.m_id;
@@ -76,20 +64,22 @@ 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;
 
-       FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it), LAMBDA(Net_Write_Effect(net_eff, it, 0)));
-       remove(net_eff);
+       FOREACH_CLIENT(IS_REAL_CLIENT(it), Net_Write_Effect(net_eff, it, 0));
+       delete(net_eff);
 }
 
 void Send_Effect_(string eff_name, vector eff_loc, vector eff_vel, int eff_cnt)
 {
        // problem with this is, we might not have all the available effects for it
-       FOREACH(Effects, it.eent_eff_name == eff_name, LAMBDA(
+       FOREACH(Effects, it.eent_eff_name == eff_name, {
                Send_Effect(it, eff_loc, eff_vel, eff_cnt);
                return;
-       ));
-       // revert to engine handling
+       });
+       // revert to engine handling TODO: send the effect name and draw it on the client side? not as light on networking, but resolves the use of server side effects
        __pointparticles(_particleeffectnum(eff_name), eff_loc, eff_vel, eff_cnt);
 }
 #endif
 
-#include "effectinfo.qc"
+#if ENABLE_EFFECTINFO
+       #include "effectinfo.qc"
+#endif