aboutsummaryrefslogtreecommitdiff
path: root/engines/hopkins/files.cpp
diff options
context:
space:
mode:
authorPaul Gilbert2012-09-15 11:46:10 +1000
committerPaul Gilbert2012-09-15 11:46:10 +1000
commit10bb7730ea559f62682db053eda2f532d25ffe68 (patch)
tree64dbe6edbe88648c579f48e1345ddf996d597967 /engines/hopkins/files.cpp
parent6e8fd5812ba1d03c8dd4753eb75d6da34f8d7033 (diff)
downloadscummvm-rg350-10bb7730ea559f62682db053eda2f532d25ffe68.tar.gz
scummvm-rg350-10bb7730ea559f62682db053eda2f532d25ffe68.tar.bz2
scummvm-rg350-10bb7730ea559f62682db053eda2f532d25ffe68.zip
HOPKINS: Fix loading images other than the first item in a picture index
Diffstat (limited to 'engines/hopkins/files.cpp')
-rw-r--r--engines/hopkins/files.cpp28
1 files changed, 6 insertions, 22 deletions
diff --git a/engines/hopkins/files.cpp b/engines/hopkins/files.cpp
index bbe3fbc7d0..951db67483 100644
--- a/engines/hopkins/files.cpp
+++ b/engines/hopkins/files.cpp
@@ -261,45 +261,29 @@ bool FileManager::RECHERCHE_CAT(const Common::String &file, int a2) {
}
// Scan for an entry in the catalogue
- const byte *startP = ptr;
int result;
bool matchFlag = false;
int offsetVal = 0;
do {
- Common::String name = (const char *)startP;
+ Common::String name = (const char *)ptr + offsetVal;
- if (file == name) {
+ if (name == file) {
// Found entry for file, so get it's details from the catalogue entry
- const byte *pData = startP + offsetVal;
- startP += offsetVal + 15;
+ const byte *pData = ptr + offsetVal;
GLOBALS.CAT_POSI = READ_LE_UINT32(pData + 15);
GLOBALS.CAT_TAILLE = READ_LE_UINT32(pData + 19);
matchFlag = true;
}
- const char *finishString = "FINIS";
- const char *nameP = name.c_str();
- int finishRemainingChars = 6;
- int v19 = 0;
- bool finishMatch = true;
-
- do {
- if (!finishRemainingChars)
- break;
- finishMatch = *finishString++ == *nameP++;
- --finishRemainingChars;
- } while (finishMatch);
-
- if (!finishMatch)
- v19 = *(byte *)(finishString - 1) - *(byte *)(nameP - 1);
- if (!v19) {
+ if (name == "FINIS") {
GLOBALS.dos_free2(ptr);
- return PTRNUL;
+ return false;
}
offsetVal += 23;
} while (!matchFlag);
+
GLOBALS.dos_free2(ptr);
// TODO: Double check whether this really should be an unsigned int comparison