aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/director/lingo/lingo-builtins.cpp47
-rw-r--r--engines/director/lingo/lingo.h10
2 files changed, 49 insertions, 8 deletions
diff --git a/engines/director/lingo/lingo-builtins.cpp b/engines/director/lingo/lingo-builtins.cpp
index de829560f1..9f80de6f7f 100644
--- a/engines/director/lingo/lingo-builtins.cpp
+++ b/engines/director/lingo/lingo-builtins.cpp
@@ -46,9 +46,10 @@ static struct BuiltinProto {
{ "sqrt", Lingo::b_sqrt, 1, 1, true }, // D2
{ "tan", Lingo::b_tan, 1, 1, true }, // D4
// String
- { "chars", Lingo::b_chars, 3, 3, true }, // D2
- { "length", Lingo::b_length, 1, 1, true }, // D2
- { "string", Lingo::b_string, 1, 1, true }, // D2
+ { "chars", Lingo::b_chars, 3, 3, true }, // D2
+ { "charToNum", Lingo::b_charToNum, 1, 1, true }, // D2
+ { "length", Lingo::b_length, 1, 1, true }, // D2
+ { "string", Lingo::b_string, 1, 1, true }, // D2
// Files
{ "closeDA", Lingo::b_closeDA, 0, 0, false }, // D2
{ "closeResFile", Lingo::b_closeResFile, 0, 1, false }, // D2
@@ -87,6 +88,8 @@ static struct BuiltinProto {
{ "showGlobals", Lingo::b_showGlobals, 0, 0, false }, // D2
{ "showLocals", Lingo::b_showLocals, 0, 0, false }, // D2
// Score
+ { "constrainH", Lingo::b_constrainH, 2, 2, true }, // D2
+ { "constrainV", Lingo::b_constrainV, 2, 2, true }, // D2
{ "editableText", Lingo::b_editableText, 0, 0, false }, // D2
// go // D2
{ "installMenu", Lingo::b_installMenu, 1, 1, false }, // D2
@@ -300,6 +303,20 @@ void Lingo::b_chars(int nargs) {
g_lingo->push(s);
}
+void Lingo::b_charToNum(int nargs) {
+ Datum d = g_lingo->pop();
+
+ if (d.type != STRING)
+ error("Incorrect type for 'charToNum' function: %s", d.type2str());
+
+ byte chr = d.u.s->c_str()[0];
+ delete d.u.s;
+
+ d.u.i = chr;
+ d.type = INT;
+ g_lingo->push(d);
+}
+
void Lingo::b_length(int nargs) {
Datum d = g_lingo->pop();
@@ -496,8 +513,24 @@ void Lingo::b_showLocals(int nargs) {
///////////////////
// Score
///////////////////
-void Lingo::b_updateStage(int nargs) {
- warning("STUB: b_updateStage");
+void Lingo::b_constrainH(int nargs) {
+ Datum num = g_lingo->pop();
+ Datum sprite = g_lingo->pop();
+
+ num.toInt();
+ sprite.toInt();
+
+ warning("STUB: b_constrainH(%d, %d)", sprite.u.i, num.u.i);
+}
+
+void Lingo::b_constrainV(int nargs) {
+ Datum num = g_lingo->pop();
+ Datum sprite = g_lingo->pop();
+
+ num.toInt();
+ sprite.toInt();
+
+ warning("STUB: b_constrainV(%d, %d)", sprite.u.i, num.u.i);
}
void Lingo::b_editableText(int nargs) {
@@ -559,6 +592,10 @@ void Lingo::b_zoomBox(int nargs) {
g_lingo->dropStack(nargs);
}
+void Lingo::b_updateStage(int nargs) {
+ warning("STUB: b_updateStage");
+}
+
///////////////////
diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h
index 0d004a0045..b4244e8bee 100644
--- a/engines/director/lingo/lingo.h
+++ b/engines/director/lingo/lingo.h
@@ -264,21 +264,23 @@ public:
static void b_abs(int nargs);
static void b_atan(int nargs);
- static void b_chars(int nargs);
static void b_cos(int nargs);
static void b_exp(int nargs);
static void b_float(int nargs);
static void b_integer(int nargs);
- static void b_length(int nargs);
static void b_log(int nargs);
static void b_pi(int nargs);
static void b_power(int nargs);
static void b_random(int nargs);
static void b_sin(int nargs);
static void b_sqrt(int nargs);
- static void b_string(int nargs);
static void b_tan(int nargs);
+ static void b_chars(int nargs);
+ static void b_charToNum(int nargs);
+ static void b_length(int nargs);
+ static void b_string(int nargs);
+
static void b_ilk(int nargs);
static void b_alert(int nargs);
static void b_cursor(int nargs);
@@ -286,6 +288,8 @@ public:
static void b_showGlobals(int nargs);
static void b_showLocals(int nargs);
+ static void b_constrainH(int nargs);
+ static void b_constrainV(int nargs);
static void b_editableText(int nargs);
static void b_installMenu(int nargs);
static void b_updateStage(int nargs);