]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - snd_mix.c
shuffled cl_light and some of cl_tent into cl_main and remaining cl_tent code into...
[xonotic/darkplaces.git] / snd_mix.c
index 96f20236f156b415e64b5dd36b0cda4eafcdfd42..e9325085348f6a4582af37d1224ceb3a28792ab2 100644 (file)
--- a/snd_mix.c
+++ b/snd_mix.c
@@ -26,9 +26,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 #endif
 
 // LordHavoc: was 512, expanded to 2048
-#define        PAINTBUFFER_SIZE        2048
+#define        PAINTBUFFER_SIZE 2048
 portable_samplepair_t paintbuffer[PAINTBUFFER_SIZE];
-int            snd_scaletable[32][256];
+int snd_scaletable[32][256];
 
 /*
 // LordHavoc: disabled this because it desyncs with the video too easily
@@ -342,19 +342,19 @@ void S_PaintChannels(int endtime)
 
 void SND_InitScaletable (void)
 {
-       int             i, j;
+       int i, j;
 
-       for (i=0 ; i<32 ; i++)
-               for (j=0 ; j<256 ; j++)
+       for (i = 0;i < 32;i++)
+               for (j = 0;j < 256;j++)
                        snd_scaletable[i][j] = ((signed char)j) * i * 8;
 }
 
 
 void SND_PaintChannelFrom8 (channel_t *ch, sfxcache_t *sc, int count)
 {
-       int             *lscale, *rscale;
+       int *lscale, *rscale;
        unsigned char *sfx;
-       int             i;
+       int i, n;
 
        if (ch->leftvol > 255)
                ch->leftvol = 255;
@@ -367,22 +367,20 @@ void SND_PaintChannelFrom8 (channel_t *ch, sfxcache_t *sc, int count)
        {
                // LordHavoc: stereo sound support, and optimizations
                sfx = (unsigned char *)sc->data + ch->pos * 2;
-
-               for (i=0 ; i<count ; i++)
+               for (i = 0;i < count;i++)
                {
                        paintbuffer[i].left += lscale[*sfx++];
                        paintbuffer[i].right += rscale[*sfx++];
                }
-               
        }
        else
        {
                sfx = (unsigned char *)sc->data + ch->pos;
-
-               for (i=0 ; i<count ; i++)
+               for (i = 0;i < count;i++)
                {
-                       paintbuffer[i].left += lscale[*sfx];
-                       paintbuffer[i].right += rscale[*sfx++];
+                       n = *sfx++;
+                       paintbuffer[i].left += lscale[n];
+                       paintbuffer[i].right += rscale[n];
                }
 
        }
@@ -393,7 +391,7 @@ void SND_PaintChannelFrom16 (channel_t *ch, sfxcache_t *sc, int count)
 {
        int leftvol, rightvol;
        signed short *sfx;
-       int     i;
+       int i;
 
        leftvol = ch->leftvol;
        rightvol = ch->rightvol;