From 19e321bd91a389090c61d1c5c9edf311a82e690a Mon Sep 17 00:00:00 2001 From: Lee Salzman Date: Mon, 26 Jul 2010 18:58:07 +0000 Subject: [PATCH] maxtrail var git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@5459 e016b1c5-ed68-44aa-a2f7-31cac88cffde --- source/src/renderparticles.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/source/src/renderparticles.cpp b/source/src/renderparticles.cpp index be812ec7..29f61e83 100644 --- a/source/src/renderparticles.cpp +++ b/source/src/renderparticles.cpp @@ -571,17 +571,20 @@ void particle_splash(int type, int num, int fade, const vec &p) } } +VARP(maxtrail, 1, 500, 10000); + void particle_trail(int type, int fade, const vec &s, const vec &e) { vec v; - float d = e.dist(s, v); - v.div(d*2+0.1f); + float d = e.dist(s, v); + int steps = clamp(int(d*2), 1, maxtrail); + v.div(steps); vec p = s; - loopi((int)d*2) + loopi(steps) { p.add(v); - vec d((float)(rnd(11)-5), (float)(rnd(11)-5), (float)(rnd(11)-5)); - newparticle(p, d, rnd(fade)+fade, type); + vec tmp((float)(rnd(11)-5), (float)(rnd(11)-5), (float)(rnd(11)-5)); + newparticle(p, tmp, rnd(fade)+fade, type); } }