From 1a2f871517b8b782785556094d9b4118e7c385ec Mon Sep 17 00:00:00 2001 From: sezero Date: Mon, 10 Jan 2011 20:33:12 +0000 Subject: [PATCH] bgmusic.c: remove some unnecessary comments. (BGM_Play): call BGM_Stop() before anything else. don't do anything if there are no music handlers. (BGM_PlayCDtrack): remove commented out code. if CDAudio_Play() call failed and there are no music handlers, don't do anything else. git-svn-id: svn+ssh://svn.code.sf.net/p/quakespasm/code/trunk@388 af15c1b1-3010-417e-b628-4374ebc0bcbd --- quakespasm/Quake/bgmusic.c | 27 ++++++++------------------- 1 file changed, 8 insertions(+), 19 deletions(-) diff --git a/quakespasm/Quake/bgmusic.c b/quakespasm/Quake/bgmusic.c index 12de7c66..2fcc9517 100644 --- a/quakespasm/Quake/bgmusic.c +++ b/quakespasm/Quake/bgmusic.c @@ -197,8 +197,6 @@ static void BGM_Play_noext (const char *filename, unsigned int allowed_types) } if (!handler->is_available) { - /* skip handlers which failed to initialize */ - /* TODO: implement re-init, make BGM aware of it */ handler = handler->next; continue; } @@ -230,14 +228,17 @@ void BGM_Play (const char *filename) const char *ext; music_handler_t *handler; + BGM_Stop(); + + if (music_handlers == NULL) + return; + if (!filename || !*filename) { Con_DPrintf("null music file name\n"); return; } - BGM_Stop(); - ext = S_FileExtension(filename); if (!ext) /* try all things */ { @@ -248,8 +249,6 @@ void BGM_Play (const char *filename) handler = music_handlers; while (handler) { - /* skip handlers which failed to initialize */ - /* TODO: implement re-init, make BGM aware of it */ if (handler->is_available && !Q_strcasecmp(ext, handler->ext)) break; @@ -281,19 +280,6 @@ void BGM_Play (const char *filename) void BGM_PlayCDtrack (byte track, qboolean looping) { -#if 0 /* see below */ - char tmp[MAX_QPATH]; - - BGM_Stop(); - - bgmloop = looping; - - if (CDAudio_Play(track, looping) == 0) - return; /* success */ - - q_snprintf(tmp, sizeof(tmp), "track%02d", (int)track); - BGM_Play_noext(tmp, CDRIP_TYPES); -#endif /* instead of searching by the order of music_handlers, do so by * the order of searchpath priority: the file from the searchpath * with the highest path_id is most likely from our own gamedir @@ -310,6 +296,9 @@ void BGM_PlayCDtrack (byte track, qboolean looping) if (CDAudio_Play(track, looping) == 0) return; /* success */ + if (music_handlers == NULL) + return; + if (no_extmusic || !bgm_extmusic.value) return;