1
0
Fork 0
forked from fte/fteqw

particle trail fixes... hopefully

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@50 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
TimeServ 2004-08-26 17:59:48 +00:00
parent 80d3e5c9c3
commit 816d331b91
2 changed files with 47 additions and 27 deletions

View file

@ -1865,13 +1865,12 @@ float R_RocketTrail (vec3_t start, vec3_t end, int type, float lastdistance)
{
vec3_t vec, right, up;
float len;
int j;
static int tcount;
int tcount;
particle_t *p;
part_type_t *ptype = &part_type[type];
float veladd = -ptype->veladd;
float randvel = ptype->randomvel*2;
float randvel = ptype->randomvel;
float step;
float stop;
@ -1901,8 +1900,8 @@ float R_RocketTrail (vec3_t start, vec3_t end, int type, float lastdistance)
if (ptype->spawnmode == SM_SPIRAL)
{
VectorVectors(vec, right, up);
VectorScale(right, ptype->offsetspread, right);
VectorScale(up, ptype->offsetspread, up);
// VectorScale(right, ptype->offsetspread, right);
// VectorScale(up, ptype->offsetspread, up);
}
stop = lastdistance + len; //when to stop
@ -1931,6 +1930,9 @@ float R_RocketTrail (vec3_t start, vec3_t end, int type, float lastdistance)
p->color = 0;
p->nextemit = particletime + ptype->emitstart - p->die;
if (ptype->spawnmode == SM_TRACER)
tcount = (int)(len * ptype->count);
if (ptype->colorindex >= 0)
{
int cidx;
@ -1962,42 +1964,60 @@ float R_RocketTrail (vec3_t start, vec3_t end, int type, float lastdistance)
switch(ptype->spawnmode)
{
case SM_TRACER:
VectorCopy(start, p->org);
tcount++;
if (tcount & 1)
{
p->vel[0] = vec[1]*ptype->areaspread;
p->vel[1] = -vec[0]*ptype->areaspread;
p->vel[0] = vec[1]*ptype->offsetspread;
p->vel[1] = -vec[0]*ptype->offsetspread;
p->org[0] = vec[1]*ptype->areaspread;
p->org[1] = -vec[0]*ptype->areaspread;
}
else
{
p->vel[0] = -vec[1]*ptype->areaspread;
p->vel[1] = vec[0]*ptype->areaspread;
p->vel[0] = -vec[1]*ptype->offsetspread;
p->vel[1] = vec[0]*ptype->offsetspread;
p->org[0] = -vec[1]*ptype->areaspread;
p->org[1] = vec[0]*ptype->areaspread;
}
p->vel[0] += vec[0]*veladd+crandom()*randvel;
p->vel[1] += vec[1]*veladd+crandom()*randvel;
p->vel[2] = vec[2]*veladd+crandom()*randvel;
p->org[0] += start[0];
p->org[1] += start[1];
p->org[2] = start[2];
break;
case SM_SPIRAL:
p->vel[0] = cos(len/50);
p->vel[1] = sin(len/50);
for (j=0 ; j<3 ; j++)
p->org[j] = start[j] + right[j]*p->vel[0] + up[j]*p->vel[1];
{
float tsin, tcos;
p->vel[0] = vec[0]*veladd+crandom()*randvel;
p->vel[1] = vec[1]*veladd+crandom()*randvel;
p->vel[2] = vec[2]*veladd+crandom()*randvel;
tcos = cos(len/50)*ptype->areaspread;
tsin = sin(len/50)*ptype->areaspread;
p->org[0] = start[0] + right[0]*tcos + up[0]*tsin;
p->org[1] = start[1] + right[1]*tcos + up[1]*tsin;
p->org[2] = start[2] + right[2]*tcos + up[2]*tsin;
tcos = cos(len/50)*ptype->offsetspread;
tsin = sin(len/50)*ptype->offsetspread;
p->vel[0] = vec[0]*veladd+crandom()*randvel + right[0]*tcos + up[0]*tsin;
p->vel[1] = vec[1]*veladd+crandom()*randvel + right[1]*tcos + up[1]*tsin;
p->vel[2] = vec[2]*veladd+crandom()*randvel + right[2]*tcos + up[2]*tsin;
}
break;
default:
p->org[0] = start[0] + crandom()*ptype->areaspread;
p->org[1] = start[1] + crandom()*ptype->areaspread;
p->org[2] = start[2] + crandom()*ptype->areaspreadvert;
p->org[0] = crandom();
p->org[1] = crandom();
p->org[2] = crandom();
p->vel[0] = vec[0]*veladd+crandom()*randvel;
p->vel[1] = vec[1]*veladd+crandom()*randvel;
p->vel[2] = vec[2]*veladd+crandom()*randvel;
p->vel[0] = vec[0]*veladd+crandom()*randvel + p->org[0]*ptype->offsetspread;
p->vel[1] = vec[1]*veladd+crandom()*randvel + p->org[1]*ptype->offsetspread;
p->vel[2] = vec[2]*veladd+crandom()*randvel + p->org[2]*ptype->offsetspreadvert;
p->org[0] = p->org[0]*ptype->areaspread + start[0];
p->org[1] = p->org[1]*ptype->areaspread + start[1];
p->org[2] = p->org[2]*ptype->areaspreadvert + start[2];
break;
}

View file

@ -913,7 +913,7 @@ char *particle_set_faithful =
" alphachange 0\n"
" colorindex 52\n"
" citracer 1\n"
" areaspread 30\n"
" offsetspread 30\n"
" spawnmode tracer\n"
"}\n"
"\n"
@ -927,7 +927,7 @@ char *particle_set_faithful =
" alphachange 0\n"
" colorindex 230\n"
" citracer 1\n"
" areaspread 30\n"
" offsetspread 30\n"
" spawnmode tracer\n"
"}\n"
"\n"