aboutsummaryrefslogtreecommitdiff
path: root/engines/director
diff options
context:
space:
mode:
authorEugene Sandulenko2016-06-24 10:56:55 +0200
committerEugene Sandulenko2016-08-03 23:40:36 +0200
commita06e794a94002e63b9da75c92069fd7ca846df71 (patch)
tree2030be16e586415ac9ae7b22cc5aa56c87a3626b /engines/director
parentc376b12d6b82c6c2ca0d330bd1e7751aa1cd07f6 (diff)
downloadscummvm-rg350-a06e794a94002e63b9da75c92069fd7ca846df71.tar.gz
scummvm-rg350-a06e794a94002e63b9da75c92069fd7ca846df71.tar.bz2
scummvm-rg350-a06e794a94002e63b9da75c92069fd7ca846df71.zip
DIRECTOR: Lingo: Added named parameter assignment for macros
Diffstat (limited to 'engines/director')
-rw-r--r--engines/director/director.cpp12
-rw-r--r--engines/director/lingo/lingo-code.cpp7
-rw-r--r--engines/director/lingo/lingo-gr.cpp27
-rw-r--r--engines/director/lingo/lingo-gr.y11
-rw-r--r--engines/director/lingo/lingo.h1
5 files changed, 42 insertions, 16 deletions
diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index d5bfa21fa2..4e3b1f3024 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -94,8 +94,20 @@ end if\n\
if x >1 then\n\
exit\n\
end if\n\
+\n\
+--\n\
+macro check par1, par2\n\
+if par1 = 3 then\n\
+ put 8\n\
+else\n\
+ put 9\n\
+end if\n\
+\n\
", kMovieScript, 1);
+return Common::kNoError;
+
+
_lingo->addCode("mci \"open MM\\T005045a.wav type WaveAudio alias T005045a\"\n\
mci \"play T005045a from 22710 to 32872\"", kMovieScript, 1);
diff --git a/engines/director/lingo/lingo-code.cpp b/engines/director/lingo/lingo-code.cpp
index 5f98006525..8483861d46 100644
--- a/engines/director/lingo/lingo-code.cpp
+++ b/engines/director/lingo/lingo-code.cpp
@@ -379,6 +379,13 @@ void Lingo::c_gotoprevious() {
void Lingo::define(Common::String &s, int nargs) {
warning("STUB: define(\"%s\", %d)", s.c_str(), nargs);
}
+
+void Lingo::codeArg(Common::String &s) {
+ g_lingo->code1(g_lingo->c_varpush);
+ g_lingo->codeString(s.c_str());
+ g_lingo->code1(g_lingo->c_assign);
+}
+
void Lingo::c_procret() {
warning("STUB: c_procret()");
}
diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp
index 251818d976..908c07b8f8 100644
--- a/engines/director/lingo/lingo-gr.cpp
+++ b/engines/director/lingo/lingo-gr.cpp
@@ -526,8 +526,8 @@ static const yytype_uint16 yyrline[] =
189, 190, 191, 194, 195, 196, 197, 198, 199, 200,
201, 202, 203, 204, 205, 206, 207, 208, 211, 212,
213, 214, 215, 226, 227, 228, 229, 230, 231, 234,
- 235, 236, 237, 240, 241, 242, 270, 270, 273, 274,
- 275, 276
+ 235, 236, 237, 240, 241, 242, 270, 270, 276, 277,
+ 278, 279
};
#endif
@@ -1848,32 +1848,35 @@ yyreduce:
case 67:
#line 271 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_procret); g_lingo->define(*(yyvsp[(2) - (5)].s), (yyvsp[(4) - (5)].narg)); g_lingo->_indef = false; ;}
+ {
+ g_lingo->code1(g_lingo->c_procret);
+ g_lingo->define(*(yyvsp[(2) - (5)].s), (yyvsp[(4) - (5)].narg));
+ g_lingo->_indef = false; ;}
break;
case 68:
-#line 273 "engines/director/lingo/lingo-gr.y"
+#line 276 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 0; ;}
break;
case 69:
-#line 274 "engines/director/lingo/lingo-gr.y"
- { (yyval.narg) = 1; ;}
+#line 277 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->codeArg(*(yyvsp[(1) - (1)].s)); delete (yyvsp[(1) - (1)].s); (yyval.narg) = 1; ;}
break;
case 70:
-#line 275 "engines/director/lingo/lingo-gr.y"
- { (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;}
+#line 278 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->codeArg(*(yyvsp[(3) - (3)].s)); delete (yyvsp[(3) - (3)].s); (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;}
break;
case 71:
-#line 276 "engines/director/lingo/lingo-gr.y"
- { (yyval.narg) = (yyvsp[(1) - (4)].narg) + 1; ;}
+#line 279 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->codeArg(*(yyvsp[(4) - (4)].s)); delete (yyvsp[(4) - (4)].s); (yyval.narg) = (yyvsp[(1) - (4)].narg) + 1; ;}
break;
/* Line 1267 of yacc.c. */
-#line 1877 "engines/director/lingo/lingo-gr.cpp"
+#line 1880 "engines/director/lingo/lingo-gr.cpp"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -2087,6 +2090,6 @@ yyreturn:
}
-#line 280 "engines/director/lingo/lingo-gr.y"
+#line 283 "engines/director/lingo/lingo-gr.y"
diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y
index cbb18de963..910cd8077b 100644
--- a/engines/director/lingo/lingo-gr.y
+++ b/engines/director/lingo/lingo-gr.y
@@ -268,12 +268,15 @@ gotomovie: tOF tMOVIE STRING { $$ = $3; }
// See also:
// on keyword
defn: tMACRO VAR { g_lingo->_indef = true; }
- arglist stmtlist { g_lingo->code1(g_lingo->c_procret); g_lingo->define(*$2, $4); g_lingo->_indef = false; }
+ arglist stmtlist {
+ g_lingo->code1(g_lingo->c_procret);
+ g_lingo->define(*$2, $4);
+ g_lingo->_indef = false; }
;
arglist: /* nothing */ { $$ = 0; }
- | VAR { $$ = 1; }
- | arglist ',' VAR { $$ = $1 + 1; }
- | arglist ',' '\n' VAR { $$ = $1 + 1; }
+ | VAR { g_lingo->codeArg(*$1); delete $1; $$ = 1; }
+ | arglist ',' VAR { g_lingo->codeArg(*$3); delete $3; $$ = $1 + 1; }
+ | arglist ',' '\n' VAR { g_lingo->codeArg(*$4); delete $4; $$ = $1 + 1; }
;
diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h
index 7b1faede26..c4b720c163 100644
--- a/engines/director/lingo/lingo.h
+++ b/engines/director/lingo/lingo.h
@@ -121,6 +121,7 @@ public:
void execute(int pc);
Symbol *lookupVar(const char *name);
void define(Common::String &s, int nargs);
+ void codeArg(Common::String &s);
static void c_xpop();
static void c_printtop();