From dcb2372e23d58f700f25764429f148ddd5d8f73b Mon Sep 17 00:00:00 2001 From: Travis Howell Date: Fri, 14 Oct 2005 12:36:46 +0000 Subject: Adjust array ids in HE80+ games, to match original. Otherwise array aren't always nuked by scripts. svn-id: r19082 --- scumm/resource.cpp | 4 ++++ scumm/script_v6.cpp | 3 +++ scumm/script_v6he.cpp | 3 +++ scumm/script_v72he.cpp | 6 ++++++ 4 files changed, 16 insertions(+) diff --git a/scumm/resource.cpp b/scumm/resource.cpp index 6e256a62dd..4ddc571c7a 100644 --- a/scumm/resource.cpp +++ b/scumm/resource.cpp @@ -753,6 +753,10 @@ byte *ScummEngine::getResourceAddress(int type, int idx) { byte *ptr; CHECK_HEAP + + if (_heversion >= 80 && type == rtString) + idx &= ~0x33539000; + if (!res.validateResource("getResourceAddress", type, idx)) return NULL; diff --git a/scumm/script_v6.cpp b/scumm/script_v6.cpp index 7b9557ff83..cd61ab565a 100644 --- a/scumm/script_v6.cpp +++ b/scumm/script_v6.cpp @@ -460,6 +460,9 @@ void ScummEngine_v6::nukeArray(int a) { data = readVar(a); + if (_heversion >= 80) + data &= ~0x33539000; + if (data) res.nukeResource(rtString, data); if (_heversion >= 60) diff --git a/scumm/script_v6he.cpp b/scumm/script_v6he.cpp index 74828bfdd6..e6c8210950 100644 --- a/scumm/script_v6he.cpp +++ b/scumm/script_v6he.cpp @@ -1152,6 +1152,9 @@ void ScummEngine_v60he::o60_soundOps() { } void ScummEngine_v60he::localizeArray(int slot, byte scriptSlot) { + if (_heversion >= 80) + slot &= ~0x33539000; + if (slot >= _numArray) error("o60_localizeArrayToScript(%d): array slot out of range", slot); diff --git a/scumm/script_v72he.cpp b/scumm/script_v72he.cpp index 281ec6b0e1..fbb022ae68 100644 --- a/scumm/script_v72he.cpp +++ b/scumm/script_v72he.cpp @@ -405,8 +405,14 @@ ScummEngine_v72he::ArrayHeader *ScummEngine_v72he::defineArray(int array, int ty size = arrayDataSizes[type]; + if (_heversion >= 80) + id |= 0x33539000; + writeVar(array, id); + if (_heversion >= 80) + id &= ~0x33539000; + size *= dim2end - dim2start + 1; size *= dim1end - dim1start + 1; size >>= 3; -- cgit v1.2.3