aboutsummaryrefslogtreecommitdiff
path: root/engines/mohawk/livingbooks_code.cpp
diff options
context:
space:
mode:
authorAlyssa Milburn2011-11-27 00:11:34 +0100
committerAlyssa Milburn2011-11-27 00:11:34 +0100
commite4bdea7c17a4d2122a89236010fbc77cb298dfa5 (patch)
tree1acd0f546827f47a03b7bc633e26f5aa543f4e66 /engines/mohawk/livingbooks_code.cpp
parent9f56876165d10dbfc86d8f232345ea0a766966bf (diff)
downloadscummvm-rg350-e4bdea7c17a4d2122a89236010fbc77cb298dfa5.tar.gz
scummvm-rg350-e4bdea7c17a4d2122a89236010fbc77cb298dfa5.tar.bz2
scummvm-rg350-e4bdea7c17a4d2122a89236010fbc77cb298dfa5.zip
MOHAWK: Stub LB's min/max/abs.
Diffstat (limited to 'engines/mohawk/livingbooks_code.cpp')
-rw-r--r--engines/mohawk/livingbooks_code.cpp35
1 files changed, 32 insertions, 3 deletions
diff --git a/engines/mohawk/livingbooks_code.cpp b/engines/mohawk/livingbooks_code.cpp
index c18f49171c..f16fd409b3 100644
--- a/engines/mohawk/livingbooks_code.cpp
+++ b/engines/mohawk/livingbooks_code.cpp
@@ -744,9 +744,9 @@ CodeCommandInfo generalCommandInfo[NUM_GENERAL_COMMANDS] = {
{ "random", &LBCode::cmdRandom },
{ "stringLen", &LBCode::cmdStringLen },
{ "substring", &LBCode::cmdSubstring },
- { "max", 0 },
- { "min", 0 },
- { "abs", 0 },
+ { "max", &LBCode::cmdMax },
+ { "min", &LBCode::cmdMin },
+ { "abs", &LBCode::cmdAbs },
{ "getRect", &LBCode::cmdGetRect }, // also "makeRect"
{ "makePt", &LBCode::cmdMakePoint }, // also "makePair"
{ "topLeft", &LBCode::cmdTopLeft },
@@ -942,6 +942,35 @@ void LBCode::cmdSubstring(const Common::Array<LBValue> &params) {
_stack.push(substring);
}
+void LBCode::cmdMax(const Common::Array<LBValue> &params) {
+ if (params.size() != 2)
+ error("incorrect number of parameters (%d) to max", params.size());
+
+ // FIXME: fp
+ int a = params[0].toInt();
+ int b = params[1].toInt();
+ _stack.push(MAX(a, b));
+}
+
+void LBCode::cmdMin(const Common::Array<LBValue> &params) {
+ if (params.size() != 2)
+ error("incorrect number of parameters (%d) to min", params.size());
+
+ // FIXME: fp
+ int a = params[0].toInt();
+ int b = params[1].toInt();
+ _stack.push(MIN(a, b));
+}
+
+void LBCode::cmdAbs(const Common::Array<LBValue> &params) {
+ if (params.size() != 1)
+ error("incorrect number of parameters (%d) to abs", params.size());
+
+ // FIXME: fp
+ int a = params[0].toInt();
+ _stack.push(ABS(a));
+}
+
void LBCode::cmdGetRect(const Common::Array<LBValue> &params) {
if (params.size() < 2) {
_stack.push(getRectFromParams(params));