]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - cl_particles.c
sys: [Linux] remove/replace obsolete timing and sleep syscalls, slightly improve...
[xonotic/darkplaces.git] / cl_particles.c
index f6da360123f5f03a78c9851d8c0d6163ae850c1f..31abace8711e9e2dfbd2bfe20b37460c12519785 100644 (file)
@@ -332,7 +332,7 @@ static void CL_Particles_ParseEffectInfo(const char *textstart, const char *text
                                break;
                        if (argc < 16)
                        {
-                               strlcpy(argv[argc], com_token, sizeof(argv[argc]));
+                               dp_strlcpy(argv[argc], com_token, sizeof(argv[argc]));
                                argc++;
                        }
                }
@@ -362,7 +362,7 @@ static void CL_Particles_ParseEffectInfo(const char *textstart, const char *text
                                }
                                else
                                {
-                                       strlcpy(particleeffectname[effectnameindex], argv[1], sizeof(particleeffectname[effectnameindex]));
+                                       dp_strlcpy(particleeffectname[effectnameindex], argv[1], sizeof(particleeffectname[effectnameindex]));
                                        break;
                                }
                        }
@@ -545,15 +545,15 @@ static void CL_Particles_LoadEffectInfo(const char *customfile)
        memset(particleeffectinfo, 0, sizeof(particleeffectinfo));
        memset(particleeffectname, 0, sizeof(particleeffectname));
        for (i = 0;i < EFFECT_TOTAL;i++)
