env_sound and env_soundscape: Don't run when WORLD hasn't been initialized

This commit is contained in:
Marco Cawthorne 2020-03-03 22:48:07 +01:00
parent f3f2176fc7
commit 07e6fae83e
2 changed files with 13 additions and 3 deletions

View file

@ -319,7 +319,11 @@ void DSP_UpdateListener(void)
static int old_dsp;
vector vecPlayer;
if (!g_iWorldInitialized) {
return;
}
if (autocvar_dsp_environments == FALSE) {
return;
}
@ -372,7 +376,9 @@ void DSP_UpdateListener(void)
}
g_flDSPTime += clframetime;
#else
#ifdef DEVELOPER
print(sprintf("[DSP] Environment changed to %i.\n", g_iDSP));
#endif
old_dsp = g_iDSP;
setup_reverb(12, &reverbPresets[g_iDSP], sizeof(reverbinfo_t));
#endif

View file

@ -79,6 +79,10 @@ void DSP_UpdateSoundscape(void)
{
vector vecPlayer;
if (!g_iWorldInitialized) {
return;
}
if (autocvar_dsp_soundscapes == FALSE) {
return;
}
@ -90,7 +94,7 @@ void DSP_UpdateSoundscape(void)
pSeat = &seats[s];
vecPlayer = pSeat->vPlayerOrigin;
#endif
float bestdist = 999999;
for ( entity e = world; ( e = find( e, classname, "env_soundscape" ) ); ) {
env_soundscape scape = (env_soundscape)e;
@ -126,7 +130,7 @@ void DSP_UpdateSoundscape(void)
float newvol;
for ( entity e = world; ( e = find( e, classname, "env_soundscape" ) ); ) {
env_soundscape t = (env_soundscape)e;
if (g_ambientsound) {
if (e == g_ambientsound) {
continue;