]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - snd_mem.c
cmd: Check for empty cbuf when inserting too
[xonotic/darkplaces.git] / snd_mem.c
index 1098c2b67a817b0ec09c139b636ad42449b7590e..519ef0e27924a3049b533a8c6ee33ed64208161e 100644 (file)
--- a/snd_mem.c
+++ b/snd_mem.c
@@ -19,12 +19,18 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 */
 
 
-#include "quakedef.h"
+#include "darkplaces.h"
 
 #include "snd_main.h"
 #include "snd_ogg.h"
 #include "snd_wav.h"
+#ifdef USEXMP
+#include "snd_xmp.h"
+#endif
+#include "sound.h"
 
+void SCR_PushLoadingScreen (const char *, float);
+void SCR_PopLoadingScreen (qbool);
 
 /*
 ====================
@@ -78,7 +84,7 @@ snd_ringbuffer_t *Snd_CreateRingBuffer (const snd_format_t* format, unsigned int
 S_LoadSound
 ==============
 */
-qboolean S_LoadSound (sfx_t *sfx, qboolean complain)
+qbool S_LoadSound (sfx_t *sfx, qbool complain)
 {
        char namebuffer[MAX_QPATH + 16];
        size_t len;
@@ -102,9 +108,9 @@ qboolean S_LoadSound (sfx_t *sfx, qboolean complain)
        if (developer_loading.integer)
                Con_Printf("loading sound %s\n", sfx->name);
 
-       SCR_PushLoadingScreen(true, sfx->name, 1);
+       SCR_PushLoadingScreen(sfx->name, 1);
 
-       // LordHavoc: if the sound filename does not begin with sound/, try adding it
+       // LadyHavoc: if the sound filename does not begin with sound/, try adding it
        if (strncasecmp(sfx->name, "sound/", 6))
        {
                dpsnprintf (namebuffer, sizeof(namebuffer), "sound/%s", sfx->name);
@@ -120,9 +126,16 @@ qboolean S_LoadSound (sfx_t *sfx, qboolean complain)
                        if (OGG_LoadVorbisFile (namebuffer, sfx))
                                goto loaded;
                }
+#ifdef USEXMP
+               else if (len >= 1)
+               {
+                       if (XMP_LoadModFile (namebuffer, sfx))
+                               goto loaded;
+               }
+#endif
        }
 
-       // LordHavoc: then try without the added sound/ as wav and ogg
+       // LadyHavoc: then try without the added sound/ as wav and ogg
        dpsnprintf (namebuffer, sizeof(namebuffer), "%s", sfx->name);
        len = strlen(namebuffer);
        // request foo.wav: tries foo.wav, then foo.ogg
@@ -139,11 +152,18 @@ qboolean S_LoadSound (sfx_t *sfx, qboolean complain)
                if (OGG_LoadVorbisFile (namebuffer, sfx))
                        goto loaded;
        }
+#ifdef USEXMP
+       else if (len >= 1)
+       {
+               if (XMP_LoadModFile (namebuffer, sfx))
+                       goto loaded;
+       }
+#endif
 
        // Can't load the sound!
        sfx->flags |= SFXFLAG_FILEMISSING;
        if (complain)
-               Con_DPrintf("failed to load sound \"%s\"\n", sfx->name);
+               Con_Printf(CON_ERROR "Failed to load sound \"%s\"\n", sfx->name);
 
        SCR_PopLoadingScreen(false);
        return false;