aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFilippos Karapetis2011-02-10 12:57:43 +0000
committerFilippos Karapetis2011-02-10 12:57:43 +0000
commitc7c0198e274a3802d350a029636c10ff0f04212c (patch)
tree038c8280db7e7df0eb529e28a99ca7349d69d6a1
parentd915560f4475a30ab7ff961b3af8e109e3e8ffa7 (diff)
downloadscummvm-rg350-c7c0198e274a3802d350a029636c10ff0f04212c.tar.gz
scummvm-rg350-c7c0198e274a3802d350a029636c10ff0f04212c.tar.bz2
scummvm-rg350-c7c0198e274a3802d350a029636c10ff0f04212c.zip
SCI: Renamed addInternalSources -> addAudioSources and separated the script chunk loading code
svn-id: r55866
-rw-r--r--engines/sci/resource.cpp17
-rw-r--r--engines/sci/resource.h3
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<ResourceId> *resources = listResources(kResourceTypeMap);
Common::List<ResourceId>::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<ResourceId> *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();
/**