#include "quakedef.h"
-#ifdef _WIN32
-#include "winquake.h"
-#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
{
if (cl_avidemo_soundfile == NULL)
{
- sprintf (filename, "%s/dpavi.wav", com_gamedir);
- cl_avidemo_soundfile = fopen(filename, "wb");
+ cl_avidemo_soundfile = FS_Open ("dpavi.wav", "wb", false);
memset(out, 0, 44);
fwrite(out, 1, 44, cl_avidemo_soundfile);
// header will be filled out when file is closed
// if at end of loop, restart
if (ltime >= ch->end)
{
- if (sc->loopstart >= 0)
+ if (sc->loopstart >= 0 || ch->forceloop)
{
- ch->pos = sc->loopstart;
+ ch->pos = bound(0, sc->loopstart, sc->length - 1);
ch->end = ltime + sc->length - ch->pos;
}
else
{
int *lscale, *rscale;
unsigned char *sfx;
- int i;
+ int i, n;
if (ch->leftvol > 255)
ch->leftvol = 255;
{
// 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];
}
}