diff options
-rw-r--r-- | engines/sci/resource.cpp | 10 | ||||
-rw-r--r-- | engines/sci/resource_audio.cpp | 4 | ||||
-rw-r--r-- | engines/sci/resource_intern.h | 47 |
3 files changed, 53 insertions, 8 deletions
diff --git a/engines/sci/resource.cpp b/engines/sci/resource.cpp index f60c6a3c96..9691fa3f9c 100644 --- a/engines/sci/resource.cpp +++ b/engines/sci/resource.cpp @@ -192,7 +192,7 @@ ResourceSource::~ResourceSource() { // Resource source list management ResourceSource *ResourceManager::addExternalMap(const Common::String &filename, int volume_nr) { - ResourceSource *newsrc = new ResourceSource(kSourceExtMap, filename); + ResourceSource *newsrc = new ExtMapResourceSource(filename); newsrc->volume_number = volume_nr; @@ -201,7 +201,7 @@ ResourceSource *ResourceManager::addExternalMap(const Common::String &filename, } ResourceSource *ResourceManager::addExternalMap(const Common::FSNode *mapFile, int volume_nr) { - ResourceSource *newsrc = new ResourceSource(kSourceExtMap, mapFile->getName()); + ResourceSource *newsrc = new ExtMapResourceSource(mapFile->getName()); newsrc->resourceFile = mapFile; newsrc->volume_number = volume_nr; @@ -236,7 +236,7 @@ ResourceSource *ResourceManager::addSource(ResourceSource *map, ResSourceType ty } ResourceSource *ResourceManager::addPatchDir(const Common::String &dirname) { - ResourceSource *newsrc = new ResourceSource(kSourceDirectory, dirname); + ResourceSource *newsrc = new DirectoryResourceSource(dirname); _sources.push_back(newsrc); return 0; @@ -1224,7 +1224,7 @@ void ResourceManager::readResourcePatchesBase36(ResourceSource *source) { delete stream; } - psrcPatch = new ResourceSource(kSourcePatch, name); + psrcPatch = new PatchResourceSource(name); processPatch(psrcPatch, (ResourceType)i, resourceNr, resource36.tuple); } } @@ -1272,7 +1272,7 @@ void ResourceManager::readResourcePatches(ResourceSource *source) { } if (bAdd) { - psrcPatch = new ResourceSource(kSourcePatch, name); + psrcPatch = new PatchResourceSource(name); processPatch(psrcPatch, (ResourceType)i, resourceNr); } } diff --git a/engines/sci/resource_audio.cpp b/engines/sci/resource_audio.cpp index 9721a884dc..1b001ad975 100644 --- a/engines/sci/resource_audio.cpp +++ b/engines/sci/resource_audio.cpp @@ -155,13 +155,13 @@ void ResourceManager::addNewGMPatch(const Common::String &gameId) { gmPatchFile = "TALEGM.PAT"; if (!gmPatchFile.empty() && Common::File::exists(gmPatchFile)) { - ResourceSource *psrcPatch = new ResourceSource(kSourcePatch, gmPatchFile); + ResourceSource *psrcPatch = new PatchResourceSource(gmPatchFile); processPatch(psrcPatch, kResourceTypePatch, 4); } } void ResourceManager::processWavePatch(ResourceId resourceId, Common::String name) { - ResourceSource *resSrc = new ResourceSource(kSourceWave, name); + ResourceSource *resSrc = new WaveResourceSource(name); Resource *newRes = 0; diff --git a/engines/sci/resource_intern.h b/engines/sci/resource_intern.h index ceae474b39..1a8e6ec747 100644 --- a/engines/sci/resource_intern.h +++ b/engines/sci/resource_intern.h @@ -50,12 +50,57 @@ public: public: ResourceSource(ResSourceType type, const Common::String &name); - ~ResourceSource(); + virtual ~ResourceSource(); ResSourceType getSourceType() const { return _sourceType; } const Common::String &getLocationName() const { return _name; } }; +class DirectoryResourceSource : public ResourceSource { +public: + DirectoryResourceSource(const Common::String &name) : ResourceSource(kSourceDirectory, name) {} +}; + +class PatchResourceSource : public ResourceSource { +public: + PatchResourceSource(const Common::String &name) : ResourceSource(kSourcePatch, name) {} +}; + +class VolumeResourceSource : public ResourceSource { +public: + VolumeResourceSource(const Common::String &name) : ResourceSource(kSourceVolume, name) {} +}; + +class ExtMapResourceSource : public ResourceSource { +public: + ExtMapResourceSource(const Common::String &name) : ResourceSource(kSourceExtMap, name) {} +}; + +class IntMapResourceSource : public ResourceSource { +public: + IntMapResourceSource(const Common::String &name) : ResourceSource(kSourceIntMap, name) {} +}; + +class AudioVolumeResourceSource : public ResourceSource { +public: + AudioVolumeResourceSource(const Common::String &name) : ResourceSource(kSourceAudioVolume, name) {} +}; + +class ExtAudioMapResourceSource : public ResourceSource { +public: + ExtAudioMapResourceSource(const Common::String &name) : ResourceSource(kSourceExtAudioMap, name) {} +}; + +class WaveResourceSource : public ResourceSource { +public: + WaveResourceSource(const Common::String &name) : ResourceSource(kSourceWave, name) {} +}; + +class MacResourceForkResourceSource : public ResourceSource { +public: + MacResourceForkResourceSource(const Common::String &name) : ResourceSource(kSourceMacResourceFork, name) {} +}; + } // End of namespace Sci #endif // SCI_RESOURCE_INTERN_H |