added particle fields beamtexstep/beamtexspeed for beam texture manipulation, added alphadelta which obsoletes alphachange

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@1955 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
TimeServ 2006-02-11 23:41:40 +00:00
parent 781e8ee38f
commit 484cf48e82
5 changed files with 69 additions and 53 deletions

View File

@ -174,7 +174,7 @@ typedef struct {
break; \ break; \
} }
// TODO: merge in alpha with rgb to gain benefit of vector opts
typedef struct part_type_s { typedef struct part_type_s {
char name[MAX_QPATH]; char name[MAX_QPATH];
char texname[MAX_QPATH]; char texname[MAX_QPATH];
@ -415,6 +415,7 @@ void P_ParticleEffect_f(void)
beamseg_t *beamsegs; beamseg_t *beamsegs;
skytris_t *st; skytris_t *st;
qboolean settype = false; qboolean settype = false;
qboolean setalphadelta = false;
part_type_t *ptype; part_type_t *ptype;
int pnum, assoc; int pnum, assoc;
@ -523,7 +524,14 @@ void P_ParticleEffect_f(void)
else else
ptype->rotationrand = 0; ptype->rotationrand = 0;
} }
else if (!strcmp(var, "beamtexstep"))
{
ptype->rotationstartmin = 1/atof(value);
}
else if (!strcmp(var, "beamtexspeed"))
{
ptype->rotationmin = atof(value);
}
else if (!strcmp(var, "scale")) else if (!strcmp(var, "scale"))
{ {
ptype->scale = atof(value); ptype->scale = atof(value);
@ -555,7 +563,15 @@ void P_ParticleEffect_f(void)
else if (!strcmp(var, "alpha")) else if (!strcmp(var, "alpha"))
ptype->alpha = atof(value); ptype->alpha = atof(value);
else if (!strcmp(var, "alphachange")) else if (!strcmp(var, "alphachange"))
{
Con_DPrintf("alphachange is deprechiated, use alphadelta\n");
ptype->alphachange = atof(value); ptype->alphachange = atof(value);
}
else if (!strcmp(var, "alphadelta"))
{
ptype->alphachange = atof(value);
setalphadelta = true;
}
else if (!strcmp(var, "die")) else if (!strcmp(var, "die"))
ptype->die = atof(value); ptype->die = atof(value);
else if (!strcmp(var, "diesubrand")) else if (!strcmp(var, "diesubrand"))
@ -958,6 +974,10 @@ void P_ParticleEffect_f(void)
} }
} }
// use old behavior if not using alphadelta
if (!setalphadelta)
ptype->alphachange = (-ptype->alphachange / ptype->die) * ptype->alpha;
if (ptype->rampmode && !ptype->ramp) if (ptype->rampmode && !ptype->ramp)
{ {
ptype->rampmode = RAMP_NONE; ptype->rampmode = RAMP_NONE;
@ -2039,7 +2059,7 @@ int P_RunParticleEffectState (vec3_t org, vec3_t dir, float count, int typenum,
d->die = ptype->randdie*frandom(); d->die = ptype->randdie*frandom();
if (ptype->die) if (ptype->die)
d->alpha = ptype->alpha-d->die*(ptype->alpha/ptype->die)*ptype->alphachange; d->alpha = ptype->alpha+d->die*ptype->alphachange;
else else
d->alpha = ptype->alpha; d->alpha = ptype->alpha;
@ -2180,7 +2200,7 @@ int P_RunParticleEffectState (vec3_t org, vec3_t dir, float count, int typenum,
p->die = ptype->randdie*frandom(); p->die = ptype->randdie*frandom();
p->scale = ptype->scale+ptype->randscale*frandom(); p->scale = ptype->scale+ptype->randscale*frandom();
if (ptype->die) if (ptype->die)
p->alpha = ptype->alpha-p->die*(ptype->alpha/ptype->die)*ptype->alphachange; p->alpha = ptype->alpha+p->die*ptype->alphachange;
else else
p->alpha = ptype->alpha; p->alpha = ptype->alpha;
// p->color = 0; // p->color = 0;
@ -2880,7 +2900,7 @@ static void P_ParticleTrailDraw (vec3_t startpos, vec3_t end, part_type_t *ptype
p->die = ptype->randdie*frandom(); p->die = ptype->randdie*frandom();
p->scale = ptype->scale+ptype->randscale*frandom(); p->scale = ptype->scale+ptype->randscale*frandom();
if (ptype->die) if (ptype->die)
p->alpha = ptype->alpha-p->die*(ptype->alpha/ptype->die)*ptype->alphachange; p->alpha = ptype->alpha+p->die*ptype->alphachange;
else else
p->alpha = ptype->alpha; p->alpha = ptype->alpha;
// p->color = 0; // p->color = 0;
@ -3562,7 +3582,7 @@ void GL_DrawParticleBeam_Textured(beamseg_t *b, part_type_t *type)
VectorSubtract(r_refdef.vieworg, q->org, v); VectorSubtract(r_refdef.vieworg, q->org, v);
VectorNormalize(v); VectorNormalize(v);
CrossProduct(c->dir, v, cr); CrossProduct(c->dir, v, cr);
ts = (c->texture_s*type->rotationstartmin + particletime*type->rotationmin)/754; ts = c->texture_s*type->rotationstartmin + particletime*type->rotationmin;
VectorMA(q->org, -q->scale, cr, point); VectorMA(q->org, -q->scale, cr, point);
qglTexCoord2f(ts, 0); qglTexCoord2f(ts, 0);
@ -3579,7 +3599,7 @@ void GL_DrawParticleBeam_Textured(beamseg_t *b, part_type_t *type)
VectorSubtract(r_refdef.vieworg, p->org, v); VectorSubtract(r_refdef.vieworg, p->org, v);
VectorNormalize(v); VectorNormalize(v);
CrossProduct(b->dir, v, cr); // replace with old p->dir? CrossProduct(b->dir, v, cr); // replace with old p->dir?
ts = (b->texture_s*type->rotationstartmin + particletime*type->rotationmin)/754; ts = b->texture_s*type->rotationstartmin + particletime*type->rotationmin;
VectorMA(p->org, p->scale, cr, point); VectorMA(p->org, p->scale, cr, point);
qglTexCoord2f(ts, 1); qglTexCoord2f(ts, 1);
@ -3933,7 +3953,7 @@ void DrawParticleTypes (void texturedparticles(particle_t *,part_type_t*), void
d->rgb[1] += pframetime*type->rgbchange[1]; d->rgb[1] += pframetime*type->rgbchange[1];
d->rgb[2] += pframetime*type->rgbchange[2]; d->rgb[2] += pframetime*type->rgbchange[2];
} }
d->alpha -= pframetime*(type->alpha/type->die)*type->alphachange; d->alpha += pframetime*type->alphachange;
} }
drawdecalparticles(d, type); drawdecalparticles(d, type);
@ -4198,7 +4218,7 @@ void DrawParticleTypes (void texturedparticles(particle_t *,part_type_t*), void
p->rgb[1] += pframetime*type->rgbchange[1]; p->rgb[1] += pframetime*type->rgbchange[1];
p->rgb[2] += pframetime*type->rgbchange[2]; p->rgb[2] += pframetime*type->rgbchange[2];
} }
p->alpha -= pframetime*(type->alpha/type->die)*type->alphachange; p->alpha += pframetime*type->alphachange;
p->scale += pframetime*type->scaledelta; p->scale += pframetime*type->scaledelta;
} }

