From b569d58b6ee79d41e9135dd7d3763d4514e7954e Mon Sep 17 00:00:00 2001 From: Max Horn Date: Thu, 5 Aug 2004 09:57:36 +0000 Subject: Aargh, my work around code was using a wrong check, and then using the wrong operations (which were effectively not doing anything)... Fixed the workaround code, which cures bug #918280 (and its dup #1003717) svn-id: r14467 --- scumm/script_v6.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'scumm') diff --git a/scumm/script_v6.cpp b/scumm/script_v6.cpp index c7262fa485..610b28fd3f 100644 --- a/scumm/script_v6.cpp +++ b/scumm/script_v6.cpp @@ -483,6 +483,8 @@ int ScummEngine_v6::findFreeArrayId() { return -1; } +#define SWAP16(x) x = SWAP_BYTES_16(x) + ArrayHeader *ScummEngine_v6::getArray(int array) { ArrayHeader *ah = (ArrayHeader *)getResourceAddress(rtString, readVar(array)); if (!ah) @@ -492,10 +494,10 @@ ArrayHeader *ScummEngine_v6::getArray(int array) { // endianness, instead of a fixed endianness. We try to detect savegames // which were created on a big endian system and convert them to little // endian. - if ((ah->dim1 & 0xF000) || (ah->dim2 & 0xF000) || (ah->type & 0xFF00)) { - SWAP_BYTES_16(ah->dim1); - SWAP_BYTES_16(ah->dim2); - SWAP_BYTES_16(ah->type); + if ((FROM_LE_16(ah->dim1) & 0xF000) || (FROM_LE_16(ah->dim2) & 0xF000) || (FROM_LE_16(ah->type) & 0xFF00)) { + SWAP16(ah->dim1); + SWAP16(ah->dim2); + SWAP16(ah->type); } return ah; @@ -519,7 +521,6 @@ int ScummEngine_v6::readArray(int array, int idx, int base) { return 0; } - const int offset = base + idx * FROM_LE_16(ah->dim1); if (offset < 0 || offset >= FROM_LE_16(ah->dim1) * FROM_LE_16(ah->dim2)) { -- cgit v1.2.3