]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - cl_particles.c
changed cl_stainmaps to be a loadtime cvar which decides whether to
[xonotic/darkplaces.git] / cl_particles.c
index f78e4aee9a6b520de8ea1580b7c1558c69d75524..b491a0f2d12d1c1bcc3f74065f10caf0fc163df8 100644 (file)
@@ -656,7 +656,7 @@ void CL_ParticleEffect_Fallback(int effectnameindex, float count, const vec3_t o
                        }
                }
                // bullet hole
-               if (cl_stainmaps.integer) R_Stain(center, 32, 96, 96, 96, 24, 128, 128, 128, 24);
+               R_Stain(center, 32, 96, 96, 96, 24, 128, 128, 128, 24);
                CL_SpawnDecalParticleForPoint(center, 6, 3, 255, tex_bulletdecal[rand()&7], 0xFFFFFF, 0xFFFFFF);
        }
        else if (effectnameindex == EFFECT_TE_SPIKEQUAD)
@@ -676,7 +676,7 @@ void CL_ParticleEffect_Fallback(int effectnameindex, float count, const vec3_t o
                        }
                }
                // bullet hole
-               if (cl_stainmaps.integer) R_Stain(center, 32, 96, 96, 96, 24, 128, 128, 128, 24);
+               R_Stain(center, 32, 96, 96, 96, 24, 128, 128, 128, 24);
                CL_SpawnDecalParticleForPoint(center, 6, 3, 255, tex_bulletdecal[rand()&7], 0xFFFFFF, 0xFFFFFF);
                CL_AllocLightFlash(NULL, &tempmatrix, 100, 0.15f, 0.15f, 1.5f, 500, 0.2, 0, -1, true, 1, 0.25, 1, 0, 0, LIGHTFLAG_NORMALMODE | LIGHTFLAG_REALTIMEMODE);
        }
@@ -697,7 +697,7 @@ void CL_ParticleEffect_Fallback(int effectnameindex, float count, const vec3_t o
                        }
                }
                // bullet hole
-               if (cl_stainmaps.integer) R_Stain(center, 32, 96, 96, 96, 24, 128, 128, 128, 24);
+               R_Stain(center, 32, 96, 96, 96, 24, 128, 128, 128, 24);
                CL_SpawnDecalParticleForPoint(center, 6, 3, 255, tex_bulletdecal[rand()&7], 0xFFFFFF, 0xFFFFFF);
        }
        else if (effectnameindex == EFFECT_TE_SUPERSPIKEQUAD)
@@ -717,7 +717,7 @@ void CL_ParticleEffect_Fallback(int effectnameindex, float count, const vec3_t o
                        }
                }
                // bullet hole
-               if (cl_stainmaps.integer) R_Stain(center, 32, 96, 96, 96, 24, 128, 128, 128, 24);
+               R_Stain(center, 32, 96, 96, 96, 24, 128, 128, 128, 24);
                CL_SpawnDecalParticleForPoint(center, 6, 3, 255, tex_bulletdecal[rand()&7], 0xFFFFFF, 0xFFFFFF);
                CL_AllocLightFlash(NULL, &tempmatrix, 100, 0.15f, 0.15f, 1.5f, 500, 0.2, 0, -1, true, 1, 0.25, 1, 0, 0, LIGHTFLAG_NORMALMODE | LIGHTFLAG_REALTIMEMODE);
        }
@@ -741,7 +741,7 @@ void CL_ParticleEffect_Fallback(int effectnameindex, float count, const vec3_t o
        else if (effectnameindex == EFFECT_TE_PLASMABURN)
        {
                // plasma scorch mark
-               if (cl_stainmaps.integer) R_Stain(center, 48, 96, 96, 96, 32, 128, 128, 128, 32);
+               R_Stain(center, 48, 96, 96, 96, 32, 128, 128, 128, 32);
                CL_SpawnDecalParticleForPoint(center, 6, 6, 255, tex_bulletdecal[rand()&7], 0xFFFFFF, 0xFFFFFF);
                CL_AllocLightFlash(NULL, &tempmatrix, 200, 1, 1, 1, 1000, 0.2, 0, -1, true, 1, 0.25, 1, 0, 0, LIGHTFLAG_NORMALMODE | LIGHTFLAG_REALTIMEMODE);
        }
@@ -759,7 +759,7 @@ void CL_ParticleEffect_Fallback(int effectnameindex, float count, const vec3_t o
                        }
                }
                // bullet hole
-               if (cl_stainmaps.integer) R_Stain(center, 32, 96, 96, 96, 24, 128, 128, 128, 24);
+               R_Stain(center, 32, 96, 96, 96, 24, 128, 128, 128, 24);
                CL_SpawnDecalParticleForPoint(center, 6, 3, 255, tex_bulletdecal[rand()&7], 0xFFFFFF, 0xFFFFFF);
        }
        else if (effectnameindex == EFFECT_TE_GUNSHOTQUAD)
@@ -776,7 +776,7 @@ void CL_ParticleEffect_Fallback(int effectnameindex, float count, const vec3_t o
                        }
                }
                // bullet hole
