diff options
author | Max Horn | 2010-06-15 12:11:30 +0000 |
---|---|---|
committer | Max Horn | 2010-06-15 12:11:30 +0000 |
commit | 8c06425ee3cac66469c817ab96cd0ab3688cdae6 (patch) | |
tree | 49f835d4060de5f435d7f19c8a70a5955a0e56da | |
parent | 17a51121623a971b249cd33a8b581fe44b3e5616 (diff) | |
download | scummvm-rg350-8c06425ee3cac66469c817ab96cd0ab3688cdae6.tar.gz scummvm-rg350-8c06425ee3cac66469c817ab96cd0ab3688cdae6.tar.bz2 scummvm-rg350-8c06425ee3cac66469c817ab96cd0ab3688cdae6.zip |
SCI: Remove 'map' param from addSource, and let AudioVolumeResourceSource subclass VolumeResourceSource
svn-id: r49814
-rw-r--r-- | engines/sci/resource.cpp | 30 | ||||
-rw-r--r-- | engines/sci/resource.h | 7 | ||||
-rw-r--r-- | engines/sci/resource_audio.cpp | 4 | ||||
-rw-r--r-- | engines/sci/resource_intern.h | 13 |
4 files changed, 27 insertions, 27 deletions
diff --git a/engines/sci/resource.cpp b/engines/sci/resource.cpp index 83dd64339d..08ca46f881 100644 --- a/engines/sci/resource.cpp +++ b/engines/sci/resource.cpp @@ -210,11 +210,10 @@ ResourceSource *ResourceManager::addExternalMap(const Common::FSNode *mapFile, i return newsrc; } -ResourceSource *ResourceManager::addSource(ResourceSource *map, ResourceSource *newsrc, int number) { +ResourceSource *ResourceManager::addSource(ResourceSource *newsrc, int number) { assert(newsrc); newsrc->volume_number = number; - newsrc->associated_map = map; if (newsrc->getSourceType() == kSourceAudioVolume) checkIfAudioVolumeIsCompressed(newsrc); @@ -222,12 +221,11 @@ ResourceSource *ResourceManager::addSource(ResourceSource *map, ResourceSource * return newsrc; } -ResourceSource *ResourceManager::addSource(ResourceSource *map, ResourceSource *newsrc, const Common::FSNode *resFile, int number) { +ResourceSource *ResourceManager::addSource(ResourceSource *newsrc, const Common::FSNode *resFile, int number) { assert(newsrc); newsrc->resourceFile = resFile; newsrc->volume_number = number; - newsrc->associated_map = map; if (newsrc->getSourceType() == kSourceAudioVolume) checkIfAudioVolumeIsCompressed(newsrc); @@ -459,12 +457,12 @@ int ResourceManager::addAppropriateSources() { const char *dot = strrchr(name.c_str(), '.'); int number = atoi(dot + 1); - addSource(map, new VolumeResourceSource(name), number); + addSource(new VolumeResourceSource(name, map), number); } #ifdef ENABLE_SCI32 // GK1CD hires content if (Common::File::exists("alt.map") && Common::File::exists("resource.alt")) - addSource(addExternalMap("alt.map", 10), new VolumeResourceSource("resource.alt"), 10); + addSource(new VolumeResourceSource("resource.alt", addExternalMap("alt.map", 10)), 10); #endif } else if (Common::File::exists("Data1")) { // Mac SCI1.1+ file naming scheme @@ -472,7 +470,7 @@ int ResourceManager::addAppropriateSources() { for (Common::ArchiveMemberList::const_iterator x = files.begin(); x != files.end(); ++x) { Common::String filename = (*x)->getName(); - addSource(0, new MacResourceForkResourceSource(filename), atoi(filename.c_str() + 4)); + addSource(new MacResourceForkResourceSource(filename), atoi(filename.c_str() + 4)); } #ifdef ENABLE_SCI32 // Mac SCI32 games have extra folders for patches @@ -484,7 +482,7 @@ int ResourceManager::addAppropriateSources() { // There can also be a "Patches" resource fork with patches if (Common::File::exists("Patches")) - addSource(0, new MacResourceForkResourceSource("Patches"), 100); + addSource(new MacResourceForkResourceSource("Patches"), 100); } else { // SCI2.1-SCI3 file naming scheme Common::ArchiveMemberList mapFiles; @@ -504,7 +502,7 @@ int ResourceManager::addAppropriateSources() { int resNumber = atoi(strrchr(resName.c_str(), '.') + 1); if (mapNumber == resNumber) { - addSource(addExternalMap(mapName, mapNumber), new VolumeResourceSource(resName), mapNumber); + addSource(new VolumeResourceSource(resName, addExternalMap(mapName, mapNumber)), mapNumber); break; } } @@ -513,7 +511,7 @@ int ResourceManager::addAppropriateSources() { // SCI2.1 resource patches if (Common::File::exists("resmap.pat") && Common::File::exists("ressci.pat")) { // We add this resource with a map which surely won't exist - addSource(addExternalMap("resmap.pat", 100), new VolumeResourceSource("ressci.pat"), 100); + addSource(new VolumeResourceSource("ressci.pat", addExternalMap("resmap.pat", 100)), 100); } } #else @@ -523,7 +521,7 @@ int ResourceManager::addAppropriateSources() { addPatchDir("."); if (Common::File::exists("message.map")) - addSource(addExternalMap("message.map"), new VolumeResourceSource("resource.msg"), 0); + addSource(new VolumeResourceSource("resource.msg", addExternalMap("message.map")), 0); return 1; } @@ -567,7 +565,7 @@ int ResourceManager::addAppropriateSources(const Common::FSList &fslist) { #ifdef ENABLE_SCI32 if (sci21PatchMap && sci21PatchRes) - addSource(sci21PatchMap, new VolumeResourceSource(sci21PatchRes->getName()), sci21PatchRes, 100); + addSource(new VolumeResourceSource(sci21PatchRes->getName(), sci21PatchMap), sci21PatchRes, 100); #endif // Now find all the resource.0?? files @@ -582,7 +580,7 @@ int ResourceManager::addAppropriateSources(const Common::FSList &fslist) { const char *dot = strrchr(filename.c_str(), '.'); int number = atoi(dot + 1); - addSource(map, new VolumeResourceSource(file->getName()), file, number); + addSource(new VolumeResourceSource(file->getName(), map), file, number); } } @@ -597,12 +595,12 @@ int ResourceManager::addInternalSources() { Common::List<ResourceId>::iterator itr = resources->begin(); while (itr != resources->end()) { - ResourceSource *src = addSource(NULL, new IntMapResourceSource("MAP"), itr->number); + ResourceSource *src = addSource(new IntMapResourceSource("MAP"), itr->number); if ((itr->number == 65535) && Common::File::exists("RESOURCE.SFX")) - addSource(src, new AudioVolumeResourceSource("RESOURCE.SFX"), 0); + addSource(new AudioVolumeResourceSource("RESOURCE.SFX", src), 0); else if (Common::File::exists("RESOURCE.AUD")) - addSource(src, new AudioVolumeResourceSource("RESOURCE.AUD"), 0); + addSource(new AudioVolumeResourceSource("RESOURCE.AUD", src), 0); ++itr; } diff --git a/engines/sci/resource.h b/engines/sci/resource.h index cb43c9e13a..67cc4d3c1f 100644 --- a/engines/sci/resource.h +++ b/engines/sci/resource.h @@ -316,15 +316,12 @@ protected: /** * Adds a source to the resource manager's list of sources. - * @param map The map associated with this source * @param source The new source to add * @return A pointer to the added source structure, or NULL if an error occurred. */ - ResourceSource *addSource(ResourceSource *map, ResourceSource *source, - int number); + ResourceSource *addSource(ResourceSource *source, int number); - ResourceSource *addSource(ResourceSource *map, ResourceSource *source, - const Common::FSNode *resFile, int number); + ResourceSource *addSource(ResourceSource *source, const Common::FSNode *resFile, int number); /** * Add an external (i.e., separate file) map resource to the resource manager's list of sources. diff --git a/engines/sci/resource_audio.cpp b/engines/sci/resource_audio.cpp index 416e4ea361..36084087fd 100644 --- a/engines/sci/resource_audio.cpp +++ b/engines/sci/resource_audio.cpp @@ -433,7 +433,7 @@ void ResourceManager::setAudioLanguage(int language) { return; } - _audioMapSCI1 = addSource(NULL, new ExtAudioMapResourceSource(fullname), language); + _audioMapSCI1 = addSource(new ExtAudioMapResourceSource(fullname), language); // Search for audio volumes for this language and add them to the source list Common::ArchiveMemberList files; @@ -443,7 +443,7 @@ void ResourceManager::setAudioLanguage(int language) { const char *dot = strrchr(name.c_str(), '.'); int number = atoi(dot + 1); - addSource(_audioMapSCI1, new AudioVolumeResourceSource(name), number); + addSource(new AudioVolumeResourceSource(name, _audioMapSCI1), number); } scanNewSources(); diff --git a/engines/sci/resource_intern.h b/engines/sci/resource_intern.h index c3642cda1b..e0d7cdcf87 100644 --- a/engines/sci/resource_intern.h +++ b/engines/sci/resource_intern.h @@ -56,7 +56,7 @@ public: bool scanned; const Common::FSNode *resourceFile; int volume_number; - ResourceSource *associated_map; + ResourceSource *associated_map; // TODO: Move to VolumeResourceSource uint32 audioCompressionType; int32 *audioCompressionOffsetMapping; Common::MacResManager *_macResMan; @@ -82,7 +82,10 @@ public: class VolumeResourceSource : public ResourceSource { public: - VolumeResourceSource(const Common::String &name) : ResourceSource(kSourceVolume, name) {} + VolumeResourceSource(const Common::String &name, ResourceSource *map, ResSourceType type = kSourceVolume) + : ResourceSource(type, name) { + associated_map = map; + } }; class ExtMapResourceSource : public ResourceSource { @@ -95,9 +98,11 @@ public: IntMapResourceSource(const Common::String &name) : ResourceSource(kSourceIntMap, name) {} }; -class AudioVolumeResourceSource : public ResourceSource { +class AudioVolumeResourceSource : public VolumeResourceSource { public: - AudioVolumeResourceSource(const Common::String &name) : ResourceSource(kSourceAudioVolume, name) {} + AudioVolumeResourceSource(const Common::String &name, ResourceSource *map) + : VolumeResourceSource(name, map, kSourceAudioVolume) { + } }; class ExtAudioMapResourceSource : public ResourceSource { |