From 87f0ba0bd2f3edb8338dd466364cae158d72f3d3 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 6 Sep 2008 13:00:23 +0000 Subject: [PATCH] - Changed listener structure to directly contain the sound environment instead of getting it from the zone in the low level code. SVN r1201 (trunk) --- docs/rh-log.txt | 2 ++ src/s_sound.cpp | 7 ++++--- src/sound/fmodsound.cpp | 3 +-- src/sound/i_sound.h | 2 +- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/docs/rh-log.txt b/docs/rh-log.txt index 9599d4252..d96d224b5 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,4 +1,6 @@ September 6, 2008 (Changes by Graf Zahl) +- Changed listener structure to directly contain the sound environment instead + of getting it from the zone in the low level code. - Changed sound interface so that all references to game data like actors and sectors are done in s_sound.cpp and not in fmodsound.cpp. Also removed several 'sector' parameters because they were never used inside the sound code. diff --git a/src/s_sound.cpp b/src/s_sound.cpp index b6d5cb107..6131dc793 100644 --- a/src/s_sound.cpp +++ b/src/s_sound.cpp @@ -1641,7 +1641,8 @@ static void S_SetListener(SoundListener &listener, AActor *listenactor) listener.position.Y = FIXED2FLOAT(listenactor->y); listener.position.Z = FIXED2FLOAT(listenactor->z); listener.underwater = listenactor->waterlevel == 3; - listener.ZoneNumber = listenactor->Sector->ZoneNumber; + assert(zones != NULL); + listener.Environment = zones[listenactor->Sector->ZoneNumber].Environment; listener.valid = true; } else @@ -1649,8 +1650,8 @@ static void S_SetListener(SoundListener &listener, AActor *listenactor) listener.angle = 0; listener.position.Zero(); listener.velocity.Zero(); - listener.underwater=false; - listener.ZoneNumber=0; + listener.underwater = false; + listener.Environment = NULL; listener.valid = false; } } diff --git a/src/sound/fmodsound.cpp b/src/sound/fmodsound.cpp index 2f7526f1c..5c9583d77 100644 --- a/src/sound/fmodsound.cpp +++ b/src/sound/fmodsound.cpp @@ -1791,8 +1791,7 @@ void FMODSoundRenderer::UpdateListener(SoundListener *listener) else { underwater = (listener->underwater && snd_waterlp); - assert (zones != NULL); - env = zones[listener->ZoneNumber].Environment; + env = listener->Environment; if (env == NULL) { env = DefaultEnvironments[0]; diff --git a/src/sound/i_sound.h b/src/sound/i_sound.h index 915668231..5f749f4ab 100644 --- a/src/sound/i_sound.h +++ b/src/sound/i_sound.h @@ -51,7 +51,7 @@ struct SoundListener float angle; bool underwater; bool valid; - int ZoneNumber; + ReverbContainer *Environment; }; class SoundStream