From e4bdea7c17a4d2122a89236010fbc77cb298dfa5 Mon Sep 17 00:00:00 2001 From: Alyssa Milburn Date: Sun, 27 Nov 2011 00:11:34 +0100 Subject: MOHAWK: Stub LB's min/max/abs. --- engines/mohawk/livingbooks_code.cpp | 35 ++++++++++++++++++++++++++++++++--- engines/mohawk/livingbooks_code.h | 3 +++ 2 files changed, 35 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 ¶ms) { _stack.push(substring); } +void LBCode::cmdMax(const Common::Array ¶ms) { + 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 ¶ms) { + 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 ¶ms) { + 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 ¶ms) { if (params.size() < 2) { _stack.push(getRectFromParams(params)); diff --git a/engines/mohawk/livingbooks_code.h b/engines/mohawk/livingbooks_code.h index ce5910559c..6d3812aae9 100644 --- a/engines/mohawk/livingbooks_code.h +++ b/engines/mohawk/livingbooks_code.h @@ -250,6 +250,9 @@ public: void cmdRandom(const Common::Array ¶ms); void cmdStringLen(const Common::Array ¶ms); void cmdSubstring(const Common::Array ¶ms); + void cmdMax(const Common::Array ¶ms); + void cmdMin(const Common::Array ¶ms); + void cmdAbs(const Common::Array ¶ms); void cmdGetRect(const Common::Array ¶ms); void cmdMakePoint(const Common::Array ¶ms); void cmdTopLeft(const Common::Array ¶ms); -- cgit v1.2.3