diff options
author | Max Horn | 2004-08-05 09:57:36 +0000 |
---|---|---|
committer | Max Horn | 2004-08-05 09:57:36 +0000 |
commit | b569d58b6ee79d41e9135dd7d3763d4514e7954e (patch) | |
tree | 8143732d659ac490d07669f6cbbcffc4afa103f3 /scumm | |
parent | c6dcbd8eca34f021f67a86baf74233e4cebff6a1 (diff) | |
download | scummvm-rg350-b569d58b6ee79d41e9135dd7d3763d4514e7954e.tar.gz scummvm-rg350-b569d58b6ee79d41e9135dd7d3763d4514e7954e.tar.bz2 scummvm-rg350-b569d58b6ee79d41e9135dd7d3763d4514e7954e.zip |
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
Diffstat (limited to 'scumm')
-rw-r--r-- | scumm/script_v6.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
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)) { |