- Add stopmusic command

- Make cvar s_muted read-only
This commit is contained in:
Thilo Schulz 2009-11-10 01:55:54 +00:00
parent 2a0812bc06
commit be0a82d496
3 changed files with 21 additions and 6 deletions

1
README
View file

@ -198,6 +198,7 @@ New cvars
New commands New commands
video [filename] - start video capture (use with demo command) video [filename] - start video capture (use with demo command)
stopvideo - stop video capture stopvideo - stop video capture
stopmusic - stop background music
print - print out the contents of a cvar print - print out the contents of a cvar
unset - unset a user created cvar unset - unset a user created cvar

View file

@ -33,10 +33,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "snd_codec.h" #include "snd_codec.h"
#include "client.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_Update_( void );
void S_Base_StopAllSounds(void); void S_Base_StopAllSounds(void);
void S_Base_StopBackgroundTrack( 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 ); Com_DPrintf( "S_StartBackgroundTrack( %s, %s )\n", intro, loop );
if ( !intro[0] ) { if(!*intro)
{
S_Base_StopBackgroundTrack();
return; return;
} }

View file

@ -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_volume = Cvar_Get( "s_volume", "0.8", CVAR_ARCHIVE );
s_musicVolume = Cvar_Get( "s_musicvolume", "0.25", 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_doppler = Cvar_Get( "s_doppler", "1", CVAR_ARCHIVE );
s_backend = Cvar_Get( "s_backend", "", CVAR_ROM ); s_backend = Cvar_Get( "s_backend", "", CVAR_ROM );
s_muteWhenMinimized = Cvar_Get( "s_muteWhenMinimized", "0", CVAR_ARCHIVE ); 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( "play", S_Play_f );
Cmd_AddCommand( "music", S_Music_f ); Cmd_AddCommand( "music", S_Music_f );
Cmd_AddCommand( "stopmusic", S_StopMusic_f );
Cmd_AddCommand( "s_list", S_SoundList ); Cmd_AddCommand( "s_list", S_SoundList );
Cmd_AddCommand( "s_stop", S_StopAllSounds ); Cmd_AddCommand( "s_stop", S_StopAllSounds );
Cmd_AddCommand( "s_info", S_SoundInfo ); Cmd_AddCommand( "s_info", S_SoundInfo );
@ -525,6 +540,7 @@ void S_Shutdown( void )
Cmd_RemoveCommand( "play" ); Cmd_RemoveCommand( "play" );
Cmd_RemoveCommand( "music"); Cmd_RemoveCommand( "music");
Cmd_RemoveCommand( "stopmusic");
Cmd_RemoveCommand( "s_list" ); Cmd_RemoveCommand( "s_list" );
Cmd_RemoveCommand( "s_stop" ); Cmd_RemoveCommand( "s_stop" );
Cmd_RemoveCommand( "s_info" ); Cmd_RemoveCommand( "s_info" );