diff options
author | Eugene Sandulenko | 2004-02-11 03:21:50 +0000 |
---|---|---|
committer | Eugene Sandulenko | 2004-02-11 03:21:50 +0000 |
commit | 76fc86f02847daf94b8b699a32974362f9ff4937 (patch) | |
tree | 705db0088745278c97295a0afe503dd7dfa4cc91 /scumm/script_v6he.cpp | |
parent | 054edc1591a26eb178f7befb30d0cb8f3979c6ba (diff) | |
download | scummvm-rg350-76fc86f02847daf94b8b699a32974362f9ff4937.tar.gz scummvm-rg350-76fc86f02847daf94b8b699a32974362f9ff4937.tar.bz2 scummvm-rg350-76fc86f02847daf94b8b699a32974362f9ff4937.zip |
Implementation of ScummEngine_v6he::unknownEA_func
svn-id: r12819
Diffstat (limited to 'scumm/script_v6he.cpp')
-rw-r--r-- | scumm/script_v6he.cpp | 36 |
1 files changed, 32 insertions, 4 deletions
diff --git a/scumm/script_v6he.cpp b/scumm/script_v6he.cpp index 8b4aa66faf..b132c4f9a0 100644 --- a/scumm/script_v6he.cpp +++ b/scumm/script_v6he.cpp @@ -1124,19 +1124,47 @@ void ScummEngine_v6he::o6_unknownEA() { eax = fetchScriptByte(); switch (eax) { case 199: - unknownEA_func(5, esi, edi, fetchScriptWord(), eax); + unknownEA_func(fetchScriptWord(), esi, edi, 5); break; case 202: - unknownEA_func(3, esi, edi, fetchScriptWord(), eax); + unknownEA_func(fetchScriptWord(), esi, edi, 3); break; default: break; } } -void ScummEngine_v6he::unknownEA_func(int a, int b, int c, int d, int e) { +void ScummEngine_v6he::unknownEA_func(int arrayId, int newX, int newY, int d) { // Used in mini game at Cosmic Dust Diner in puttmoon - warning("unknownEA_func(%d, %d, %d, %d, %d) stub", a, b, c, d, e); + int var_2, var_4, ax, cx; + + if (readVar(arrayId) == 0) + error("unknownEA_func: Reference to zeroed array pointer"); + + byte *ptr = getResourceAddress(rtString, readVar(arrayId)); + + if (!ptr) + error("unknownEA_func: Invalid array (%d) reference", readVar(arrayId)); + + if (d == 5) + var_2 = 2; + else + var_2 = 1; + + if (READ_LE_UINT16(ptr) == 5) + var_4 = 2; + else + var_4 = 1; + + cx = var_2 * (newX + 1) * (newY + 1); + ax = var_4 * READ_LE_UINT16(ptr + 2) * READ_LE_UINT16(ptr + 4); + + if (ax == cx) + error("unknownEA_func: array %d redim mismatch", readVar(arrayId)); + + WRITE_LE_UINT16(ptr, d); + WRITE_LE_UINT16(ptr + 2, newX + 1); + WRITE_LE_UINT16(ptr + 4, newY + 1); } void ScummEngine_v6he::o6_unknownEE() { |