From 484cf48e82bab6e0fbe9c659ea80c441f21e2502 Mon Sep 17 00:00:00 2001 From: TimeServ Date: Sat, 11 Feb 2006 23:41:40 +0000 Subject: [PATCH] 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 --- engine/client/r_part.c | 38 +++++++++++++++++++++++-------- engine/client/r_partset.c | 44 ++++++++++++++++-------------------- engine/partcfgs/faithful.cfg | 32 +++++++++++++------------- engine/partcfgs/highfps.cfg | 2 +- engine/partcfgs/spikeset.cfg | 6 ++--- 5 files changed, 69 insertions(+), 53 deletions(-) diff --git a/engine/client/r_part.c b/engine/client/r_part.c index 87ba1d1ff..98612c9d6 100644 --- a/engine/client/r_part.c +++ b/engine/client/r_part.c @@ -174,7 +174,7 @@ typedef struct { break; \ } - +// TODO: merge in alpha with rgb to gain benefit of vector opts typedef struct part_type_s { char name[MAX_QPATH]; char texname[MAX_QPATH]; @@ -415,6 +415,7 @@ void P_ParticleEffect_f(void) beamseg_t *beamsegs; skytris_t *st; qboolean settype = false; + qboolean setalphadelta = false; part_type_t *ptype; int pnum, assoc; @@ -523,7 +524,14 @@ void P_ParticleEffect_f(void) else 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")) { ptype->scale = atof(value); @@ -555,7 +563,15 @@ void P_ParticleEffect_f(void) else if (!strcmp(var, "alpha")) ptype->alpha = atof(value); else if (!strcmp(var, "alphachange")) + { + Con_DPrintf("alphachange is deprechiated, use alphadelta\n"); ptype->alphachange = atof(value); + } + else if (!strcmp(var, "alphadelta")) + { + ptype->alphachange = atof(value); + setalphadelta = true; + } else if (!strcmp(var, "die")) ptype->die = atof(value); 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) { 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(); if (ptype->die) - d->alpha = ptype->alpha-d->die*(ptype->alpha/ptype->die)*ptype->alphachange; + d->alpha = ptype->alpha+d->die*ptype->alphachange; else 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->scale = ptype->scale+ptype->randscale*frandom(); if (ptype->die) - p->alpha = ptype->alpha-p->die*(ptype->alpha/ptype->die)*ptype->alphachange; + p->alpha = ptype->alpha+p->die*ptype->alphachange; else p->alpha = ptype->alpha; // 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->scale = ptype->scale+ptype->randscale*frandom(); if (ptype->die) - p->alpha = ptype->alpha-p->die*(ptype->alpha/ptype->die)*ptype->alphachange; + p->alpha = ptype->alpha+p->die*ptype->alphachange; else p->alpha = ptype->alpha; // 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); VectorNormalize(v); 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); 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); VectorNormalize(v); 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); 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[2] += pframetime*type->rgbchange[2]; } - d->alpha -= pframetime*(type->alpha/type->die)*type->alphachange; + d->alpha += pframetime*type->alphachange; } 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[2] += pframetime*type->rgbchange[2]; } - p->alpha -= pframetime*(type->alpha/type->die)*type->alphachange; + p->alpha += pframetime*type->alphachange; p->scale += pframetime*type->scaledelta; } diff --git a/engine/client/r_partset.c b/engine/client/r_partset.c index 7bc666a61..95e49347d 100644 --- a/engine/client/r_partset.c +++ b/engine/client/r_partset.c @@ -123,7 +123,6 @@ char *particle_set_spikeset = "randomvel 64\n" "veladd 10\n" "rotationspeed 90\n" -"rotationstart 0 360\n" "rgb 128 0 0\n" "gravity 200\n" "scalefactor 0.8\n" @@ -141,7 +140,6 @@ char *particle_set_spikeset = "randomvel 64\n" "veladd 10\n" "rotationspeed 90\n" -"rotationstart 0 360\n" "rgb 32 0 0\n" "gravity 200\n" "scalefactor 0.8\n" @@ -226,7 +224,6 @@ char *particle_set_spikeset = "gravity 200\n" "stains 2\n" "scalefactor 0.9\n" -"rotationstart 0 360\n" "}\n" //nq blood @@ -243,7 +240,6 @@ char *particle_set_spikeset = "gravity 200\n" "stains 2\n" "scalefactor 0.9\n" -"rotationstart 0 360\n" "}\n" ///////////////////////////////////////////////// @@ -555,7 +551,7 @@ char *particle_set_spikeset = "count 1\n" "scale 400\n" "scaledelta -4000\n" -"alphachange 0\n" +"alphadelta 0\n" "rgb 192 160 255\n" "blend add\n" "scalefactor 1\n" @@ -730,7 +726,7 @@ char *particle_set_spikeset = "scale 4\n" "veladd 15\n" "die 0.4\n" -"alphachange 0\n" +"alphadelta 0\n" "diesubrand 0.4\n" "gravity 40\n" "spawnorg 8\n" @@ -754,7 +750,7 @@ char *particle_set_spikeset = "count 1\n" "scale 50\n" "die 30\n" -"alphachange 0\n" +"alphadelta 0\n" "rgb 255 255 0\n" "}\n" @@ -773,7 +769,7 @@ char *particle_set_faithful = "step 3\n" "scale 4\n" "die 2\n" -"alphachange 0\n" +"alphadelta 0\n" "randomvel 80\n" "veladd 100\n" "colorindex 67 4\n" @@ -788,7 +784,7 @@ char *particle_set_faithful = "step 6\n" "scale 4\n" "die 2\n" -"alphachange 0\n" +"alphadelta 0\n" "randomvel 72\n" "veladd 100\n" "colorindex 67 4\n" @@ -803,7 +799,7 @@ char *particle_set_faithful = "step 3\n" "scale 4\n" "die 0.3\n" -"alphachange 0\n" +"alphadelta 0\n" "colorindex 152 4\n" "spawnorg 8\n" "}\n" @@ -814,7 +810,7 @@ char *particle_set_faithful = "step 3\n" "scale 4\n" "die 0.5\n" -"alphachange 0\n" +"alphadelta 0\n" "colorindex 52\n" "citracer\n" "spawnvel 30 0\n" @@ -827,7 +823,7 @@ char *particle_set_faithful = "step 3\n" "scale 4\n" "die 0.5\n" -"alphachange 0\n" +"alphadelta 0\n" "colorindex 230\n" "citracer\n" "spawnvel 30 0\n" @@ -888,7 +884,7 @@ char *particle_set_faithful = "scale 4\n" "veladd 15\n" "die 0.4\n" -"alphachange 0\n" +"alphadelta 0\n" "diesubrand 0.4\n" "gravity 40\n" "spawnorg 24\n" @@ -901,7 +897,7 @@ char *particle_set_faithful = "scale 4\n" "veladd 15\n" "die 0.4\n" -"alphachange 0\n" +"alphadelta 0\n" "diesubrand 0.4\n" "gravity 40\n" "spawnorg 16\n" @@ -914,7 +910,7 @@ char *particle_set_faithful = "scale 4\n" "veladd 15\n" "die 0.4\n" -"alphachange 0\n" +"alphadelta 0\n" "diesubrand 0.4\n" "gravity 40\n" "spawnorg 8\n" @@ -925,7 +921,7 @@ char *particle_set_faithful = "texture \"particles/quake\"\n" "count 512\n" "scale 4\n" -"alphachange 0\n" +"alphadelta 0\n" "die 0.5333\n" "diesubrand 0.2667\n" "rampmode absolute\n" @@ -957,7 +953,7 @@ char *particle_set_faithful = "texture \"particles/quake\"\n" "count 256\n" "scale 4\n" -"alphachange 0\n" +"alphadelta 0\n" "die 1.4\n" "colorindex 150 6\n" "gravity 40\n" @@ -970,7 +966,7 @@ char *particle_set_faithful = "texture \"particles/quake\"\n" "count 256\n" "scale 4\n" -"alphachange 0\n" +"alphadelta 0\n" "die 1.4\n" "colorindex 66 6\n" "gravity 40\n" @@ -985,7 +981,7 @@ char *particle_set_faithful = "texture \"particles/quake\"\n" "count 256\n" "scale 4\n" -"alphachange 0\n" +"alphadelta 0\n" "die 1\n" "colorindex 150 6\n" "gravity 40\n" @@ -999,7 +995,7 @@ char *particle_set_faithful = "texture \"particles/quake\"\n" "count 256\n" "scale 4\n" -"alphachange 0\n" +"alphadelta 0\n" "die 1\n" "colorindex 66 6\n" "gravity 40\n" @@ -1014,7 +1010,7 @@ char *particle_set_faithful = "texture \"particles/quake\"\n" "count 896\n" "scale 4\n" -"alphachange 0\n" +"alphadelta 0\n" "die 0.34\n" "diesubrand 0.14\n" "colorindex 7 8\n" @@ -1030,7 +1026,7 @@ char *particle_set_faithful = "texture \"particles/quake\"\n" "count 1024\n" "scale 4\n" -"alphachange 0\n" +"alphadelta 0\n" "die 2.62\n" "diesubrand 0.62\n" "colorindex 224 8\n" @@ -1057,7 +1053,7 @@ char *particle_set_faithful = "count 1\n" "scale 4\n" "die 30\n" -"alphachange 0\n" +"alphadelta 0\n" "rgb 255 255 0\n" "}\n"; @@ -1304,7 +1300,7 @@ char *particle_set_highfps = "count 1\n" "scale 50\n" "die 30\n" -"alphachange 0\n" +"alphadelta 0\n" "rgb 255 255 0\n" "}\n"; diff --git a/engine/partcfgs/faithful.cfg b/engine/partcfgs/faithful.cfg index 26d7e449b..a96d2434e 100644 --- a/engine/partcfgs/faithful.cfg +++ b/engine/partcfgs/faithful.cfg @@ -5,7 +5,7 @@ r_part t_gib step 3 scale 4 die 2 - alphachange 0 + alphadelta 0 randomvel 80 veladd 100 colorindex 67 4 @@ -20,7 +20,7 @@ r_part t_zomgib step 6 scale 4 die 2 - alphachange 0 + alphadelta 0 randomvel 72 veladd 100 colorindex 67 4 @@ -35,7 +35,7 @@ r_part t_tracer3 step 3 scale 4 die 0.3 - alphachange 0 + alphadelta 0 colorindex 152 4 spawnorg 8 } @@ -46,7 +46,7 @@ r_part t_tracer step 3 scale 4 die 0.5 - alphachange 0 + alphadelta 0 colorindex 52 citracer spawnvel 30 0 @@ -59,7 +59,7 @@ r_part t_tracer2 step 3 scale 4 die 0.5 - alphachange 0 + alphadelta 0 colorindex 230 citracer spawnvel 30 0 @@ -120,7 +120,7 @@ r_part pe_size3 scale 4 veladd 15 die 0.4 - alphachange 0 + alphadelta 0 diesubrand 0.4 gravity 40 spawnorg 24 @@ -133,7 +133,7 @@ r_part pe_size2 scale 4 veladd 15 die 0.4 - alphachange 0 + alphadelta 0 diesubrand 0.4 gravity 40 spawnorg 16 @@ -146,7 +146,7 @@ r_part pe_default scale 4 veladd 15 die 0.4 - alphachange 0 + alphadelta 0 diesubrand 0.4 gravity 40 spawnorg 8 @@ -157,7 +157,7 @@ r_part explode2 texture "particles/quake" count 512 scale 4 - alphachange 0 + alphadelta 0 die 0.5333 diesubrand 0.2667 rampmode absolute @@ -189,7 +189,7 @@ r_part blobexp2b texture "particles/quake" count 256 scale 4 - alphachange 0 + alphadelta 0 die 1.4 colorindex 150 6 gravity 40 @@ -202,7 +202,7 @@ r_part blobexp1b texture "particles/quake" count 256 scale 4 - alphachange 0 + alphadelta 0 die 1.4 colorindex 66 6 gravity 40 @@ -217,7 +217,7 @@ r_part blobexp2 texture "particles/quake" count 256 scale 4 - alphachange 0 + alphadelta 0 die 1 colorindex 150 6 gravity 40 @@ -231,7 +231,7 @@ r_part te_blob texture "particles/quake" count 256 scale 4 - alphachange 0 + alphadelta 0 die 1 colorindex 66 6 gravity 40 @@ -246,7 +246,7 @@ r_part te_teleportsplash texture "particles/quake" count 896 scale 4 - alphachange 0 + alphadelta 0 die 0.34 diesubrand 0.14 colorindex 7 8 @@ -262,7 +262,7 @@ r_part te_lavasplash texture "particles/quake" count 1024 scale 4 - alphachange 0 + alphadelta 0 die 2.62 diesubrand 0.62 colorindex 224 8 @@ -289,7 +289,7 @@ r_part pe_pointfile count 1 scale 4 die 30 - alphachange 0 + alphadelta 0 rgb 255 255 0 } diff --git a/engine/partcfgs/highfps.cfg b/engine/partcfgs/highfps.cfg index 289943e01..111bb9db4 100644 --- a/engine/partcfgs/highfps.cfg +++ b/engine/partcfgs/highfps.cfg @@ -240,7 +240,7 @@ r_part pe_pointfile count 1 scale 50 die 30 - alphachange 0 + alphadelta 0 rgb 255 255 0 } diff --git a/engine/partcfgs/spikeset.cfg b/engine/partcfgs/spikeset.cfg index b1ec9b8ef..c3293a5a1 100644 --- a/engine/partcfgs/spikeset.cfg +++ b/engine/partcfgs/spikeset.cfg @@ -552,7 +552,7 @@ r_part empflash count 1 scale 400 scaledelta -4000 - alphachange 0 + alphadelta 0 rgb 192 160 255 blend add scalefactor 1 @@ -727,7 +727,7 @@ r_part pe_default scale 4 veladd 15 die 0.4 - alphachange 0 + alphadelta 0 diesubrand 0.4 gravity 40 spawnorg 8 @@ -751,7 +751,7 @@ r_part pe_pointfile count 1 scale 50 die 30 - alphachange 0 + alphadelta 0 rgb 255 255 0 }