From 3aafeee19c6ebe9c5bd1f1840dd6fc809ed6a87d Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Tue, 17 May 2016 11:13:30 +0200 Subject: SCUMM HE: Started work on Complex Array Operations --- engines/scumm/he/script_v100he.cpp | 81 ++++++++++++++++++++++---------------- 1 file changed, 47 insertions(+), 34 deletions(-) (limited to 'engines/scumm') diff --git a/engines/scumm/he/script_v100he.cpp b/engines/scumm/he/script_v100he.cpp index 7fe1d88120..e6d0cdc8c3 100644 --- a/engines/scumm/he/script_v100he.cpp +++ b/engines/scumm/he/script_v100he.cpp @@ -625,42 +625,55 @@ void ScummEngine_v100he::o100_arrayOps() { } break; case 132: // SO_COMPLEX_ARRAY_MATH_OPERATION - // TODO: Used by room 2 script 2180 in Moonbase Commander (modify-line-of-sight) - fetchScriptWord(); - fetchScriptWord(); - type = pop(); - pop(); - pop(); - pop(); - pop(); - pop(); - pop(); - pop(); - pop(); - dim1end = pop(); - dim1start = pop(); - dim2end = pop(); - dim2start = pop(); - id = readVar(array); - if (id == 0) { - defineArray(array, kDwordArray, dim2start, dim2end, dim1start, dim1end); - } - switch (type) { - case 1: - break; - case 2: - break; - case 3: - break; - case 4: - break; - case 5: + { + // TODO: Used by room 2 script 2180 in Moonbase Commander (modify-line-of-sight) + int a2 = fetchScriptWord(); + int a1 = fetchScriptWord(); + type = pop(); + int a1_dim1end = pop(); + int a1_dim1start = pop(); + int a1_dim2end = pop(); + int a1_dim2start = pop(); + int a2_dim1end = pop(); + int a2_dim1start = pop(); + int a2_dim2end = pop(); + int a2_dim2start = pop(); + dim1end = pop(); + dim1start = pop(); + dim2end = pop(); + dim2start = pop(); + + int a12_num = a1_dim2end - a1_dim2start + 1; + int a11_num = a1_dim1end - a1_dim1start + 1; + int a22_num = a2_dim2end - a2_dim2start + 1; + int a21_num = a2_dim1end - a2_dim1start + 1; + int d12_num = dim2end - dim2start + 1; + int d11_num = dim1end - dim1start + 1; + + id = readVar(array); + if (id == 0) { + defineArray(array, kDwordArray, dim2start, dim2end, dim1start, dim1end); + } + if (a12_num != a22_num || a12_num != d12_num || a11_num != a21_num || a11_num != d11_num) { + error("Operation size mismatch (%d vs %d)(%d vs %d)", a12_num, a22_num, a11_num, a21_num); + } + switch (type) { + case 1: // Addition + break; + case 2: // Subtraction + break; + case 3: // Binary AND + break; + case 4: // Binary OR + break; + case 5: // Binary XOR + break; + default: + error("o100_arrayOps: case 132 unknown type %d)", type); + } + warning("STUB: o100_arrayOps: case 132 type %d", type); break; - default: - error("o100_arrayOps: case 132 unknown type %d)", type); } - warning("STUB: o100_arrayOps: case 132 type %d", type); - break; case 133: // SO_RANGE_ARRAY_ASSIGNMENT b = pop(); c = pop(); -- cgit v1.2.3