diff --git a/README b/README index aa7b1f4d..03a7b715 100644 --- a/README +++ b/README @@ -198,6 +198,7 @@ New cvars New commands video [filename] - start video capture (use with demo command) stopvideo - stop video capture + stopmusic - stop background music print - print out the contents of a cvar unset - unset a user created cvar diff --git a/code/client/snd_dma.c b/code/client/snd_dma.c index 7d0e7511..428d1d4d 100644 --- a/code/client/snd_dma.c +++ b/code/client/snd_dma.c @@ -33,10 +33,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #include "snd_codec.h" #include "client.h" -void S_Play_f(void); -void S_SoundList_f(void); -void S_Music_f(void); - void S_Update_( void ); void S_Base_StopAllSounds(void); void S_Base_StopBackgroundTrack( void ); @@ -1315,7 +1311,9 @@ void S_Base_StartBackgroundTrack( const char *intro, const char *loop ){ } Com_DPrintf( "S_StartBackgroundTrack( %s, %s )\n", intro, loop ); - if ( !intro[0] ) { + if(!*intro) + { + S_Base_StopBackgroundTrack(); return; } diff --git a/code/client/snd_main.c b/code/client/snd_main.c index c406ffd2..7d4ed682 100644 --- a/code/client/snd_main.c +++ b/code/client/snd_main.c @@ -448,6 +448,20 @@ void S_Music_f( void ) { } +/* +================= +S_Music_f +================= +*/ +void S_StopMusic_f( void ) +{ + if(!si.StopBackgroundTrack) + return; + + si.StopBackgroundTrack(); +} + + //============================================================================= /* @@ -464,7 +478,7 @@ void S_Init( void ) s_volume = Cvar_Get( "s_volume", "0.8", CVAR_ARCHIVE ); s_musicVolume = Cvar_Get( "s_musicvolume", "0.25", CVAR_ARCHIVE ); - s_muted = Cvar_Get("s_muted", "0", CVAR_TEMP); + s_muted = Cvar_Get("s_muted", "0", CVAR_ROM); s_doppler = Cvar_Get( "s_doppler", "1", CVAR_ARCHIVE ); s_backend = Cvar_Get( "s_backend", "", CVAR_ROM ); s_muteWhenMinimized = Cvar_Get( "s_muteWhenMinimized", "0", CVAR_ARCHIVE ); @@ -479,6 +493,7 @@ void S_Init( void ) Cmd_AddCommand( "play", S_Play_f ); Cmd_AddCommand( "music", S_Music_f ); + Cmd_AddCommand( "stopmusic", S_StopMusic_f ); Cmd_AddCommand( "s_list", S_SoundList ); Cmd_AddCommand( "s_stop", S_StopAllSounds ); Cmd_AddCommand( "s_info", S_SoundInfo ); @@ -525,6 +540,7 @@ void S_Shutdown( void ) Cmd_RemoveCommand( "play" ); Cmd_RemoveCommand( "music"); + Cmd_RemoveCommand( "stopmusic"); Cmd_RemoveCommand( "s_list" ); Cmd_RemoveCommand( "s_stop" ); Cmd_RemoveCommand( "s_info" );