]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/client/projectile.qc
the trivial movetypes do not have to match the server's ticrate as they are ticrate...
[xonotic/xonotic-data.pk3dir.git] / qcsrc / client / projectile.qc
index 6160cb3f0219713d80c3df0aee6556b0894f596e..e1f325a6798003f93b524defef46167617f063cf 100644 (file)
@@ -37,7 +37,22 @@ void Projectile_DrawTrail(vector to)
                        from_z += 1;
 
        if (self.traileffect)
-               trailparticles(self, self.traileffect, from, to);
+       {
+               if(checkextension("DP_CSQC_BOXPARTICLES"))
+               {
+                       /* looks good, but we can do better with particle count
+                       particles_alphamin = particles_alphamax = self.alpha;
+                       boxparticles(self.traileffect, self, from, to, self.velocity, self.velocity, 1, PARTICLES_USEALPHA);
+                       */
+                       /* looks bad
+                       boxparticles(self.traileffect, self, from, to, self.velocity, self.velocity, self.alpha, 0);
+                       */
+                       particles_alphamin = particles_alphamax = sqrt(self.alpha);
+                       boxparticles(self.traileffect, self, from, to, self.velocity, self.velocity, sqrt(self.alpha), PARTICLES_USEALPHA);
+               }
+               else
+                       trailparticles(self, self.traileffect, from, to);
+       }
 }
 
 void Projectile_Draw()
@@ -54,7 +69,15 @@ void Projectile_Draw()
        if(self.count & 0x80)
        {
                //self.move_flags &~= FL_ONGROUND;
-               Movetype_Physics_MatchServer(autocvar_cl_projectiles_sloppy);
+               if(self.move_movetype == MOVETYPE_NONE || self.move_movetype == MOVETYPE_FLY)
+                       Movetype_Physics_NoMatchServer();
+                       // the trivial movetypes do not have to match the
+                       // server's ticrate as they are ticrate independent
+                       // NOTE: this assumption is only true if MOVETYPE_FLY
+                       // projectiles detonate on impact. If they continue
+                       // moving, we might still be ticrate dependent.
+               else
+                       Movetype_Physics_MatchServer(autocvar_cl_projectiles_sloppy);
                if(!(self.move_flags & FL_ONGROUND))
                        self.angles = vectoangles(self.velocity);
        }
@@ -102,8 +125,10 @@ void Projectile_Draw()
        makevectors(ang);
 
        a = 1 - (time - self.fade_time) * self.fade_rate;
-       if(a <= 0)
+       self.alpha = bound(0, self.alphamod * a, 1);
+       if(self.alpha <= 0)
                drawn = 0;
+       self.renderflags = 0;
 
        trailorigin = self.origin;
        switch(self.cnt)
@@ -136,9 +161,6 @@ void Projectile_Draw()
                        break;
        }
 
-       self.alpha = self.alphamod * a;
-       self.renderflags = 0;
-
        R_AddEntity(self);
 }