aboutsummaryrefslogtreecommitdiff
path: root/sword2/resman.cpp
diff options
context:
space:
mode:
authorTorbjörn Andersson2004-05-01 10:42:23 +0000
committerTorbjörn Andersson2004-05-01 10:42:23 +0000
commitbc77ba431a7ccfc9a961df5fa8f1531e2f72fd44 (patch)
treeb6b7ebc379d756ae3f869c314666fbdf09b94b87 /sword2/resman.cpp
parente830d35a21fda5e28bcc290b37a922dbf4114224 (diff)
downloadscummvm-rg350-bc77ba431a7ccfc9a961df5fa8f1531e2f72fd44.tar.gz
scummvm-rg350-bc77ba431a7ccfc9a961df5fa8f1531e2f72fd44.tar.bz2
scummvm-rg350-bc77ba431a7ccfc9a961df5fa8f1531e2f72fd44.zip
Simplified the handling of sound effects. It's not necessary for the driver
to keep its own copy of the sound data. It could be even further simplified (I don't really see any reason for having two different sound queues), but I seem to have reached a point of stability here and I don't want to jinx it by making further changes yet. svn-id: r13705
Diffstat (limited to 'sword2/resman.cpp')
-rw-r--r--sword2/resman.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/sword2/resman.cpp b/sword2/resman.cpp
index 245f9819dd..c9c424b482 100644
--- a/sword2/resman.cpp
+++ b/sword2/resman.cpp
@@ -40,8 +40,9 @@ namespace Sword2 {
// is located in and the number within the cluster
// If 0, resouces are expelled immediately when they are closed. At the moment
-// this causes the game to crash, which seems like a bug to me. In fact, it
-// could be a clue to the mysterious and infrequent crashes...
+// this causes the sound queue to run out of slots. My only theory is that it's
+// a script that gets reloaded over and over. That'd clear its local variables
+// which I guess may cause it to set up the sounds over and over.
#define CACHE_CLUSTERS 1
@@ -768,6 +769,12 @@ void ResourceManager::removeAll(void) {
void ResourceManager::killAll(bool wantInfo) {
int nuked = 0;
+ // We need to clear the FX queue, because otherwise the sound system
+ // will still believe that the sound resources are in memory, and that
+ // it's ok to close them.
+
+ _vm->clearFxQueue();
+
for (uint i = 0; i < _totalResFiles; i++) {
// Don't nuke the global variables or the player object!
if (i == 1 || i == CUR_PLAYER_ID)