aboutsummaryrefslogtreecommitdiff
path: root/engines/sludge/fileset.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/sludge/fileset.cpp')
-rw-r--r--engines/sludge/fileset.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/engines/sludge/fileset.cpp b/engines/sludge/fileset.cpp
index fcdec32335..c9c3e7a43b 100644
--- a/engines/sludge/fileset.cpp
+++ b/engines/sludge/fileset.cpp
@@ -48,12 +48,14 @@ void ResourceManager::init() {
_startOfSubIndex = 0;
_startOfObjectIndex = 0;
_startIndex = 0;
+ _allResourceNames.clear();
}
void ResourceManager::kill() {
if (_bigDataFile) {
delete _bigDataFile;
_bigDataFile = nullptr;
}
+ _allResourceNames.clear();
}
bool ResourceManager::openSubSlice(int num) {
@@ -216,6 +218,31 @@ void ResourceManager::finishAccess() {
_sliceBusy = false;
}
+void ResourceManager::readResourceNames(Common::SeekableReadStream *readStream) {
+ int numResourceNames = readStream->readUint16BE();
+ debugC(2, kSludgeDebugDataLoad, "numResourceNames %i", numResourceNames);
+ _allResourceNames.reserve(numResourceNames);
+
+ for (int fn = 0; fn < numResourceNames; fn++) {
+ _allResourceNames[fn].clear();
+ _allResourceNames[fn] = readString(readStream);
+ debugC(2, kSludgeDebugDataLoad, "Resource %i: %s", fn, _allResourceNames[fn].c_str());
+ }
+}
+
+const Common::String ResourceManager::resourceNameFromNum(int i) {
+ if (i == -1)
+ return "";
+
+ if (_allResourceNames.empty())
+ return "RESOURCE";
+
+ if (i < (int)_allResourceNames.size())
+ return _allResourceNames[i];
+
+ return "Unknown resource";
+}
+
void ResourceManager::setData(Common::File *fp) {
_bigDataFile = fp;
_startIndex = fp->pos();