View File

@ -123,7 +123,6 @@ char *particle_set_spikeset =
"randomvel 64\n" "randomvel 64\n"
"veladd 10\n" "veladd 10\n"
"rotationspeed 90\n" "rotationspeed 90\n"
"rotationstart 0 360\n"
"rgb 128 0 0\n" "rgb 128 0 0\n"
"gravity 200\n" "gravity 200\n"
"scalefactor 0.8\n" "scalefactor 0.8\n"
@ -141,7 +140,6 @@ char *particle_set_spikeset =
"randomvel 64\n" "randomvel 64\n"
"veladd 10\n" "veladd 10\n"
"rotationspeed 90\n" "rotationspeed 90\n"
"rotationstart 0 360\n"
"rgb 32 0 0\n" "rgb 32 0 0\n"
"gravity 200\n" "gravity 200\n"
"scalefactor 0.8\n" "scalefactor 0.8\n"
@ -226,7 +224,6 @@ char *particle_set_spikeset =
"gravity 200\n" "gravity 200\n"
"stains 2\n" "stains 2\n"
"scalefactor 0.9\n" "scalefactor 0.9\n"
"rotationstart 0 360\n"
"}\n" "}\n"
//nq blood //nq blood
@ -243,7 +240,6 @@ char *particle_set_spikeset =
"gravity 200\n" "gravity 200\n"
"stains 2\n" "stains 2\n"
"scalefactor 0.9\n" "scalefactor 0.9\n"
"rotationstart 0 360\n"
"}\n" "}\n"
///////////////////////////////////////////////// /////////////////////////////////////////////////
@ -555,7 +551,7 @@ char *particle_set_spikeset =
"count 1\n" "count 1\n"
"scale 400\n" "scale 400\n"
"scaledelta -4000\n" "scaledelta -4000\n"
"alphachange 0\n" "alphadelta 0\n"
"rgb 192 160 255\n" "rgb 192 160 255\n"
"blend add\n" "blend add\n"
"scalefactor 1\n" "scalefactor 1\n"
@ -730,7 +726,7 @@ char *particle_set_spikeset =
"scale 4\n" "scale 4\n"
"veladd 15\n" "veladd 15\n"
"die 0.4\n" "die 0.4\n"
"alphachange 0\n" "alphadelta 0\n"
"diesubrand 0.4\n" "diesubrand 0.4\n"
"gravity 40\n" "gravity 40\n"
"spawnorg 8\n" "spawnorg 8\n"
@ -754,7 +750,7 @@ char *particle_set_spikeset =
"count 1\n" "count 1\n"
"scale 50\n" "scale 50\n"
"die 30\n" "die 30\n"
"alphachange 0\n" "alphadelta 0\n"
"rgb 255 255 0\n" "rgb 255 255 0\n"
"}\n" "}\n"
@ -773,7 +769,7 @@ char *particle_set_faithful =
"step 3\n" "step 3\n"
"scale 4\n" "scale 4\n"
"die 2\n" "die 2\n"
"alphachange 0\n" "alphadelta 0\n"
"randomvel 80\n" "randomvel 80\n"
"veladd 100\n" "veladd 100\n"
"colorindex 67 4\n" "colorindex 67 4\n"
@ -788,7 +784,7 @@ char *particle_set_faithful =
"step 6\n" "step 6\n"
"scale 4\n" "scale 4\n"
"die 2\n" "die 2\n"
"alphachange 0\n" "alphadelta 0\n"
"randomvel 72\n" "randomvel 72\n"
"veladd 100\n" "veladd 100\n"
"colorindex 67 4\n" "colorindex 67 4\n"
@ -803,7 +799,7 @@ char *particle_set_faithful =
"step 3\n" "step 3\n"
"scale 4\n" "scale 4\n"
"die 0.3\n" "die 0.3\n"
"alphachange 0\n" "alphadelta 0\n"
"colorindex 152 4\n" "colorindex 152 4\n"
"spawnorg 8\n" "spawnorg 8\n"
"}\n" "}\n"
@ -814,7 +810,7 @@ char *particle_set_faithful =
"step 3\n" "step 3\n"
"scale 4\n" "scale 4\n"
"die 0.5\n" "die 0.5\n"
"alphachange 0\n" "alphadelta 0\n"
"colorindex 52\n" "colorindex 52\n"
"citracer\n" "citracer\n"
"spawnvel 30 0\n" "spawnvel 30 0\n"
@ -827,7 +823,7 @@ char *particle_set_faithful =
"step 3\n" "step 3\n"
"scale 4\n" "scale 4\n"
"die 0.5\n" "die 0.5\n"
"alphachange 0\n" "alphadelta 0\n"
"colorindex 230\n" "colorindex 230\n"
"citracer\n" "citracer\n"
"spawnvel 30 0\n" "spawnvel 30 0\n"
@ -888,7 +884,7 @@ char *particle_set_faithful =
"scale 4\n" "scale 4\n"
"veladd 15\n" "veladd 15\n"
"die 0.4\n" "die 0.4\n"
"alphachange 0\n" "alphadelta 0\n"
"diesubrand 0.4\n" "diesubrand 0.4\n"
"gravity 40\n" "gravity 40\n"
"spawnorg 24\n" "spawnorg 24\n"
@ -901,7 +897,7 @@ char *particle_set_faithful =
"scale 4\n" "scale 4\n"
"veladd 15\n" "veladd 15\n"
"die 0.4\n" "die 0.4\n"
"alphachange 0\n" "alphadelta 0\n"
"diesubrand 0.4\n" "diesubrand 0.4\n"
"gravity 40\n" "gravity 40\n"
"spawnorg 16\n" "spawnorg 16\n"
@ -914,7 +910,7 @@ char *particle_set_faithful =
"scale 4\n" "scale 4\n"
"veladd 15\n" "veladd 15\n"
"die 0.4\n" "die 0.4\n"
"alphachange 0\n" "alphadelta 0\n"
"diesubrand 0.4\n" "diesubrand 0.4\n"
"gravity 40\n" "gravity 40\n"
"spawnorg 8\n" "spawnorg 8\n"
@ -925,7 +921,7 @@ char *particle_set_faithful =
"texture \"particles/quake\"\n" "texture \"particles/quake\"\n"
"count 512\n" "count 512\n"
"scale 4\n" "scale 4\n"
"alphachange 0\n" "alphadelta 0\n"
"die 0.5333\n" "die 0.5333\n"
"diesubrand 0.2667\n" "diesubrand 0.2667\n"
"rampmode absolute\n" "rampmode absolute\n"
@ -957,7 +953,7 @@ char *particle_set_faithful =
"texture \"particles/quake\"\n" "texture \"particles/quake\"\n"
"count 256\n" "count 256\n"
"scale 4\n" "scale 4\n"
"alphachange 0\n" "alphadelta 0\n"
"die 1.4\n" "die 1.4\n"
"colorindex 150 6\n" "colorindex 150 6\n"
"gravity 40\n" "gravity 40\n"
@ -970,7 +966,7 @@ char *particle_set_faithful =
"texture \"particles/quake\"\n" "texture \"particles/quake\"\n"
"count 256\n" "count 256\n"
"scale 4\n" "scale 4\n"
"alphachange 0\n" "alphadelta 0\n"
"die 1.4\n" "die 1.4\n"
"colorindex 66 6\n" "colorindex 66 6\n"
"gravity 40\n" "gravity 40\n"
@ -985,7 +981,7 @@ char *particle_set_faithful =
"texture \"particles/quake\"\n" "texture \"particles/quake\"\n"
"count 256\n" "count 256\n"
"scale 4\n" "scale 4\n"
"alphachange 0\n" "alphadelta 0\n"
"die 1\n" "die 1\n"
"colorindex 150 6\n" "colorindex 150 6\n"
"gravity 40\n" "gravity 40\n"
@ -999,7 +995,7 @@ char *particle_set_faithful =
"texture \"particles/quake\"\n" "texture \"particles/quake\"\n"
"count 256\n" "count 256\n"
"scale 4\n" "scale 4\n"
"alphachange 0\n" "alphadelta 0\n"
"die 1\n" "die 1\n"
"colorindex 66 6\n" "colorindex 66 6\n"
"gravity 40\n" "gravity 40\n"
@ -1014,7 +1010,7 @@ char *particle_set_faithful =
"texture \"particles/quake\"\n" "texture \"particles/quake\"\n"
"count 896\n" "count 896\n"
"scale 4\n" "scale 4\n"
"alphachange 0\n" "alphadelta 0\n"
"die 0.34\n" "die 0.34\n"
"diesubrand 0.14\n" "diesubrand 0.14\n"
"colorindex 7 8\n" "colorindex 7 8\n"
@ -1030,7 +1026,7 @@ char *particle_set_faithful =
"texture \"particles/quake\"\n" "texture \"particles/quake\"\n"
"count 1024\n" "count 1024\n"
"scale 4\n" "scale 4\n"
"alphachange 0\n" "alphadelta 0\n"
"die 2.62\n" "die 2.62\n"
"diesubrand 0.62\n" "diesubrand 0.62\n"
"colorindex 224 8\n" "colorindex 224 8\n"
@ -1057,7 +1053,7 @@ char *particle_set_faithful =
"count 1\n" "count 1\n"
"scale 4\n" "scale 4\n"
"die 30\n" "die 30\n"
"alphachange 0\n" "alphadelta 0\n"
"rgb 255 255 0\n" "rgb 255 255 0\n"
"}\n"; "}\n";
@ -1304,7 +1300,7 @@ char *particle_set_highfps =
"count 1\n" "count 1\n"
"scale 50\n" "scale 50\n"
"die 30\n" "die 30\n"
"alphachange 0\n" "alphadelta 0\n"
"rgb 255 255 0\n" "rgb 255 255 0\n"
"}\n"; "}\n";

