]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - cl_particles.c
jpeg screenshot support in cl_avidemo recording
[xonotic/darkplaces.git] / cl_particles.c
index e778e9ee644081cdb2f6a4baaa32572b660b324b..da6be2fa7cb02089b5bd825ec3fba9a41b93a1c5 100644 (file)
@@ -453,36 +453,30 @@ void CL_EntityParticles (entity_t *ent)
 
 void CL_ReadPointFile_f (void)
 {
-       vec3_t  org;
-       int             r, c;
-       char    *pointfile = NULL, *pointfilepos, *t, tchar;
-#if WORKINGLQUAKE
-       char    name[MAX_OSPATH];
+       vec3_t org, leakorg;
+       int r, c, s;
+       char *pointfile = NULL, *pointfilepos, *t, tchar;
+       char name[MAX_OSPATH];
 
-       sprintf (name,"maps/%s.pts", cl.worldmodel->name);
-       COM_FOpenFile (name, &f);
-       if (f)
-       {
-               int pointfilelength;
-               fseek(f, 0, SEEK_END);
-               pointfilelength = ftell(f);
-               fseek(f, 0, SEEK_SET);
-               pointfile = malloc(pointfilelength + 1);
-               fread(pointfile, 1, pointfilelength, f);
-               pointfile[pointfilelength] = 0;
-               fclose(f);
-       }
+       if (!cl.worldmodel)
+               return;
+
+       FS_StripExtension(cl.worldmodel->name, name);
+       strcat(name, ".pts");
+#if WORKINGLQUAKE
+       pointfile = COM_LoadTempFile (name);
 #else
-       pointfile = FS_LoadFile(va("maps/%s.pts", cl.worldmodel->name), true);
+       pointfile = FS_LoadFile(name, true);
 #endif
        if (!pointfile)
        {
-               Con_Printf ("couldn't open %s.pts\n", cl.worldmodel->name);
+               Con_Printf ("Could not open %s\n", name);
                return;
        }
 
-       Con_Printf ("Reading %s.pts...\n", cl.worldmodel->name);
+       Con_Printf ("Reading %s...\n", name);
        c = 0;
+       s = 0;
        pointfilepos = pointfile;
        while (*pointfilepos)
        {
@@ -500,22 +494,25 @@ void CL_ReadPointFile_f (void)
                pointfilepos = t;
                if (r != 3)
                        break;
+               if (c == 0)
+                       VectorCopy(org, leakorg);
                c++;
 
-               if (cl_numparticles >= cl_maxparticles)
+               if (cl_numparticles < cl_maxparticles - 3)
                {
-                       Con_Printf ("Not enough free particles\n");
-                       break;
+                       s++;
+                       particle(pt_static, PARTICLE_BILLBOARD, particlepalette[(-c)&15], particlepalette[(-c)&15], tex_particle, false, PBLEND_ALPHA, 2, 2, 255, 0, 99999, 0, 0, org[0], org[1], org[2], 0, 0, 0, 0, 0, 0, 0, 0, 0);
                }
-               particle(pt_static, PARTICLE_BILLBOARD, particlepalette[(-c)&15], particlepalette[(-c)&15], tex_particle, false, PBLEND_ALPHA, 2, 2, 255, 0, 99999, 0, 0, org[0], org[1], org[2], 0, 0, 0, 0, 0, 0, 0, 0, 0);
        }
-
-#ifdef WORKINGLQUAKE
-       free(pointfile);
-#else
+#ifndef WORKINGLQUAKE
        Mem_Free(pointfile);
 #endif
-       Con_Printf ("%i points read\n", c);
+       VectorCopy(leakorg, org);
+       Con_Printf ("%i points read (%i particles spawned)\nLeak at %f %f %f\n", c, s, org[0], org[1], org[2]);
+
+       particle(pt_static, PARTICLE_BEAM, 0xFF0000, 0xFF0000, tex_beam, false, PBLEND_ALPHA, 64, 64, 255, 0, 99999, 0, 0, org[0] - 4096, org[1], org[2], 0, 0, 0, 0, org[0] + 4096, org[1], org[2], 0, 0);
+       particle(pt_static, PARTICLE_BEAM, 0x00FF00, 0x00FF00, tex_beam, false, PBLEND_ALPHA, 64, 64, 255, 0, 99999, 0, 0, org[0], org[1] - 4096, org[2], 0, 0, 0, 0, org[0], org[1] + 4096, org[2], 0, 0);
+       particle(pt_static, PARTICLE_BEAM, 0x0000FF, 0x0000FF, tex_beam, false, PBLEND_ALPHA, 64, 64, 255, 0, 99999, 0, 0, org[0], org[1], org[2] - 4096, 0, 0, 0, 0, org[0], org[1], org[2] + 4096, 0, 0);
 }
 
 /*
@@ -559,7 +556,7 @@ void CL_ParticleExplosion (vec3_t org)
        if (cl_stainmaps.integer)
                R_Stain(org, 96, 80, 80, 80, 64, 176, 176, 176, 64);
 
-       i = Mod_PointContents(org, cl.worldmodel);
+       i = cl.worldmodel ? cl.worldmodel->PointContents(cl.worldmodel, org) : CONTENTS_EMPTY;
        if ((i == CONTENTS_SLIME || i == CONTENTS_WATER) && cl_particles.integer && cl_particles_bubbles.integer)
        {
                for (i = 0;i < 128;i++)
@@ -664,7 +661,14 @@ void CL_RunParticleEffect (vec3_t org, vec3_t dir, int color, int count)
        while (count--)
        {
                k = particlepalette[color + (rand()&7)];
-               particle(pt_static, PARTICLE_BILLBOARD, k, k, tex_particle, false, PBLEND_ALPHA, 1, 1, 255, 512, 9999, 0, 0, org[0] + lhrandom(-8, 8), org[1] + lhrandom(-8, 8), org[2] + lhrandom(-8, 8), lhrandom(-15, 15), lhrandom(-15, 15), lhrandom(-15, 15), 0, 0, 0, 0, 0, 0);
+               if (gamemode == GAME_GOODVSBAD2)
+               {
+                       particle(pt_static, PARTICLE_BILLBOARD, k, k, tex_particle, false, PBLEND_ALPHA, 5, 5, 255, 300, 9999, 0, 0, org[0] + lhrandom(-8, 8), org[1] + lhrandom(-8, 8), org[2] + lhrandom(-8, 8), lhrandom(-10, 10), lhrandom(-10, 10), lhrandom(-10, 10), 0, 0, 0, 0, 0, 0);
+               }
+               else
+               {
+                       particle(pt_static, PARTICLE_BILLBOARD, k, k, tex_particle, false, PBLEND_ALPHA, 1, 1, 255, 512, 9999, 0, 0, org[0] + lhrandom(-8, 8), org[1] + lhrandom(-8, 8), org[2] + lhrandom(-8, 8), dir[0] + lhrandom(-15, 15), dir[1] + lhrandom(-15, 15), dir[2] + lhrandom(-15, 15), 0, 0, 0, 0, 0, 0);
+               }
        }
 }
 
@@ -832,14 +836,28 @@ void CL_ParticleRain (vec3_t mins, vec3_t maxs, vec3_t dir, int count, int color
                while(count--)
                {
                        k = particlepalette[colorbase + (rand()&3)];
-                       particle(pt_rain, PARTICLE_SPARK, k, k, tex_particle, true, PBLEND_ADD, 0.5, 0.02, lhrandom(8, 16), 0, t, 0, 0, lhrandom(mins[0], maxs[0]), lhrandom(mins[1], maxs[1]), lhrandom(minz, maxz), dir[0], dir[1], dir[2], cl.time + 9999, dir[0], dir[1], dir[2], 0, 0);
+                       if (gamemode == GAME_GOODVSBAD2)
+                       {
+                               particle(pt_rain, PARTICLE_SPARK, k, k, tex_particle, true, PBLEND_ADD, 20, 20, lhrandom(8, 16), 0, t, 0, 0, lhrandom(mins[0], maxs[0]), lhrandom(mins[1], maxs[1]), lhrandom(minz, maxz), dir[0], dir[1], dir[2], cl.time + 9999, dir[0], dir[1], dir[2], 0, 0);
+                       }
+                       else
+                       {
+                               particle(pt_rain, PARTICLE_SPARK, k, k, tex_particle, true, PBLEND_ADD, 0.5, 0.02, lhrandom(8, 16), 0, t, 0, 0, lhrandom(mins[0], maxs[0]), lhrandom(mins[1], maxs[1]), lhrandom(minz, maxz), dir[0], dir[1], dir[2], cl.time + 9999, dir[0], dir[1], dir[2], 0, 0);
+                       }
                }
                break;
        case 1:
                while(count--)
                {
                        k = particlepalette[colorbase + (rand()&3)];
-                       particle(pt_rain, PARTICLE_BILLBOARD, k, k, tex_particle, false, PBLEND_ADD, 1, 1, lhrandom(64, 128), 0, t, 0, 0, lhrandom(mins[0], maxs[0]), lhrandom(mins[1], maxs[1]), lhrandom(minz, maxz), dir[0], dir[1], dir[2], 0, dir[0], dir[1], dir[2], 0, 0);
+                       if (gamemode == GAME_GOODVSBAD2)
+                       {
+                               particle(pt_rain, PARTICLE_BILLBOARD, k, k, tex_particle, false, PBLEND_ADD, 20, 20, lhrandom(64, 128), 0, t, 0, 0, lhrandom(mins[0], maxs[0]), lhrandom(mins[1], maxs[1]), lhrandom(minz, maxz), dir[0], dir[1], dir[2], 0, dir[0], dir[1], dir[2], 0, 0);
+                       }
+                       else
+                       {
+                               particle(pt_rain, PARTICLE_BILLBOARD, k, k, tex_particle, false, PBLEND_ADD, 1, 1, lhrandom(64, 128), 0, t, 0, 0, lhrandom(mins[0], maxs[0]), lhrandom(mins[1], maxs[1]), lhrandom(minz, maxz), dir[0], dir[1], dir[2], 0, dir[0], dir[1], dir[2], 0, 0);
+                       }
                }
                break;
        default:
@@ -916,14 +934,15 @@ CL_LavaSplash
 */
 void CL_LavaSplash (vec3_t origin)
 {
-       int                     i, j, k;
+       int                     i, j, k, l, inc;
        float           vel;
        vec3_t          dir, org;
        if (!cl_particles.integer) return;
 
-       for (i=-128 ; i<128 ; i+=16)
+       inc = 32;
+       for (i = -128;i < 128;i += inc)
        {
-               for (j=-128 ; j<128 ; j+=16)
+               for (j = -128;j < 128;j += inc)
                {
                        dir[0] = j + lhrandom(0, 8);
                        dir[1] = i + lhrandom(0, 8);
@@ -932,8 +951,17 @@ void CL_LavaSplash (vec3_t origin)
                        org[1] = origin[1] + dir[1];
                        org[2] = origin[2] + lhrandom(0, 64);
                        vel = lhrandom(50, 120) / VectorLength(dir); // normalize and scale
-                       k = particlepalette[224 + (rand()&7)];
-                       particle(pt_static, PARTICLE_BILLBOARD, k, k, tex_particle, false, PBLEND_ADD, 7, 7, 255, 192, 9999, 0.05, 0, org[0], org[1], org[2], dir[0] * vel, dir[1] * vel, dir[2] * vel, 0, 0, 0, 0, 0, 0);
+                       if (gamemode == GAME_GOODVSBAD2)
+                       {
+                               k = particlepalette[0 + (rand()&255)];
+                               l = particlepalette[0 + (rand()&255)];
+                               particle(pt_static, PARTICLE_BILLBOARD, k, l, tex_particle, false, PBLEND_ADD, 12, 12, 255, 240, 9999, 0.05, 1, org[0], org[1], org[2], dir[0] * vel, dir[1] * vel, dir[2] * vel, 0, 0, 0, 0, 0, 0);
+                       }
+                       else
+                       {
+                               k = l = particlepalette[224 + (rand()&7)];
+                               particle(pt_static, PARTICLE_BILLBOARD, k, l, tex_particle, false, PBLEND_ADD, 12, 12, 255, 240, 9999, 0.05, 0, org[0], org[1], org[2], dir[0] * vel, dir[1] * vel, dir[2] * vel, 0, 0, 0, 0, 0, 0);
+                       }
                }
        }
 }
