]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - r_explosion.c
faster number to edict lookup (sv.edictstable) and faster edict to number lookup...
[xonotic/darkplaces.git] / r_explosion.c
index 0d5fdf46728ef607e2371bffc335a50d00489c1b..b5654092e18eb945874d5ed0d9b96387cfd1ead3 100644 (file)
@@ -29,7 +29,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 #define EXPLOSIONFADESTART (1.5f)
 #define EXPLOSIONFADERATE (3.0f)
 
-float explosiontexcoords[EXPLOSIONVERTS][2];
+float explosiontexcoords[EXPLOSIONVERTS][4];
 int explosiontris[EXPLOSIONTRIS][3];
 int explosionnoiseindex[EXPLOSIONVERTS];
 vec3_t explosionpoint[EXPLOSIONVERTS];
@@ -80,11 +80,11 @@ void r_explosion_start(void)
                        data[y][x][3] = bound(0, a, 255);
                }
        }
-       explosiontexture = R_LoadTexture (explosiontexturepool, "explosiontexture", 128, 128, &data[0][0][0], TEXTYPE_RGBA, TEXF_MIPMAP | TEXF_ALPHA | TEXF_PRECACHE);
+       explosiontexture = R_LoadTexture2D(explosiontexturepool, "explosiontexture", 128, 128, &data[0][0][0], TEXTYPE_RGBA, TEXF_MIPMAP | TEXF_ALPHA | TEXF_PRECACHE, NULL);
        for (y = 0;y < 128;y++)
                for (x = 0;x < 128;x++)
                        data[y][x][0] = data[y][x][1] = data[y][x][2] = 255;
-       explosiontexturefog = R_LoadTexture (explosiontexturepool, "explosiontexturefog", 128, 128, &data[0][0][0], TEXTYPE_RGBA, TEXF_MIPMAP | TEXF_ALPHA | TEXF_PRECACHE);
+       explosiontexturefog = R_LoadTexture2D(explosiontexturepool, "explosiontexturefog", 128, 128, &data[0][0][0], TEXTYPE_RGBA, TEXF_MIPMAP | TEXF_ALPHA | TEXF_PRECACHE, NULL);
        // note that explosions survive the restart
 }
 
@@ -103,8 +103,8 @@ int R_ExplosionVert(int column, int row)
        int i;
        float a, b, c;
        i = row * (EXPLOSIONGRID + 1) + column;
-       a = row * M_PI * 2 / EXPLOSIONGRID;
-       b = column * M_PI * 2 / EXPLOSIONGRID;
+       a = ((double) row / EXPLOSIONGRID) * M_PI * 2;
+       b = (((double) column / EXPLOSIONGRID) + 0.5) * M_PI;
        c = cos(b);
        explosionpoint[i][0] = cos(a) * c;
        explosionpoint[i][1] = sin(a) * c;
@@ -198,7 +198,7 @@ void R_DrawExplosionCallback(const void *calldata1, int calldata2)
                v[1] = e->vert[i][1];
                v[2] = e->vert[i][2];
        }
-       memcpy(varray_texcoord[0], explosiontexcoords, numverts * sizeof(float[2]));
+       memcpy(varray_texcoord[0], explosiontexcoords, numverts * sizeof(float[4]));
        alpha = e->alpha;
        VectorSubtract(r_origin, e->origin, centerdir);
        VectorNormalizeFast(centerdir);
@@ -241,6 +241,7 @@ void R_DrawExplosionCallback(const void *calldata1, int calldata2)
                        c[3] = 1;
                }
        }
+       GL_UseColorArray();
        R_Mesh_Draw(numverts, numtriangles, explosiontris[0]);
 }
 
@@ -267,7 +268,7 @@ void R_MoveExplosion(explosion_t *e)
                        VectorMA(e->vert[i], frametime, e->vertvel[i], end);
                        if (r_explosionclip.integer)
                        {
-                               if (CL_TraceLine(e->vert[i], end, impact, normal, 0, true) < 1)
+                               if (CL_TraceLine(e->vert[i], end, impact, normal, 0, true, NULL) < 1)
                                {
                                        // clip velocity against the wall
                                        dot = DotProduct(e->vertvel[i], normal) * -1.125f;