View File

@ -5,7 +5,7 @@ r_part t_gib
step 3 step 3
scale 4 scale 4
die 2 die 2
alphachange 0 alphadelta 0
randomvel 80 randomvel 80
veladd 100 veladd 100
colorindex 67 4 colorindex 67 4
@ -20,7 +20,7 @@ r_part t_zomgib
step 6 step 6
scale 4 scale 4
die 2 die 2
alphachange 0 alphadelta 0
randomvel 72 randomvel 72
veladd 100 veladd 100
colorindex 67 4 colorindex 67 4
@ -35,7 +35,7 @@ r_part t_tracer3
step 3 step 3
scale 4 scale 4
die 0.3 die 0.3
alphachange 0 alphadelta 0
colorindex 152 4 colorindex 152 4
spawnorg 8 spawnorg 8
} }
@ -46,7 +46,7 @@ r_part t_tracer
step 3 step 3
scale 4 scale 4
die 0.5 die 0.5
alphachange 0 alphadelta 0
colorindex 52 colorindex 52
citracer citracer
spawnvel 30 0 spawnvel 30 0
@ -59,7 +59,7 @@ r_part t_tracer2
step 3 step 3
scale 4 scale 4
die 0.5 die 0.5
alphachange 0 alphadelta 0
colorindex 230 colorindex 230
citracer citracer
spawnvel 30 0 spawnvel 30 0
@ -120,7 +120,7 @@ r_part pe_size3
scale 4 scale 4
veladd 15 veladd 15
die 0.4 die 0.4
alphachange 0 alphadelta 0
diesubrand 0.4 diesubrand 0.4
gravity 40 gravity 40
spawnorg 24 spawnorg 24
@ -133,7 +133,7 @@ r_part pe_size2
scale 4 scale 4
veladd 15 veladd 15
die 0.4 die 0.4
alphachange 0 alphadelta 0
diesubrand 0.4 diesubrand 0.4
gravity 40 gravity 40
spawnorg 16 spawnorg 16
@ -146,7 +146,7 @@ r_part pe_default
scale 4 scale 4
veladd 15 veladd 15
die 0.4 die 0.4
alphachange 0 alphadelta 0
diesubrand 0.4 diesubrand 0.4
gravity 40 gravity 40
spawnorg 8 spawnorg 8
@ -157,7 +157,7 @@ r_part explode2
texture "particles/quake" texture "particles/quake"
count 512 count 512
scale 4 scale 4
alphachange 0 alphadelta 0
die 0.5333 die 0.5333
diesubrand 0.2667 diesubrand 0.2667
rampmode absolute rampmode absolute
@ -189,7 +189,7 @@ r_part blobexp2b
texture "particles/quake" texture "particles/quake"
count 256 count 256
scale 4 scale 4
alphachange 0 alphadelta 0
die 1.4 die 1.4
colorindex 150 6 colorindex 150 6
gravity 40 gravity 40
@ -202,7 +202,7 @@ r_part blobexp1b
texture "particles/quake" texture "particles/quake"
count 256 count 256
scale 4 scale 4
alphachange 0 alphadelta 0
die 1.4 die 1.4
colorindex 66 6 colorindex 66 6
gravity 40 gravity 40
@ -217,7 +217,7 @@ r_part blobexp2
texture "particles/quake" texture "particles/quake"
count 256 count 256
scale 4 scale 4
alphachange 0 alphadelta 0
die 1 die 1
colorindex 150 6 colorindex 150 6
gravity 40 gravity 40
@ -231,7 +231,7 @@ r_part te_blob
texture "particles/quake" texture "particles/quake"
count 256 count 256
scale 4 scale 4
alphachange 0 alphadelta 0
die 1 die 1
colorindex 66 6 colorindex 66 6
gravity 40 gravity 40
@ -246,7 +246,7 @@ r_part te_teleportsplash
texture "particles/quake" texture "particles/quake"
count 896 count 896
scale 4 scale 4
alphachange 0 alphadelta 0
die 0.34 die 0.34
diesubrand 0.14 diesubrand 0.14
colorindex 7 8 colorindex 7 8
@ -262,7 +262,7 @@ r_part te_lavasplash
texture "particles/quake" texture "particles/quake"
count 1024 count 1024
scale 4 scale 4
alphachange 0 alphadelta 0
die 2.62 die 2.62
diesubrand 0.62 diesubrand 0.62
colorindex 224 8 colorindex 224 8
@ -289,7 +289,7 @@ r_part pe_pointfile
count 1 count 1
scale 4 scale 4
die 30 die 30
alphachange 0 alphadelta 0
rgb 255 255 0 rgb 255 255 0
} }

View File

@ -240,7 +240,7 @@ r_part pe_pointfile
count 1 count 1
scale 50 scale 50
die 30 die 30
alphachange 0 alphadelta 0
rgb 255 255 0 rgb 255 255 0
} }

View File

@ -552,7 +552,7 @@ r_part empflash
count 1 count 1
scale 400 scale 400
scaledelta -4000 scaledelta -4000
alphachange 0 alphadelta 0
rgb 192 160 255 rgb 192 160 255
blend add blend add
scalefactor 1 scalefactor 1
@ -727,7 +727,7 @@ r_part pe_default
scale 4 scale 4
veladd 15 veladd 15
die 0.4 die 0.4
alphachange 0 alphadelta 0
diesubrand 0.4 diesubrand 0.4
gravity 40 gravity 40
spawnorg 8 spawnorg 8
@ -751,7 +751,7 @@ r_part pe_pointfile
count 1 count 1
scale 50 scale 50
die 30 die 30
alphachange 0 alphadelta 0
rgb 255 255 0 rgb 255 255 0
} }