Skip to content

Commit

Permalink
client: merged and modified S_Play_f function based on
Browse files Browse the repository at this point in the history
ioquke3/Ensiform's patch refs #34 NOTE: we no longer correct files w/o
extension (forced to wav) - if there are issues with map/custom sounds
let us know!
  • Loading branch information
IR4T4 committed Nov 24, 2012
1 parent 8457d03 commit fad2154
Showing 1 changed file with 29 additions and 15 deletions.
44 changes: 29 additions & 15 deletions src/client/snd_main.c
Expand Up @@ -507,34 +507,48 @@ void S_MasterGain(float gain)
#endif
// USE_VOIP

/*
=================
S_Play_f
=================
*/
void S_Play_f(void)
{
int i;
sfxHandle_t h;
char name[256];
int i;
int c;
sfxHandle_t h;

if(!si.RegisterSound || !si.StartLocalSound)
{
return;
}

c = Cmd_Argc();

if (!si.RegisterSound || !si.StartLocalSound)
if (c < 2)
{
Com_Printf("Usage: play <sound filename> [sound filename] [sound filename] ...\n");
return;
}

i = 1;
while (i < Cmd_Argc())
for (i = 1; i < c; i++)
{
if (!Q_strrchr(Cmd_Argv(i), '.'))
{
Com_sprintf(name, sizeof(name), "%s.wav", Cmd_Argv(1));
//Com_sprintf(name, sizeof(name), "%s.wav", Cmd_Argv(1)); // genuine ET 'forces' wav
Com_Printf("Warning: S_Play_f sound name '%s' has no file extension", Cmd_Argv(i));
}
else

h = si.RegisterSound(Cmd_Argv(i), qfalse); // *qtrue* TODO: detect compression via extension?

if ( h )
{
Q_strncpyz(name, Cmd_Argv(i), sizeof(name));
si.StartLocalSound(h, CHAN_LOCAL_SOUND, 1.0f);
}
h = si.RegisterSound(name, qfalse);
if (h)
else
{
si.StartLocalSound(h, CHAN_LOCAL_SOUND, 1.0f);
Com_Printf("Warning: S_Play_f sound '%s' not played.", Cmd_Argv(i));
}
i++;
}
}

Expand Down Expand Up @@ -563,7 +577,7 @@ void S_Music_f(void)
}
else
{
Com_Printf("music <musicfile> [loopfile] [fadeupTime]\n");
Com_Printf("Usage: music <musicfile> [loopfile] [fadeupTime]\n");
return;
}
}
Expand Down Expand Up @@ -607,7 +621,7 @@ void S_Stream_f(void)
}
else
{
Com_Printf("stream <streamfile> [loopfile] [entnum] [channel] [attenuation]\n");
Com_Printf("Usage: stream <streamfile> [loopfile] [entnum] [channel] [attenuation]\n");
return;
}
}
Expand Down

0 comments on commit fad2154

Please sign in to comment.