client: reuse combined colors in CL_ParticleEffect

This commit is contained in:
Denis Pauk 2024-09-08 19:08:25 +03:00
parent 900233ada7
commit 6b00ed85cd
4 changed files with 39 additions and 33 deletions

View file

@ -384,7 +384,7 @@ CL_AddMuzzleFlash2(void)
dl->color[0] = 1; dl->color[0] = 1;
dl->color[1] = 1; dl->color[1] = 1;
dl->color[2] = 0; dl->color[2] = 0;
CL_ParticleEffect(origin, vec3_origin, 0, 40); CL_ParticleEffect(origin, vec3_origin, 0xff000000, 0xff6b6b6b, 40);
CL_SmokeAndFlash(origin); CL_SmokeAndFlash(origin);
S_StartSound(NULL, ent, CHAN_WEAPON, S_StartSound(NULL, ent, CHAN_WEAPON,
S_RegisterSound("infantry/infatck1.wav"), 1, ATTN_NORM, 0); S_RegisterSound("infantry/infatck1.wav"), 1, ATTN_NORM, 0);
@ -401,7 +401,7 @@ CL_AddMuzzleFlash2(void)
dl->color[0] = 1; dl->color[0] = 1;
dl->color[1] = 1; dl->color[1] = 1;
dl->color[2] = 0; dl->color[2] = 0;
CL_ParticleEffect(origin, vec3_origin, 0, 40); CL_ParticleEffect(origin, vec3_origin, 0xff000000, 0xff6b6b6b, 40);
CL_SmokeAndFlash(origin); CL_SmokeAndFlash(origin);
S_StartSound(NULL, ent, CHAN_WEAPON, S_StartSound(NULL, ent, CHAN_WEAPON,
S_RegisterSound("soldier/solatck3.wav"), 1, ATTN_NORM, 0); S_RegisterSound("soldier/solatck3.wav"), 1, ATTN_NORM, 0);
@ -418,7 +418,7 @@ CL_AddMuzzleFlash2(void)
dl->color[0] = 1; dl->color[0] = 1;
dl->color[1] = 1; dl->color[1] = 1;
dl->color[2] = 0; dl->color[2] = 0;
CL_ParticleEffect(origin, vec3_origin, 0, 40); CL_ParticleEffect(origin, vec3_origin, 0xff000000, 0xff6b6b6b, 40);
CL_SmokeAndFlash(origin); CL_SmokeAndFlash(origin);
S_StartSound(NULL, ent, CHAN_WEAPON, S_StartSound(NULL, ent, CHAN_WEAPON,
S_RegisterSound("gunner/gunatck2.wav"), 1, ATTN_NORM, 0); S_RegisterSound("gunner/gunatck2.wav"), 1, ATTN_NORM, 0);
@ -436,7 +436,7 @@ CL_AddMuzzleFlash2(void)
dl->color[1] = 1; dl->color[1] = 1;
dl->color[2] = 0; dl->color[2] = 0;
CL_ParticleEffect(origin, vec3_origin, 0, 40); CL_ParticleEffect(origin, vec3_origin, 0xff000000, 0xff6b6b6b, 40);
CL_SmokeAndFlash(origin); CL_SmokeAndFlash(origin);
S_StartSound(NULL, ent, CHAN_WEAPON, S_StartSound(NULL, ent, CHAN_WEAPON,
S_RegisterSound("infantry/infatck1.wav"), 1, ATTN_NORM, 0); S_RegisterSound("infantry/infatck1.wav"), 1, ATTN_NORM, 0);
@ -453,7 +453,7 @@ CL_AddMuzzleFlash2(void)
dl->color[1] = 1; dl->color[1] = 1;
dl->color[2] = 0; dl->color[2] = 0;
CL_ParticleEffect(origin, vec3_origin, 0, 40); CL_ParticleEffect(origin, vec3_origin, 0xff000000, 0xff6b6b6b, 40);
CL_SmokeAndFlash(origin); CL_SmokeAndFlash(origin);
S_StartSound(NULL, ent, CHAN_WEAPON, S_StartSound(NULL, ent, CHAN_WEAPON,
S_RegisterSound("infantry/infatck1.wav"), 1, ATTN_NONE, 0); S_RegisterSound("infantry/infatck1.wav"), 1, ATTN_NONE, 0);
@ -556,7 +556,7 @@ CL_AddMuzzleFlash2(void)
dl->color[0] = 1; dl->color[0] = 1;
dl->color[1] = 1; dl->color[1] = 1;
dl->color[2] = 0; dl->color[2] = 0;
CL_ParticleEffect(origin, vec3_origin, 0, 40); CL_ParticleEffect(origin, vec3_origin, 0xff000000, 0xff6b6b6b, 40);
CL_SmokeAndFlash(origin); CL_SmokeAndFlash(origin);
Com_sprintf(soundname, sizeof(soundname), "tank/tnkatk2%c.wav", Com_sprintf(soundname, sizeof(soundname), "tank/tnkatk2%c.wav",
'a' + (char)(randk() % 5)); 'a' + (char)(randk() % 5));
@ -656,7 +656,7 @@ CL_AddMuzzleFlash2(void)
dl->color[0] = 1; dl->color[0] = 1;
dl->color[1] = 1; dl->color[1] = 1;
dl->color[2] = 0; dl->color[2] = 0;
CL_ParticleEffect(origin, vec3_origin, 0, 40); CL_ParticleEffect(origin, vec3_origin, 0xff000000, 0xff6b6b6b, 40);
CL_SmokeAndFlash(origin); CL_SmokeAndFlash(origin);
S_StartSound(NULL, ent, CHAN_WEAPON, S_StartSound(NULL, ent, CHAN_WEAPON,
S_RegisterSound("boss3/xfire.wav"), 1, ATTN_NORM, 0); S_RegisterSound("boss3/xfire.wav"), 1, ATTN_NORM, 0);
@ -671,7 +671,7 @@ CL_AddMuzzleFlash2(void)
dl->color[0] = 1; dl->color[0] = 1;
dl->color[1] = 1; dl->color[1] = 1;
dl->color[2] = 0; dl->color[2] = 0;
CL_ParticleEffect(origin, vec3_origin, 0, 40); CL_ParticleEffect(origin, vec3_origin, 0xff000000, 0xff6b6b6b, 40);
CL_SmokeAndFlash(origin); CL_SmokeAndFlash(origin);
break; break;
@ -693,7 +693,7 @@ CL_AddMuzzleFlash2(void)
dl->color[1] = 1; dl->color[1] = 1;
dl->color[2] = 0; dl->color[2] = 0;
CL_ParticleEffect(origin, vec3_origin, 0, 40); CL_ParticleEffect(origin, vec3_origin, 0xff000000, 0xff6b6b6b, 40);
CL_SmokeAndFlash(origin); CL_SmokeAndFlash(origin);
break; break;
@ -2951,7 +2951,7 @@ CL_BlasterParticles2(vec3_t org, vec3_t dir, unsigned int basecolor, unsigned in
p->time = time; p->time = time;
d = (float)(randk() & 15); d = (float)(randk() & 15);
p->color = CL_CombineColors(basecolor, finalcolor, d / 15.0); p->color = CL_CombineColors(basecolor, finalcolor, (float)(randk() & 7) / 7.0);
for (j = 0; j < 3; j++) for (j = 0; j < 3; j++)
{ {

View file

@ -50,7 +50,7 @@ CL_ClearParticles(void)
} }
void void
CL_ParticleEffect(vec3_t org, vec3_t dir, int color, int count) CL_ParticleEffect(vec3_t org, vec3_t dir, unsigned int basecolor, unsigned int finalcolor, int count)
{ {
int i, j; int i, j;
cparticle_t *p; cparticle_t *p;
@ -69,7 +69,7 @@ CL_ParticleEffect(vec3_t org, vec3_t dir, int color, int count)
active_particles = p; active_particles = p;
p->time = cl.time; p->time = cl.time;
p->color = VID_PaletteColor(color + (randk() & 7)); p->color = CL_CombineColors(basecolor, finalcolor, (float)(randk() & 7) / 7.0);
d = randk() & 31; d = randk() & 31;
for (j = 0; j < 3; j++) for (j = 0; j < 3; j++)
@ -87,7 +87,7 @@ CL_ParticleEffect(vec3_t org, vec3_t dir, int color, int count)
} }
void void
CL_ParticleEffect2(vec3_t org, vec3_t dir, int color, int count) CL_ParticleEffect2(vec3_t org, vec3_t dir, unsigned int basecolor, unsigned int finalcolor, int count)
{ {
int i, j; int i, j;
cparticle_t *p; cparticle_t *p;
@ -109,7 +109,7 @@ CL_ParticleEffect2(vec3_t org, vec3_t dir, int color, int count)
active_particles = p; active_particles = p;
p->time = time; p->time = time;
p->color = VID_PaletteColor(color + (randk() & 7)); p->color = CL_CombineColors(basecolor, finalcolor, (float)(randk() & 7) / 7.0);
d = randk() & 7; d = randk() & 7;
@ -128,7 +128,7 @@ CL_ParticleEffect2(vec3_t org, vec3_t dir, int color, int count)
} }
void void
CL_ParticleEffect3(vec3_t org, vec3_t dir, int color, int count) CL_ParticleEffect3(vec3_t org, vec3_t dir, unsigned int color, int count)
{ {
int i, j; int i, j;
cparticle_t *p; cparticle_t *p;
@ -150,7 +150,7 @@ CL_ParticleEffect3(vec3_t org, vec3_t dir, int color, int count)
active_particles = p; active_particles = p;
p->time = time; p->time = time;
p->color = VID_PaletteColor(color); p->color = color;
d = randk() & 7; d = randk() & 7;

View file

@ -259,7 +259,8 @@ CL_ParseParticles(void)
count = MSG_ReadByte(&net_message); count = MSG_ReadByte(&net_message);
CL_ParticleEffect(pos, dir, color, count); CL_ParticleEffect(pos, dir,
VID_PaletteColor(color), VID_PaletteColor(color + 7), count);
} }
void void
@ -669,7 +670,7 @@ CL_ParseTEnt(void)
case TE_BLOOD: /* bullet hitting flesh */ case TE_BLOOD: /* bullet hitting flesh */
MSG_ReadPos(&net_message, pos); MSG_ReadPos(&net_message, pos);
MSG_ReadDir(&net_message, dir); MSG_ReadDir(&net_message, dir);
CL_ParticleEffect(pos, dir, 0xe8, 60); CL_ParticleEffect(pos, dir, 0xff001f9b, 0xff00001b, 60);
break; break;
case TE_GUNSHOT: /* bullet hitting wall */ case TE_GUNSHOT: /* bullet hitting wall */
@ -680,11 +681,11 @@ CL_ParseTEnt(void)
if (type == TE_GUNSHOT) if (type == TE_GUNSHOT)
{ {
CL_ParticleEffect(pos, dir, 0, 40); CL_ParticleEffect(pos, dir, 0xff000000, 0xff6b6b6b, 40);
} }
else else
{ {
CL_ParticleEffect(pos, dir, 0xe0, 6); CL_ParticleEffect(pos, dir, 0xff07abff, 0xff002bab, 6);
} }
if (type != TE_SPARKS) if (type != TE_SPARKS)
@ -716,12 +717,12 @@ CL_ParseTEnt(void)
if (type == TE_SCREEN_SPARKS) if (type == TE_SCREEN_SPARKS)
{ {
CL_ParticleEffect(pos, dir, 0xd0, 40); CL_ParticleEffect(pos, dir, 0xff00ff00, 0xffffffff, 40);
} }
else else
{ {
CL_ParticleEffect(pos, dir, 0xb0, 40); CL_ParticleEffect(pos, dir, 0xffcf7b77, 0xff734747, 40);
} }
if (cl_limitsparksounds->value) if (cl_limitsparksounds->value)
@ -761,7 +762,7 @@ CL_ParseTEnt(void)
case TE_SHOTGUN: /* bullet hitting wall */ case TE_SHOTGUN: /* bullet hitting wall */
MSG_ReadPos(&net_message, pos); MSG_ReadPos(&net_message, pos);
MSG_ReadDir(&net_message, dir); MSG_ReadDir(&net_message, dir);
CL_ParticleEffect(pos, dir, 0, 20); CL_ParticleEffect(pos, dir, 0xff000000, 0xff6b6b6b, 20);
CL_SmokeAndFlash(pos); CL_SmokeAndFlash(pos);
break; break;
@ -780,7 +781,8 @@ CL_ParseTEnt(void)
color = splash_color[r]; color = splash_color[r];
} }
CL_ParticleEffect(pos, dir, color, cnt); CL_ParticleEffect(pos, dir,
VID_PaletteColor(color), VID_PaletteColor(color + 7), cnt);
if (r == SPLASH_SPARKS) if (r == SPLASH_SPARKS)
{ {
@ -807,7 +809,8 @@ CL_ParseTEnt(void)
MSG_ReadPos(&net_message, pos); MSG_ReadPos(&net_message, pos);
MSG_ReadDir(&net_message, dir); MSG_ReadDir(&net_message, dir);
color = MSG_ReadByte(&net_message); color = MSG_ReadByte(&net_message);
CL_ParticleEffect2(pos, dir, color, cnt); CL_ParticleEffect2(pos, dir,
VID_PaletteColor(color), VID_PaletteColor(color + 7), cnt);
break; break;
case TE_BLUEHYPERBLASTER: case TE_BLUEHYPERBLASTER:
@ -1017,7 +1020,8 @@ CL_ParseTEnt(void)
MSG_ReadPos(&net_message, pos); MSG_ReadPos(&net_message, pos);
MSG_ReadDir(&net_message, dir); MSG_ReadDir(&net_message, dir);
color = MSG_ReadByte(&net_message); color = MSG_ReadByte(&net_message);
CL_ParticleEffect2(pos, dir, color, cnt); CL_ParticleEffect2(pos, dir,
VID_PaletteColor(color), VID_PaletteColor(color + 7), cnt);
ex = CL_AllocExplosion(); ex = CL_AllocExplosion();
VectorCopy(pos, ex->ent.origin); VectorCopy(pos, ex->ent.origin);
@ -1035,7 +1039,7 @@ CL_ParseTEnt(void)
case TE_GREENBLOOD: case TE_GREENBLOOD:
MSG_ReadPos(&net_message, pos); MSG_ReadPos(&net_message, pos);
MSG_ReadDir(&net_message, dir); MSG_ReadDir(&net_message, dir);
CL_ParticleEffect2(pos, dir, 0xdf, 30); CL_ParticleEffect2(pos, dir, 0xff0fbfff, 0xff003bb7, 30);
break; break;
case TE_TUNNEL_SPARKS: case TE_TUNNEL_SPARKS:
@ -1043,7 +1047,7 @@ CL_ParseTEnt(void)
MSG_ReadPos(&net_message, pos); MSG_ReadPos(&net_message, pos);
MSG_ReadDir(&net_message, dir); MSG_ReadDir(&net_message, dir);
color = MSG_ReadByte(&net_message); color = MSG_ReadByte(&net_message);
CL_ParticleEffect3(pos, dir, color, cnt); CL_ParticleEffect3(pos, dir, VID_PaletteColor(color), cnt);
break; break;
case TE_BLASTER2: case TE_BLASTER2:
@ -1208,7 +1212,7 @@ CL_ParseTEnt(void)
case TE_MOREBLOOD: case TE_MOREBLOOD:
MSG_ReadPos(&net_message, pos); MSG_ReadPos(&net_message, pos);
MSG_ReadDir(&net_message, dir); MSG_ReadDir(&net_message, dir);
CL_ParticleEffect(pos, dir, 0xe8, 250); CL_ParticleEffect(pos, dir, 0xff001f9b, 0xff00001b, 250);
break; break;
case TE_CHAINFIST_SMOKE: case TE_CHAINFIST_SMOKE:
@ -1222,7 +1226,7 @@ CL_ParseTEnt(void)
case TE_ELECTRIC_SPARKS: case TE_ELECTRIC_SPARKS:
MSG_ReadPos(&net_message, pos); MSG_ReadPos(&net_message, pos);
MSG_ReadDir(&net_message, dir); MSG_ReadDir(&net_message, dir);
CL_ParticleEffect(pos, dir, 0x75, 40); CL_ParticleEffect(pos, dir, 0xff5b430f, 0xff1f1700, 40);
S_StartSound(pos, 0, 0, cl_sfx_lashit, 1, ATTN_NORM, 0); S_StartSound(pos, 0, 0, cl_sfx_lashit, 1, ATTN_NORM, 0);
break; break;

View file

@ -364,10 +364,12 @@ typedef struct cl_sustain
void CL_ParticleSteamEffect2(cl_sustain_t *self); void CL_ParticleSteamEffect2(cl_sustain_t *self);
void CL_TeleporterParticles (entity_state_t *ent); void CL_TeleporterParticles (entity_state_t *ent);
void CL_ParticleEffect (vec3_t org, vec3_t dir, int color, int count); void CL_ParticleEffect (vec3_t org, vec3_t dir, unsigned int basecolor, unsigned int finalcolor,
void CL_ParticleEffect2 (vec3_t org, vec3_t dir, int color, int count); int count);
void CL_ParticleEffect2 (vec3_t org, vec3_t dir, unsigned int basecolor, unsigned int finalcolor,
int count);
void CL_ParticleEffect3 (vec3_t org, vec3_t dir, int color, int count); void CL_ParticleEffect3 (vec3_t org, vec3_t dir, unsigned int color, int count);
typedef struct particle_s typedef struct particle_s