diff options
author | Lars Skovlund | 2010-12-23 14:03:58 +0000 |
---|---|---|
committer | Lars Skovlund | 2010-12-23 14:03:58 +0000 |
commit | 5b2071487f4df5adbb0c9a67d8c6077c0747d781 (patch) | |
tree | b72099ab0f30e1b66e4e70b291f864d1f73d42b0 /engines | |
parent | ee2b1092ab35be717c728ea641d18baa7f817536 (diff) | |
download | scummvm-rg350-5b2071487f4df5adbb0c9a67d8c6077c0747d781.tar.gz scummvm-rg350-5b2071487f4df5adbb0c9a67d8c6077c0747d781.tar.bz2 scummvm-rg350-5b2071487f4df5adbb0c9a67d8c6077c0747d781.zip |
SCI: Unbreak script loading on big-endian machines. Thanks to [md5] and wjp.
svn-id: r55025
Diffstat (limited to 'engines')
-rw-r--r-- | engines/sci/engine/object.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/engines/sci/engine/object.cpp b/engines/sci/engine/object.cpp index 99527b5d1a..e28c8c6fcf 100644 --- a/engines/sci/engine/object.cpp +++ b/engines/sci/engine/object.cpp @@ -63,14 +63,18 @@ void Object::init(byte *buf, reg_t obj_pos, bool initVariables) { _variables.resize(READ_LE_UINT16(data + kOffsetSelectorCounter)); _baseVars = (uint16 *)(_baseObj + _variables.size() * 2); _methodCount = READ_LE_UINT16(data + READ_LE_UINT16(data + kOffsetFunctionArea) - 2); - _baseMethod = Common::Array<uint16>((const uint16 *)(data + READ_LE_UINT16(data + kOffsetFunctionArea)), - _methodCount*2+2); + for (int i = 0; i < _methodCount * 2 + 2; ++i) + { + _baseMethod.push_back(READ_SCI11ENDIAN_UINT16(data + READ_LE_UINT16(data + kOffsetFunctionArea) + i * 2)); + } } else if (getSciVersion() >= SCI_VERSION_1_1 && getSciVersion() <= SCI_VERSION_2_1) { _variables.resize(READ_SCI11ENDIAN_UINT16(data + 2)); _baseVars = (uint16 *)(buf + READ_SCI11ENDIAN_UINT16(data + 4)); _methodCount = READ_SCI11ENDIAN_UINT16(buf + READ_SCI11ENDIAN_UINT16(data + 6)); - _baseMethod = Common::Array<uint16>((const uint16 *) (buf + READ_SCI11ENDIAN_UINT16(data + 6)), - _methodCount*2+3); + for (int i = 0; i < _methodCount * 2 + 3; ++i) + { + _baseMethod.push_back(READ_SCI11ENDIAN_UINT16(buf + READ_SCI11ENDIAN_UINT16(data + 6) + i * 2)); + } } else if (getSciVersion() == SCI_VERSION_3) { initSelectorsSci3(buf); } |