]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
add a specific "linkjoin" effect
authorRudolf Polzer <divverent@alientrap.org>
Tue, 9 Nov 2010 19:24:23 +0000 (20:24 +0100)
committerRudolf Polzer <divverent@alientrap.org>
Tue, 9 Nov 2010 19:24:46 +0000 (20:24 +0100)
effectinfo.txt
qcsrc/server/w_crylink.qc
sound/weapons/crylink_linkjoin.ogg [new file with mode: 0644]

index 3ad766d85ff714ded5623b3f1ef287583faa6dbb..9529ebecc84f6ab943ba4fe2712014a46ae85b02 100644 (file)
@@ -5060,3 +5060,56 @@ velocitymultiplier 2.5
 airfriction 8
 gravity 1.3
 stretchfactor 0.1
+
+
+
+// crylink linkjoin effect
+// decal
+// used in qcsrc/client/damage.qc:                                     pointparticles(particleeffectnum("crylink_linkjoin"), org2, '0 0 0', 1)
+effect crylink_linkjoin
+countabsolute 1
+type decal
+tex 47 47
+size 8 8
+alpha 256 256 0
+originjitter 12 12 12
+//lightradius 60
+//lightradiusfade 300
+//lightcolor 3.2 0.4 4
+// purple flare effect
+effect crylink_linkjoin
+countabsolute 1
+type static
+tex 39 39
+color 0x504060 0x504060
+size 8 8
+alpha 256 256 512
+// purple sparks
+effect crylink_linkjoin
+count 10
+type spark
+tex 41 41
+color 0xA040C0 0xA040C0
+bounce 2
+size 1 2
+alpha 256 256 1024
+velocityjitter 256 256 256
+// purple splash
+effect crylink_linkjoin
+count 1.5
+type static
+color 0xE070FF 0xE070FF
+size 8 8
+alpha 256 256 512
+velocityjitter 8 8 8
+// purple splash
+effect crylink_linkjoin
+count 1.5
+type static
+color 0xE070FF 0xE070FF
+size 8 8
+alpha 256 256 1024
+velocityjitter 32 32 32
+
+
+
index 5424b64b8e8104cee9902fb59f15f89c117885de..de5abb1fda2630afc7103b57d9ddda2fb083b87a 100644 (file)
@@ -52,6 +52,8 @@ vector W_Crylink_LinkJoin(entity e, float joinspeed)
        float avg_dist, n;
        entity p;
 
+       w_crylink_linkjoin_time = 0;
+
        avg_origin = e.origin;
        avg_velocity = e.velocity;
        n = 1;
@@ -64,6 +66,9 @@ vector W_Crylink_LinkJoin(entity e, float joinspeed)
        avg_origin *= (1.0 / n);
        avg_velocity *= (1.0 / n);
 
+       if(n < 2)
+               return avg_origin; // nothing to do
+
        // yes, mathematically we can do this in ONE step, but beware of 32bit floats...
        avg_dist = pow(vlen(e.origin - avg_origin), 2);
        for(p = e; (p = p.queuenext) != e; )
@@ -71,7 +76,6 @@ vector W_Crylink_LinkJoin(entity e, float joinspeed)
        avg_dist *= (1.0 / n);
        avg_dist = sqrt(avg_dist);
 
-       w_crylink_linkjoin_time = 0;
        if(avg_dist == 0)
                return avg_origin; // no change needed
 
@@ -116,6 +120,32 @@ vector W_Crylink_LinkJoin(entity e, float joinspeed)
        return targ_origin;
 }
 
+void W_Crylink_LinkJoinEffect_Think()
+{
+       // is there at least 2 projectiles very close?
+       entity e, p;
+       float n;
+       e = self.owner.crylink_lastgroup;
+       n = 0;
+       if(e)
+       {
+               if(vlen(e.origin - self.origin) < vlen(e.velocity) * frametime)
+                       ++n;
+               for(p = e; (p = p.queuenext) != e; )
+               {
+                       if(vlen(p.origin - self.origin) < vlen(p.velocity) * frametime)
+                               ++n;
+               }
+               if(n >= 2)
+               {
+                       // they seem to touch...
+                       // TODO make a specific particle effect for this
+                       pointparticles(particleeffectnum("crylink_linkjoin"), self.origin, '0 0 0', 1);
+               }
+       }
+       remove(self);
+}
+
 // NO bounce protection, as bounces are limited!
 void W_Crylink_Touch (void)
 {
@@ -434,14 +464,23 @@ float w_crylink(float req)
                                // fired and released now!
                                if(self.crylink_lastgroup)
                                {
+                                       vector pos;
                                        if(self.crylink_waitrelease == 1)
                                        {
-                                               W_Crylink_LinkJoin(self.crylink_lastgroup, cvar("g_balance_crylink_primary_joinspeed"));
+                                               pos = W_Crylink_LinkJoin(self.crylink_lastgroup, cvar("g_balance_crylink_primary_joinspeed"));
                                        }
                                        else
                                        {
-                                               W_Crylink_LinkJoin(self.crylink_lastgroup, cvar("g_balance_crylink_secondary_joinspeed"));
+                                               pos = W_Crylink_LinkJoin(self.crylink_lastgroup, cvar("g_balance_crylink_secondary_joinspeed"));
                                        }
+
+                                       entity linkjoineffect;
+                                       linkjoineffect = spawn();
+                                       linkjoineffect.classname = "linkjoineffect";
+                                       linkjoineffect.think = W_Crylink_LinkJoinEffect_Think;
+                                       linkjoineffect.nextthink = time + w_crylink_linkjoin_time;
+                                       linkjoineffect.owner = self;
+                                       setorigin(linkjoineffect, pos);
                                }
                        }
                        self.crylink_waitrelease = 0;
@@ -454,6 +493,7 @@ float w_crylink(float req)
                precache_model ("models/weapons/h_crylink.iqm");
                precache_sound ("weapons/crylink_fire.wav");
                precache_sound ("weapons/crylink_fire2.wav");
+               precache_sound ("weapons/crylink_linkjoin.wav");
        }
        else if (req == WR_SETUP)
                weapon_setup(WEP_CRYLINK);
diff --git a/sound/weapons/crylink_linkjoin.ogg b/sound/weapons/crylink_linkjoin.ogg
new file mode 100644 (file)
index 0000000..26c7af5
Binary files /dev/null and b/sound/weapons/crylink_linkjoin.ogg differ