SCI: Add ResourceSource subclasses, one for each type

svn-id: r49812
This commit is contained in:
Max Horn 2010-06-15 12:10:41 +00:00
parent 793c04f43b
commit 24a295f4a3
3 changed files with 53 additions and 8 deletions

View File

@ -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);
}
}

View File

@ -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;

View File

@ -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