particle scripting: allow model lines to set r= g= b= color tint (#291)
* particle scripting: allow model lines to set r= g= b= color tint * pass RF_FORCECOLOURMOD to the relevant CL_SpawnSpriteEffect call changes.
This commit is contained in:
parent
e4c4938efe
commit
8c71c4103c
4 changed files with 26 additions and 6 deletions
|
@ -245,6 +245,7 @@ typedef struct
|
|||
int type;
|
||||
vec3_t angles;
|
||||
vec3_t avel;
|
||||
vec3_t rgb;
|
||||
int flags;
|
||||
float gravity;
|
||||
float startalpha;
|
||||
|
@ -672,6 +673,9 @@ static void CL_ClearExplosion(explosion_t *exp, vec3_t org)
|
|||
{
|
||||
exp->endalpha = 0;
|
||||
exp->startalpha = 1;
|
||||
exp->rgb[0] = 1.0f;
|
||||
exp->rgb[1] = 1.0f;
|
||||
exp->rgb[2] = 1.0f;
|
||||
exp->scale = 1;
|
||||
exp->gravity = 0;
|
||||
exp->flags = 0;
|
||||
|
@ -2473,7 +2477,7 @@ void CL_ParseParticleEffect4 (void)
|
|||
P_RunParticleEffect4 (org, radius, color, effect, msgcount);
|
||||
}
|
||||
|
||||
void CL_SpawnSpriteEffect(vec3_t org, vec3_t dir, vec3_t orientationup, model_t *model, int startframe, int framecount, float framerate, float alpha, float scale, float randspin, float gravity, int traileffect, unsigned int renderflags, int skinnum)
|
||||
void CL_SpawnSpriteEffect(vec3_t org, vec3_t dir, vec3_t orientationup, model_t *model, int startframe, int framecount, float framerate, float alpha, float scale, float randspin, float gravity, int traileffect, unsigned int renderflags, int skinnum, float red, float green, float blue)
|
||||
{
|
||||
explosion_t *ex;
|
||||
|
||||
|
@ -2486,6 +2490,9 @@ void CL_SpawnSpriteEffect(vec3_t org, vec3_t dir, vec3_t orientationup, model_t
|
|||
ex->skinnum = skinnum;
|
||||
ex->traileffect = traileffect;
|
||||
ex->scale = scale;
|
||||
ex->rgb[0] = red;
|
||||
ex->rgb[1] = green;
|
||||
ex->rgb[2] = blue;
|
||||
|
||||
ex->flags |= renderflags;
|
||||
|
||||
|
@ -2568,7 +2575,7 @@ void CL_ParseEffect (qboolean effect2)
|
|||
framerate = MSG_ReadByte();
|
||||
|
||||
mod = cl.model_precache[modelindex];
|
||||
CL_SpawnSpriteEffect(org, NULL, NULL, mod, startframe, framecount, framerate, mod->type==mod_sprite?-1:1, 1, 0, 0, P_INVALID, 0, 0);
|
||||
CL_SpawnSpriteEffect(org, NULL, NULL, mod, startframe, framecount, framerate, mod->type==mod_sprite?-1:1, 1, 0, 0, P_INVALID, 0, 0, 1.0f, 1.0f, 1.0f);
|
||||
}
|
||||
|
||||
#ifdef Q2CLIENT
|
||||
|
@ -3302,6 +3309,9 @@ void CL_UpdateExplosions (float frametime)
|
|||
ent->framestate.g[FS_REG].frame[0] = of+firstframe;
|
||||
ent->framestate.g[FS_REG].lerpweight[1] = (f - (int)f);
|
||||
ent->framestate.g[FS_REG].lerpweight[0] = 1-ent->framestate.g[FS_REG].lerpweight[1];
|
||||
ent->shaderRGBAf[0] = ex->rgb[0];
|
||||
ent->shaderRGBAf[1] = ex->rgb[1];
|
||||
ent->shaderRGBAf[2] = ex->rgb[2];
|
||||
ent->shaderRGBAf[3] = (1.0 - f/(numframes))*(ex->startalpha-ex->endalpha) + ex->endalpha;
|
||||
ent->flags = ex->flags;
|
||||
ent->scale = scale*ex->scale;
|
||||
|
|
|
@ -1449,7 +1449,7 @@ void CL_ParseParticleEffect4 (void);
|
|||
int CL_TranslateParticleFromServer(int sveffect);
|
||||
void CL_ParseTrailParticles(void);
|
||||
void CL_ParsePointParticles(qboolean compact);
|
||||
void CL_SpawnSpriteEffect(vec3_t org, vec3_t dir, vec3_t orientationup, struct model_s *model, int startframe, int framecount, float framerate, float alpha, float scale, float randspin, float gravity, int traileffect, unsigned int renderflags, int skinnum); /*called from the particlesystem*/
|
||||
void CL_SpawnSpriteEffect(vec3_t org, vec3_t dir, vec3_t orientationup, struct model_s *model, int startframe, int framecount, float framerate, float alpha, float scale, float randspin, float gravity, int traileffect, unsigned int renderflags, int skinnum, float red, float green, float blue); /*called from the particlesystem*/
|
||||
|
||||
//
|
||||
// cl_ents.c
|
||||
|
|
|
@ -217,6 +217,7 @@ typedef struct {
|
|||
float framecount;
|
||||
float framerate;
|
||||
float alpha;
|
||||
vec3_t rgb;
|
||||
float scalemin, scalemax;
|
||||
int skin;
|
||||
int traileffect;
|
||||
|
@ -1626,6 +1627,9 @@ parsefluid:
|
|||
mod->traileffect = P_INVALID;
|
||||
mod->rflags = RF_NOSHADOW;
|
||||
mod->scalemin = mod->scalemax = 1;
|
||||
mod->rgb[0] = 1.0f;
|
||||
mod->rgb[1] = 1.0f;
|
||||
mod->rgb[2] = 1.0f;
|
||||
|
||||
strtoul(Cmd_Argv(2), &e, 0);
|
||||
while(*e == ' ' || *e == '\t')
|
||||
|
@ -1660,6 +1664,12 @@ parsefluid:
|
|||
mod->scalemin = atof(e+9);
|
||||
else if (!Q_strncasecmp(e, "scalemax=", 9))
|
||||
mod->scalemax = atof(e+9);
|
||||
else if (!Q_strncasecmp(e, "r=", 2))
|
||||
mod->rgb[0] = atof(e+2);
|
||||
else if (!Q_strncasecmp(e, "g=", 2))
|
||||
mod->rgb[1] = atof(e+2);
|
||||
else if (!Q_strncasecmp(e, "b=", 2))
|
||||
mod->rgb[2] = atof(e+2);
|
||||
else if (!Q_strncasecmp(e, "trail=", 6))
|
||||
{
|
||||
mod->traileffect = P_AllocateParticleType(config, e+6);//careful - this can realloc all the particle types
|
||||
|
@ -4942,7 +4952,7 @@ static int PScript_RunParticleEffectState (vec3_t org, vec3_t dir, float count,
|
|||
vec3_t morg, mdir;
|
||||
float scale = frandom() * (mod->scalemax-mod->scalemin) + mod->scalemin;
|
||||
PScript_ApplyOrgVel(morg, mdir, org, axis, i, count, ptype);
|
||||
CL_SpawnSpriteEffect(morg, mdir, (mod->rflags&RF_USEORIENTATION)?axis[2]:NULL, mod->model, mod->framestart, mod->framecount, mod->framerate?mod->framerate:10, mod->alpha?mod->alpha:1, scale, ptype->rotationmin*180/M_PI, ptype->gravity, mod->traileffect, mod->rflags & ~RF_USEORIENTATION, mod->skin);
|
||||
CL_SpawnSpriteEffect(morg, mdir, (mod->rflags&RF_USEORIENTATION)?axis[2]:NULL, mod->model, mod->framestart, mod->framecount, mod->framerate?mod->framerate:10, mod->alpha?mod->alpha:1, scale, ptype->rotationmin*180/M_PI, ptype->gravity, mod->traileffect, (mod->rflags & ~RF_USEORIENTATION) | RF_FORCECOLOURMOD, mod->skin, mod->rgb[0], mod->rgb[1], mod->rgb[2]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5763,7 +5773,7 @@ static void P_ParticleTrailSpawn (vec3_t startpos, vec3_t end, part_type_t *ptyp
|
|||
vec3_t morg, mdir;
|
||||
float scale = frandom() * (mod->scalemax-mod->scalemin) + mod->scalemin;
|
||||
PScript_ApplyOrgVel(morg, mdir, start, dlaxis, i, count, ptype);
|
||||
CL_SpawnSpriteEffect(morg, mdir, (mod->rflags&RF_USEORIENTATION)?dlaxis[2]:NULL, mod->model, mod->framestart, mod->framecount, mod->framerate?mod->framerate:10, mod->alpha?mod->alpha:1, scale, ptype->rotationmin*180/M_PI, ptype->gravity, mod->traileffect, mod->rflags & ~RF_USEORIENTATION, mod->skin);
|
||||
CL_SpawnSpriteEffect(morg, mdir, (mod->rflags&RF_USEORIENTATION)?dlaxis[2]:NULL, mod->model, mod->framestart, mod->framecount, mod->framerate?mod->framerate:10, mod->alpha?mod->alpha:1, scale, ptype->rotationmin*180/M_PI, ptype->gravity, mod->traileffect, (mod->rflags & ~RF_USEORIENTATION) | RF_FORCECOLOURMOD, mod->skin, mod->rgb[0], mod->rgb[1], mod->rgb[2]);
|
||||
}
|
||||
VectorAdd (start, vstep, start);
|
||||
}
|
||||
|
|
|
@ -4780,7 +4780,7 @@ void QCBUILTIN PF_cl_effect(pubprogfuncs_t *prinst, struct globalvars_s *pr_glob
|
|||
|
||||
mdl = Mod_ForName(name, MLV_WARN);
|
||||
if (mdl)
|
||||
CL_SpawnSpriteEffect(org, NULL, NULL, mdl, startframe, endframe, framerate, mdl->type==mod_sprite?-1:1, 1, 0, 0, P_INVALID, 0, 0);
|
||||
CL_SpawnSpriteEffect(org, NULL, NULL, mdl, startframe, endframe, framerate, mdl->type==mod_sprite?-1:1, 1, 0, 0, P_INVALID, 0, 0, 1.0f, 1.0f, 1.0f);
|
||||
else
|
||||
Con_Printf("PF_cl_effect: Couldn't load model %s\n", name);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue