beam stuff for regular effects, SM_UNICIRCLE addition
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@362 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
fc20b7cb95
commit
e86a39d079
1 changed files with 189 additions and 325 deletions
|
@ -146,7 +146,7 @@ typedef struct part_type_s {
|
||||||
vec3_t rgbrand;
|
vec3_t rgbrand;
|
||||||
int colorindex;
|
int colorindex;
|
||||||
int colorrand;
|
int colorrand;
|
||||||
int citracer;
|
qboolean citracer;
|
||||||
float rgbchangetime;
|
float rgbchangetime;
|
||||||
vec3_t rgbrandsync;
|
vec3_t rgbrandsync;
|
||||||
float scale, alpha;
|
float scale, alpha;
|
||||||
|
@ -181,7 +181,7 @@ typedef struct part_type_s {
|
||||||
|
|
||||||
float offsetup; // make this into a vec3_t later with dir, possibly for mdls
|
float offsetup; // make this into a vec3_t later with dir, possibly for mdls
|
||||||
|
|
||||||
enum {SM_BOX, SM_CIRCLE, SM_BALL, SM_SPIRAL, SM_TRACER, SM_TELEBOX, SM_LAVASPLASH} spawnmode;
|
enum {SM_BOX, SM_CIRCLE, SM_BALL, SM_SPIRAL, SM_TRACER, SM_TELEBOX, SM_LAVASPLASH, SM_UNICIRCLE} spawnmode;
|
||||||
//box = even spread within the area
|
//box = even spread within the area
|
||||||
//circle = around edge of a circle
|
//circle = around edge of a circle
|
||||||
//ball = filled sphere
|
//ball = filled sphere
|
||||||
|
@ -189,9 +189,11 @@ typedef struct part_type_s {
|
||||||
//tracer = tracer trail
|
//tracer = tracer trail
|
||||||
//telebox = q1-style telebox
|
//telebox = q1-style telebox
|
||||||
//lavasplash = q1-style lavasplash
|
//lavasplash = q1-style lavasplash
|
||||||
|
//unicircle = uniform circle
|
||||||
|
|
||||||
float gravity;
|
float gravity;
|
||||||
vec3_t friction;
|
vec3_t friction;
|
||||||
|
float clipbounce;
|
||||||
int stains;
|
int stains;
|
||||||
|
|
||||||
enum {RAMP_NONE, RAMP_DELTA, RAMP_ABSOLUTE} rampmode;
|
enum {RAMP_NONE, RAMP_DELTA, RAMP_ABSOLUTE} rampmode;
|
||||||
|
@ -345,11 +347,12 @@ void R_ParticleEffect_f(void)
|
||||||
ptype->emit = -1;
|
ptype->emit = -1;
|
||||||
ptype->alpha = 1;
|
ptype->alpha = 1;
|
||||||
ptype->alphachange = 1;
|
ptype->alphachange = 1;
|
||||||
|
ptype->clipbounce = 0.8;
|
||||||
ptype->colorindex = -1;
|
ptype->colorindex = -1;
|
||||||
ptype->rotationstartmin = -M_PI; //start with a random angle
|
ptype->rotationstartmin = -M_PI; //start with a random angle
|
||||||
ptype->rotationstartrand = M_PI-ptype->rotationstartmin;
|
ptype->rotationstartrand = M_PI-ptype->rotationstartmin;
|
||||||
ptype->rotationmin = 0; //but don't spin
|
ptype->rotationmin = 0; //but don't spin
|
||||||
ptype->rotationrand = 0-ptype->rotationmin;
|
ptype->rotationrand = 0;
|
||||||
|
|
||||||
while(1)
|
while(1)
|
||||||
{
|
{
|
||||||
|
@ -438,6 +441,8 @@ void R_ParticleEffect_f(void)
|
||||||
}
|
}
|
||||||
else if (!strcmp(var, "gravity"))
|
else if (!strcmp(var, "gravity"))
|
||||||
ptype->gravity = atof(value);
|
ptype->gravity = atof(value);
|
||||||
|
else if (!strcmp(var, "clipbounce"))
|
||||||
|
ptype->clipbounce = atof(value);
|
||||||
|
|
||||||
else if (!strcmp(var, "assoc"))
|
else if (!strcmp(var, "assoc"))
|
||||||
{
|
{
|
||||||
|
@ -451,7 +456,7 @@ void R_ParticleEffect_f(void)
|
||||||
else if (!strcmp(var, "colorrand"))
|
else if (!strcmp(var, "colorrand"))
|
||||||
ptype->colorrand = atoi(value);
|
ptype->colorrand = atoi(value);
|
||||||
else if (!strcmp(var, "citracer"))
|
else if (!strcmp(var, "citracer"))
|
||||||
ptype->citracer = atoi(value);
|
ptype->citracer = true;
|
||||||
|
|
||||||
else if (!strcmp(var, "red"))
|
else if (!strcmp(var, "red"))
|
||||||
ptype->rgb[0] = atof(value)/255;
|
ptype->rgb[0] = atof(value)/255;
|
||||||
|
@ -523,6 +528,8 @@ void R_ParticleEffect_f(void)
|
||||||
ptype->spawnmode = SM_TELEBOX;
|
ptype->spawnmode = SM_TELEBOX;
|
||||||
else if (!strcmp(value, "lavasplash"))
|
else if (!strcmp(value, "lavasplash"))
|
||||||
ptype->spawnmode = SM_LAVASPLASH;
|
ptype->spawnmode = SM_LAVASPLASH;
|
||||||
|
else if (!strcmp(value, "uniformcircle"))
|
||||||
|
ptype->spawnmode = SM_UNICIRCLE;
|
||||||
else
|
else
|
||||||
ptype->spawnmode = SM_BOX;
|
ptype->spawnmode = SM_BOX;
|
||||||
|
|
||||||
|
@ -1298,11 +1305,6 @@ void R_EmitSkyEffectTris(model_t *mod, msurface_t *fa)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void R_DarkFieldParticles (float *org, qbyte colour)
|
void R_DarkFieldParticles (float *org, qbyte colour)
|
||||||
{
|
{
|
||||||
int i, j, k;
|
int i, j, k;
|
||||||
|
@ -1486,10 +1488,10 @@ int R_RunParticleEffectType (vec3_t org, vec3_t dir, float count, int typenum)
|
||||||
{
|
{
|
||||||
part_type_t *ptype = &part_type[typenum];
|
part_type_t *ptype = &part_type[typenum];
|
||||||
int i, j, k, l;
|
int i, j, k, l;
|
||||||
|
float m;
|
||||||
particle_t *p;
|
particle_t *p;
|
||||||
|
beamseg_t *b, *bfirst;
|
||||||
if (typenum == 0)
|
vec3_t ofsvec, arsvec; // offsetspread vec, areaspread vec
|
||||||
typenum = rand()&15;
|
|
||||||
|
|
||||||
if (typenum < 0)
|
if (typenum < 0)
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -1499,162 +1501,118 @@ int R_RunParticleEffectType (vec3_t org, vec3_t dir, float count, int typenum)
|
||||||
|
|
||||||
while(ptype)
|
while(ptype)
|
||||||
{
|
{
|
||||||
|
// init spawn specific variables
|
||||||
|
b = bfirst = NULL;
|
||||||
switch (ptype->spawnmode)
|
switch (ptype->spawnmode)
|
||||||
{
|
{
|
||||||
case SM_BOX:
|
case SM_UNICIRCLE:
|
||||||
for (i = 0; i < count*ptype->count; i++)
|
m = (count*ptype->count)-1;
|
||||||
{
|
if (m < 1)
|
||||||
if (!free_particles)
|
m = 0;
|
||||||
return 0;
|
else
|
||||||
p = free_particles;
|
m = (M_PI*2)/m;
|
||||||
free_particles = p->next;
|
|
||||||
p->next = ptype->particles;
|
|
||||||
ptype->particles = p;
|
|
||||||
|
|
||||||
p->die = ptype->randdie*frandom();
|
|
||||||
p->scale = ptype->scale+ptype->randscale*frandom();
|
|
||||||
if (ptype->die)
|
|
||||||
p->alpha = ptype->alpha-p->die*(ptype->alpha/ptype->die)*ptype->alphachange;
|
|
||||||
else
|
|
||||||
p->alpha = ptype->alpha;
|
|
||||||
p->color = 0;
|
|
||||||
p->nextemit = particletime + ptype->emitstart - p->die;
|
|
||||||
|
|
||||||
p->rotationspeed = ptype->rotationmin + frandom()*ptype->rotationrand;
|
|
||||||
p->angle = ptype->rotationstartmin + frandom()*ptype->rotationstartrand;
|
|
||||||
|
|
||||||
if (ptype->colorindex >= 0)
|
|
||||||
{
|
|
||||||
int cidx;
|
|
||||||
cidx = ptype->colorrand > 0 ? rand() % ptype->colorrand : 0;
|
|
||||||
cidx = ptype->colorindex + cidx;
|
|
||||||
if (cidx > 255)
|
|
||||||
p->alpha = p->alpha / 2;
|
|
||||||
cidx = d_8to24rgbtable[cidx & 0xff];
|
|
||||||
p->rgb[0] = (cidx & 0xff) * (1/255.0);
|
|
||||||
p->rgb[1] = (cidx >> 8 & 0xff) * (1/255.0);
|
|
||||||
p->rgb[2] = (cidx >> 16 & 0xff) * (1/255.0);
|
|
||||||
}
|
|
||||||
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]);
|
|
||||||
|
|
||||||
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;
|
|
||||||
p->rgb[2] += p->org[2]*ptype->rgbrand[2] + ptype->rgbchange[2]*p->die;
|
|
||||||
|
|
||||||
p->org[0] = crandom();
|
|
||||||
p->org[1] = crandom();
|
|
||||||
p->org[2] = crandom();
|
|
||||||
|
|
||||||
p->vel[0] = crandom()*ptype->randomvel;
|
|
||||||
p->vel[1] = crandom()*ptype->randomvel;
|
|
||||||
p->vel[2] = crandom()*ptype->randomvelvert;
|
|
||||||
|
|
||||||
if (dir)
|
|
||||||
{
|
|
||||||
p->vel[0] += dir[0]*ptype->veladd+p->org[0]*ptype->offsetspread;
|
|
||||||
p->vel[1] += dir[1]*ptype->veladd+p->org[1]*ptype->offsetspread;
|
|
||||||
p->vel[2] += dir[2]*ptype->veladd+p->org[2]*ptype->offsetspreadvert;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
p->vel[0] += p->org[0]*ptype->offsetspread;
|
|
||||||
p->vel[1] += p->org[1]*ptype->offsetspread;
|
|
||||||
p->vel[2] += p->org[2]*ptype->offsetspreadvert - ptype->veladd;
|
|
||||||
}
|
|
||||||
p->org[0] = org[0] + p->org[0]*ptype->areaspread;
|
|
||||||
p->org[1] = org[1] + p->org[1]*ptype->areaspread;
|
|
||||||
p->org[2] = org[2] + p->org[2]*ptype->areaspreadvert + ptype->offsetup;
|
|
||||||
|
|
||||||
p->die = particletime + ptype->die - p->die;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case SM_TELEBOX:
|
case SM_TELEBOX:
|
||||||
j = k = -ptype->areaspread;
|
j = k = -ptype->areaspread;
|
||||||
|
case SM_LAVASPLASH:
|
||||||
l = -ptype->areaspreadvert;
|
l = -ptype->areaspreadvert;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
for (i = 0; i < count*ptype->count; i++)
|
// particle spawning loop
|
||||||
|
for (i = 0; i < count*ptype->count; i++)
|
||||||
|
{
|
||||||
|
if (!free_particles)
|
||||||
|
break;
|
||||||
|
p = free_particles;
|
||||||
|
if (ptype->isbeam)
|
||||||
{
|
{
|
||||||
if (!free_particles)
|
if (!free_beams)
|
||||||
return 0;
|
break;
|
||||||
p = free_particles;
|
if (b)
|
||||||
free_particles = p->next;
|
|
||||||
p->next = ptype->particles;
|
|
||||||
ptype->particles = p;
|
|
||||||
|
|
||||||
p->die = ptype->randdie*frandom();
|
|
||||||
p->scale = ptype->scale+ptype->randscale*frandom();
|
|
||||||
if (ptype->die)
|
|
||||||
p->alpha = ptype->alpha-p->die*(ptype->alpha/ptype->die)*ptype->alphachange;
|
|
||||||
else
|
|
||||||
p->alpha = ptype->alpha;
|
|
||||||
p->color = 0;
|
|
||||||
p->nextemit = particletime + ptype->emitstart - p->die;
|
|
||||||
|
|
||||||
p->rotationspeed = ptype->rotationmin + frandom()*ptype->rotationrand;
|
|
||||||
p->angle = ptype->rotationstartmin + frandom()*ptype->rotationstartrand;
|
|
||||||
|
|
||||||
if (ptype->colorindex >= 0)
|
|
||||||
{
|
{
|
||||||
int cidx;
|
b = b->next = free_beams;
|
||||||
cidx = ptype->colorrand > 0 ? rand() % ptype->colorrand : 0;
|
free_beams = free_beams->next;
|
||||||
cidx = ptype->colorindex + cidx;
|
|
||||||
if (cidx > 255)
|
|
||||||
p->alpha = p->alpha / 2;
|
|
||||||
cidx = d_8to24rgbtable[cidx & 0xff];
|
|
||||||
p->rgb[0] = (cidx & 0xff) * (1/255.0);
|
|
||||||
p->rgb[1] = (cidx >> 8 & 0xff) * (1/255.0);
|
|
||||||
p->rgb[2] = (cidx >> 16 & 0xff) * (1/255.0);
|
|
||||||
}
|
|
||||||
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]);
|
|
||||||
|
|
||||||
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;
|
|
||||||
p->rgb[2] += p->org[2]*ptype->rgbrand[2] + ptype->rgbchange[2]*p->die;
|
|
||||||
|
|
||||||
p->vel[0] = crandom()*ptype->randomvel;
|
|
||||||
p->vel[1] = crandom()*ptype->randomvel;
|
|
||||||
p->vel[2] = crandom()*ptype->randomvelvert;
|
|
||||||
|
|
||||||
// use org to store temp for particle dir
|
|
||||||
p->org[0] = k;
|
|
||||||
p->org[1] = j;
|
|
||||||
p->org[2] = l+4;
|
|
||||||
VectorNormalize(p->org);
|
|
||||||
VectorScale(p->org, 1.0-(frandom())*0.55752, p->org);
|
|
||||||
|
|
||||||
if (dir)
|
|
||||||
{
|
|
||||||
p->vel[0] += dir[0]*ptype->veladd+p->org[0]*ptype->offsetspread;
|
|
||||||
p->vel[1] += dir[1]*ptype->veladd+p->org[1]*ptype->offsetspread;
|
|
||||||
p->vel[2] += dir[2]*ptype->veladd+p->org[2]*ptype->offsetspreadvert;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
p->vel[0] += p->org[0]*ptype->offsetspread;
|
b = bfirst = free_beams;
|
||||||
p->vel[1] += p->org[1]*ptype->offsetspread;
|
free_beams = free_beams->next;
|
||||||
p->vel[2] += p->org[2]*ptype->offsetspreadvert - ptype->veladd;
|
|
||||||
}
|
}
|
||||||
|
b->texture_s = i;
|
||||||
|
b->flags = 0;
|
||||||
|
b->p = p;
|
||||||
|
VectorClear(b->dir);
|
||||||
|
}
|
||||||
|
free_particles = p->next;
|
||||||
|
p->next = ptype->particles;
|
||||||
|
ptype->particles = p;
|
||||||
|
|
||||||
|
p->die = ptype->randdie*frandom();
|
||||||
|
p->scale = ptype->scale+ptype->randscale*frandom();
|
||||||
|
if (ptype->die)
|
||||||
|
p->alpha = ptype->alpha-p->die*(ptype->alpha/ptype->die)*ptype->alphachange;
|
||||||
|
else
|
||||||
|
p->alpha = ptype->alpha;
|
||||||
|
p->color = 0;
|
||||||
|
p->nextemit = particletime + ptype->emitstart - p->die;
|
||||||
|
|
||||||
|
p->rotationspeed = ptype->rotationmin + frandom()*ptype->rotationrand;
|
||||||
|
p->angle = ptype->rotationstartmin + frandom()*ptype->rotationstartrand;
|
||||||
|
|
||||||
|
if (ptype->colorindex >= 0)
|
||||||
|
{
|
||||||
|
int cidx;
|
||||||
|
cidx = ptype->colorrand > 0 ? rand() % ptype->colorrand : 0;
|
||||||
|
cidx = ptype->colorindex + cidx;
|
||||||
|
if (cidx > 255)
|
||||||
|
p->alpha = p->alpha / 2; // Hexen 2 style transparency
|
||||||
|
cidx = d_8to24rgbtable[cidx & 0xff];
|
||||||
|
p->rgb[0] = (cidx & 0xff) * (1/255.0);
|
||||||
|
p->rgb[1] = (cidx >> 8 & 0xff) * (1/255.0);
|
||||||
|
p->rgb[2] = (cidx >> 16 & 0xff) * (1/255.0);
|
||||||
|
}
|
||||||
|
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]);
|
||||||
|
|
||||||
|
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;
|
||||||
|
p->rgb[2] += p->org[2]*ptype->rgbrand[2] + ptype->rgbchange[2]*p->die;
|
||||||
|
|
||||||
|
// randomvel
|
||||||
|
p->vel[0] = crandom()*ptype->randomvel;
|
||||||
|
p->vel[1] = crandom()*ptype->randomvel;
|
||||||
|
p->vel[2] = crandom()*ptype->randomvelvert;
|
||||||
|
|
||||||
|
// handle spawn modes (org/vel)
|
||||||
|
switch (ptype->spawnmode)
|
||||||
|
{
|
||||||
|
case SM_BOX:
|
||||||
|
ofsvec[0] = crandom();
|
||||||
|
ofsvec[1] = crandom();
|
||||||
|
ofsvec[2] = crandom();
|
||||||
|
|
||||||
|
arsvec[0] = ofsvec[0]*ptype->areaspread;
|
||||||
|
arsvec[1] = ofsvec[1]*ptype->areaspread;
|
||||||
|
arsvec[2] = ofsvec[2]*ptype->areaspreadvert;
|
||||||
|
break;
|
||||||
|
case SM_TELEBOX:
|
||||||
|
ofsvec[0] = k;
|
||||||
|
ofsvec[1] = j;
|
||||||
|
ofsvec[2] = l+4;
|
||||||
|
VectorNormalize(ofsvec);
|
||||||
|
VectorScale(ofsvec, 1.0-(frandom())*0.55752, ofsvec);
|
||||||
|
|
||||||
// org is just like the original
|
// org is just like the original
|
||||||
p->org[0] = org[0] + j + (rand()&3);
|
arsvec[0] = j + (rand()&3);
|
||||||
p->org[1] = org[1] + k + (rand()&3);
|
arsvec[1] = k + (rand()&3);
|
||||||
p->org[2] = org[2] + l + (rand()&3) + ptype->offsetup;
|
arsvec[2] = l + (rand()&3);
|
||||||
|
|
||||||
p->die = particletime + ptype->die - p->die;
|
|
||||||
|
|
||||||
// advance telebox loop
|
// advance telebox loop
|
||||||
j += 4;
|
j += 4;
|
||||||
|
@ -1670,93 +1628,19 @@ int R_RunParticleEffectType (vec3_t org, vec3_t dir, float count, int typenum)
|
||||||
l = -ptype->areaspreadvert;
|
l = -ptype->areaspreadvert;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
break;
|
||||||
break;
|
case SM_LAVASPLASH:
|
||||||
case SM_LAVASPLASH:
|
|
||||||
j = k = -ptype->areaspread;
|
|
||||||
|
|
||||||
for (i = 0; i < count*ptype->count; i++)
|
|
||||||
{
|
|
||||||
if (!free_particles)
|
|
||||||
return 0;
|
|
||||||
p = free_particles;
|
|
||||||
free_particles = p->next;
|
|
||||||
p->next = ptype->particles;
|
|
||||||
ptype->particles = p;
|
|
||||||
|
|
||||||
p->die = ptype->randdie*frandom();
|
|
||||||
p->scale = ptype->scale+ptype->randscale*frandom();
|
|
||||||
if (ptype->die)
|
|
||||||
p->alpha = ptype->alpha-p->die*(ptype->alpha/ptype->die)*ptype->alphachange;
|
|
||||||
else
|
|
||||||
p->alpha = ptype->alpha;
|
|
||||||
p->color = 0;
|
|
||||||
p->nextemit = particletime + ptype->emitstart - p->die;
|
|
||||||
|
|
||||||
p->rotationspeed = ptype->rotationmin + frandom()*ptype->rotationrand;
|
|
||||||
p->angle = ptype->rotationstartmin + frandom()*ptype->rotationstartrand;
|
|
||||||
|
|
||||||
if (ptype->colorindex >= 0)
|
|
||||||
{
|
|
||||||
int cidx;
|
|
||||||
cidx = ptype->colorrand > 0 ? rand() % ptype->colorrand : 0;
|
|
||||||
cidx = ptype->colorindex + cidx;
|
|
||||||
if (cidx > 255)
|
|
||||||
p->alpha = p->alpha / 2;
|
|
||||||
cidx = d_8to24rgbtable[cidx & 0xff];
|
|
||||||
p->rgb[0] = (cidx & 0xff) * (1/255.0);
|
|
||||||
p->rgb[1] = (cidx >> 8 & 0xff) * (1/255.0);
|
|
||||||
p->rgb[2] = (cidx >> 16 & 0xff) * (1/255.0);
|
|
||||||
}
|
|
||||||
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]);
|
|
||||||
|
|
||||||
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;
|
|
||||||
p->rgb[2] += p->org[2]*ptype->rgbrand[2] + ptype->rgbchange[2]*p->die;
|
|
||||||
|
|
||||||
p->vel[0] = crandom()*ptype->randomvel;
|
|
||||||
p->vel[1] = crandom()*ptype->randomvel;
|
|
||||||
p->vel[2] = crandom()*ptype->randomvelvert;
|
|
||||||
|
|
||||||
// calc directions, org with temp vector
|
// calc directions, org with temp vector
|
||||||
{
|
ofsvec[0] = k*8 + (rand()&7);
|
||||||
vec3_t temp;
|
ofsvec[1] = j*8 + (rand()&7);
|
||||||
|
ofsvec[2] = 256;
|
||||||
|
|
||||||
temp[0] = k*8 + (rand()&7);
|
arsvec[0] = ofsvec[0];
|
||||||
temp[1] = j*8 + (rand()&7);
|
arsvec[1] = ofsvec[1];
|
||||||
temp[2] = 256;
|
arsvec[2] = frandom()*ptype->areaspreadvert;
|
||||||
|
|
||||||
// calc org first
|
VectorNormalize(ofsvec);
|
||||||
p->org[0] = org[0] + temp[0];
|
VectorScale(ofsvec, 1.0-(frandom())*0.55752, ofsvec);
|
||||||
p->org[1] = org[1] + temp[1];
|
|
||||||
p->org[2] = org[2] + frandom()*ptype->areaspreadvert + ptype->offsetup;
|
|
||||||
|
|
||||||
VectorNormalize(temp);
|
|
||||||
VectorScale(temp, 1.0-(frandom())*0.55752, temp);
|
|
||||||
|
|
||||||
if (dir)
|
|
||||||
{
|
|
||||||
p->vel[0] += dir[0]*ptype->veladd+temp[0]*ptype->offsetspread;
|
|
||||||
p->vel[1] += dir[1]*ptype->veladd+temp[1]*ptype->offsetspread;
|
|
||||||
p->vel[2] += dir[2]*ptype->veladd+temp[2]*ptype->offsetspreadvert;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
p->vel[0] += temp[0]*ptype->offsetspread;
|
|
||||||
p->vel[1] += temp[1]*ptype->offsetspread;
|
|
||||||
p->vel[2] += temp[2]*ptype->offsetspreadvert - ptype->veladd;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
p->die = particletime + ptype->die - p->die;
|
|
||||||
|
|
||||||
// advance splash loop
|
// advance splash loop
|
||||||
j++;
|
j++;
|
||||||
|
@ -1767,91 +1651,76 @@ int R_RunParticleEffectType (vec3_t org, vec3_t dir, float count, int typenum)
|
||||||
if (k >= ptype->areaspread)
|
if (k >= ptype->areaspread)
|
||||||
k = -ptype->areaspread;
|
k = -ptype->areaspread;
|
||||||
}
|
}
|
||||||
}
|
break;
|
||||||
break;
|
case SM_UNICIRCLE:
|
||||||
default: // circle
|
ofsvec[0] = cos(m*i);
|
||||||
for (i = 0; i < count*ptype->count; i++)
|
ofsvec[1] = sin(m*i);
|
||||||
{
|
ofsvec[2] = 0;
|
||||||
if (!free_particles)
|
VectorScale(ofsvec, ptype->areaspread, arsvec);
|
||||||
return 0;
|
break;
|
||||||
p = free_particles;
|
default: // SM_BALL, SM_CIRCLE
|
||||||
free_particles = p->next;
|
ofsvec[0] = hrandom();
|
||||||
p->next = ptype->particles;
|
ofsvec[1] = hrandom();
|
||||||
ptype->particles = p;
|
|
||||||
|
|
||||||
p->die = ptype->randdie*frandom();
|
|
||||||
p->scale = ptype->scale+ptype->randscale*frandom();
|
|
||||||
if (ptype->die)
|
|
||||||
p->alpha = ptype->alpha-p->die*(ptype->alpha/ptype->die)*ptype->alphachange;
|
|
||||||
else
|
|
||||||
p->alpha = ptype->alpha;
|
|
||||||
p->color = 0;
|
|
||||||
p->nextemit = particletime + ptype->emitstart - p->die;
|
|
||||||
|
|
||||||
p->rotationspeed = ptype->rotationmin + frandom()*ptype->rotationrand;
|
|
||||||
p->angle = ptype->rotationstartmin + frandom()*ptype->rotationstartrand;
|
|
||||||
|
|
||||||
if (ptype->colorindex >= 0)
|
|
||||||
{
|
|
||||||
int cidx;
|
|
||||||
cidx = ptype->colorrand > 0 ? rand() % ptype->colorrand : 0;
|
|
||||||
cidx = ptype->colorindex + cidx;
|
|
||||||
if (cidx > 255)
|
|
||||||
p->alpha = p->alpha / 2;
|
|
||||||
cidx = d_8to24rgbtable[cidx & 0xff];
|
|
||||||
p->rgb[0] = (cidx & 0xff) * (1/255.0);
|
|
||||||
p->rgb[1] = (cidx >> 8 & 0xff) * (1/255.0);
|
|
||||||
p->rgb[2] = (cidx >> 16 & 0xff) * (1/255.0);
|
|
||||||
}
|
|
||||||
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]);
|
|
||||||
|
|
||||||
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;
|
|
||||||
p->rgb[2] += p->org[2]*ptype->rgbrand[2] + ptype->rgbchange[2]*p->die;
|
|
||||||
|
|
||||||
p->org[0] = hrandom();
|
|
||||||
p->org[1] = hrandom();
|
|
||||||
if (ptype->areaspreadvert)
|
if (ptype->areaspreadvert)
|
||||||
p->org[2] = hrandom();
|
ofsvec[2] = hrandom();
|
||||||
else
|
else
|
||||||
p->org[2] = 0;
|
ofsvec[2] = 0;
|
||||||
|
|
||||||
VectorNormalize(p->org);
|
VectorNormalize(ofsvec);
|
||||||
if (ptype->spawnmode != SM_CIRCLE)
|
if (ptype->spawnmode != SM_CIRCLE)
|
||||||
VectorScale(p->org, frandom(), p->org);
|
VectorScale(ofsvec, frandom(), ofsvec);
|
||||||
|
|
||||||
p->vel[0] = crandom()*ptype->randomvel;
|
arsvec[0] = ofsvec[0]*ptype->areaspread;
|
||||||
p->vel[1] = crandom()*ptype->randomvel;
|
arsvec[1] = ofsvec[1]*ptype->areaspread;
|
||||||
p->vel[2] = crandom()*ptype->randomvelvert;
|
arsvec[2] = ofsvec[2]*ptype->areaspreadvert;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (dir)
|
// 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;
|
||||||
|
}
|
||||||
|
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[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;
|
||||||
|
}
|
||||||
|
|
||||||
|
// update beam list
|
||||||
|
if (ptype->isbeam)
|
||||||
|
{
|
||||||
|
if (b)
|
||||||
|
{
|
||||||
|
// update dir for bfirst for certain modes since it will never get updated
|
||||||
|
switch (ptype->spawnmode)
|
||||||
{
|
{
|
||||||
p->vel[0] += dir[0]*ptype->veladd+org[0]*ptype->offsetspread;
|
case SM_UNICIRCLE:
|
||||||
p->vel[1] += dir[1]*ptype->veladd+org[1]*ptype->offsetspread;
|
// kinda hackish here, assuming ofsvec contains the point at i-1
|
||||||
p->vel[2] += dir[2]*ptype->veladd+org[2]*ptype->offsetspreadvert;
|
arsvec[0] = cos(m*(i-2));
|
||||||
|
arsvec[1] = sin(m*(i-2));
|
||||||
|
arsvec[2] = 0;
|
||||||
|
VectorSubtract(ofsvec, arsvec, bfirst->dir);
|
||||||
|
VectorNormalize(bfirst->dir);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
p->vel[0] += p->org[0]*ptype->offsetspread;
|
|
||||||
p->vel[1] += p->org[1]*ptype->offsetspread;
|
|
||||||
p->vel[2] += p->org[2]*ptype->offsetspreadvert - ptype->veladd;
|
|
||||||
|
|
||||||
}
|
b->flags |= BS_NODRAW;
|
||||||
p->org[0] = org[0] + p->org[0]*ptype->areaspread;
|
b->next = ptype->beams;
|
||||||
p->org[1] = org[1] + p->org[1]*ptype->areaspread;
|
ptype->beams = bfirst;
|
||||||
p->org[2] = org[2] + p->org[2]*ptype->areaspreadvert + ptype->offsetup;
|
|
||||||
|
|
||||||
p->die = particletime + ptype->die - p->die;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// go to next associated effect
|
||||||
if (ptype->assoc < 0)
|
if (ptype->assoc < 0)
|
||||||
break;
|
break;
|
||||||
ptype = &part_type[ptype->assoc];
|
ptype = &part_type[ptype->assoc];
|
||||||
|
@ -2139,7 +2008,6 @@ int R_RocketTrail (vec3_t start, vec3_t end, int type, trailstate_t *ts)
|
||||||
}
|
}
|
||||||
|
|
||||||
p = free_particles;
|
p = free_particles;
|
||||||
|
|
||||||
if (ptype->isbeam)
|
if (ptype->isbeam)
|
||||||
{
|
{
|
||||||
if (!free_beams)
|
if (!free_beams)
|
||||||
|
@ -2157,7 +2025,7 @@ int R_RocketTrail (vec3_t start, vec3_t end, int type, trailstate_t *ts)
|
||||||
b = bfirst = free_beams;
|
b = bfirst = free_beams;
|
||||||
free_beams = free_beams->next;
|
free_beams = free_beams->next;
|
||||||
}
|
}
|
||||||
b->texture_s = len;
|
b->texture_s = len; // not sure how to calc this
|
||||||
b->flags = 0;
|
b->flags = 0;
|
||||||
b->p = p;
|
b->p = p;
|
||||||
VectorCopy(vec, b->dir);
|
VectorCopy(vec, b->dir);
|
||||||
|
@ -2328,7 +2196,6 @@ int R_RocketTrail (vec3_t start, vec3_t end, int type, trailstate_t *ts)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2489,10 +2356,9 @@ void GL_DrawTexturedParticle(particle_t *p, part_type_t *type)
|
||||||
+ (p->org[2] - r_origin[2])*vpn[2];
|
+ (p->org[2] - r_origin[2])*vpn[2];
|
||||||
scale = (scale*p->scale)*(type->invscalefactor) + p->scale * (type->scalefactor*250);
|
scale = (scale*p->scale)*(type->invscalefactor) + p->scale * (type->scalefactor*250);
|
||||||
if (scale < 20)
|
if (scale < 20)
|
||||||
scale = 1;
|
scale = 0.25;
|
||||||
else
|
else
|
||||||
scale = 1 + scale * 0.004;
|
scale = 0.25 + scale * 0.001;
|
||||||
scale/=4;
|
|
||||||
|
|
||||||
glColor4f ( p->rgb[0],
|
glColor4f ( p->rgb[0],
|
||||||
p->rgb[1],
|
p->rgb[1],
|
||||||
|
@ -2543,11 +2409,9 @@ void GL_DrawTrifanParticle(particle_t *p, part_type_t *type)
|
||||||
+ (p->org[2] - r_origin[2])*vpn[2];
|
+ (p->org[2] - r_origin[2])*vpn[2];
|
||||||
scale = (scale*p->scale)*(type->invscalefactor) + p->scale * (type->scalefactor*250);
|
scale = (scale*p->scale)*(type->invscalefactor) + p->scale * (type->scalefactor*250);
|
||||||
if (scale < 20)
|
if (scale < 20)
|
||||||
scale = 1;
|
scale = 0.05;
|
||||||
else
|
else
|
||||||
scale = 1 + scale * 0.004;
|
scale = 0.05 + scale * 0.0002;
|
||||||
scale/=4;
|
|
||||||
scale/=5;
|
|
||||||
/*
|
/*
|
||||||
if ((p->vel[0]*p->vel[0]+p->vel[1]*p->vel[1]+p->vel[2]*p->vel[2])*2*scale > 30*30)
|
if ((p->vel[0]*p->vel[0]+p->vel[1]*p->vel[1]+p->vel[2]*p->vel[2])*2*scale > 30*30)
|
||||||
scale = 1+1/30/Length(p->vel)*2;*/
|
scale = 1+1/30/Length(p->vel)*2;*/
|
||||||
|
@ -3056,9 +2920,9 @@ void DrawParticleTypes (void texturedparticles(particle_t *,part_type_t*), void
|
||||||
|
|
||||||
VectorMA(p->vel, dist, normal, p->vel);
|
VectorMA(p->vel, dist, normal, p->vel);
|
||||||
VectorCopy(stop, p->org);
|
VectorCopy(stop, p->org);
|
||||||
p->vel[0] *= 0.8;
|
p->vel[0] *= type->clipbounce;
|
||||||
p->vel[1] *= 0.8;
|
p->vel[1] *= type->clipbounce;
|
||||||
p->vel[2] *= 0.8;
|
p->vel[2] *= type->clipbounce;
|
||||||
|
|
||||||
if (!*type->texname && Length(p->vel)<1000*pframetime && !type->isbeam)
|
if (!*type->texname && Length(p->vel)<1000*pframetime && !type->isbeam)
|
||||||
p->die = -1;
|
p->die = -1;
|
||||||
|
|
Loading…
Reference in a new issue