-               strlcpy(particleeffectname[i], standardeffectnames[i], sizeof(particleeffectname[i]));
+               dp_strlcpy(particleeffectname[i], standardeffectnames[i], sizeof(particleeffectname[i]));
        for (filepass = 0;;filepass++)
        {
                if (filepass == 0)
                {
                        if (customfile)
-                               strlcpy(filename, customfile, sizeof(filename));
+                               dp_strlcpy(filename, customfile, sizeof(filename));
                        else
-                               strlcpy(filename, "effectinfo.txt", sizeof(filename));
+                               dp_strlcpy(filename, "effectinfo.txt", sizeof(filename));
                }
                else if (filepass == 1)
                {
@@ -778,7 +778,7 @@ particle_t *CL_NewParticle(const vec3_t sortorigin, unsigned short ptypeindex, i
                        part2->die += part->die - cl.time;
                        for (i = rand() & 7;i < 10;i++)
                        {
-                               part2 = CL_NewParticle(endvec, pt_spark, pcolor1, pcolor2, tex_particle, 0.25f, 0, part->alpha * 2, part->alpha * 4, 1, 0, trace.endpos[0] + trace.plane.normal[0], trace.endpos[1] + trace.plane.normal[1], trace.endpos[2] + trace.plane.normal[2], trace.plane.normal[0] * 16, trace.plane.normal[1] * 16, trace.plane.normal[2] * 16 + cl.movevars_gravity * 0.04, 0, 0, 0, 32, pqualityreduction, 0, 1, PBLEND_ADD, PARTICLE_SPARK, -1, -1, -1, 1, 1, 0, 0, NULL);
+                               part2 = CL_NewParticle(endvec, pt_spark, pcolor1, pcolor2, tex_particle, 0.25f, 0, part->alpha * 2, part->alpha * 4, 1, 0.1, trace.endpos[0] + trace.plane.normal[0], trace.endpos[1] + trace.plane.normal[1], trace.endpos[2] + trace.plane.normal[2], trace.plane.normal[0] * 16, trace.plane.normal[1] * 16, trace.plane.normal[2] * 16 + cl.movevars_gravity * 0.04, 0, 0, 0, 32, pqualityreduction, 0, 1, PBLEND_ADD, PARTICLE_SPARK, -1, -1, -1, 1, 1, 0, 0, NULL);
                                if (part2)
                                {
                                        part2->delayedspawn = part->die;
@@ -914,7 +914,7 @@ static void CL_ParticleEffect_Fallback(int effectnameindex, float count, const v
                                for (;count > 0;count--)
                                {
                                        int k = particlepalette[(palettecolor & ~7) + (rand()&7)];
-                                       CL_NewParticle(center, pt_alphastatic, k, k, tex_particle, 1.5, 0, 255, 0, 0.05, 0, lhrandom(originmins[0], originmaxs[0]), lhrandom(originmins[1], originmaxs[1]), lhrandom(originmins[2], originmaxs[2]), lhrandom(velocitymins[0], velocitymaxs[0]), lhrandom(velocitymins[1], velocitymaxs[1]), lhrandom(velocitymins[2], velocitymaxs[2]), 0, 0, 8, 0, true, lhrandom(0.1, 0.5), 1, PBLEND_ALPHA, PARTICLE_BILLBOARD, -1, -1, -1, 1, 1, 0, 0, NULL);
+                                       CL_NewParticle(center, pt_alphastatic, k, k, tex_particle, 1.5, 0, 255, 0, 0.15, 0, lhrandom(originmins[0], originmaxs[0]), lhrandom(originmins[1], originmaxs[1]), lhrandom(originmins[2], originmaxs[2]), lhrandom(velocitymins[0], velocitymaxs[0]), lhrandom(velocitymins[1], velocitymaxs[1]), lhrandom(velocitymins[2], velocitymaxs[2]), 0, 0, 8, 3, true, lhrandom(0.1, 0.4), 1, PBLEND_ALPHA, PARTICLE_BILLBOARD, -1, -1, -1, 1, 1, 0, 0, NULL);
                                }
                        }
                }
@@ -1278,7 +1278,7 @@ static void CL_ParticleEffect_Fallback(int effectnameindex, float count, const v
                                        if (cl_particles_quake.integer)
                                        {
                                                color = particlepalette[67 + (rand()&3)];
-                                               CL_NewParticle(center, pt_alphastatic, color, color, tex_particle, 1.5f, 0, 255, 0, 0.05, 0, pos[0], pos[1], pos[2], 0, 0, 0, 0, 0, 3, 0, true, 2, 1, PBLEND_ALPHA, PARTICLE_BILLBOARD, -1, -1, -1, 1, 1, 0, 0, NULL);
+                                               CL_NewParticle(center, pt_alphastatic, color, color, tex_particle, 1.5f, 0, 255, 0, 0.25, 0, pos[0], pos[1], pos[2], 0, 0, 0, 0, 0, 3, 0, true, 2, 1, PBLEND_ALPHA, PARTICLE_BILLBOARD, -1, -1, -1, 1, 1, 0, 0, NULL);
                                        }
                                        else
                                        {
@@ -1292,7 +1292,7 @@ static void CL_ParticleEffect_Fallback(int effectnameindex, float count, const v
                                        {
                                                dec = 6;
                                                color = particlepalette[67 + (rand()&3)];
-                                               CL_NewParticle(center, pt_alphastatic, color, color, tex_particle, 1.5f, 0, 255, 0, 0.05, 0, pos[0], pos[1], pos[2], 0, 0, 0, 0, 0, 3, 0, true, 2, 1, PBLEND_ALPHA, PARTICLE_BILLBOARD, -1, -1, -1, 1, 1, 0, 0, NULL);
+                                               CL_NewParticle(center, pt_alphastatic, color, color, tex_particle, 1.5f, 0, 255, 0, 0.25, 0, pos[0], pos[1], pos[2], 0, 0, 0, 0, 0, 3, 0, true, 2, 1, PBLEND_ALPHA, PARTICLE_BILLBOARD, -1, -1, -1, 1, 1, 0, 0, NULL);
                                        }
                                        else
                                        {
@@ -1309,7 +1309,7 @@ static void CL_ParticleEffect_Fallback(int effectnameindex, float count, const v
                                        {
                                                r = rand()&3;
                                                color = particlepalette[ramp3[r]];
-                                               CL_NewParticle(center, pt_alphastatic, color, color, tex_particle, 1.5f, 0, 255, 0, -0.05, 0, pos[0], pos[1], pos[2], 0, 0, 0, 0, 0, 3, 0, true, 0.1372549*(6-r), 1, PBLEND_ALPHA, PARTICLE_BILLBOARD, -1, -1, -1, 1, 1, 0, 0, NULL);
+                                               CL_NewParticle(center, pt_alphastatic, color, color, tex_particle, 1.5f, 0, 255, 0, -0.10, 0, pos[0], pos[1], pos[2], 0, 0, 0, 0, 0, 3, 0, true, 0.1372549*(6-r), 1, PBLEND_ALPHA, PARTICLE_BILLBOARD, -1, -1, -1, 1, 1, 0, 0, NULL);
                                        }
                                        else
                                        {
@@ -1321,9 +1321,9 @@ static void CL_ParticleEffect_Fallback(int effectnameindex, float count, const v
                                {
                                        if (cl_particles_quake.integer)
                                        {
-                                               r = 2 + (rand()%5);
+                                               r = 2 + (rand()%4);
                                                color = particlepalette[ramp3[r]];
-                                               CL_NewParticle(center, pt_alphastatic, color, color, tex_particle, 1.5f, 0, 255, 0, -0.05, 0, pos[0], pos[1], pos[2], 0, 0, 0, 0, 0, 3, 0, true, 0.1372549*(6-r), 1, PBLEND_ALPHA, PARTICLE_BILLBOARD, -1, -1, -1, 1, 1, 0, 0, NULL);
+                                               CL_NewParticle(center, pt_alphastatic, color, color, tex_particle, 1.5f, 0, 255, 0, -0.15, 0, pos[0], pos[1], pos[2], 0, 0, 0, 0, 0, 3, 0, true, 0.1372549*(6-r), 1, PBLEND_ALPHA, PARTICLE_BILLBOARD, -1, -1, -1, 1, 1, 0, 0, NULL);
                                        }
                                        else
                                        {
@@ -2357,7 +2357,7 @@ static void R_InitParticleTexture (void)
 
                        if (COM_ParseToken_Simple(&bufptr, true, false, true) && strcmp(com_token, "\n"))
                        {
-                               strlcpy(texturename, com_token, sizeof(texturename));
+                               dp_strlcpy(texturename, com_token, sizeof(texturename));
                                s1 = atof(com_token);
                                if (COM_ParseToken_Simple(&bufptr, true, false, true) && strcmp(com_token, "\n"))
                                {
@@ -2369,9 +2369,9 @@ static void R_InitParticleTexture (void)
                                                if (COM_ParseToken_Simple(&bufptr, true, false, true) && strcmp(com_token, "\n"))
                                                {
                                                        t2 = atof(com_token);
-                                                       strlcpy(texturename, "particles/particlefont.tga", sizeof(texturename));
+                                                       dp_strlcpy(texturename, "particles/particlefont.tga", sizeof(texturename));
                                                        if (COM_ParseToken_Simple(&bufptr, true, false, true) && strcmp(com_token, "\n"))
-                                                               strlcpy(texturename, com_token, sizeof(texturename));
+                                                               dp_strlcpy(texturename, com_token, sizeof(texturename));
                                                }
                                        }
                                }