SCUMM: prevent possible issues when range is reversed

This commit is contained in:
BLooperZ 2022-11-15 09:13:58 +02:00 committed by Eugene Sandulenko
parent cc08993822
commit 0c3c7a4b5c
2 changed files with 4 additions and 4 deletions

View File

@ -710,14 +710,14 @@ void ScummEngine_v100he::o100_arrayOps() {
offs = (b >= c) ? 1 : -1;
tmp2 = c;
tmp3 = c - b + 1;
tmp3 = ABS(c - b) + 1;
while (dim2start <= dim2end) {
tmp = dim1start;
while (tmp <= dim1end) {
writeArray(array, dim2start, tmp, tmp2);
if (--tmp3 == 0) {
tmp2 = c;
tmp3 = c - b + 1;
tmp3 = ABS(c - b) + 1;
} else {
tmp2 += offs;
}

View File

@ -1174,14 +1174,14 @@ void ScummEngine_v72he::o72_arrayOps() {
offs = (b >= c) ? 1 : -1;
tmp2 = c;
tmp3 = c - b + 1;
tmp3 = ABS(c - b) + 1;
while (dim2start <= dim2end) {
tmp = dim1start;
while (tmp <= dim1end) {
writeArray(array, dim2start, tmp, tmp2);
if (--tmp3 == 0) {
tmp2 = c;
tmp3 = c - b + 1;
tmp3 = ABS(c - b) + 1;
} else {
tmp2 += offs;
}