client: reuse combined colors in CL_BfgParticles

This commit is contained in:
Denis Pauk 2024-09-09 00:00:40 +03:00
parent 8ab3e54f6a
commit aba2dc9ccf
3 changed files with 14 additions and 8 deletions

View file

@ -1803,7 +1803,7 @@ CL_BfgParticles(entity_t *ent)
VectorSubtract(p->org, ent->origin, v);
dist = VectorLength(v) / 90.0f;
p->color = VID_PaletteColor((int)floor(0xd0 + dist * 7));
p->color = CL_CombineColors(0xff00ff00, 0xffffffff, dist);
p->alpha = 1.0f - dist;
p->alphavel = -100;
}
@ -2138,8 +2138,8 @@ CL_DebugTrail(vec3_t start, vec3_t end)
}
void
CL_SmokeTrail(vec3_t start, vec3_t end, int colorStart,
int colorRun, int spacing)
CL_SmokeTrail(vec3_t start, vec3_t end, unsigned int basecolor, unsigned int finalcolor,
int spacing)
{
vec3_t move;
vec3_t vec;
@ -2174,7 +2174,9 @@ CL_SmokeTrail(vec3_t start, vec3_t end, int colorStart,
p->alpha = 1.0;
p->alphavel = -1.0f / (1 + frandk() * 0.5f);
p->color = VID_PaletteColor(colorStart + (float)(randk() % colorRun));
p->color = CL_CombineColors(basecolor, finalcolor,
(float)(randk() & 7) / 7.0);
for (j = 0; j < 3; j++)
{
@ -2466,7 +2468,8 @@ CL_ParticleSteamEffect2(cl_sustain_t *self)
active_particles = p;
p->time = cl.time;
p->color = VID_PaletteColor(self->color + (randk() & 7));
p->color = CL_CombineColors(self->basecolor, self->finalcolor,
(float)(randk() & 7) / 7.0);
for (j = 0; j < 3; j++)
{

View file

@ -549,7 +549,8 @@ CL_ParseSteam(void)
MSG_ReadPos(&net_message, s->org);
MSG_ReadDir(&net_message, s->dir);
r = MSG_ReadByte(&net_message);
s->color = r & 0xff;
s->basecolor = VID_PaletteColor(r & 0xff);
s->finalcolor = VID_PaletteColor((r + 7) & 0xff);
s->magnitude = MSG_ReadShort(&net_message);
s->endtime = cl.time + MSG_ReadLong(&net_message);
s->think = CL_ParticleSteamEffect2;

View file

@ -355,7 +355,8 @@ typedef struct cl_sustain
int thinkinterval;
vec3_t org;
vec3_t dir;
int color;
unsigned int basecolor;
unsigned int finalcolor;
int count;
int magnitude;
void (*think)(struct cl_sustain *self);
@ -400,7 +401,8 @@ void CL_IonripperTrail (vec3_t start, vec3_t end);
void CL_BlasterParticles2 (vec3_t org, vec3_t dir, unsigned int basecolor, unsigned int finalcolor);
void CL_BlasterTrail2 (vec3_t start, vec3_t end);
void CL_DebugTrail (vec3_t start, vec3_t end);
void CL_SmokeTrail (vec3_t start, vec3_t end, int colorStart, int colorRun, int spacing);
void CL_SmokeTrail (vec3_t start, vec3_t end, unsigned int basecolor, unsigned int finalcolor,
int spacing);
void CL_Flashlight (int ent, vec3_t pos);
void CL_ForceWall (vec3_t start, vec3_t end, int color);
void CL_FlameEffects (centity_t *ent, vec3_t origin);