+
+/*
+==============
+S_LoadSound
+==============
+*/
+sfxcache_t *S_LoadSound (sfx_t *s, int complain)
+{
+ char namebuffer[MAX_QPATH];
+ size_t len;
+ sfxcache_t *sc;
+
+ // see if still in memory
+ if (!shm || !shm->speed)
+ return NULL;
+ if (s->sfxcache && (s->sfxcache->speed == shm->speed))
+ return s->sfxcache;
+
+ len = snprintf (namebuffer, sizeof (namebuffer), "sound/%s", s->name);
+ if (len >= sizeof (namebuffer))
+ return NULL;
+
+ // Try to load it as a WAV file
+ sc = S_LoadWavFile (namebuffer, s);
+
+ // TODO: insert Ogg Vorbis support here
+
+ // Can't load the sound!
+ if (sc == NULL)
+ {
+ s->silentlymissing = !complain;
+ if (complain)
+ Con_Printf ("Couldn't load %s\n", namebuffer);
+ return NULL;
+ }
+
+ return sc;
+}
+