From 5ab33ac35e712417cbc151d01abc808c2de3e435 Mon Sep 17 00:00:00 2001 From: havoc Date: Wed, 3 Nov 2004 17:13:37 +0000 Subject: [PATCH] internal cleanup: split up CL_SparkShower into CL_SparkShower, CL_Smoke, and CL_BulletMark so the effects parser can be a little cleaner, also added gravityscale to CL_SparkShower git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@4732 d7cf8633-e32d-0410-b094-e92efae38249 --- cl_parse.c | 40 ++++++++++++++++++++++++++-------- cl_particles.c | 59 ++++++++++++++++++++++++++++---------------------- client.h | 25 ++++++++++++++++++++- menu.c | 11 ---------- 4 files changed, 88 insertions(+), 47 deletions(-) diff --git a/cl_parse.c b/cl_parse.c index 5fee1c83..6f8c5dd8 100644 --- a/cl_parse.c +++ b/cl_parse.c @@ -941,8 +941,12 @@ void CL_ParseTempEntity(void) // spike hitting wall MSG_ReadVector(pos, cl.protocol); CL_FindNonSolidLocation(pos, pos, 4); - // LordHavoc: changed to spark shower - CL_SparkShower(pos, vec3_origin, 15); + if (cl_particles_bulletimpacts.integer) + { + CL_SparkShower(pos, vec3_origin, 15, 1); + CL_Smoke(pos, vec3_origin, 15); + CL_BulletMark(pos); + } if (rand() % 5) S_StartSound(-1, 0, cl_sfx_tink1, pos, 1, 1); else @@ -961,7 +965,12 @@ void CL_ParseTempEntity(void) MSG_ReadVector(pos, cl.protocol); CL_FindNonSolidLocation(pos, pos, 4); // LordHavoc: changed to spark shower - CL_SparkShower(pos, vec3_origin, 15); + if (cl_particles_bulletimpacts.integer) + { + CL_SparkShower(pos, vec3_origin, 15, 1); + CL_Smoke(pos, vec3_origin, 15); + CL_BulletMark(pos); + } Matrix4x4_CreateTranslate(&tempmatrix, pos[0], pos[1], pos[2]); CL_AllocDlight(NULL, &tempmatrix, 100, 0.15f, 0.15f, 1.5f, 500, 0.2, 0, 0, true, 1); S_StartSound(-1, 0, cl_sfx_r_exp3, pos, 1, 1); @@ -983,7 +992,12 @@ void CL_ParseTempEntity(void) MSG_ReadVector(pos, cl.protocol); CL_FindNonSolidLocation(pos, pos, 4); // LordHavoc: changed to dust shower - CL_SparkShower(pos, vec3_origin, 30); + if (cl_particles_bulletimpacts.integer) + { + CL_SparkShower(pos, vec3_origin, 30, 1); + CL_Smoke(pos, vec3_origin, 30); + CL_BulletMark(pos); + } if (rand() % 5) S_StartSound(-1, 0, cl_sfx_tink1, pos, 1, 1); else @@ -1002,7 +1016,12 @@ void CL_ParseTempEntity(void) MSG_ReadVector(pos, cl.protocol); CL_FindNonSolidLocation(pos, pos, 4); // LordHavoc: changed to dust shower - CL_SparkShower(pos, vec3_origin, 30); + if (cl_particles_bulletimpacts.integer) + { + CL_SparkShower(pos, vec3_origin, 30, 1); + CL_Smoke(pos, vec3_origin, 30); + CL_BulletMark(pos); + } Matrix4x4_CreateTranslate(&tempmatrix, pos[0], pos[1], pos[2]); CL_AllocDlight(NULL, &tempmatrix, 100, 0.15f, 0.15f, 1.5f, 500, 0.2, 0, 0, true, 1); if (rand() % 5) @@ -1037,7 +1056,7 @@ void CL_ParseTempEntity(void) dir[1] = MSG_ReadChar(); dir[2] = MSG_ReadChar(); count = MSG_ReadByte(); - CL_SparkShower(pos, dir, count); + CL_SparkShower(pos, dir, count, 1); break; case TE_PLASMABURN: MSG_ReadVector(pos, cl.protocol); @@ -1091,15 +1110,18 @@ void CL_ParseTempEntity(void) // bullet hitting wall MSG_ReadVector(pos, cl.protocol); CL_FindNonSolidLocation(pos, pos, 4); - // LordHavoc: changed to dust shower - CL_SparkShower(pos, vec3_origin, 15); + CL_SparkShower(pos, vec3_origin, 15, 1); + CL_Smoke(pos, vec3_origin, 15); + CL_BulletMark(pos); break; case TE_GUNSHOTQUAD: // quad bullet hitting wall MSG_ReadVector(pos, cl.protocol); CL_FindNonSolidLocation(pos, pos, 4); - CL_SparkShower(pos, vec3_origin, 15); + CL_SparkShower(pos, vec3_origin, 15, 1); + CL_Smoke(pos, vec3_origin, 15); + CL_BulletMark(pos); Matrix4x4_CreateTranslate(&tempmatrix, pos[0], pos[1], pos[2]); CL_AllocDlight(NULL, &tempmatrix, 100, 0.15f, 0.15f, 1.5f, 500, 0.2, 0, 0, true, 1); break; diff --git a/cl_particles.c b/cl_particles.c index 4fe3bb1b..0cf22897 100644 --- a/cl_particles.c +++ b/cl_particles.c @@ -782,46 +782,53 @@ void CL_RunParticleEffect (vec3_t org, vec3_t dir, int color, int count) CL_SparkShower =============== */ -void CL_SparkShower (vec3_t org, vec3_t dir, int count) +void CL_SparkShower (vec3_t org, vec3_t dir, int count, vec_t gravityscale) { - vec3_t org2, org3; int k; - if (cl_stainmaps.integer) - R_Stain(org, 32, 96, 96, 96, 24, 128, 128, 128, 24); - CL_SpawnDecalParticleForPoint(org, 6, 3, 255, tex_bulletdecal[rand()&7], 0xFFFFFF, 0xFFFFFF); - if (!cl_particles.integer) return; - if (cl_particles_bulletimpacts.integer) + if (cl_particles_sparks.integer) { - // smoke puff - if (cl_particles_smoke.integer) + // sparks + count *= cl_particles_quality.value; + while(count--) { - k = count * 0.25 * cl_particles_quality.value; - while(k--) - { - org2[0] = org[0] + 0.125f * lhrandom(-count, count); - org2[1] = org[1] + 0.125f * lhrandom(-count, count); - org2[2] = org[2] + 0.125f * lhrandom(-count, count); - CL_TraceLine(org, org2, org3, NULL, true, NULL, SUPERCONTENTS_SOLID); - particle(pt_grow, PARTICLE_BILLBOARD, 0x101010, 0x202020, tex_smoke[rand()&7], true, PBLEND_ADD, 3, 3, (1.0f / cl_particles_quality.value) * 255, (1.0f / cl_particles_quality.value) * 1024, 9999, -0.2, 0, org3[0], org3[1], org3[2], lhrandom(-8, 8), lhrandom(-8, 8), lhrandom(0, 16), 15, 0, 0, 0, 0.2, 0); - } + k = particlepalette[0x68 + (rand() & 7)]; + particle(pt_static, PARTICLE_SPARK, k, k, tex_particle, false, PBLEND_ADD, 0.4f, 0.015f, (1.0f / cl_particles_quality.value) * lhrandom(64, 255), (1.0f / cl_particles_quality.value) * 512, 9999, gravityscale, 0, org[0], org[1], org[2], lhrandom(-64, 64) + dir[0], lhrandom(-64, 64) + dir[1], lhrandom(0, 128) + dir[2], 0, 0, 0, 0, 0, 0); } + } +} - if (cl_particles_sparks.integer) +void CL_Smoke (vec3_t org, vec3_t dir, int count) +{ + vec3_t org2, org3; + int k; + + if (!cl_particles.integer) return; + + // smoke puff + if (cl_particles_smoke.integer) + { + k = count * 0.25 * cl_particles_quality.value; + while(k--) { - // sparks - count *= cl_particles_quality.value; - while(count--) - { - k = particlepalette[0x68 + (rand() & 7)]; - particle(pt_static, PARTICLE_SPARK, k, k, tex_particle, false, PBLEND_ADD, 0.4f, 0.015f, (1.0f / cl_particles_quality.value) * lhrandom(64, 255), (1.0f / cl_particles_quality.value) * 512, 9999, 1, 0, org[0], org[1], org[2], lhrandom(-64, 64) + dir[0], lhrandom(-64, 64) + dir[1], lhrandom(0, 128) + dir[2], 0, 0, 0, 0, 0.2, 0); - } + org2[0] = org[0] + 0.125f * lhrandom(-count, count); + org2[1] = org[1] + 0.125f * lhrandom(-count, count); + org2[2] = org[2] + 0.125f * lhrandom(-count, count); + CL_TraceLine(org, org2, org3, NULL, true, NULL, SUPERCONTENTS_SOLID); + particle(pt_grow, PARTICLE_BILLBOARD, 0x101010, 0x202020, tex_smoke[rand()&7], true, PBLEND_ADD, 3, 3, (1.0f / cl_particles_quality.value) * 255, (1.0f / cl_particles_quality.value) * 1024, 9999, 0, 0, org3[0], org3[1], org3[2], lhrandom(-8, 8), lhrandom(-8, 8), lhrandom(-8, 8), 15, 0, 0, 0, 0, 0); } } } +void CL_BulletMark (vec3_t org) +{ + if (cl_stainmaps.integer) + R_Stain(org, 32, 96, 96, 96, 24, 128, 128, 128, 24); + CL_SpawnDecalParticleForPoint(org, 6, 3, 255, tex_bulletdecal[rand()&7], 0xFFFFFF, 0xFFFFFF); +} + void CL_PlasmaBurn (vec3_t org) { if (cl_stainmaps.integer) diff --git a/client.h b/client.h index 13d28593..70c2b66a 100644 --- a/client.h +++ b/client.h @@ -719,13 +719,36 @@ void CL_InitTEnts (void); // cl_part // +extern cvar_t cl_particles; +extern cvar_t cl_particles_quality; +extern cvar_t cl_particles_size; +extern cvar_t cl_particles_bloodshowers; +extern cvar_t cl_particles_blood; +extern cvar_t cl_particles_blood_alpha; +extern cvar_t cl_particles_blood_bloodhack; +extern cvar_t cl_particles_bulletimpacts; +extern cvar_t cl_particles_explosions_bubbles; +extern cvar_t cl_particles_explosions_smoke; +extern cvar_t cl_particles_explosions_sparks; +extern cvar_t cl_particles_explosions_shell; +extern cvar_t cl_particles_smoke; +extern cvar_t cl_particles_smoke_alpha; +extern cvar_t cl_particles_smoke_alphafade; +extern cvar_t cl_particles_sparks; +extern cvar_t cl_particles_bubbles; +extern cvar_t cl_decals; +extern cvar_t cl_decals_time; +extern cvar_t cl_decals_fadetime; + void CL_Particles_Clear(void); void CL_Particles_Init(void); void CL_ParseParticleEffect (void); void CL_RunParticleEffect (vec3_t org, vec3_t dir, int color, int count); void CL_RocketTrail (vec3_t start, vec3_t end, int type, int color, entity_t *ent); -void CL_SparkShower (vec3_t org, vec3_t dir, int count); +void CL_SparkShower (vec3_t org, vec3_t dir, int count, vec_t gravityscale); +void CL_Smoke (vec3_t org, vec3_t dir, int count); +void CL_BulletMark (vec3_t org); void CL_PlasmaBurn (vec3_t org); void CL_BloodPuff (vec3_t org, vec3_t vel, int count); void CL_Stardust (vec3_t mins, vec3_t maxs, int count); diff --git a/menu.c b/menu.c index 162d4d20..081c1299 100644 --- a/menu.c +++ b/menu.c @@ -1490,23 +1490,12 @@ void M_Menu_Options_Effects_f (void) extern cvar_t r_detailtextures; -extern cvar_t cl_particles; extern cvar_t cl_stainmaps; extern cvar_t cl_stainmapsclearonload; -extern cvar_t cl_decals; extern cvar_t r_explosionclip; extern cvar_t r_modellights; extern cvar_t r_coronas; extern cvar_t gl_flashblend; -extern cvar_t cl_particles_quality; -extern cvar_t cl_particles_bulletimpacts; -extern cvar_t cl_particles_smoke; -extern cvar_t cl_particles_sparks; -extern cvar_t cl_particles_bubbles; -extern cvar_t cl_particles_blood; -extern cvar_t cl_particles_blood_alpha; -extern cvar_t cl_particles_blood_bloodhack; -extern cvar_t cl_particles_explosions_shell; extern cvar_t cl_beams_polygon; extern cvar_t cl_beams_relative; extern cvar_t cl_beams_lightatend; -- 2.39.2