aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--scumm/intern.h7
-rw-r--r--scumm/script_v90he.cpp45
2 files changed, 43 insertions, 9 deletions
diff --git a/scumm/intern.h b/scumm/intern.h
index 303dcfb7a1..e45edffef7 100644
--- a/scumm/intern.h
+++ b/scumm/intern.h
@@ -868,10 +868,13 @@ protected:
/* HE version 90 script opcodes */
void o90_dup();
- void o90_getLT();
- void o90_getGT();
+ void o90_min();
+ void o90_max();
void o90_sin();
void o90_cos();
+ void o90_sqrt();
+ void o90_atan2();
+ void o90_getSegmentAngle();
void o90_startLocalScript();
void o90_wizImageOps();
void o90_unknown25();
diff --git a/scumm/script_v90he.cpp b/scumm/script_v90he.cpp
index b800e9fdf5..1d02260f12 100644
--- a/scumm/script_v90he.cpp
+++ b/scumm/script_v90he.cpp
@@ -80,14 +80,14 @@ void ScummEngine_v90he::setupOpcodes() {
OPCODE(o72_isAnyOf),
/* 1C */
OPCODE(o90_wizImageOps),
- OPCODE(o90_getLT),
- OPCODE(o90_getGT),
+ OPCODE(o90_min),
+ OPCODE(o90_max),
OPCODE(o90_sin),
/* 20 */
OPCODE(o90_cos),
- OPCODE(o6_invalid),
- OPCODE(o6_invalid),
- OPCODE(o6_invalid),
+ OPCODE(o90_sqrt),
+ OPCODE(o90_atan2),
+ OPCODE(o90_getSegmentAngle),
/* 24 */
OPCODE(o6_invalid),
OPCODE(o90_unknown25),
@@ -388,7 +388,7 @@ void ScummEngine_v90he::o90_dup() {
}
}
-void ScummEngine_v90he::o90_getLT() {
+void ScummEngine_v90he::o90_min() {
int a = pop();
int b = pop();
@@ -399,7 +399,7 @@ void ScummEngine_v90he::o90_getLT() {
}
}
-void ScummEngine_v90he::o90_getGT() {
+void ScummEngine_v90he::o90_max() {
int a = pop();
int b = pop();
@@ -420,6 +420,37 @@ void ScummEngine_v90he::o90_cos() {
push((int)(cos(a) * 100000));
}
+void ScummEngine_v90he::o90_sqrt() {
+ int i = pop();
+ if (i < 2) {
+ push(i);
+ } else {
+ push((int)sqrt(i + 1));
+ }
+}
+
+void ScummEngine_v90he::o90_atan2() {
+ int y = pop();
+ int x = pop();
+ int a = (int)(atan2(y, x) * 180. / PI);
+ if (a < 0) {
+ a += 360;
+ }
+ push(a);
+}
+
+void ScummEngine_v90he::o90_getSegmentAngle() {
+ int y1 = pop();
+ int x1 = pop();
+ int dy = y1 - pop();
+ int dx = x1 - pop();
+ int a = (int)(atan2(dy, dx) * 180. / PI);
+ if (a < 0) {
+ a += 360;
+ }
+ push(a);
+}
+
void ScummEngine_v90he::o90_startLocalScript() {
int args[16];
int script, entryp;