Skip to content

Commit

Permalink
HOPKINS: Fix loading images other than the first item in a picture index
Browse files Browse the repository at this point in the history
  • Loading branch information
dreammaster committed Sep 15, 2012
1 parent 6e8fd58 commit 10bb773
Showing 1 changed file with 6 additions and 22 deletions.
28 changes: 6 additions & 22 deletions engines/hopkins/files.cpp
Expand Up @@ -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
Expand Down

0 comments on commit 10bb773

Please sign in to comment.