]> de.git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
internal cleanup: split up CL_SparkShower into CL_SparkShower, CL_Smoke, and CL_Bulle...
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Wed, 3 Nov 2004 17:13:37 +0000 (17:13 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Wed, 3 Nov 2004 17:13:37 +0000 (17:13 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@4732 d7cf8633-e32d-0410-b094-e92efae38249

cl_parse.c
cl_particles.c
client.h
menu.c

index 5fee1c839f4775e953919727b203b69e21e2fe6f..6f8c5dd847045a55a6f19c7407291c7454e5acf9 100644 (file)
@@ -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;
index 4fe3bb1bf0e6797ae8ed42e20c4628e8043a1323..0cf228972524c51343f2dbf1128d4b95a98eadda 100644 (file)
@@ -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)
index 13d285939852f6c8f2de6c4ee362aebbfd050f7c..70c2b66a8d0c88c2a64b7019806b74d0a1eb55fa 100644 (file)
--- 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 162d4d20545d94f14a1e616f684b284cf6923339..081c12996230effc866e897727a3c59674c5d0e9 100644 (file)
--- 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;