Skip to content

Commit

Permalink
SCI: Fix resource type range checks
Browse files Browse the repository at this point in the history
  • Loading branch information
wjp committed Apr 20, 2013
1 parent 09fc458 commit 9694cbb
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions engines/sci/resource.cpp
Expand Up @@ -158,24 +158,24 @@ static const ResourceType s_resTypeMapSci21[] = {
ResourceType ResourceManager::convertResType(byte type) {
type &= 0x7f;

if (_mapVersion < kResVersionSci2) {
bool forceSci0 = false;

// LSL6 hires doesn't have the chunk resource type, to match
// the resource types of the lowres version, thus we use the
// older resource types here.
// PQ4 CD and QFG4 CD are SCI2.1, but use the resource types of the
// corresponding SCI2 floppy disk versions.
if (g_sci && (g_sci->getGameId() == GID_LSL6HIRES ||
g_sci->getGameId() == GID_QFG4 || g_sci->getGameId() == GID_PQ4))
forceSci0 = true;

if (_mapVersion < kResVersionSci2 || forceSci0) {
// SCI0 - SCI2
if (type < ARRAYSIZE(s_resTypeMapSci0))
return s_resTypeMapSci0[type];
} else {
// SCI2.1+
if (type < ARRAYSIZE(s_resTypeMapSci21)) {
// LSL6 hires doesn't have the chunk resource type, to match
// the resource types of the lowres version, thus we use the
// older resource types here.
// PQ4 CD and QFG4 CD are SCI2.1, but use the resource types of the
// corresponding SCI2 floppy disk versions.
if (g_sci && (g_sci->getGameId() == GID_LSL6HIRES ||
g_sci->getGameId() == GID_QFG4 || g_sci->getGameId() == GID_PQ4))
return s_resTypeMapSci0[type];
else
return s_resTypeMapSci21[type];
}
if (type < ARRAYSIZE(s_resTypeMapSci21))
return s_resTypeMapSci21[type];
}

return kResourceTypeInvalid;
Expand Down

0 comments on commit 9694cbb

Please sign in to comment.