@@ -998,7 +1026,7 @@ void CL_RocketTrail (vec3_t start, vec3_t end, int type, entity_t *ent)
        VectorMA(start, dec, vec, pos);
        len -= dec;
 
-       contents = Mod_PointContents(pos, cl.worldmodel);
+       contents = cl.worldmodel ? cl.worldmodel->PointContents(cl.worldmodel, pos) : CONTENTS_EMPTY;
        if (contents == CONTENTS_SKY || contents == CONTENTS_LAVA)
                return;
 
@@ -1048,7 +1076,14 @@ void CL_RocketTrail (vec3_t start, vec3_t end, int type, entity_t *ent)
                                dec = 6;
                                if (smoke)
                                {
-                                       particle(pt_static, PARTICLE_BILLBOARD, 0x002000, 0x003000, tex_particle, false, PBLEND_ADD, dec, dec, 128, 384, 9999, 0, 0, pos[0], pos[1], pos[2], lhrandom(-8, 8), lhrandom(-8, 8), lhrandom(-8, 8), 0, 0, 0, 0, 0, 0);
+                                       if (gamemode == GAME_GOODVSBAD2)
+                                       {
+                                               particle(pt_static, PARTICLE_BILLBOARD, 0x00002E, 0x000030, tex_particle, false, PBLEND_ADD, dec, dec, 128, 384, 9999, 0, 0, pos[0], pos[1], pos[2], lhrandom(-8, 8), lhrandom(-8, 8), lhrandom(-8, 8), 0, 0, 0, 0, 0, 0);
+                                       }
+                                       else
+                                       {
+                                               particle(pt_static, PARTICLE_BILLBOARD, 0x002000, 0x003000, tex_particle, false, PBLEND_ADD, dec, dec, 128, 384, 9999, 0, 0, pos[0], pos[1], pos[2], lhrandom(-8, 8), lhrandom(-8, 8), lhrandom(-8, 8), 0, 0, 0, 0, 0, 0);
+                                       }
                                }
                                break;
 
