client: Restore CL_FlameEffect

Based on:
* https://github.com/id-Software/Quake-2/blob/master/client/cl_newfx.c
This commit is contained in:
Denis Pauk 2024-10-19 22:59:32 +03:00
parent 2c82f906e1
commit db110ddc7e
3 changed files with 80 additions and 3 deletions

View file

@ -2092,6 +2092,78 @@ CL_ClearEffects(void)
CL_ClearLightStyles();
}
void
CL_FlameEffects(vec3_t origin)
{
int n, count;
count = rand() & 0xF;
for(n = 0; n < count; n++)
{
cparticle_t *p;
int j;
if (!free_particles)
{
return;
}
p = free_particles;
free_particles = p->next;
p->next = active_particles;
active_particles = p;
VectorClear(p->accel);
p->time = cl.time;
p->alpha = 1.0;
p->alphavel = -1.0 / (1 + frandk() * 0.2);
p->color = CL_CombineColors(0xff0b0700, 0xff47477b,
(float)(randk() & 15) / 15.0);
for (j = 0; j < 3; j++)
{
p->org[j] = origin[j] + crandk() * 5;
p->vel[j] = crandk() * 5;
}
p->vel[2] = crandk() * -10;
p->accel[2] = -PARTICLE_GRAVITY;
}
count = rand() & 0x7;
for (n = 0; n < count; n++)
{
cparticle_t *p;
int j;
if (!free_particles)
{
return;
}
p = free_particles;
free_particles = p->next;
p->next = active_particles;
active_particles = p;
VectorClear(p->accel);
p->time = cl.time;
p->alpha = 1.0;
p->alphavel = -1.0 / (1 + frandk() * 0.5);
p->color = CL_CombineColors(0xff000000, 0xff2f2f2f,
(float)(randk() & 15) / 15.0);
for (j=0 ; j<3 ; j++)
{
p->org[j] = origin[j] + crandk() * 3;
}
p->vel[2] = 20 + crandk() * 5;
}
}
void
CL_Flashlight(int ent, vec3_t pos)
{

View file

@ -664,7 +664,7 @@ static unsigned int splash_color[] = {
void
CL_ParseTEnt(void)
{
int type;
temp_event_t type;
vec3_t pos, pos2, dir;
explosion_t *ex;
int cnt;
@ -1124,6 +1124,11 @@ CL_ParseTEnt(void)
S_StartSound(pos, 0, 0, cl_sfx_lashit, 1, ATTN_NORM, 0);
break;
case TE_FLAME:
MSG_ReadPos(&net_message, pos);
CL_FlameEffects(pos);
break;
case TE_LIGHTNING:
ent = CL_ParseLightning(cl_mod_lightning);
S_StartSound(NULL, ent, CHAN_WEAPON, cl_sfx_lightning,
@ -1261,7 +1266,7 @@ CL_ParseTEnt(void)
break;
default:
Com_Error(ERR_DROP, "CL_ParseTEnt: bad type");
Com_Error(ERR_DROP, "%s: bad type", __func__);
}
}

View file

@ -405,7 +405,7 @@ void CL_SmokeTrail (vec3_t start, vec3_t end, unsigned int basecolor, unsigned i
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);
void CL_FlameEffects (vec3_t origin);
void CL_GenericParticleEffect (vec3_t org, vec3_t dir, unsigned int basecolor, unsigned int finalcolor,
int count, int numcolors, int dirspread, float alphavel);
void CL_BubbleTrail2 (vec3_t start, vec3_t end, int dist);