aboutsummaryrefslogtreecommitdiff
path: root/engines/sci
diff options
context:
space:
mode:
authorMax Horn2010-06-15 12:12:21 +0000
committerMax Horn2010-06-15 12:12:21 +0000
commit055ee6ab5b51c0e0fbaa8e6e9e66850ac48504aa (patch)
tree3dac8503e6481bf92a5a6b29e190b332e96048a3 /engines/sci
parent89cf6f7cb1b8336931b46e714b403f9bfe9af128 (diff)
downloadscummvm-rg350-055ee6ab5b51c0e0fbaa8e6e9e66850ac48504aa.tar.gz
scummvm-rg350-055ee6ab5b51c0e0fbaa8e6e9e66850ac48504aa.tar.bz2
scummvm-rg350-055ee6ab5b51c0e0fbaa8e6e9e66850ac48504aa.zip
SCI: Add virtual method ResourceSource::scanSource
svn-id: r49816
Diffstat (limited to 'engines/sci')
-rw-r--r--engines/sci/resource.cpp59
-rw-r--r--engines/sci/resource.h9
-rw-r--r--engines/sci/resource_intern.h16
3 files changed, 56 insertions, 28 deletions
diff --git a/engines/sci/resource.cpp b/engines/sci/resource.cpp
index 44b4525cd2..74f99ecd03 100644
--- a/engines/sci/resource.cpp
+++ b/engines/sci/resource.cpp
@@ -623,38 +623,41 @@ void ResourceManager::scanNewSources() {
if (!source->scanned) {
source->scanned = true;
- switch (source->getSourceType()) {
- case kSourceDirectory:
- readResourcePatches(source);
-
- // We can't use getSciVersion() at this point, thus using _volVersion
- if (_volVersion >= kResVersionSci11) // SCI1.1+
- readResourcePatchesBase36(source);
-
- readWaveAudioPatches();
- break;
- case kSourceExtMap:
- if (_mapVersion < kResVersionSci1Late)
- readResourceMapSCI0(source);
- else
- readResourceMapSCI1(source);
- break;
- case kSourceExtAudioMap:
- readAudioMapSCI1(source);
- break;
- case kSourceIntMap:
- readAudioMapSCI11(source);
- break;
- case kSourceMacResourceFork:
- readMacResourceFork(source);
- break;
- default:
- break;
- }
+ source->scanSource(this);
}
}
}
+void DirectoryResourceSource::scanSource(ResourceManager *resMan) {
+ resMan->readResourcePatches(this);
+
+ // We can't use getSciVersion() at this point, thus using _volVersion
+ if (resMan->_volVersion >= ResourceManager::kResVersionSci11) // SCI1.1+
+ resMan->readResourcePatchesBase36(this);
+
+ resMan->readWaveAudioPatches();
+}
+
+void ExtMapResourceSource::scanSource(ResourceManager *resMan) {
+ if (resMan->_mapVersion < ResourceManager::kResVersionSci1Late)
+ resMan->readResourceMapSCI0(this);
+ else
+ resMan->readResourceMapSCI1(this);
+}
+
+void ExtAudioMapResourceSource::scanSource(ResourceManager *resMan) {
+ resMan->readAudioMapSCI1(this);
+}
+
+void IntMapResourceSource::scanSource(ResourceManager *resMan) {
+ resMan->readAudioMapSCI11(this);
+}
+
+void MacResourceForkResourceSource::scanSource(ResourceManager *resMan) {
+ resMan->readMacResourceFork(this);
+}
+
+
void ResourceManager::freeResourceSources() {
for (Common::List<ResourceSource *>::iterator it = _sources.begin(); it != _sources.end(); ++it)
delete *it;
diff --git a/engines/sci/resource.h b/engines/sci/resource.h
index 826fbff850..8720e8eabb 100644
--- a/engines/sci/resource.h
+++ b/engines/sci/resource.h
@@ -194,6 +194,15 @@ protected:
typedef Common::HashMap<ResourceId, Resource *, ResourceIdHash, ResourceIdEqualTo> ResourceMap;
class ResourceManager {
+ // FIXME: These 'friend' declarations are meant to be a temporary hack to
+ // ease transition to the ResourceSource class system.
+ friend class ResourceSource;
+ friend class DirectoryResourceSource;
+ friend class ExtMapResourceSource;
+ friend class IntMapResourceSource;
+ friend class ExtAudioMapResourceSource;
+ friend class MacResourceForkResourceSource;
+
public:
enum ResVersion {
kResVersionUnknown,
diff --git a/engines/sci/resource_intern.h b/engines/sci/resource_intern.h
index 15fd5c391d..fc07572cea 100644
--- a/engines/sci/resource_intern.h
+++ b/engines/sci/resource_intern.h
@@ -72,11 +72,19 @@ public:
virtual ResourceSource *findVolume(ResourceSource *map, int volume_nr) {
return NULL;
};
+
+ /**
+ * Scan this source for TODO.
+ * TODO: The resMan param for now is just a hack.
+ */
+ virtual void scanSource(ResourceManager *resMan) {}
};
class DirectoryResourceSource : public ResourceSource {
public:
DirectoryResourceSource(const Common::String &name) : ResourceSource(kSourceDirectory, name) {}
+
+ virtual void scanSource(ResourceManager *resMan);
};
class PatchResourceSource : public ResourceSource {
@@ -101,11 +109,15 @@ public:
class ExtMapResourceSource : public ResourceSource {
public:
ExtMapResourceSource(const Common::String &name) : ResourceSource(kSourceExtMap, name) {}
+
+ virtual void scanSource(ResourceManager *resMan);
};
class IntMapResourceSource : public ResourceSource {
public:
IntMapResourceSource(const Common::String &name) : ResourceSource(kSourceIntMap, name) {}
+
+ virtual void scanSource(ResourceManager *resMan);
};
class AudioVolumeResourceSource : public VolumeResourceSource {
@@ -118,6 +130,8 @@ public:
class ExtAudioMapResourceSource : public ResourceSource {
public:
ExtAudioMapResourceSource(const Common::String &name) : ResourceSource(kSourceExtAudioMap, name) {}
+
+ virtual void scanSource(ResourceManager *resMan);
};
class WaveResourceSource : public ResourceSource {
@@ -128,6 +142,8 @@ public:
class MacResourceForkResourceSource : public ResourceSource {
public:
MacResourceForkResourceSource(const Common::String &name) : ResourceSource(kSourceMacResourceFork, name) {}
+
+ virtual void scanSource(ResourceManager *resMan);
};
} // End of namespace Sci