aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFilippos Karapetis2010-05-31 18:31:37 +0000
committerFilippos Karapetis2010-05-31 18:31:37 +0000
commitde2e935b2c6ca2091e37068772931da1ec51ceb3 (patch)
tree386f67efcc9f9a11abdca14b2cbc53501a9061a0
parent443c0d4f935ce908caf79bdc94183ad5214dc7c1 (diff)
downloadscummvm-rg350-de2e935b2c6ca2091e37068772931da1ec51ceb3.tar.gz
scummvm-rg350-de2e935b2c6ca2091e37068772931da1ec51ceb3.tar.bz2
scummvm-rg350-de2e935b2c6ca2091e37068772931da1ec51ceb3.zip
Wrote the initialization code for the exports and synonyms table to make more sense and fixed a bug with the initialization of the synonyms pointer, introduced with rev #49336
svn-id: r49360
-rw-r--r--engines/sci/engine/segment.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/engines/sci/engine/segment.cpp b/engines/sci/engine/segment.cpp
index 07fe6f0a92..10d73d7325 100644
--- a/engines/sci/engine/segment.cpp
+++ b/engines/sci/engine/segment.cpp
@@ -194,18 +194,21 @@ void Script::load(ResourceManager *resMan) {
_numSynonyms = 0;
if (getSciVersion() >= SCI_VERSION_1_1) {
- if (READ_LE_UINT16(_buf + 6) > 0) {
- _exportTable = (const uint16 *)(_buf + 6 + 2);
+ if (READ_LE_UINT16(_buf + 1 + 5) > 0) {
+ _exportTable = (const uint16 *)(_buf + 1 + 5 + 2);
_numExports = READ_SCI11ENDIAN_UINT16(_exportTable - 1);
}
} else {
_exportTable = (const uint16 *)findBlock(SCI_OBJ_EXPORTS);
if (_exportTable) {
- _exportTable += 3;
- _numExports = READ_SCI11ENDIAN_UINT16(_exportTable - 1);
+ _numExports = READ_SCI11ENDIAN_UINT16(_exportTable + 1);
+ _exportTable += 3; // skip header plus 2 bytes (_exportTable is a uint16 pointer)
}
_synonyms = findBlock(SCI_OBJ_SYNONYMS);
- _numSynonyms = _synonyms ? READ_SCI11ENDIAN_UINT16(_synonyms - 2) / 4 : 0;
+ if (_synonyms) {
+ _numSynonyms = READ_SCI11ENDIAN_UINT16(_synonyms + 2) / 4;
+ _synonyms += 4; // skip header
+ }
}
}