1
0
Fork 0
forked from fte/fteqw

Added orgadd to add to the origin like veladd does

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@1540 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2005-10-28 01:32:24 +00:00
parent b19c4d4a81
commit 9858ac6fdb

View file

@ -191,6 +191,7 @@ typedef struct part_type_s {
float alphachange;
float die, randdie;
float randomvel, veladd;
float orgadd;
float offsetspread;
float offsetspreadvert;
float randomvelvert;
@ -562,6 +563,8 @@ void P_ParticleEffect_f(void)
}
else if (!strcmp(var, "veladd"))
ptype->veladd = atof(value);
else if (!strcmp(var, "orgadd"))
ptype->orgadd = atof(value);
else if (!strcmp(var, "friction"))
{
ptype->friction[2] = ptype->friction[1] = ptype->friction[0] = atof(value);
@ -2280,22 +2283,29 @@ int P_RunParticleEffectState (vec3_t org, vec3_t dir, float count, int typenum,
break;
}
p->org[0] = org[0] + arsvec[0];
p->org[1] = org[1] + arsvec[1];
p->org[2] = org[2] + arsvec[2] + ptype->offsetup;
// apply arsvec+ofsvec
if (dir)
{
p->vel[0] += dir[0]*ptype->veladd+ofsvec[0]*ptype->offsetspread;
p->vel[1] += dir[1]*ptype->veladd+ofsvec[1]*ptype->offsetspread;
p->vel[2] += dir[2]*ptype->veladd+ofsvec[2]*ptype->offsetspreadvert;
p->org[0] += dir[0]*ptype->orgadd;
p->org[1] += dir[1]*ptype->orgadd;
p->org[2] += dir[2]*ptype->orgadd;
}
else
{
p->vel[0] += ofsvec[0]*ptype->offsetspread;
p->vel[1] += ofsvec[1]*ptype->offsetspread;
p->vel[2] += ofsvec[2]*ptype->offsetspreadvert - ptype->veladd;
p->org[2] -= ptype->orgadd;
}
p->org[0] = org[0] + arsvec[0];
p->org[1] = org[1] + arsvec[1];
p->org[2] = org[2] + arsvec[2] + ptype->offsetup;
p->die = particletime + ptype->die - p->die;
}
@ -2825,11 +2835,19 @@ static void P_ParticleTrailDraw (vec3_t startpos, vec3_t end, part_type_t *ptype
else
VectorCopy(ptype->rgb, p->rgb);
// use org temporarily for rgbsync
p->org[2] = frandom();
p->org[0] = p->org[2]*ptype->rgbrandsync[0] + frandom()*(1-ptype->rgbrandsync[0]);
p->org[1] = p->org[2]*ptype->rgbrandsync[1] + frandom()*(1-ptype->rgbrandsync[1]);
p->org[2] = p->org[2]*ptype->rgbrandsync[2] + frandom()*(1-ptype->rgbrandsync[2]);
if (ptype->orgadd)
{
p->org[0] += vec[0]*ptype->orgadd;
p->org[1] += vec[1]*ptype->orgadd;
p->org[2] += vec[2]*ptype->orgadd;
}
p->rgb[0] += p->org[0]*ptype->rgbrand[0] + ptype->rgbchange[0]*p->die;
p->rgb[1] += p->org[1]*ptype->rgbrand[1] + ptype->rgbchange[1]*p->die;