diff options
author | Zack Middleton <zturtleman@gmail.com> | 2012-11-18 23:16:13 +0000 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2013-01-12 21:24:49 +0000 |
commit | 23c000eae77da314c6642b3aa9950417690a9407 (patch) | |
tree | ac5db0d314fae8a44e7ca6d8d259e5c4954701e4 /src/client/snd_main.c | |
parent | d76d692561b9508106a1761916d185b7ea198ddd (diff) |
Improve "play" command, based on a patch from Ensiform.
Diffstat (limited to 'src/client/snd_main.c')
-rw-r--r-- | src/client/snd_main.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/client/snd_main.c b/src/client/snd_main.c index ff233039..5cb206be 100644 --- a/src/client/snd_main.c +++ b/src/client/snd_main.c @@ -415,22 +415,28 @@ S_Play_f */ void S_Play_f( void ) { int i; + int c; sfxHandle_t h; - char name[256]; + char name[MAX_TOKEN_CHARS]; if( !si.RegisterSound || !si.StartLocalSound ) { return; } - i = 1; - while ( i<Cmd_Argc() ) { + c = Cmd_Argc(); + + if( c < 2 ) { + Com_Printf ("Usage: play <sound filename> [sound filename] [sound filename] ...\n"); + return; + } + + for( i = 1; i < c; i++ ) { Q_strncpyz( name, Cmd_Argv(i), sizeof(name) ); h = si.RegisterSound( name, qfalse ); if( h ) { si.StartLocalSound( h, CHAN_LOCAL_SOUND ); } - i++; } } @@ -453,7 +459,7 @@ void S_Music_f( void ) { } else if ( c == 3 ) { si.StartBackgroundTrack( Cmd_Argv(1), Cmd_Argv(2) ); } else { - Com_Printf ("music <musicfile> [loopfile]\n"); + Com_Printf ("Usage: music <musicfile> [loopfile]\n"); return; } |