aboutsummaryrefslogtreecommitdiff
path: root/engines/scumm/he
diff options
context:
space:
mode:
authorAlyssa Milburn2013-08-04 15:48:55 +0200
committerAlyssa Milburn2013-08-04 15:54:37 +0200
commit89e14f6862bbd61af0f532442e298f2323f9b88d (patch)
tree4e74e989d5e7688bd8b139cd239613b60df2a040 /engines/scumm/he
parent7b517f7fd1b463f268b2aa381ab00351092ba97b (diff)
downloadscummvm-rg350-89e14f6862bbd61af0f532442e298f2323f9b88d.tar.gz
scummvm-rg350-89e14f6862bbd61af0f532442e298f2323f9b88d.tar.bz2
scummvm-rg350-89e14f6862bbd61af0f532442e298f2323f9b88d.zip
SCUMM: Fix backwards-in-same-array case of v72he::copyArray.
Diffstat (limited to 'engines/scumm/he')
-rw-r--r--engines/scumm/he/script_v72he.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/engines/scumm/he/script_v72he.cpp b/engines/scumm/he/script_v72he.cpp
index b9f454de0f..f36f5cc130 100644
--- a/engines/scumm/he/script_v72he.cpp
+++ b/engines/scumm/he/script_v72he.cpp
@@ -1779,8 +1779,11 @@ void ScummEngine_v72he::copyArray(int array1, int a1_dim2start, int a1_dim2end,
copyArrayHelper(ah, a1_dim2start, a1_dim1start, a1_dim1end, &dst, &dstPitch, &rowSize);
copyArrayHelper(ah, a2_dim2start, a2_dim1start, a2_dim1end, &src, &srcPitch, &rowSize);
} else {
+ // start at the end, so we copy backwards (in case the indices overlap)
copyArrayHelper(ah, a1_dim2end, a1_dim1start, a1_dim1end, &dst, &dstPitch, &rowSize);
copyArrayHelper(ah, a2_dim2end, a2_dim1start, a2_dim1end, &src, &srcPitch, &rowSize);
+ dstPitch = -dstPitch;
+ srcPitch = -srcPitch;
}
for (; a1_dim2start <= a1_dim2end; ++a1_dim2start) {
memcpy(dst, src, rowSize);