diff options
author | Gregory Montoir | 2004-11-21 20:55:56 +0000 |
---|---|---|
committer | Gregory Montoir | 2004-11-21 20:55:56 +0000 |
commit | be0fb14facb55d14f142f33f78d780501df7b4f4 (patch) | |
tree | 80d2fefa31bf5d9a91ff765d648db36922bc75b8 | |
parent | ee565c0bae8fd7ca09c39c785995a53b0539ca7e (diff) | |
download | scummvm-rg350-be0fb14facb55d14f142f33f78d780501df7b4f4.tar.gz scummvm-rg350-be0fb14facb55d14f142f33f78d780501df7b4f4.tar.bz2 scummvm-rg350-be0fb14facb55d14f142f33f78d780501df7b4f4.zip |
o90_unknown24 implementation
svn-id: r15856
-rw-r--r-- | scumm/intern.h | 2 | ||||
-rw-r--r-- | scumm/script_v90he.cpp | 46 |
2 files changed, 32 insertions, 16 deletions
diff --git a/scumm/intern.h b/scumm/intern.h index 810d690243..cf7aa4cdb8 100644 --- a/scumm/intern.h +++ b/scumm/intern.h @@ -888,7 +888,7 @@ protected: void o90_startScriptUnk(); void o90_jumpToScriptUnk(); void o90_wizImageOps(); - void o90_unknown24(); + void o90_getDistanceBetweenPoints(); void o90_unknown25(); void o90_unknown26(); void o90_unknown27(); diff --git a/scumm/script_v90he.cpp b/scumm/script_v90he.cpp index 64e1df32cf..d84068c9d5 100644 --- a/scumm/script_v90he.cpp +++ b/scumm/script_v90he.cpp @@ -89,7 +89,7 @@ void ScummEngine_v90he::setupOpcodes() { OPCODE(o90_atan2), OPCODE(o90_getSegmentAngle), /* 24 */ - OPCODE(o90_unknown24), + OPCODE(o90_getDistanceBetweenPoints), OPCODE(o90_unknown25), OPCODE(o90_unknown26), OPCODE(o90_unknown27), @@ -831,29 +831,45 @@ void ScummEngine_v90he::o90_wizImageOps() { debug(1,"o90_wizImageOps stub (%d)", subOp); } -void ScummEngine_v90he::o90_unknown24() { +void ScummEngine_v90he::o90_getDistanceBetweenPoints() { byte subOp = fetchScriptByte(); + int x1, y1, z1, x2, y2, z2, dx, dy, dz, d; switch (subOp) { case 28: - pop(); - pop(); - pop(); - pop(); + y2 = pop(); + x2 = pop(); + y1 = pop(); + x1 = pop(); + dx = x2 - x1; + dy = y2 - y1; + d = dx * dx + dy * dy; + if (d < 2) { + push(d); + } else { + push((int)sqrt((double)(d + 1))); + } break; case 29: - pop(); - pop(); - pop(); - pop(); - pop(); - pop(); + z2 = pop(); + y2 = pop(); + x2 = pop(); + z1 = pop(); + y1 = pop(); + x1 = pop(); + dx = x2 - x1; + dy = y2 - y1; + dz = z2 - z1; + d = dx * dx + dy * dy + dz * dz; + if (d < 2) { + push(d); + } else { + push((int)sqrt((double)(d + 1))); + } break; default: - error("o90_unknown24: Unknown case %d", subOp); + error("o90_getDistanceBetweenPoints: Unknown case %d", subOp); } - push(0); - debug(1,"o90_unknown24 stub (%d)", subOp); } void ScummEngine_v90he::o90_unknown25() { |