More improvements from ashridah.

This commit is contained in:
Ragnvald Maartmann-Moe IV 2004-02-08 02:39:44 +00:00
parent 8ea7690530
commit 6880b42182

View file

@ -235,6 +235,9 @@ I_OGGMus_Play (int track, qboolean looping)
if (!tracklist || !mus_enabled) if (!tracklist || !mus_enabled)
return; return;
if (playing)
I_OGGMus_Stop ();
trackstring = va ("%i", track); trackstring = va ("%i", track);
trackmap = PL_ObjectForKey (tracklist, trackstring); trackmap = PL_ObjectForKey (tracklist, trackstring);
if (!trackmap || trackmap->type != QFString) { if (!trackmap || trackmap->type != QFString) {
@ -270,36 +273,30 @@ I_OGGMus_Play (int track, qboolean looping)
static void static void
I_OGGMus_Info (void) I_OGGMus_Info (void)
{ {
plitem_t *keylist = NULL; int count = 0, iter = 0, keycount = 0;
plitem_t *currenttrack = NULL;
int count = 0, iter = 0;
const char *trackstring; const char *trackstring;
plitem_t *currenttrack = NULL;
if (!tracklist) { if (!tracklist) {
Sys_Printf ("\n" "No Tracklist\n" "------------\n"); Sys_Printf ("\n" "No Tracklist\n" "------------\n");
return; return;
} }
if (!(keylist = PL_D_AllKeys (tracklist))) { if (!(keycount = PL_D_NumKeys (tracklist)))
Sys_DPrintf ("OGGMus: Didn't get valid plist_t array, yet have "
"valid tracklist?\n");
return; return;
}
Sys_Printf ("\n" "Tracklist loaded from file:\n%s\n" Sys_Printf ("\n" "Tracklist loaded from file:\n%s\n"
"---------------------------\n", mus_ogglist->string); "---------------------------\n", mus_ogglist->string);
/* loop, and count up the Highest key number. */ /* loop, and count up the Highest key number. */
for (iter = 1, count = 0; count < ((plarray_t *) (keylist->data))->numvals for (iter = 1, count = 0; count < keycount && iter <= 99 ; iter++) {
&& iter <= 99 ; iter++) {
trackstring = va ("%i", iter); trackstring = va ("%i", iter);
if (!(currenttrack = PL_ObjectForKey (tracklist, trackstring))) { if (!(currenttrack = PL_ObjectForKey (tracklist, trackstring))) {
continue; continue;
} }
Sys_Printf (" %s - %s\n", trackstring, (char *) currenttrack->data); Sys_Printf (" %s - %s\n", trackstring, (char *) currenttrack->data);
count++; count++;
} }
PL_Free (keylist);
} }
static void static void