]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - r_explosion.c
rewrote timing code, now a much better and very different sleeping method, no longer...
[xonotic/darkplaces.git] / r_explosion.c
index 7bf4e18328ff2be45168d11a996b179d359e5048..4dd9f853ed6832c4750842db2998364d80851fb5 100644 (file)
@@ -52,8 +52,8 @@ static rtexture_t     *explosiontexturefog;
 
 static rtexturepool_t  *explosiontexturepool;
 
-cvar_t r_explosionclip = {CVAR_SAVE, "r_explosionclip", "1"};
-static cvar_t r_drawexplosions = {0, "r_drawexplosions", "1"};
+cvar_t r_explosionclip = {CVAR_SAVE, "r_explosionclip", "1", "enables collision detection for explosion shell (so that it flattens against walls and floors)"};
+static cvar_t r_drawexplosions = {0, "r_drawexplosions", "1", "enables rendering of explosion shells (see also cl_particles_explosions_shell)"};
 
 static void r_explosion_start(void)
 {
@@ -141,7 +141,7 @@ void R_Explosion_Init(void)
        R_RegisterModule("R_Explosions", r_explosion_start, r_explosion_shutdown, r_explosion_newmap);
 }
 
-void R_NewExplosion(vec3_t org)
+void R_NewExplosion(const vec3_t org)
 {
        int i, j;
        float dist, n;
@@ -180,28 +180,28 @@ void R_NewExplosion(vec3_t org)
        }
 }
 
-static void R_DrawExplosionCallback(const void *calldata1, int calldata2)
+static void R_DrawExplosion_TransparentCallback(const entity_render_t *ent, int surfacenumber, const rtlight_t *rtlight)
 {
+       const explosion_t *e = explosion + surfacenumber;
        int numtriangles, numverts;
        float alpha;
        rmeshstate_t m;
-       const explosion_t *e;
-       e = (explosion_t *)calldata1;
 
        GL_BlendFunc(GL_SRC_ALPHA, GL_ONE);
        GL_DepthMask(false);
        GL_DepthTest(true);
-       R_Mesh_Matrix(&r_identitymatrix);
+       R_Mesh_Matrix(&identitymatrix);
 
        numtriangles = EXPLOSIONTRIS;
        numverts = EXPLOSIONVERTS;
        alpha = e->alpha;
 
+       R_Mesh_VertexPointer(e->vert[0]);
+       R_Mesh_ColorPointer(NULL);
        memset(&m, 0, sizeof(m));
        m.tex[0] = R_GetTexture(explosiontexture);
        m.pointer_texcoord[0] = explosiontexcoord2f[0];
-       m.pointer_vertex = e->vert[0];
-       R_Mesh_State(&m);
+       R_Mesh_TextureState(&m);
 
        GL_Color(alpha, alpha, alpha, 1);
 
@@ -258,6 +258,6 @@ void R_DrawExplosions(void)
                return;
        for (i = 0;i < MAX_EXPLOSIONS;i++)
                if (r_refdef.time < explosion[i].endtime)
-                       R_MeshQueue_AddTransparent(explosion[i].origin, R_DrawExplosionCallback, &explosion[i], 0);
+                       R_MeshQueue_AddTransparent(explosion[i].origin, R_DrawExplosion_TransparentCallback, NULL, i, NULL);
 }