mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-02-20 10:43:29 +00:00
Make S_Init safe to use with a null viewentity.
Current work in qwaq doesn't need 3d spacialization, so it wants to pass null for the viewentity pointer.
This commit is contained in:
parent
463e41082a
commit
7b38b0b339
1 changed files with 10 additions and 6 deletions
|
@ -243,18 +243,19 @@ s_playcenter_f (void)
|
|||
dstring_t *name = dstring_new ();
|
||||
int i;
|
||||
sfx_t *sfx;
|
||||
int viewent = 0;
|
||||
|
||||
i = 1;
|
||||
while (i < Cmd_Argc ()) {
|
||||
if (snd_render_data.viewentity)
|
||||
viewent = *snd_render_data.viewentity;
|
||||
|
||||
for (i = 1; i < Cmd_Argc (); i++) {
|
||||
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 (*snd_render_data.viewentity, 0, sfx, listener_origin,
|
||||
1.0, 1.0);
|
||||
i++;
|
||||
SND_StartSound (viewent, 0, sfx, listener_origin, 1.0, 1.0);
|
||||
}
|
||||
dstring_delete (name);
|
||||
}
|
||||
|
@ -703,11 +704,14 @@ void
|
|||
SND_LocalSound (const char *sound)
|
||||
{
|
||||
sfx_t *sfx;
|
||||
int viewent = 0;
|
||||
|
||||
sfx = SND_PrecacheSound (sound);
|
||||
if (!sfx) {
|
||||
Sys_Printf ("S_LocalSound: can't cache %s\n", sound);
|
||||
return;
|
||||
}
|
||||
SND_StartSound (*snd_render_data.viewentity, -1, sfx, vec3_origin, 1, 1);
|
||||
if (snd_render_data.viewentity)
|
||||
viewent = *snd_render_data.viewentity;
|
||||
SND_StartSound (viewent, -1, sfx, vec3_origin, 1, 1);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue