aboutsummaryrefslogtreecommitdiff
path: root/engines/mohawk/resource.cpp
diff options
context:
space:
mode:
authorMatthew Hoops2010-11-22 17:50:30 +0000
committerMatthew Hoops2010-11-22 17:50:30 +0000
commitcc6c7e33bff84f12512d01058c3f5a384ff36c83 (patch)
tree942c01d5de9829cd7dd00a8d542f38120e9a2475 /engines/mohawk/resource.cpp
parenteba5c441b27d0c7ec82b4d7abd0f51bfee2dc8ba (diff)
downloadscummvm-rg350-cc6c7e33bff84f12512d01058c3f5a384ff36c83.tar.gz
scummvm-rg350-cc6c7e33bff84f12512d01058c3f5a384ff36c83.tar.bz2
scummvm-rg350-cc6c7e33bff84f12512d01058c3f5a384ff36c83.zip
MOHAWK: Switch slider bitmap ID's to matching via string; fixes some versions
svn-id: r54416
Diffstat (limited to 'engines/mohawk/resource.cpp')
-rw-r--r--engines/mohawk/resource.cpp47
1 files changed, 15 insertions, 32 deletions
diff --git a/engines/mohawk/resource.cpp b/engines/mohawk/resource.cpp
index 1ae069e459..e9e1c6b792 100644
--- a/engines/mohawk/resource.cpp
+++ b/engines/mohawk/resource.cpp
@@ -192,7 +192,7 @@ int MohawkArchive::getIDIndex(int typeIndex, const Common::String &resName) {
for (uint16 i = 0; i < _types[typeIndex].nameTable.num; i++)
if (_types[typeIndex].nameTable.entries[i].name.matchString(resName)) {
- index = i;
+ index = _types[typeIndex].nameTable.entries[i].index;
break;
}
@@ -206,6 +206,20 @@ int MohawkArchive::getIDIndex(int typeIndex, const Common::String &resName) {
return -1; // Not found
}
+uint16 MohawkArchive::findResourceID(uint32 type, const Common::String &resName) {
+ int typeIndex = getTypeIndex(type);
+
+ if (typeIndex < 0)
+ return 0xFFFF;
+
+ int idIndex = getIDIndex(typeIndex, resName);
+
+ if (idIndex < 0)
+ return 0xFFFF;
+
+ return _types[typeIndex].resTable.entries[idIndex].id;
+}
+
bool MohawkArchive::hasResource(uint32 tag, uint16 id) {
if (!_mhk)
return false;
@@ -273,37 +287,6 @@ Common::SeekableReadStream *MohawkArchive::getResource(uint32 tag, uint16 id) {
return new Common::SeekableSubReadStream(_mhk, _fileTable[fileTableIndex].offset, _fileTable[fileTableIndex].offset + _fileTable[fileTableIndex].dataSize);
}
-Common::SeekableReadStream *MohawkArchive::getResource(uint32 tag, const Common::String &resName) {
- if (!_mhk)
- error("MohawkArchive::getResource(): No File in Use");
-
- int16 typeIndex = getTypeIndex(tag);
-
- if (typeIndex < 0)
- error("Could not find a tag of '%s' in file '%s'", tag2str(tag), _curFile.c_str());
-
- int16 idIndex = getIDIndex(typeIndex, resName);
-
- if (idIndex < 0)
- error("Could not find '%s' '%s' in file '%s'", tag2str(tag), resName.c_str(), _curFile.c_str());
-
- // Note: the fileTableIndex is based off 1, not 0. So, subtract 1
- uint16 fileTableIndex = _types[typeIndex].resTable.entries[idIndex].index - 1;
-
- // WORKAROUND: tMOV resources pretty much ignore the size part of the file table,
- // as the original just passed the full Mohawk file to QuickTime and the offset.
- // We need to do this because of the way Mohawk is set up (this is much more "proper"
- // than passing _mhk at the right offset). We may want to do that in the future, though.
- if (_types[typeIndex].tag == ID_TMOV) {
- if (fileTableIndex == _fileTableAmount)
- return new Common::SeekableSubReadStream(_mhk, _fileTable[fileTableIndex].offset, _mhk->size());
- else
- return new Common::SeekableSubReadStream(_mhk, _fileTable[fileTableIndex].offset, _fileTable[fileTableIndex + 1].offset);
- }
-
- return new Common::SeekableSubReadStream(_mhk, _fileTable[fileTableIndex].offset, _fileTable[fileTableIndex].offset + _fileTable[fileTableIndex].dataSize);
-}
-
void LivingBooksArchive_v1::open(Common::SeekableReadStream *stream) {
close();
_mhk = stream;