Skip to content

Commit

Permalink
DIRECTOR: Lingo: Implemented ilk() function
Browse files Browse the repository at this point in the history
  • Loading branch information
sev- committed Aug 3, 2016
1 parent 7fd25e9 commit ba3cf61
Show file tree
Hide file tree
Showing 8 changed files with 472 additions and 442 deletions.
8 changes: 8 additions & 0 deletions engines/director/lingo/lingo-builtins.cpp
Expand Up @@ -49,6 +49,7 @@ static struct BuiltinProto {
{ "string", Lingo::b_string, 1},
// Misc
{ "dontpassevent", Lingo::b_dontpassevent, -1 },
{ "ilk", Lingo::b_ilk, 1 },
// point
{ "point", Lingo::b_point, 2},
{ 0, 0, 0 }
Expand Down Expand Up @@ -218,6 +219,13 @@ void Lingo::b_dontpassevent() {
warning("STUB: b_dontpassevent");
}

void Lingo::b_ilk() {
Datum d = g_lingo->pop();
d.u.i = d.type;
d.type = SYMBOL;
g_lingo->push(d);
}

///////////////////
// Point
///////////////////
Expand Down
9 changes: 8 additions & 1 deletion engines/director/lingo/lingo-code.cpp
Expand Up @@ -96,7 +96,10 @@ void Lingo::c_printtop(void) {
warning("%s", d.u.s->c_str());
break;
case POINT:
warning("point (%d, %d)", (int)((*d.u.arr)[0]), (int)((*d.u.arr)[1]));
warning("point(%d, %d)", (int)((*d.u.arr)[0]), (int)((*d.u.arr)[1]));
break;
case SYMBOL:
warning("%s", d.type2str(true));
break;
default:
warning("--unknown--");
Expand Down Expand Up @@ -180,6 +183,8 @@ void Lingo::c_assign() {
d1.u.sym->u.s = new Common::String(*d2.u.s);
else if (d2.type == POINT)
d1.u.sym->u.arr = d2.u.arr;
else if (d2.type == SYMBOL)
d1.u.sym->u.i = d2.u.i;
else
error("c_assign: unhandled type: %s", d2.type2str());

Expand Down Expand Up @@ -223,6 +228,8 @@ void Lingo::c_eval() {
d.u.s = new Common::String(*d.u.sym->u.s);
else if (d.u.sym->type == POINT)
d.u.arr = d.u.sym->u.arr;
else if (d.u.sym->type == SYMBOL)
d.u.i = d.u.sym->u.i;
else
error("c_eval: unhandled type: %s", d.type2str());

Expand Down

0 comments on commit ba3cf61

Please sign in to comment.