From c7c0198e274a3802d350a029636c10ff0f04212c Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Thu, 10 Feb 2011 12:57:43 +0000 Subject: SCI: Renamed addInternalSources -> addAudioSources and separated the script chunk loading code svn-id: r55866 --- engines/sci/resource.cpp | 17 ++++++++++------- engines/sci/resource.h | 3 ++- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/engines/sci/resource.cpp b/engines/sci/resource.cpp index a4d4b31597..f98a875f7f 100644 --- a/engines/sci/resource.cpp +++ b/engines/sci/resource.cpp @@ -739,7 +739,7 @@ int ResourceManager::addAppropriateSources(const Common::FSList &fslist) { return 1; } -int ResourceManager::addInternalSources() { +bool ResourceManager::addAudioSources() { Common::List *resources = listResources(kResourceTypeMap); Common::List::iterator itr = resources->begin(); @@ -751,20 +751,24 @@ int ResourceManager::addInternalSources() { else if (Common::File::exists("RESOURCE.AUD")) addSource(new AudioVolumeResourceSource(this, "RESOURCE.AUD", src, 0)); else - return 0; + return false; ++itr; } delete resources; + return true; +} + +void ResourceManager::addScriptChunkSources() { #ifdef ENABLE_SCI32 if (_mapVersion >= kResVersionSci2) { // If we have no scripts, but chunk 0 is present, open up the chunk // to try to get to any scripts in there. The Lighthouse SCI2.1 demo // does exactly this. - resources = listResources(kResourceTypeScript); + Common::List *resources = listResources(kResourceTypeScript); if (resources->empty() && testResource(ResourceId(kResourceTypeChunk, 0))) addResourcesFromChunk(0); @@ -772,8 +776,6 @@ int ResourceManager::addInternalSources() { delete resources; } #endif - - return 1; } void ResourceManager::scanNewSources() { @@ -943,13 +945,14 @@ void ResourceManager::init(bool initFromFallbackDetector) { scanNewSources(); if (!initFromFallbackDetector) { - if (!addInternalSources()) { + if (!addAudioSources()) { // FIXME: This error message is not always correct. // OTOH, it is nice to be able to detect missing files/sources - // So we should definitely fix addInternalSources so this error + // So we should definitely fix addAudioSources so this error // only pops up when necessary. Disabling for now. //error("Somehow I can't seem to find the sound files I need (RESOURCE.AUD/RESOURCE.SFX), aborting"); } + addScriptChunkSources(); scanNewSources(); } diff --git a/engines/sci/resource.h b/engines/sci/resource.h index ad6a7cac3e..15cc823b30 100644 --- a/engines/sci/resource.h +++ b/engines/sci/resource.h @@ -435,7 +435,8 @@ protected: */ void scanNewSources(); - int addInternalSources(); + bool addAudioSources(); + void addScriptChunkSources(); void freeResourceSources(); /** -- cgit v1.2.3