diff options
-rw-r--r-- | scumm/script_v100he.cpp | 30 | ||||
-rw-r--r-- | scumm/script_v72he.cpp | 21 |
2 files changed, 23 insertions, 28 deletions
diff --git a/scumm/script_v100he.cpp b/scumm/script_v100he.cpp index 2478ba319a..cb3697ed15 100644 --- a/scumm/script_v100he.cpp +++ b/scumm/script_v100he.cpp @@ -578,26 +578,27 @@ void ScummEngine_v100he::o100_actorOps() { } void ScummEngine_v100he::o100_arrayOps() { - byte subOp = fetchScriptByte(); - int array = fetchScriptWord(); - int offs, tmp, tmp2, tmp3; - int dim1end, dim1start, dim2end, dim2start; - int id, len, b, c; ArrayHeader *ah; - int list[128]; byte string[1024]; + int dim1end, dim1start, dim2end, dim2start; + int id, len, b, c, list[128]; + int offs, tmp, tmp2; + uint tmp3; + + byte subOp = fetchScriptByte(); + int array = fetchScriptWord(); + debug(1,"o100_arrayOps: array %d case %d", array, subOp); - debug(1,"o100_arrayOps: case %d", subOp); switch (subOp) { case 35: decodeScriptString(string); - len = resStrLen(string) + 1; + len = resStrLen(string); ah = defineArray(array, kStringArray, 0, 0, 0, len); memcpy(ah->data, string, len); break; case 77: // SO_ASSIGN_STRING copyScriptString(string, sizeof(string)); - len = resStrLen(string) + 1; + len = resStrLen(string); ah = defineArray(array, kStringArray, 0, 0, 0, len); memcpy(ah->data, string, len); break; @@ -606,7 +607,7 @@ void ScummEngine_v100he::o100_arrayOps() { len = getStackList(list, ARRAYSIZE(list)); id = readVar(array); if (id == 0) - error("o100_arrayOps: Must DIM a two dimensional array before assigning"); + error("Must DIM a two dimensional array before assigning"); c = pop(); while (--len >= 0) { writeArray(array, c, len, list[len]); @@ -617,7 +618,7 @@ void ScummEngine_v100he::o100_arrayOps() { c = pop(); id = readVar(array); if (id == 0) { - defineArray(array, kDwordArray, 0, 0, 0, b + c); + defineArray(array, kDwordArray, 0, 0, 0, b + c - 1); } while (c--) { writeArray(array, 0, b + c, pop()); @@ -657,7 +658,7 @@ void ScummEngine_v100he::o100_arrayOps() { int a1_dim2end = pop(); int a1_dim2start = pop(); if (a1_dim1end - a1_dim1start != a2_dim1end - a2_dim1start || a2_dim2end - a2_dim2start != a1_dim2end - a1_dim2start) { - warning("Source and dest ranges size are mismatched"); + error("Source and dest ranges size are mismatched"); } copyArray(array, a1_dim2start, a1_dim2end, a1_dim1start, a1_dim1end, array2, a2_dim2start, a2_dim2end, a2_dim1start, a2_dim1end); } @@ -674,12 +675,9 @@ void ScummEngine_v100he::o100_arrayOps() { defineArray(array, kDwordArray, dim2start, dim2end, dim1start, dim1end); } - len = c - b; - len |= dim2end; - len = len - dim2end + 1; offs = (b >= c) ? 1 : -1; tmp2 = c; - tmp3 = len; + tmp3 = c - b + 1;; while (dim2start <= dim2end) { tmp = dim1start; while (tmp <= dim1end) { diff --git a/scumm/script_v72he.cpp b/scumm/script_v72he.cpp index 0bb5cc1db8..c7c2057c68 100644 --- a/scumm/script_v72he.cpp +++ b/scumm/script_v72he.cpp @@ -1443,17 +1443,17 @@ void ScummEngine_v72he::o72_findObject() { } void ScummEngine_v72he::o72_arrayOps() { - byte subOp = fetchScriptByte(); - int array = fetchScriptWord(); - int offs, tmp, tmp2, tmp3; - int dim1end, dim1start, dim2end, dim2start; - int id, len, b, c; ArrayHeader *ah; - int list[128]; byte string[1024]; + int dim1end, dim1start, dim2end, dim2start; + int id, len, b, c, list[128]; + int offs, tmp, tmp2; + uint tmp3; + byte subOp = fetchScriptByte(); + int array = fetchScriptWord(); + debug(1,"o72_arrayOps: array %d case %d", array, subOp); - debug(1,"o72_arrayOps: case %d", subOp); switch (subOp) { case 7: // SO_ASSIGN_STRING copyScriptString(string, sizeof(string)); @@ -1496,7 +1496,7 @@ void ScummEngine_v72he::o72_arrayOps() { int a1_dim2end = pop(); int a1_dim2start = pop(); if (a1_dim1end - a1_dim1start != a2_dim1end - a2_dim1start || a2_dim2end - a2_dim2start != a1_dim2end - a1_dim2start) { - warning("Source and dest ranges size are mismatched"); + error("Source and dest ranges size are mismatched"); } copyArray(array, a1_dim2start, a1_dim2end, a1_dim1start, a1_dim1end, array2, a2_dim2start, a2_dim2end, a2_dim1start, a2_dim1end); } @@ -1513,12 +1513,9 @@ void ScummEngine_v72he::o72_arrayOps() { defineArray(array, kDwordArray, dim2start, dim2end, dim1start, dim1end); } - len = c - b; - len |= dim2end; - len = len - dim2end + 1; offs = (b >= c) ? 1 : -1; tmp2 = c; - tmp3 = len; + tmp3 = c - b + 1;; while (dim2start <= dim2end) { tmp = dim1start; while (tmp <= dim1end) { |