]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - r_particles.c
reenabled loading plaques (and cleaned up that code a lot)
[xonotic/darkplaces.git] / r_particles.c
index affa059b3dc551b2e8e0a3814427a8273bfeff12..cb5795a8861b67b3981035eb368e95121db4d931 100644 (file)
@@ -29,7 +29,7 @@ static particletexture_t particletexture[MAX_PARTICLETEXTURES][2];
 static cvar_t r_drawparticles = {0, "r_drawparticles", "1"};
 static cvar_t r_particles_lighting = {0, "r_particles_lighting", "1"};
 
-static byte shadebubble(float dx, float dy, vec3_t light)
+static qbyte shadebubble(float dx, float dy, vec3_t light)
 {
        float   dz, f, dot;
        vec3_t  normal;
@@ -56,13 +56,13 @@ static byte shadebubble(float dx, float dy, vec3_t light)
                f *= 128;
                f += 16; // just to give it a haze so you can see the outline
                f = bound(0, f, 255);
-               return (byte) f;
+               return (qbyte) f;
        }
        else
                return 0;
 }
 
-static void setuptex(int cltexnum, int fog, int rtexnum, byte *data, byte *particletexturedata)
+static void setuptex(int cltexnum, int fog, int rtexnum, qbyte *data, qbyte *particletexturedata)
 {
        int basex, basey, y;
        basex = ((rtexnum >> 0) & 7) * 32;
@@ -79,9 +79,9 @@ static void R_InitParticleTexture (void)
 {
        int             x,y,d,i,m;
        float   dx, dy, radius, f, f2;
-       byte    data[32][32][4], noise1[64][64], noise2[64][64];
+       qbyte   data[32][32][4], noise1[64][64], noise2[64][64];
        vec3_t  light;
-       byte    particletexturedata[256*256*4];
+       qbyte   particletexturedata[256*256*4];
 
        memset(particletexturedata, 255, sizeof(particletexturedata));
 
@@ -99,7 +99,7 @@ static void R_InitParticleTexture (void)
                                dy = y - 16;
                                for (x = 0;x < 32;x++)
                                {
-                                       d = (noise1[y][x] - 128) * 2 + 64; // was + 128
+                                       d = (noise1[y][x] - 128) * 2 + 128;
                                        d = bound(0, d, 255);
                                        data[y][x][0] = data[y][x][1] = data[y][x][2] = d;
                                        dx = x - 16;
@@ -107,7 +107,7 @@ static void R_InitParticleTexture (void)
                                        if (d > 0)
                                                d = (d * (256 - (int) (dx*dx+dy*dy))) >> 8;
                                        d = bound(0, d, 255);
-                                       data[y][x][3] = (byte) d;
+                                       data[y][x][3] = (qbyte) d;
                                        if (m < d)
                                                m = d;
                                }
@@ -153,7 +153,7 @@ static void R_InitParticleTexture (void)
                        dx = x - 16;
                        d = (256 - (dx*dx+dy*dy));
                        d = bound(0, d, 255);
-                       data[y][x][3] = (byte) d;
+                       data[y][x][3] = (qbyte) d;
                }
        }
        setuptex(24, 0, 32, &data[0][0][0], particletexturedata);
@@ -232,7 +232,7 @@ void R_Particles_Init (void)
        R_RegisterModule("R_Particles", r_part_start, r_part_shutdown, r_part_newmap);
 }
 
-//int partindexarray[6] = {0, 1, 2, 0, 2, 3};
+int partindexarray[6] = {0, 1, 2, 0, 2, 3};
 
 void R_DrawParticles (void)
 {
@@ -266,14 +266,14 @@ void R_DrawParticles (void)
        m.transparent = true;
        m.blendfunc1 = GL_SRC_ALPHA;
        m.blendfunc2 = GL_ONE_MINUS_SRC_ALPHA;
-       //m.numtriangles = 2;
-       //m.index = partindexarray;
-       //m.numverts = 4;
+       m.numtriangles = 2;
+       m.index = partindexarray;
+       m.numverts = 4;
        m.vertex = &tvxyz[0][0];
-       //m.vertexstep = sizeof(float[4]);
+       m.vertexstep = sizeof(float[4]);
        m.tex[0] = R_GetTexture(particlefonttexture);
        m.texcoords[0] = &tvst[0][0];
-       //m.texcoordstep[0] = sizeof(float[2]);
+       m.texcoordstep[0] = sizeof(float[2]);
 
        for (i = 0, r = r_refdef.particles;i < r_refdef.numparticles;i++, r++)
        {
@@ -365,14 +365,14 @@ void R_DrawParticles (void)
                                                m.cr *= ifog;
                                                m.cg *= ifog;
                                                m.cb *= ifog;
-                                               R_Mesh_DrawDecal(&m);
+                                               R_Mesh_Draw(&m);
                                        }
                                }
                                else
-                                       R_Mesh_DrawDecal(&m);
+                                       R_Mesh_Draw(&m);
                        }
                        else
-                               R_Mesh_DrawDecal(&m);
+                               R_Mesh_Draw(&m);
                }
                else
                {
@@ -400,7 +400,7 @@ void R_DrawParticles (void)
                                                tvst[2][1] = texfog->t2;
                                                tvst[3][0] = texfog->s2;
                                                tvst[3][1] = texfog->t1;
-                                               R_Mesh_DrawDecal(&m);
+                                               R_Mesh_Draw(&m);
                                        }
                                        else
                                        {
@@ -415,12 +415,12 @@ void R_DrawParticles (void)
                                                        m.cr += fogcolor[0] * fog;
                                                        m.cg += fogcolor[1] * fog;
                                                        m.cb += fogcolor[2] * fog;
-                                                       R_Mesh_DrawDecal(&m);
+                                                       R_Mesh_Draw(&m);
                                                }
                                                else
                                                {
                                                        // render the first pass (alpha), then do additive fog
-                                                       R_Mesh_DrawDecal(&m);
+                                                       R_Mesh_Draw(&m);
 
                                                        m.blendfunc2 = GL_ONE;
                                                        m.cr = fogcolor[0];
@@ -435,15 +435,15 @@ void R_DrawParticles (void)
                                                        tvst[2][1] = texfog->t2;
                                                        tvst[3][0] = texfog->s2;
                                                        tvst[3][1] = texfog->t1;
-                                                       R_Mesh_DrawDecal(&m);
+                                                       R_Mesh_Draw(&m);
                                                }
                                        }
                                }
                                else
-                                       R_Mesh_DrawDecal(&m);
+                                       R_Mesh_Draw(&m);
                        }
                        else
-                               R_Mesh_DrawDecal(&m);
+                               R_Mesh_Draw(&m);
                }
        }
 }