diff options
author | Alyssa Milburn | 2011-11-27 00:11:34 +0100 |
---|---|---|
committer | Alyssa Milburn | 2011-11-27 00:11:34 +0100 |
commit | e4bdea7c17a4d2122a89236010fbc77cb298dfa5 (patch) | |
tree | 1acd0f546827f47a03b7bc633e26f5aa543f4e66 /engines | |
parent | 9f56876165d10dbfc86d8f232345ea0a766966bf (diff) | |
download | scummvm-rg350-e4bdea7c17a4d2122a89236010fbc77cb298dfa5.tar.gz scummvm-rg350-e4bdea7c17a4d2122a89236010fbc77cb298dfa5.tar.bz2 scummvm-rg350-e4bdea7c17a4d2122a89236010fbc77cb298dfa5.zip |
MOHAWK: Stub LB's min/max/abs.
Diffstat (limited to 'engines')
-rw-r--r-- | engines/mohawk/livingbooks_code.cpp | 35 | ||||
-rw-r--r-- | 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<LBValue> ¶ms) { _stack.push(substring); } +void LBCode::cmdMax(const Common::Array<LBValue> ¶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<LBValue> ¶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<LBValue> ¶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<LBValue> ¶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<LBValue> ¶ms); void cmdStringLen(const Common::Array<LBValue> ¶ms); void cmdSubstring(const Common::Array<LBValue> ¶ms); + void cmdMax(const Common::Array<LBValue> ¶ms); + void cmdMin(const Common::Array<LBValue> ¶ms); + void cmdAbs(const Common::Array<LBValue> ¶ms); void cmdGetRect(const Common::Array<LBValue> ¶ms); void cmdMakePoint(const Common::Array<LBValue> ¶ms); void cmdTopLeft(const Common::Array<LBValue> ¶ms); |