]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/client/projectile.qc
FruitieX: projectile bounds are not networked. Always update this file too.
[xonotic/xonotic-data.pk3dir.git] / qcsrc / client / projectile.qc
index 9a2907c5c83397ba88ae2f10e5891f905472b0a0..6c27a5251eeb17b8113af5193810bfe5353e69ff 100644 (file)
@@ -31,8 +31,28 @@ void Projectile_DrawTrail(vector to)
        self.trail_oldorigin = to;
        self.trail_oldtime = time;
 
+       // force the effect even for stationary firemine
+       if(self.cnt == PROJECTILE_FIREMINE)
+               if(from == 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()
@@ -49,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);
        }
@@ -97,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)
@@ -131,9 +161,6 @@ void Projectile_Draw()
                        break;
        }
 
-       self.alpha = self.alphamod * a;
-       self.renderflags = 0;
-
        R_AddEntity(self);
 }
 
@@ -216,7 +243,7 @@ void Ent_Projectile()
                        if(f & 0x10)
                                self.gravity = ReadCoord();
                        else
-                               self.gravity = 0; // default
+                               self.gravity = 0; // none
                        self.move_origin = self.origin;
                        self.move_velocity = self.velocity;
                }
@@ -270,6 +297,9 @@ void Ent_Projectile()
                        case PROJECTILE_HAGAR_BOUNCING: setmodel(self, "models/hagarmissile.mdl");self.traileffect = particleeffectnum("TR_GRENADE"); self.scale = 0.4; break;
                        case PROJECTILE_FIREBALL: self.model = ""; self.modelindex = 0; self.traileffect = particleeffectnum("fireball"); break; // particle effect is good enough
                        case PROJECTILE_FIREMINE: self.model = ""; self.modelindex = 0; self.traileffect = particleeffectnum("firemine"); break; // particle effect is good enough
+                       case PROJECTILE_TAG: setmodel(self, "models/laser.mdl"); self.traileffect = particleeffectnum("TR_ROCKET"); break;
+                       case PROJECTILE_FLAC: setmodel(self, "models/hagarmissile.mdl"); self.scale = 0.4; self.traileffect = particleeffectnum("TR_ROCKET"); break;
+                       case PROJECTILE_SEEKER: setmodel(self, "models/tagrocket.md3"); self.scale = 2; self.traileffect = particleeffectnum("TR_ROCKET"); break;
                        default:
                                error("Received invalid CSQC projectile, can't work with this!");
                                break;
@@ -287,8 +317,8 @@ void Ent_Projectile()
                        case PROJECTILE_ELECTRO:
                                // only new engines support sound moving with object
                                loopsound(self, CHAN_PROJECTILE, "weapons/electro_fly.wav", VOL_BASE, ATTN_NORM);
-                               self.mins = '0 0 -3';
-                               self.maxs = '0 0 -3';
+                               self.mins = '0 0 -4';
+                               self.maxs = '0 0 -4';
                                self.move_movetype = MOVETYPE_BOUNCE;
                                self.move_touch = SUB_Null;
                                break;
@@ -341,6 +371,19 @@ void Ent_Projectile()
                                self.mins = '-4 -4 -4';
                                self.maxs = '4 4 4';
                                break;
+                       case PROJECTILE_TAG:
+                               loopsound(self, CHAN_PROJECTILE, "weapons/tag_rocket_fly.wav", VOL_BASE, ATTN_NORM);
+                               self.mins = '-2 -2 -2';
+                               self.maxs = '2 2 2';
+                               break;
+                       case PROJECTILE_FLAC:
+                               self.mins = '-2 -2 -2';
+                               self.maxs = '2 2 2';
+                               break;
+                       case PROJECTILE_SEEKER:
+                               self.mins = '-4 -4 -4';
+                               self.maxs = '4 4 4';
+                               break;
                        default:
                                break;
                }
@@ -378,9 +421,11 @@ void Projectile_Precache()
        precache_model("models/laser.mdl");
        precache_model("models/plasmatrail.mdl");
        precache_model("models/rocket.md3");
+       precache_model("models/tagrocket.md3");
        precache_model("models/tracer.mdl");
        precache_sound("weapons/electro_fly.wav");
        precache_sound("weapons/rocket_fly.wav");
        precache_sound("weapons/fireball_fly.wav");
        precache_sound("weapons/fireball_fly2.wav");
+       precache_sound("weapons/tag_rocket_fly.wav");
 }