mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-17 22:50:51 +00:00
Add the playcenter command to play a sound without 3d spatialization.
This commit is contained in:
parent
6eaa5518a4
commit
124d90f84f
1 changed files with 24 additions and 1 deletions
|
@ -277,7 +277,7 @@ SND_Spatialize (channel_t *ch)
|
|||
vec3_t source_vec;
|
||||
|
||||
// anything coming from the view entity will always be full volume
|
||||
if (ch->entnum == *render_data.viewentity) {
|
||||
if (ch->entnum == *render_data.viewentity || ch->entnum == -1) {
|
||||
ch->leftvol = ch->master_vol;
|
||||
ch->rightvol = ch->master_vol;
|
||||
ch->phase = 0;
|
||||
|
@ -721,6 +721,27 @@ SND_Play (void)
|
|||
dstring_delete (name);
|
||||
}
|
||||
|
||||
static void
|
||||
SND_PlayCenter (void)
|
||||
{
|
||||
dstring_t *name = dstring_new ();
|
||||
int i;
|
||||
sfx_t *sfx;
|
||||
|
||||
i = 1;
|
||||
while (i < Cmd_Argc ()) {
|
||||
if (!strrchr (Cmd_Argv (i), '.')) {
|
||||
dsprintf (name, "%s.wav", Cmd_Argv (i));
|
||||
} else {
|
||||
dsprintf (name, "%s", Cmd_Argv (i));
|
||||
}
|
||||
sfx = SND_PrecacheSound (name->str);
|
||||
SND_StartSound (-1, 0, sfx, listener_origin, 1.0, 1.0);
|
||||
i++;
|
||||
}
|
||||
dstring_delete (name);
|
||||
}
|
||||
|
||||
static void
|
||||
SND_PlayVol (void)
|
||||
{
|
||||
|
@ -867,6 +888,8 @@ SND_Init (void)
|
|||
|
||||
Cmd_AddCommand ("play", SND_Play,
|
||||
"Play selected sound effect (play pathto/sound.wav)");
|
||||
Cmd_AddCommand ("playcenter", SND_PlayCenter,
|
||||
"Play selected sound effect without 3D spatialization.");
|
||||
Cmd_AddCommand ("playvol", SND_PlayVol, "Play selected sound effect at "
|
||||
"selected volume (playvol pathto/sound.wav num");
|
||||
Cmd_AddCommand ("stopsound", SND_StopAllSoundsC,
|
||||
|
|
Loading…
Reference in a new issue