@@ -1064,7 +1099,14 @@ void CL_RocketTrail (vec3_t start, vec3_t end, int type, entity_t *ent)
                                dec = 6;
                                if (smoke)
                                {
-                                       particle(pt_static, PARTICLE_BILLBOARD, 0x502030, 0x502030, tex_particle, false, PBLEND_ADD, dec, dec, 128, 384, 9999, 0, 0, pos[0], pos[1], pos[2], lhrandom(-8, 8), lhrandom(-8, 8), lhrandom(-8, 8), 0, 0, 0, 0, 0, 0);
+                                       if (gamemode == GAME_GOODVSBAD2)
+                                       {
+                                               particle(pt_static, PARTICLE_BILLBOARD, particlepalette[0 + (rand()&255)], particlepalette[0 + (rand()&255)], tex_particle, false, PBLEND_ALPHA, dec, dec, 255, 384, 9999, 0, 0, pos[0], pos[1], pos[2], lhrandom(-8, 8), lhrandom(-8, 8), lhrandom(-8, 8), 0, 0, 0, 0, 0, 0);
+                                       }
+                                       else
+                                       {
+                                               particle(pt_static, PARTICLE_BILLBOARD, 0x502030, 0x502030, tex_particle, false, PBLEND_ADD, dec, dec, 128, 384, 9999, 0, 0, pos[0], pos[1], pos[2], lhrandom(-8, 8), lhrandom(-8, 8), lhrandom(-8, 8), 0, 0, 0, 0, 0, 0);
+                                       }
                                }
                                break;
 
