]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
minor improvement to modplug (now cd loop 1 also would load a mod/it/xm/s3m/... file...
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Thu, 13 Dec 2007 15:23:14 +0000 (15:23 +0000)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Thu, 13 Dec 2007 15:23:14 +0000 (15:23 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@7790 d7cf8633-e32d-0410-b094-e92efae38249

cd_shared.c
makefile.inc
snd_mem.c

index e6c27a88217276737e1d221281d810d3ed4b2ca0..e56fa388911f8c616c0a4ad2d410855e8d8aac82 100644 (file)
@@ -129,6 +129,10 @@ void CDAudio_Play_byName (const char *trackname, qboolean looping)
                sfx = S_PrecacheSound (va ("cdtracks/track%02u.wav", track), false, false);
                if (sfx == NULL || !S_IsSoundPrecached (sfx))
                        sfx = S_PrecacheSound (va ("cdtracks/track%03u.wav", track), false, false);
+               if (sfx == NULL || !S_IsSoundPrecached (sfx))
+                       sfx = S_PrecacheSound (va ("cdtracks/track%02u", track), false, false);
+               if (sfx == NULL || !S_IsSoundPrecached (sfx))
+                       sfx = S_PrecacheSound (va ("cdtracks/track%03u", track), false, false);
        }
        else
        {
index 8e604f55809ca07139e92615b6c0499fe7c5992c..1d7ee8b97e94e24814a43bcacfe426638a993548 100644 (file)
@@ -173,9 +173,9 @@ OBJ_GLX= builddate.c sys_linux.o vid_glx.o $(OBJ_SOUND) $(OBJ_CD) $(OBJ_COMMON)
 
 LDFLAGS_UNIXCOMMON=-lm
 LDFLAGS_UNIXCL=-L$(UNIX_X11LIBPATH) -lX11 -lXpm -lXext -lXxf86dga -lXxf86vm $(LIB_SOUND)
-LDFLAGS_UNIXCL_PRELOAD=-lz -ljpeg -lpng -lvorbis -lvorbisfile -lcurl
+LDFLAGS_UNIXCL_PRELOAD=-lz -ljpeg -lpng -lvorbis -lvorbisfile -lcurl -lmodplug
 LDFLAGS_UNIXSV_PRELOAD=-lz -lcurl
-LDFLAGS_UNIXSDL_PRELOAD=-lz -ljpeg -lpng -lvorbis -lvorbisfile -lcurl
+LDFLAGS_UNIXSDL_PRELOAD=-lz -ljpeg -lpng -lvorbis -lvorbisfile -lcurl -lmodplug
 CFLAGS_UNIX_PRELOAD=-DPREFER_PRELOAD
 
 LDFLAGS_UNIXSDL=$(SDLCONFIG_LIBS)
index 44e33d16cdf5be80291b1d0c45bed95de3944252..a6cb234e69ca2f1d08e4e05b9b3121b910f677b2 100644 (file)
--- a/snd_mem.c
+++ b/snd_mem.c
@@ -333,15 +333,22 @@ qboolean S_LoadSound (sfx_t *sfx, qboolean complain)
                        Con_DPrintf("S_LoadSound: name \"%s\" is too long\n", sfx->name);
                        return false;
                }
-               if (S_LoadWavFile (namebuffer, sfx))
-                       return true;
                if (len >= 4 && !strcasecmp (namebuffer + len - 4, ".wav"))
+               {
+                       if (S_LoadWavFile (namebuffer, sfx))
+                               return true;
                        memcpy (namebuffer + len - 3, "ogg", 4);
+               }
                if (len >= 4 && !strcasecmp (namebuffer + len - 4, ".ogg"))
+               {
                        if (OGG_LoadVorbisFile (namebuffer, sfx))
                                return true;
-               if (ModPlug_LoadModPlugFile (namebuffer, sfx))
-                       return true;
+               }
+               else
+               {
+                       if (ModPlug_LoadModPlugFile (namebuffer, sfx))
+                               return true;
+               }
        }
 
        // LordHavoc: then try without the added sound/ as wav and ogg
@@ -352,15 +359,25 @@ qboolean S_LoadSound (sfx_t *sfx, qboolean complain)
                Con_DPrintf("S_LoadSound: name \"%s\" is too long\n", sfx->name);
                return false;
        }
-       if (S_LoadWavFile (namebuffer, sfx))
-               return true;
+       // request foo.wav: tries foo.wav, then foo.ogg
+       // request foo.ogg: tries foo.ogg only
+       // request foo.mod: tries foo.mod only
        if (len >= 4 && !strcasecmp (namebuffer + len - 4, ".wav"))
+       {
+               if (S_LoadWavFile (namebuffer, sfx))
+                       return true;
                memcpy (namebuffer + len - 3, "ogg", 4);
+       }
        if (len >= 4 && !strcasecmp (namebuffer + len - 4, ".ogg"))
+       {
                if (OGG_LoadVorbisFile (namebuffer, sfx))
                        return true;
-       if (ModPlug_LoadModPlugFile (namebuffer, sfx))
-               return true;
+       }
+       else
+       {
+               if (ModPlug_LoadModPlugFile (namebuffer, sfx))
+                       return true;
+       }
 
        // Can't load the sound!
        sfx->flags |= SFXFLAG_FILEMISSING;