Skip to content

Commit

Permalink
- Add stopmusic command
Browse files Browse the repository at this point in the history
 - Make cvar s_muted read-only
  • Loading branch information
Thilo Schulz committed Nov 10, 2009
1 parent 2a0812b commit be0a82d
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 6 deletions.
1 change: 1 addition & 0 deletions README
Expand Up @@ -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
Expand Down
8 changes: 3 additions & 5 deletions code/client/snd_dma.c
Expand Up @@ -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 );
Expand Down Expand Up @@ -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;
}

Expand Down
18 changes: 17 additions & 1 deletion code/client/snd_main.c
Expand Up @@ -448,6 +448,20 @@ void S_Music_f( void ) {

}

/*
=================
S_Music_f
=================
*/
void S_StopMusic_f( void )
{
if(!si.StopBackgroundTrack)
return;

si.StopBackgroundTrack();
}


//=============================================================================

/*
Expand All @@ -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 );
Expand All @@ -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 );
Expand Down Expand Up @@ -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" );
Expand Down

0 comments on commit be0a82d

Please sign in to comment.