[Scummvm-cvs-logs] scummvm master -> e4bdea7c17a4d2122a89236010fbc77cb298dfa5
fuzzie
fuzzie at fuzzie.org
Sun Nov 27 00:13:20 CET 2011
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
e4bdea7c17 MOHAWK: Stub LB's min/max/abs.
Commit: e4bdea7c17a4d2122a89236010fbc77cb298dfa5
https://github.com/scummvm/scummvm/commit/e4bdea7c17a4d2122a89236010fbc77cb298dfa5
Author: Alyssa Milburn (fuzzie at fuzzie.org)
Date: 2011-11-26T15:11:34-08:00
Commit Message:
MOHAWK: Stub LB's min/max/abs.
Changed paths:
engines/mohawk/livingbooks_code.cpp
engines/mohawk/livingbooks_code.h
diff --git a/engines/mohawk/livingbooks_code.cpp b/engines/mohawk/livingbooks_code.cpp
index c18f491..f16fd40 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 ce59105..6d3812a 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);
More information about the Scummvm-git-logs
mailing list