]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - dpvsimpledecode.c
100% untested: additionally apply mastervolume to ambient sound channels
[xonotic/darkplaces.git] / dpvsimpledecode.c
index 7519c3f6ecd6dad1cf0cb48a418fbf1bc470849d..8ad43beab3736e9292b3106a26cdda7c4d88076d 100644 (file)
@@ -38,7 +38,7 @@ hz_bitstream_read_t *hz_bitstream_read_open(char *filename)
 {
        qfile_t *file;
        hz_bitstream_read_t *stream;
-       if ((file = FS_Open (filename, "rb", false, false)))
+       if ((file = FS_OpenVirtualFile(filename, false)))
        {
                stream = (hz_bitstream_read_t *)Z_Malloc(sizeof(hz_bitstream_read_t));
                memset(stream, 0, sizeof(*stream));
@@ -279,7 +279,6 @@ static int dpvsimpledecode_setpixelformat(dpvsimpledecodestream_t *s, unsigned i
        default:
                s->error = DPVSIMPLEDECODEERROR_UNSUPPORTEDBPP;
                return s->error;
-               break;
        }
        for (Rshift = 0;!(Rmask & 1);Rshift++, Rmask >>= 1);
        for (Gshift = 0;!(Gmask & 1);Gshift++, Gmask >>= 1);
@@ -334,7 +333,7 @@ static int dpvsimpledecode_setpixelformat(dpvsimpledecodestream_t *s, unsigned i
 // opening and closing streams
 
 // opens a stream
-void *dpvsimpledecode_open(char *filename, char **errorstring)
+void *dpvsimpledecode_open(char *filename, const char **errorstring)
 {
        dpvsimpledecodestream_t *s;
        char t[8], *wavename;
@@ -369,7 +368,7 @@ void *dpvsimpledecode_open(char *filename, char **errorstring)
                                                        if (s->videopixels != NULL)
                                                        {
                                                                size_t namelen;
-                                                               
+
                                                                namelen = strlen(filename) + 10;
                                                                wavename = (char *)Z_Malloc(namelen);
                                                                if (wavename)
@@ -424,7 +423,7 @@ void dpvsimpledecode_close(void *stream)
        if (s->videopixels)
                Z_Free(s->videopixels);
        if (s->sndchan != -1)
-               S_StopChannel (s->sndchan);
+               S_StopChannel (s->sndchan, true);
        if (s->framedatablocks)
                hz_bitstream_read_blocks_free(s->framedatablocks);
        if (s->bitstream)
@@ -438,7 +437,7 @@ void dpvsimpledecode_close(void *stream)
 // number to DPVSIMPLEDECODEERROR_NONE
 // if the supplied string pointer variable is not NULL, it will be set to the
 // error message
-int dpvsimpledecode_error(void *stream, char **errorstring)
+int dpvsimpledecode_error(void *stream, const char **errorstring)
 {
        dpvsimpledecodestream_t *s = (dpvsimpledecodestream_t *)stream;
        int e;