@@ -1265,7 +1307,7 @@ void CL_MoveParticles (void)
                {
                        f = p->friction * frametime;
                        if (!content)
-                               content = Mod_PointContents(p->org, cl.worldmodel);
+                               content = cl.worldmodel ? cl.worldmodel->PointContents(cl.worldmodel, p->org) : CONTENTS_EMPTY;
                        if (content != CONTENTS_EMPTY)
                                f *= 4;
                        f = 1.0f - f;
@@ -1278,7 +1320,7 @@ void CL_MoveParticles (void)
                        {
                        case pt_blood:
                                if (!content)
-                                       content = Mod_PointContents(p->org, cl.worldmodel);
+                                       content = cl.worldmodel ? cl.worldmodel->PointContents(cl.worldmodel, p->org) : CONTENTS_EMPTY;
                                a = content;
                                if (a != CONTENTS_EMPTY)
                                {
@@ -1296,7 +1338,7 @@ void CL_MoveParticles (void)
                                break;
                        case pt_bubble:
                                if (!content)
-                                       content = Mod_PointContents(p->org, cl.worldmodel);
+                                       content = cl.worldmodel ? cl.worldmodel->PointContents(cl.worldmodel, p->org) : CONTENTS_EMPTY;
                                if (content != CONTENTS_WATER && content != CONTENTS_SLIME)
                                {
                                        p->die = -1;
@@ -1313,7 +1355,7 @@ void CL_MoveParticles (void)
                                        p->vel[2] = /*lhrandom(-32, 32) +*/ p->vel2[2];
                                }
                                if (!content)
-                                       content = Mod_PointContents(p->org, cl.worldmodel);
+                                       content = cl.worldmodel ? cl.worldmodel->PointContents(cl.worldmodel, p->org) : CONTENTS_EMPTY;
                                a = content;
                                if (a != CONTENTS_EMPTY && a != CONTENTS_SKY)
                                        p->die = -1;
@@ -1669,10 +1711,10 @@ void R_InitParticles(void)
        CL_Particles_Init();
        R_Particles_Init();
 }
-
-float varray_vertex3f[12], varray_texcoord2f[1][8];
 #endif
 
+float particle_vertex3f[12], particle_texcoord2f[8];
+
 #ifdef WORKINGLQUAKE
 void R_DrawParticle(particle_t *p)
 {
@@ -1704,26 +1746,6 @@ void R_DrawParticleCallback(const void *calldata1, int calldata2)
        }
 
 #ifndef WORKINGLQUAKE
-       memset(&m, 0, sizeof(m));
-       if (p->blendmode == 0)
-       {
-               m.blendfunc1 = GL_SRC_ALPHA;
-               m.blendfunc2 = GL_ONE_MINUS_SRC_ALPHA;
-       }
-       else if (p->blendmode == 1)
-       {
-               m.blendfunc1 = GL_SRC_ALPHA;
-               m.blendfunc2 = GL_ONE;
-       }
-       else
-       {
-               m.blendfunc1 = GL_ZERO;
-               m.blendfunc2 = GL_ONE_MINUS_SRC_COLOR;
-       }
-       m.tex[0] = R_GetTexture(tex->texture);
-       R_Mesh_Matrix(&r_identitymatrix);
-       R_Mesh_State(&m);
-
        if (fogenabled && p->blendmode != PBLEND_MOD)
        {
                VectorSubtract(org, r_origin, fogvec);
@@ -1745,7 +1767,22 @@ void R_DrawParticleCallback(const void *calldata1, int calldata2)
 
        GL_Color(cr, cg, cb, ca);
 
-       R_Mesh_GetSpace(4);
+       R_Mesh_Matrix(&r_identitymatrix);
+
+       memset(&m, 0, sizeof(m));
+       m.tex[0] = R_GetTexture(tex->texture);
+       m.pointer_texcoord[0] = particle_texcoord2f;
+       R_Mesh_State_Texture(&m);
+
+       if (p->blendmode == 0)
+               GL_BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+       else if (p->blendmode == 1)
+               GL_BlendFunc(GL_SRC_ALPHA, GL_ONE);
+       else
+               GL_BlendFunc(GL_ZERO, GL_ONE_MINUS_SRC_COLOR);
+       GL_DepthMask(false);
+       GL_DepthTest(true);
+       GL_VertexPointer(particle_vertex3f);
 #endif
        if (p->orientation == PARTICLE_BILLBOARD || p->orientation == PARTICLE_ORIENTED_DOUBLESIDED)
        {
@@ -1767,44 +1804,44 @@ void R_DrawParticleCallback(const void *calldata1, int calldata2)
                        VectorScale(vright, p->scalex, right);
                        VectorScale(vup, p->scaley, up);
                }
-               varray_vertex3f[ 0] = org[0] - right[0] - up[0];
-               varray_vertex3f[ 1] = org[1] - right[1] - up[1];
-               varray_vertex3f[ 2] = org[2] - right[2] - up[2];
-               varray_vertex3f[ 3] = org[0] - right[0] + up[0];
-               varray_vertex3f[ 4] = org[1] - right[1] + up[1];
-               varray_vertex3f[ 5] = org[2] - right[2] + up[2];
-               varray_vertex3f[ 6] = org[0] + right[0] + up[0];
-               varray_vertex3f[ 7] = org[1] + right[1] + up[1];
-               varray_vertex3f[ 8] = org[2] + right[2] + up[2];
-               varray_vertex3f[ 9] = org[0] + right[0] - up[0];
-               varray_vertex3f[10] = org[1] + right[1] - up[1];
-               varray_vertex3f[11] = org[2] + right[2] - up[2];
-               varray_texcoord2f[0][0] = tex->s1;varray_texcoord2f[0][1] = tex->t2;
-               varray_texcoord2f[0][2] = tex->s1;varray_texcoord2f[0][3] = tex->t1;
-               varray_texcoord2f[0][4] = tex->s2;varray_texcoord2f[0][5] = tex->t1;
-               varray_texcoord2f[0][6] = tex->s2;varray_texcoord2f[0][7] = tex->t2;
+               particle_vertex3f[ 0] = org[0] - right[0] - up[0];
+               particle_vertex3f[ 1] = org[1] - right[1] - up[1];
+               particle_vertex3f[ 2] = org[2] - right[2] - up[2];
+               particle_vertex3f[ 3] = org[0] - right[0] + up[0];
+               particle_vertex3f[ 4] = org[1] - right[1] + up[1];
+               particle_vertex3f[ 5] = org[2] - right[2] + up[2];
+               particle_vertex3f[ 6] = org[0] + right[0] + up[0];
+               particle_vertex3f[ 7] = org[1] + right[1] + up[1];
+               particle_vertex3f[ 8] = org[2] + right[2] + up[2];
+               particle_vertex3f[ 9] = org[0] + right[0] - up[0];
+               particle_vertex3f[10] = org[1] + right[1] - up[1];
+               particle_vertex3f[11] = org[2] + right[2] - up[2];
+               particle_texcoord2f[0] = tex->s1;particle_texcoord2f[1] = tex->t2;
+               particle_texcoord2f[2] = tex->s1;particle_texcoord2f[3] = tex->t1;
+               particle_texcoord2f[4] = tex->s2;particle_texcoord2f[5] = tex->t1;
+               particle_texcoord2f[6] = tex->s2;particle_texcoord2f[7] = tex->t2;
        }
        else if (p->orientation == PARTICLE_SPARK)
        {
                VectorMA(p->org, -p->scaley, p->vel, v);
                VectorMA(p->org, p->scaley, p->vel, up2);
-               R_CalcBeam_Vertex3f(varray_vertex3f, v, up2, p->scalex);
-               varray_texcoord2f[0][0] = tex->s1;varray_texcoord2f[0][1] = tex->t2;
-               varray_texcoord2f[0][2] = tex->s1;varray_texcoord2f[0][3] = tex->t1;
-               varray_texcoord2f[0][4] = tex->s2;varray_texcoord2f[0][5] = tex->t1;
-               varray_texcoord2f[0][6] = tex->s2;varray_texcoord2f[0][7] = tex->t2;
+               R_CalcBeam_Vertex3f(particle_vertex3f, v, up2, p->scalex);
+               particle_texcoord2f[0] = tex->s1;particle_texcoord2f[1] = tex->t2;
+               particle_texcoord2f[2] = tex->s1;particle_texcoord2f[3] = tex->t1;
+               particle_texcoord2f[4] = tex->s2;particle_texcoord2f[5] = tex->t1;
+               particle_texcoord2f[6] = tex->s2;particle_texcoord2f[7] = tex->t2;
        }
        else if (p->orientation == PARTICLE_BEAM)
        {
-               R_CalcBeam_Vertex3f(varray_vertex3f, p->org, p->vel2, p->scalex);
+               R_CalcBeam_Vertex3f(particle_vertex3f, p->org, p->vel2, p->scalex);
                VectorSubtract(p->vel2, p->org, up);
                VectorNormalizeFast(up);
                v[0] = DotProduct(p->org, up) * (1.0f / 64.0f) - cl.time * 0.25;
                v[1] = DotProduct(p->vel2, up) * (1.0f / 64.0f) - cl.time * 0.25;
-               varray_texcoord2f[0][0] = 1;varray_texcoord2f[0][1] = v[0];
-               varray_texcoord2f[0][2] = 0;varray_texcoord2f[0][3] = v[0];
-               varray_texcoord2f[0][4] = 0;varray_texcoord2f[0][5] = v[1];
-               varray_texcoord2f[0][6] = 1;varray_texcoord2f[0][7] = v[1];
+               particle_texcoord2f[0] = 1;particle_texcoord2f[1] = v[0];
+               particle_texcoord2f[2] = 0;particle_texcoord2f[3] = v[0];
+               particle_texcoord2f[4] = 0;particle_texcoord2f[5] = v[1];
+               particle_texcoord2f[6] = 1;particle_texcoord2f[7] = v[1];
        }
        else
                Host_Error("R_DrawParticles: unknown particle orientation %i\n", p->orientation);
@@ -1818,10 +1855,10 @@ void R_DrawParticleCallback(const void *calldata1, int calldata2)
                glBlendFunc(GL_ZERO, GL_ONE_MINUS_SRC_COLOR);
        glColor4f(cr, cg, cb, ca);
        glBegin(GL_QUADS);
-       glTexCoord2f(varray_texcoord2f[0][0], varray_texcoord2f[0][1]);glVertex3f(varray_vertex3f[ 0], varray_vertex3f[ 1], varray_vertex3f[ 2]);
-       glTexCoord2f(varray_texcoord2f[0][2], varray_texcoord2f[0][3]);glVertex3f(varray_vertex3f[ 3], varray_vertex3f[ 4], varray_vertex3f[ 5]);
-       glTexCoord2f(varray_texcoord2f[0][4], varray_texcoord2f[0][5]);glVertex3f(varray_vertex3f[ 6], varray_vertex3f[ 7], varray_vertex3f[ 8]);
-       glTexCoord2f(varray_texcoord2f[0][6], varray_texcoord2f[0][7]);glVertex3f(varray_vertex3f[ 9], varray_vertex3f[10], varray_vertex3f[11]);
+       glTexCoord2f(particle_texcoord2f[0], particle_texcoord2f[1]);glVertex3f(particle_vertex3f[ 0], particle_vertex3f[ 1], particle_vertex3f[ 2]);
+       glTexCoord2f(particle_texcoord2f[2], particle_texcoord2f[3]);glVertex3f(particle_vertex3f[ 3], particle_vertex3f[ 4], particle_vertex3f[ 5]);
+       glTexCoord2f(particle_texcoord2f[4], particle_texcoord2f[5]);glVertex3f(particle_vertex3f[ 6], particle_vertex3f[ 7], particle_vertex3f[ 8]);
+       glTexCoord2f(particle_texcoord2f[6], particle_texcoord2f[7]);glVertex3f(particle_vertex3f[ 9], particle_vertex3f[10], particle_vertex3f[11]);
        glEnd();
 #else
        R_Mesh_Draw(4, 2, polygonelements);