From: Rudolf Polzer Date: Wed, 12 May 2010 07:58:21 +0000 (+0200) Subject: DP_CSQC_BOXPARTICLES use :P for fading out particle trails X-Git-Tag: xonotic-v0.1.0preview~632^2~2 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=8af574764e25b2d215df3351b578a9009a8e354d;p=xonotic%2Fxonotic-data.pk3dir.git DP_CSQC_BOXPARTICLES use :P for fading out particle trails --- diff --git a/qcsrc/client/csqc_builtins.qc b/qcsrc/client/csqc_builtins.qc index c108a4ca0..83955df8c 100644 --- a/qcsrc/client/csqc_builtins.qc +++ b/qcsrc/client/csqc_builtins.qc @@ -310,3 +310,9 @@ float log(float f) = #532; void(entity e, entity ignore) tracetoss = #64; float(entity e, float ch) getsoundtime = #533; // (DP_SND_GETSOUNDTIME) + +#define PARTICLES_USEALPHA 1 +float particles_alphamin, particles_alphamax; +#define PARTICLES_USECOLOR 2 +vector particles_colormin, particles_colormax; +void(float effectindex, entity own, vector org_from, vector org_to, vector dir_from, vector dir_to, float countmultiplier, float flags) boxparticles = #502; diff --git a/qcsrc/client/projectile.qc b/qcsrc/client/projectile.qc index 6160cb3f0..b67cc76aa 100644 --- a/qcsrc/client/projectile.qc +++ b/qcsrc/client/projectile.qc @@ -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() @@ -102,8 +117,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 +153,6 @@ void Projectile_Draw() break; } - self.alpha = self.alphamod * a; - self.renderflags = 0; - R_AddEntity(self); }