-               if (cl_stainmaps.integer) R_Stain(center, 32, 96, 96, 96, 24, 128, 128, 128, 24);
+               R_Stain(center, 32, 96, 96, 96, 24, 128, 128, 128, 24);
                CL_SpawnDecalParticleForPoint(center, 6, 3, 255, tex_bulletdecal[rand()&7], 0xFFFFFF, 0xFFFFFF);
                CL_AllocLightFlash(NULL, &tempmatrix, 100, 0.15f, 0.15f, 1.5f, 500, 0.2, 0, -1, true, 1, 0.25, 1, 0, 0, LIGHTFLAG_NORMALMODE | LIGHTFLAG_REALTIMEMODE);
        }
@@ -884,8 +884,7 @@ void CL_ParticleEffect_Fallback(int effectnameindex, float count, const vec3_t o
        else if (effectnameindex == EFFECT_TE_TEI_PLASMAHIT)
        {
                float f;
-               if (cl_stainmaps.integer)
-                       R_Stain(center, 40, 96, 96, 96, 40, 128, 128, 128, 40);
+               R_Stain(center, 40, 96, 96, 96, 40, 128, 128, 128, 40);
                CL_SpawnDecalParticleForPoint(center, 6, 8, 255, tex_bulletdecal[rand()&7], 0xFFFFFF, 0xFFFFFF);
                if (cl_particles_smoke.integer)
                        for (f = 0;f < count;f += 4.0f / cl_particles_quality.value)
@@ -1387,8 +1386,7 @@ void CL_ParticleExplosion (const vec3_t org)
        trace_t trace;
        //vec3_t v;
        //vec3_t v2;
-       if (cl_stainmaps.integer)
-               R_Stain(org, 96, 80, 80, 80, 64, 176, 176, 176, 64);
+       R_Stain(org, 96, 80, 80, 80, 64, 176, 176, 176, 64);
        CL_SpawnDecalParticleForPoint(org, 40, 48, 255, tex_bulletdecal[rand()&7], 0xFFFFFF, 0xFFFFFF);
 
        if (cl_particles_quake.integer)
@@ -1906,22 +1904,23 @@ static void r_part_shutdown(void)
 
 static void r_part_newmap(void)
 {
+       CL_Particles_LoadEffectInfo();
 }
 
 #define BATCHSIZE 256
-int particle_element3i[BATCHSIZE*6];
+unsigned short particle_elements[BATCHSIZE*6];
 
 void R_Particles_Init (void)
 {
        int i;
        for (i = 0;i < BATCHSIZE;i++)
        {
-               particle_element3i[i*6+0] = i*4+0;
-               particle_element3i[i*6+1] = i*4+1;
-               particle_element3i[i*6+2] = i*4+2;
-               particle_element3i[i*6+3] = i*4+0;
-               particle_element3i[i*6+4] = i*4+2;
-               particle_element3i[i*6+5] = i*4+3;
+               particle_elements[i*6+0] = i*4+0;
+               particle_elements[i*6+1] = i*4+1;
+               particle_elements[i*6+2] = i*4+2;
+               particle_elements[i*6+3] = i*4+0;
+               particle_elements[i*6+4] = i*4+2;
+               particle_elements[i*6+5] = i*4+3;
        }
 
        Cvar_RegisterVariable(&r_drawparticles);
@@ -2002,7 +2001,7 @@ void R_DrawDecal_TransparentCallback(const entity_render_t *ent, const rtlight_t
        GL_BlendFunc(GL_ZERO, GL_ONE_MINUS_SRC_COLOR);
        R_Mesh_TexBind(0, R_GetTexture(particletexture[63].texture));
        GL_LockArrays(0, numsurfaces*4);
-       R_Mesh_Draw(0, numsurfaces * 4, numsurfaces * 2, particle_element3i, 0, 0);
+       R_Mesh_Draw(0, numsurfaces * 4, 0, numsurfaces * 2, NULL, particle_elements, 0, 0);
        GL_LockArrays(0, 0);
 }
 
@@ -2259,7 +2258,7 @@ void R_DrawParticle_TransparentCallback(const entity_render_t *ent, const rtligh
                }
 
                batchcount = surfacelistindex - batchstart;
-               R_Mesh_Draw(batchstart * 4, batchcount * 4, batchcount * 2, particle_element3i + batchstart * 6, 0, 0);
+               R_Mesh_Draw(batchstart * 4, batchcount * 4, batchstart * 2, batchcount * 2, NULL, particle_elements, 0, 0);
        }
        GL_LockArrays(0, 0);
 }
@@ -2354,8 +2353,7 @@ void R_DrawParticles (void)
                                                        // blood - splash on solid
                                                        if (trace.hitq3surfaceflags & Q3SURFACEFLAG_NOMARKS)
                                                                goto killparticle;
-                                                       if (cl_stainmaps.integer)
-                                                               R_Stain(p->org, 32, 32, 16, 16, (int)(p->alpha * p->size * (1.0f / 40.0f)), 192, 48, 48, (int)(p->alpha * p->size * (1.0f / 40.0f)));
+                                                       R_Stain(p->org, 32, 32, 16, 16, (int)(p->alpha * p->size * (1.0f / 40.0f)), 192, 48, 48, (int)(p->alpha * p->size * (1.0f / 40.0f)));
                                                        if (cl_decals.integer)
                                                        {
                                                                // create a decal for the blood splat