X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=r_explosion.c;h=28f8bae0ff05679069a0ea9f86a6ce87f916d444;hb=b8d63f8b1a4a6d8cc880be5ff8ea83aa6fbba365;hp=430e399c08533ef30bc8f9fdbd27fff52e771139;hpb=066c77541b654eb4665614c07126b864b9d5e2f7;p=xonotic%2Fdarkplaces.git diff --git a/r_explosion.c b/r_explosion.c index 430e399c..28f8bae0 100644 --- a/r_explosion.c +++ b/r_explosion.c @@ -52,13 +52,13 @@ 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) { int x, y; - qbyte noise1[128][128], noise2[128][128], noise3[128][128], data[128][128][4]; + unsigned char noise1[128][128], noise2[128][128], noise3[128][128], data[128][128][4]; explosiontexturepool = R_AllocTexturePool(); fractalnoise(&noise1[0][0], 128, 32); fractalnoise(&noise2[0][0], 128, 4); @@ -147,7 +147,7 @@ void R_NewExplosion(vec3_t org) float dist, n; explosion_t *e; trace_t trace; - qbyte noise[EXPLOSIONGRID*EXPLOSIONGRID]; + unsigned char noise[EXPLOSIONGRID*EXPLOSIONGRID]; fractalnoisequick(noise, EXPLOSIONGRID, 4); // adjust noise grid size according to explosion for (i = 0, e = explosion;i < MAX_EXPLOSIONS;i++, e++) { @@ -180,18 +180,17 @@ 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 = 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; @@ -258,6 +257,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); }