aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWillem Jan Palenstijn2013-04-20 16:17:49 +0200
committerWillem Jan Palenstijn2013-04-20 16:17:49 +0200
commit9694cbbaafcd7d043edb5755df5cc5dda18a5d16 (patch)
treeae1a66864307bf9c5829728f09fba924c46fe3f2
parent09fc458f15bdd320cb8d112ac1fd23a45156bd1d (diff)
downloadscummvm-rg350-9694cbbaafcd7d043edb5755df5cc5dda18a5d16.tar.gz
scummvm-rg350-9694cbbaafcd7d043edb5755df5cc5dda18a5d16.tar.bz2
scummvm-rg350-9694cbbaafcd7d043edb5755df5cc5dda18a5d16.zip
SCI: Fix resource type range checks
-rw-r--r--engines/sci/resource.cpp28
1 files changed, 14 insertions, 14 deletions
diff --git a/engines/sci/resource.cpp b/engines/sci/resource.cpp
index 1da0c5dccc..d14c965ebb 100644
--- a/engines/sci/resource.cpp
+++ b/engines/sci/resource.cpp
@@ -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;