aboutsummaryrefslogtreecommitdiff
path: root/engines/director
diff options
context:
space:
mode:
Diffstat (limited to 'engines/director')
-rw-r--r--engines/director/director.cpp18
-rw-r--r--engines/director/lingo/lingo-funcs.cpp48
-rw-r--r--engines/director/lingo/lingo-gr.cpp251
-rw-r--r--engines/director/lingo/lingo-gr.h40
-rw-r--r--engines/director/lingo/lingo-gr.y31
-rw-r--r--engines/director/lingo/lingo-lex.cpp194
-rw-r--r--engines/director/lingo/lingo-lex.l8
-rw-r--r--engines/director/lingo/lingo.h10
8 files changed, 416 insertions, 184 deletions
diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index fccd3b545b..86de72d20e 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -76,16 +76,14 @@ Common::Error DirectorEngine::run() {
_lingo->addCode("mci \"open MM\\T005045a.wav type WaveAudio alias T005045a\"\n\
mci \"play T005045a from 22710 to 32872\"", kMovieScript, 1);
- _lingo->addCode("set x = 1 + 3\n\
- set y to 2 + 3 * 2 -- this set y to 4\n\
- put 5 into z\n\
--- some more\n\
-x\n\
-y\n\
-z\n", kMovieScript, 2);
-
- _lingo->addCode("2 + 3 * 2 / (5 - 2)", kMovieScript, 3);
- _lingo->executeScript(kMovieScript, 1);
+ _lingo->addCode("go to frame \"Open23\" of movie \"OpenCabin23\"\n\
+go \"CARDBACK\"\n\
+go movie \"BAR 1\"\n\
+go to \"Open23\" of movie \"OpenCabin23\"\n\
+go to \"Chair\"\n\
+ ", kMovieScript, 2);
+
+ _lingo->executeScript(kMovieScript, 2);
//FIXME
_mainArchive = new RIFFArchive();
diff --git a/engines/director/lingo/lingo-funcs.cpp b/engines/director/lingo/lingo-funcs.cpp
index 71d1844cab..bbe8d74106 100644
--- a/engines/director/lingo/lingo-funcs.cpp
+++ b/engines/director/lingo/lingo-funcs.cpp
@@ -64,16 +64,16 @@ struct MCIToken {
{ kMCITokenNone, kMCITokenNone, 0, 0 }
};
-int Lingo::exec_mci(Common::String *s) {
+void Lingo::exec_mci(Common::String &s) {
Common::String params[5];
MCITokenType command = kMCITokenNone;
- s->trim();
- s->toLowercase();
+ s.trim();
+ s.toLowercase();
MCITokenType state = kMCITokenNone;
Common::String token;
- const char *ptr = s->c_str();
+ const char *ptr = s.c_str();
int respos = -1;
while (*ptr) {
@@ -131,7 +131,7 @@ int Lingo::exec_mci(Common::String *s) {
if (!file->open(params[0])) {
warning("Failed to open %s", params[0].c_str());
delete file;
- return 0;
+ return;
}
if (params[1] == "waveaudio") {
@@ -148,7 +148,7 @@ int Lingo::exec_mci(Common::String *s) {
if (!_audioAliases.contains(params[0])) {
warning("Unknown alias %s", params[0].c_str());
- return 0;
+ return;
}
uint32 from = strtol(params[1].c_str(), 0, 10);
@@ -158,14 +158,16 @@ int Lingo::exec_mci(Common::String *s) {
}
break;
default:
- warning("Unhandled MCI command: %s", s->c_str());
+ warning("Unhandled MCI command: %s", s.c_str());
}
+}
- return 0;
+void Lingo::exec_mciwait(Common::String &s) {
+ warning("STUB: MCI wait file: %s", s.c_str());
}
-void Lingo::exec_mciwait(Common::String *s) {
- warning("MCI wait file: %s", s->c_str());
+void Lingo::exec_goto(Common::String &frame, Common::String &movie) {
+ warning("STUB: go to %s movie %s", frame.c_str(), movie.c_str());
}
void Lingo::push(Datum d) {
@@ -312,7 +314,7 @@ void Lingo::func_negate() {
void Lingo::func_mci() {
Common::String s((char *)g_lingo->_pc);
- g_lingo->exec_mci(&s);
+ g_lingo->exec_mci(s);
g_lingo->_pc += g_lingo->calcStringAlignment(s.c_str());
}
@@ -320,9 +322,31 @@ void Lingo::func_mci() {
void Lingo::func_mciwait() {
Common::String s((char *)g_lingo->_pc);
- g_lingo->exec_mciwait(&s);
+ g_lingo->exec_mciwait(s);
g_lingo->_pc += g_lingo->calcStringAlignment(s.c_str());
}
+void Lingo::func_goto() {
+ Common::String frame((char *)g_lingo->_pc);
+ g_lingo->_pc += g_lingo->calcStringAlignment(frame.c_str());
+
+ Common::String movie((char *)g_lingo->_pc);
+ g_lingo->_pc += g_lingo->calcStringAlignment(movie.c_str());
+
+ g_lingo->exec_goto(frame, movie);
+}
+
+void Lingo::func_gotoloop() {
+ warning("STUB: func_gotoloop()");
+}
+
+void Lingo::func_gotonext() {
+ warning("STUB: func_gotonext()");
+}
+
+void Lingo::func_gotoprevious() {
+ warning("STUB: func_gotoprevious()");
+}
+
}
diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp
index 5d2d2bf054..953d2b5dfe 100644
--- a/engines/director/lingo/lingo-gr.cpp
+++ b/engines/director/lingo/lingo-gr.cpp
@@ -72,12 +72,19 @@
FLOAT = 261,
VAR = 262,
STRING = 263,
- tINTO = 264,
- tTO = 265,
- tMCI = 266,
- tMCIWAIT = 267,
- tPUT = 268,
- tSET = 269
+ tFRAME = 264,
+ tGO = 265,
+ tINTO = 266,
+ tLOOP = 267,
+ tMCI = 268,
+ tMCIWAIT = 269,
+ tMOVIE = 270,
+ tNEXT = 271,
+ tOF = 272,
+ tPREVIOUS = 273,
+ tPUT = 274,
+ tSET = 275,
+ tTO = 276
};
#endif
/* Tokens. */
@@ -87,12 +94,19 @@
#define FLOAT 261
#define VAR 262
#define STRING 263
-#define tINTO 264
-#define tTO 265
-#define tMCI 266
-#define tMCIWAIT 267
-#define tPUT 268
-#define tSET 269
+#define tFRAME 264
+#define tGO 265
+#define tINTO 266
+#define tLOOP 267
+#define tMCI 268
+#define tMCIWAIT 269
+#define tMOVIE 270
+#define tNEXT 271
+#define tOF 272
+#define tPREVIOUS 273
+#define tPUT 274
+#define tSET 275
+#define tTO 276
@@ -143,7 +157,7 @@ typedef union YYSTYPE
int code;
}
/* Line 193 of yacc.c. */
-#line 147 "engines/director/lingo/lingo-gr.cpp"
+#line 161 "engines/director/lingo/lingo-gr.cpp"
YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
@@ -156,7 +170,7 @@ typedef union YYSTYPE
/* Line 216 of yacc.c. */
-#line 160 "engines/director/lingo/lingo-gr.cpp"
+#line 174 "engines/director/lingo/lingo-gr.cpp"
#ifdef short
# undef short
@@ -369,22 +383,22 @@ union yyalloc
#endif
/* YYFINAL -- State number of the termination state. */
-#define YYFINAL 23
+#define YYFINAL 34
/* YYLAST -- Last index in YYTABLE. */
-#define YYLAST 52
+#define YYLAST 77
/* YYNTOKENS -- Number of terminals. */
-#define YYNTOKENS 24
+#define YYNTOKENS 31
/* YYNNTS -- Number of nonterminals. */
-#define YYNNTS 7
+#define YYNNTS 9
/* YYNRULES -- Number of rules. */
-#define YYNRULES 24
+#define YYNRULES 37
/* YYNRULES -- Number of states. */
-#define YYNSTATES 41
+#define YYNSTATES 63
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
#define YYUNDEFTOK 2
-#define YYMAXUTOK 269
+#define YYMAXUTOK 276
#define YYTRANSLATE(YYX) \
((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
@@ -393,12 +407,12 @@ union yyalloc
static const yytype_uint8 yytranslate[] =
{
0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 21, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 28, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 20, 2, 2,
- 22, 23, 18, 16, 2, 17, 2, 19, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 27, 2, 2,
+ 29, 30, 25, 23, 2, 24, 2, 26, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 15, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 22, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
@@ -418,7 +432,8 @@ static const yytype_uint8 yytranslate[] =
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
- 5, 6, 7, 8, 9, 10, 11, 12, 13, 14
+ 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
+ 15, 16, 17, 18, 19, 20, 21
};
#if YYDEBUG
@@ -428,20 +443,25 @@ static const yytype_uint8 yyprhs[] =
{
0, 0, 3, 7, 9, 10, 12, 14, 16, 18,
19, 24, 29, 34, 36, 38, 40, 44, 48, 52,
- 56, 59, 62, 66, 69
+ 56, 59, 62, 66, 69, 72, 75, 78, 81, 84,
+ 88, 91, 95, 98, 101, 103, 107, 110
};
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
static const yytype_int8 yyrhs[] =
{
- 25, 0, -1, 26, 21, 25, -1, 26, -1, -1,
- 30, -1, 27, -1, 28, -1, 29, -1, -1, 13,
- 29, 9, 7, -1, 14, 7, 15, 29, -1, 14,
- 7, 10, 29, -1, 29, -1, 5, -1, 7, -1,
- 29, 16, 29, -1, 29, 17, 29, -1, 29, 18,
- 29, -1, 29, 19, 29, -1, 16, 29, -1, 17,
- 29, -1, 22, 29, 23, -1, 11, 8, -1, 12,
- 7, -1
+ 32, 0, -1, 33, 28, 32, -1, 33, -1, -1,
+ 37, -1, 34, -1, 35, -1, 36, -1, -1, 19,
+ 36, 11, 7, -1, 20, 7, 22, 36, -1, 20,
+ 7, 21, 36, -1, 36, -1, 5, -1, 7, -1,
+ 36, 23, 36, -1, 36, 24, 36, -1, 36, 25,
+ 36, -1, 36, 26, 36, -1, 23, 36, -1, 24,
+ 36, -1, 29, 36, 30, -1, 13, 8, -1, 14,
+ 7, -1, 10, 12, -1, 10, 16, -1, 10, 18,
+ -1, 10, 38, -1, 10, 38, 39, -1, 10, 39,
+ -1, 21, 9, 8, -1, 9, 8, -1, 21, 8,
+ -1, 8, -1, 17, 15, 8, -1, 15, 8, -1,
+ 21, 15, 8, -1
};
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
@@ -449,7 +469,8 @@ static const yytype_uint8 yyrline[] =
{
0, 64, 64, 65, 68, 69, 70, 71, 72, 73,
76, 77, 78, 81, 84, 85, 86, 87, 88, 89,
- 90, 91, 92, 95, 96
+ 90, 91, 92, 95, 96, 97, 98, 99, 100, 101,
+ 102, 114, 115, 116, 117, 120, 121, 122
};
#endif
@@ -459,9 +480,11 @@ static const yytype_uint8 yyrline[] =
static const char *const yytname[] =
{
"$end", "error", "$undefined", "UNARY", "UNDEF", "INT", "FLOAT", "VAR",
- "STRING", "tINTO", "tTO", "tMCI", "tMCIWAIT", "tPUT", "tSET", "'='",
+ "STRING", "tFRAME", "tGO", "tINTO", "tLOOP", "tMCI", "tMCIWAIT",
+ "tMOVIE", "tNEXT", "tOF", "tPREVIOUS", "tPUT", "tSET", "tTO", "'='",
"'+'", "'-'", "'*'", "'/'", "'%'", "'\\n'", "'('", "')'", "$accept",
- "program", "programline", "assign", "statement", "expr", "func", 0
+ "program", "programline", "assign", "statement", "expr", "func",
+ "gotoframe", "gotomovie", 0
};
#endif
@@ -471,17 +494,19 @@ static const char *const yytname[] =
static const yytype_uint16 yytoknum[] =
{
0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
- 265, 266, 267, 268, 269, 61, 43, 45, 42, 47,
- 37, 10, 40, 41
+ 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
+ 275, 276, 61, 43, 45, 42, 47, 37, 10, 40,
+ 41
};
# endif
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
static const yytype_uint8 yyr1[] =
{
- 0, 24, 25, 25, 26, 26, 26, 26, 26, 26,
- 27, 27, 27, 28, 29, 29, 29, 29, 29, 29,
- 29, 29, 29, 30, 30
+ 0, 31, 32, 32, 33, 33, 33, 33, 33, 33,
+ 34, 34, 34, 35, 36, 36, 36, 36, 36, 36,
+ 36, 36, 36, 37, 37, 37, 37, 37, 37, 37,
+ 37, 38, 38, 38, 38, 39, 39, 39
};
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
@@ -489,7 +514,8 @@ static const yytype_uint8 yyr2[] =
{
0, 2, 3, 1, 0, 1, 1, 1, 1, 0,
4, 4, 4, 1, 1, 1, 3, 3, 3, 3,
- 2, 2, 3, 2, 2
+ 2, 2, 3, 2, 2, 2, 2, 2, 2, 3,
+ 2, 3, 2, 2, 1, 3, 2, 3
};
/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
@@ -498,34 +524,38 @@ static const yytype_uint8 yyr2[] =
static const yytype_uint8 yydefact[] =
{
4, 14, 15, 0, 0, 0, 0, 0, 0, 0,
- 0, 3, 6, 7, 8, 5, 23, 24, 0, 0,
- 20, 21, 0, 1, 4, 0, 0, 0, 0, 0,
- 0, 0, 22, 2, 16, 17, 18, 19, 10, 12,
- 11
+ 0, 0, 3, 6, 7, 8, 5, 34, 0, 25,
+ 0, 26, 0, 27, 0, 28, 30, 23, 24, 0,
+ 0, 20, 21, 0, 1, 4, 0, 0, 0, 0,
+ 32, 36, 0, 33, 0, 0, 0, 29, 0, 0,
+ 0, 22, 2, 16, 17, 18, 19, 35, 31, 37,
+ 10, 12, 11
};
/* YYDEFGOTO[NTERM-NUM]. */
static const yytype_int8 yydefgoto[] =
{
- -1, 10, 11, 12, 13, 14, 15
+ -1, 11, 12, 13, 14, 15, 16, 25, 26
};
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
STATE-NUM. */
-#define YYPACT_NINF -10
+#define YYPACT_NINF -18
static const yytype_int8 yypact[] =
{
- 2, -10, -10, -3, 1, 22, 5, 22, 22, 22,
- 17, 7, -10, -10, 18, -10, -10, -10, 24, -9,
- -10, -10, 29, -10, 2, 22, 22, 22, 22, 23,
- 22, 22, -10, -10, -8, -8, -10, -10, -10, 18,
- 18
+ 0, -18, -18, 44, -7, 2, 11, 8, 11, 11,
+ 11, 17, -17, -18, -18, 51, -18, -18, 19, -18,
+ 31, -18, 26, -18, 13, -9, -18, -18, -18, 25,
+ 4, -18, -18, 43, -18, 0, 11, 11, 11, 11,
+ -18, -18, 34, -18, 37, 38, 32, -18, 47, 11,
+ 11, -18, -18, 12, 12, -18, -18, -18, -18, -18,
+ -18, 51, 51
};
/* YYPGOTO[NTERM-NUM]. */
static const yytype_int8 yypgoto[] =
{
- -10, 8, -10, -10, -10, -5, -10
+ -18, 20, -18, -18, -18, -6, -18, -18, 33
};
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
@@ -535,33 +565,39 @@ static const yytype_int8 yypgoto[] =
#define YYTABLE_NINF -1
static const yytype_uint8 yytable[] =
{
- 18, 30, 20, 21, 22, 16, 31, 1, 17, 2,
- 27, 28, 19, 3, 4, 5, 6, 23, 7, 8,
- 34, 35, 36, 37, 9, 39, 40, 1, 24, 2,
- 38, 0, 33, 29, 25, 26, 27, 28, 7, 8,
- 25, 26, 27, 28, 9, 25, 26, 27, 28, 0,
- 0, 0, 32
+ 29, 27, 31, 32, 33, 1, 20, 2, 22, 28,
+ 3, 35, 46, 4, 5, 30, 1, 34, 2, 6,
+ 7, 43, 44, 8, 9, 49, 50, 40, 45, 10,
+ 53, 54, 55, 56, 8, 9, 48, 38, 39, 41,
+ 10, 42, 57, 61, 62, 58, 59, 45, 36, 37,
+ 38, 39, 17, 18, 60, 52, 19, 0, 47, 20,
+ 21, 22, 23, 0, 0, 24, 36, 37, 38, 39,
+ 0, 0, 0, 51, 36, 37, 38, 39
};
static const yytype_int8 yycheck[] =
{
- 5, 10, 7, 8, 9, 8, 15, 5, 7, 7,
- 18, 19, 7, 11, 12, 13, 14, 0, 16, 17,
- 25, 26, 27, 28, 22, 30, 31, 5, 21, 7,
- 7, -1, 24, 9, 16, 17, 18, 19, 16, 17,
- 16, 17, 18, 19, 22, 16, 17, 18, 19, -1,
- -1, -1, 23
+ 6, 8, 8, 9, 10, 5, 15, 7, 17, 7,
+ 10, 28, 21, 13, 14, 7, 5, 0, 7, 19,
+ 20, 8, 9, 23, 24, 21, 22, 8, 15, 29,
+ 36, 37, 38, 39, 23, 24, 11, 25, 26, 8,
+ 29, 15, 8, 49, 50, 8, 8, 15, 23, 24,
+ 25, 26, 8, 9, 7, 35, 12, -1, 25, 15,
+ 16, 17, 18, -1, -1, 21, 23, 24, 25, 26,
+ -1, -1, -1, 30, 23, 24, 25, 26
};
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
symbol of state STATE-NUM. */
static const yytype_uint8 yystos[] =
{
- 0, 5, 7, 11, 12, 13, 14, 16, 17, 22,
- 25, 26, 27, 28, 29, 30, 8, 7, 29, 7,
- 29, 29, 29, 0, 21, 16, 17, 18, 19, 9,
- 10, 15, 23, 25, 29, 29, 29, 29, 7, 29,
- 29
+ 0, 5, 7, 10, 13, 14, 19, 20, 23, 24,
+ 29, 32, 33, 34, 35, 36, 37, 8, 9, 12,
+ 15, 16, 17, 18, 21, 38, 39, 8, 7, 36,
+ 7, 36, 36, 36, 0, 28, 23, 24, 25, 26,
+ 8, 8, 15, 8, 9, 15, 21, 39, 11, 21,
+ 22, 30, 32, 36, 36, 36, 36, 8, 8, 8,
+ 7, 36, 36
};
#define yyerrok (yyerrstatus = 0)
@@ -1460,9 +1496,74 @@ yyreduce:
{ g_lingo->code1(g_lingo->func_mciwait); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); delete (yyvsp[(2) - (2)].s); ;}
break;
+ case 25:
+#line 97 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->func_gotoloop); ;}
+ break;
+
+ case 26:
+#line 98 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->func_gotonext); ;}
+ break;
+
+ case 27:
+#line 99 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->func_gotoprevious); ;}
+ break;
+
+ case 28:
+#line 100 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->func_goto); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); g_lingo->codeString(""); delete (yyvsp[(2) - (2)].s); ;}
+ break;
+
+ case 29:
+#line 101 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->func_goto); g_lingo->codeString((yyvsp[(2) - (3)].s)->c_str()); g_lingo->codeString((yyvsp[(3) - (3)].s)->c_str()); delete (yyvsp[(2) - (3)].s); delete (yyvsp[(3) - (3)].s); ;}
+ break;
+
+ case 30:
+#line 102 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->func_goto); g_lingo->codeString(""); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); delete (yyvsp[(2) - (2)].s); ;}
+ break;
+
+ case 31:
+#line 114 "engines/director/lingo/lingo-gr.y"
+ { (yyval.s) = (yyvsp[(3) - (3)].s); ;}
+ break;
+
+ case 32:
+#line 115 "engines/director/lingo/lingo-gr.y"
+ { (yyval.s) = (yyvsp[(2) - (2)].s); ;}
+ break;
+
+ case 33:
+#line 116 "engines/director/lingo/lingo-gr.y"
+ { (yyval.s) = (yyvsp[(2) - (2)].s); ;}
+ break;
+
+ case 34:
+#line 117 "engines/director/lingo/lingo-gr.y"
+ { (yyval.s) = (yyvsp[(1) - (1)].s); ;}
+ break;
+
+ case 35:
+#line 120 "engines/director/lingo/lingo-gr.y"
+ { (yyval.s) = (yyvsp[(3) - (3)].s); ;}
+ break;
+
+ case 36:
+#line 121 "engines/director/lingo/lingo-gr.y"
+ { (yyval.s) = (yyvsp[(2) - (2)].s); ;}
+ break;
+
+ case 37:
+#line 122 "engines/director/lingo/lingo-gr.y"
+ { (yyval.s) = (yyvsp[(3) - (3)].s); ;}
+ break;
+
/* Line 1267 of yacc.c. */
-#line 1466 "engines/director/lingo/lingo-gr.cpp"
+#line 1567 "engines/director/lingo/lingo-gr.cpp"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -1676,6 +1777,6 @@ yyreturn:
}
-#line 99 "engines/director/lingo/lingo-gr.y"
+#line 126 "engines/director/lingo/lingo-gr.y"
diff --git a/engines/director/lingo/lingo-gr.h b/engines/director/lingo/lingo-gr.h
index 40d2ddf4d2..845b39cfd0 100644
--- a/engines/director/lingo/lingo-gr.h
+++ b/engines/director/lingo/lingo-gr.h
@@ -45,12 +45,19 @@
FLOAT = 261,
VAR = 262,
STRING = 263,
- tINTO = 264,
- tTO = 265,
- tMCI = 266,
- tMCIWAIT = 267,
- tPUT = 268,
- tSET = 269
+ tFRAME = 264,
+ tGO = 265,
+ tINTO = 266,
+ tLOOP = 267,
+ tMCI = 268,
+ tMCIWAIT = 269,
+ tMOVIE = 270,
+ tNEXT = 271,
+ tOF = 272,
+ tPREVIOUS = 273,
+ tPUT = 274,
+ tSET = 275,
+ tTO = 276
};
#endif
/* Tokens. */
@@ -60,12 +67,19 @@
#define FLOAT 261
#define VAR 262
#define STRING 263
-#define tINTO 264
-#define tTO 265
-#define tMCI 266
-#define tMCIWAIT 267
-#define tPUT 268
-#define tSET 269
+#define tFRAME 264
+#define tGO 265
+#define tINTO 266
+#define tLOOP 267
+#define tMCI 268
+#define tMCIWAIT 269
+#define tMOVIE 270
+#define tNEXT 271
+#define tOF 272
+#define tPREVIOUS 273
+#define tPUT 274
+#define tSET 275
+#define tTO 276
@@ -80,7 +94,7 @@ typedef union YYSTYPE
int code;
}
/* Line 1529 of yacc.c. */
-#line 84 "engines/director/lingo/lingo-gr.hpp"
+#line 98 "engines/director/lingo/lingo-gr.hpp"
YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y
index 28f205110d..c3459e889d 100644
--- a/engines/director/lingo/lingo-gr.y
+++ b/engines/director/lingo/lingo-gr.y
@@ -49,10 +49,10 @@ using namespace Director;
%token<i> INT
%token<f> FLOAT
%token<s> VAR STRING
-%token tINTO tTO
-%token tMCI tMCIWAIT tPUT tSET
+%token tFRAME tGO tINTO tLOOP tMCI tMCIWAIT tMOVIE tNEXT tOF tPREVIOUS tPUT tSET tTO
%type<code> assign expr
+%type<s> gotoframe gotomovie
%right '='
%left '+' '-'
@@ -94,6 +94,33 @@ expr: INT { g_lingo->code1(g_lingo->func_constpush); inst i; WRITE_LE_UINT3
func: tMCI STRING { g_lingo->code1(g_lingo->func_mci); g_lingo->codeString($2->c_str()); delete $2; }
| tMCIWAIT VAR { g_lingo->code1(g_lingo->func_mciwait); g_lingo->codeString($2->c_str()); delete $2; }
+ | tGO tLOOP { g_lingo->code1(g_lingo->func_gotoloop); }
+ | tGO tNEXT { g_lingo->code1(g_lingo->func_gotonext); }
+ | tGO tPREVIOUS { g_lingo->code1(g_lingo->func_gotoprevious); }
+ | tGO gotoframe { g_lingo->code1(g_lingo->func_goto); g_lingo->codeString($2->c_str()); g_lingo->codeString(""); delete $2; }
+ | tGO gotoframe gotomovie { g_lingo->code1(g_lingo->func_goto); g_lingo->codeString($2->c_str()); g_lingo->codeString($3->c_str()); delete $2; delete $3; }
+ | tGO gotomovie { g_lingo->code1(g_lingo->func_goto); g_lingo->codeString(""); g_lingo->codeString($2->c_str()); delete $2; }
;
+// go {to} {frame} whichFrame {of movie whichMovie}
+// go {to} {frame "Open23" of} movie whichMovie
+// go loop
+// go next
+// go previous
+// go to {frame} whichFrame {of movie whichMovie}
+// go to {frame whichFrame of} movie whichMovie
+
+
+gotoframe: tTO tFRAME STRING { $$ = $3; }
+ | tFRAME STRING { $$ = $2; }
+ | tTO STRING { $$ = $2; }
+ | STRING { $$ = $1; }
+ ;
+
+gotomovie: tOF tMOVIE STRING { $$ = $3; }
+ | tMOVIE STRING { $$ = $2; }
+ | tTO tMOVIE STRING { $$ = $3; }
+ ;
+
+
%%
diff --git a/engines/director/lingo/lingo-lex.cpp b/engines/director/lingo/lingo-lex.cpp
index 6e292dc852..8383d0c385 100644
--- a/engines/director/lingo/lingo-lex.cpp
+++ b/engines/director/lingo/lingo-lex.cpp
@@ -364,8 +364,8 @@ static void yy_fatal_error (yyconst char msg[] );
*yy_cp = '\0'; \
(yy_c_buf_p) = yy_cp;
-#define YY_NUM_RULES 16
-#define YY_END_OF_BUFFER 17
+#define YY_NUM_RULES 23
+#define YY_END_OF_BUFFER 24
/* This struct is not used in this scanner,
but its presence is necessary. */
struct yy_trans_info
@@ -373,13 +373,16 @@ struct yy_trans_info
flex_int32_t yy_verify;
flex_int32_t yy_nxt;
};
-static yyconst flex_int16_t yy_accept[44] =
+static yyconst flex_int16_t yy_accept[72] =
{ 0,
- 0, 0, 17, 16, 3, 14, 16, 13, 13, 12,
- 10, 10, 10, 10, 10, 10, 2, 2, 3, 14,
- 0, 15, 1, 11, 12, 10, 10, 10, 10, 10,
- 9, 1, 11, 10, 5, 7, 8, 4, 10, 10,
- 10, 6, 0
+ 0, 0, 24, 23, 3, 21, 23, 20, 20, 19,
+ 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
+ 17, 2, 2, 3, 21, 0, 22, 1, 18, 19,
+ 17, 17, 5, 17, 17, 17, 17, 17, 12, 17,
+ 17, 17, 16, 1, 18, 17, 17, 17, 8, 17,
+ 17, 17, 14, 15, 17, 6, 7, 17, 17, 11,
+ 17, 4, 17, 10, 17, 17, 17, 9, 17, 13,
+ 0
} ;
static yyconst flex_int32_t yy_ec[256] =
@@ -395,8 +398,8 @@ static yyconst flex_int32_t yy_ec[256] =
11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
1, 1, 1, 7, 11, 1, 12, 11, 13, 11,
- 14, 11, 11, 11, 15, 11, 11, 11, 16, 17,
- 18, 19, 11, 11, 20, 21, 22, 11, 23, 11,
+ 14, 15, 16, 11, 17, 11, 11, 18, 19, 20,
+ 21, 22, 11, 23, 24, 25, 26, 27, 28, 29,
11, 11, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
@@ -414,55 +417,71 @@ static yyconst flex_int32_t yy_ec[256] =
1, 1, 1, 1, 1
} ;
-static yyconst flex_int32_t yy_meta[24] =
+static yyconst flex_int32_t yy_meta[30] =
{ 0,
1, 1, 2, 3, 1, 1, 1, 1, 1, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4
+ 4, 4, 4, 4, 4, 4, 4, 4, 4
} ;
-static yyconst flex_int16_t yy_base[47] =
+static yyconst flex_int16_t yy_base[75] =
{ 0,
- 0, 22, 62, 63, 59, 22, 54, 63, 51, 19,
- 0, 41, 44, 34, 41, 36, 51, 63, 50, 27,
- 45, 63, 0, 40, 23, 0, 28, 33, 26, 25,
- 0, 0, 35, 26, 20, 0, 0, 0, 30, 25,
- 18, 0, 63, 33, 31, 37
+ 0, 28, 91, 92, 88, 28, 83, 92, 80, 25,
+ 0, 64, 65, 65, 63, 23, 69, 67, 14, 67,
+ 59, 77, 92, 76, 35, 71, 92, 0, 66, 32,
+ 0, 63, 0, 49, 52, 55, 44, 41, 0, 55,
+ 43, 42, 0, 0, 56, 46, 43, 41, 34, 44,
+ 35, 32, 0, 0, 44, 0, 0, 45, 42, 0,
+ 38, 0, 37, 0, 32, 26, 24, 0, 22, 0,
+ 92, 44, 39, 48
} ;
-static yyconst flex_int16_t yy_def[47] =
+static yyconst flex_int16_t yy_def[75] =
{ 0,
- 43, 1, 43, 43, 43, 43, 44, 43, 43, 43,
- 45, 45, 45, 45, 45, 45, 43, 43, 43, 43,
- 44, 43, 46, 43, 43, 45, 45, 45, 45, 45,
- 45, 46, 43, 45, 45, 45, 45, 45, 45, 45,
- 45, 45, 0, 43, 43, 43
+ 71, 1, 71, 71, 71, 71, 72, 71, 71, 71,
+ 73, 73, 73, 73, 73, 73, 73, 73, 73, 73,
+ 73, 71, 71, 71, 71, 72, 71, 74, 71, 71,
+ 73, 73, 73, 73, 73, 73, 73, 73, 73, 73,
+ 73, 73, 73, 74, 71, 73, 73, 73, 73, 73,
+ 73, 73, 73, 73, 73, 73, 73, 73, 73, 73,
+ 73, 73, 73, 73, 73, 73, 73, 73, 73, 73,
+ 0, 71, 71, 71
} ;
-static yyconst flex_int16_t yy_nxt[87] =
+static yyconst flex_int16_t yy_nxt[122] =
{ 0,
4, 5, 6, 6, 4, 7, 8, 9, 4, 10,
- 11, 11, 11, 11, 12, 13, 11, 11, 14, 15,
- 16, 11, 11, 17, 20, 20, 18, 24, 25, 20,
- 20, 24, 25, 21, 26, 21, 21, 32, 42, 41,
- 32, 40, 39, 38, 33, 37, 36, 35, 34, 33,
- 22, 19, 19, 31, 30, 29, 28, 27, 23, 22,
- 19, 43, 3, 43, 43, 43, 43, 43, 43, 43,
- 43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
- 43, 43, 43, 43, 43, 43
+ 11, 11, 11, 11, 12, 13, 14, 15, 16, 17,
+ 18, 19, 11, 20, 21, 11, 11, 11, 11, 22,
+ 25, 25, 23, 29, 30, 36, 40, 25, 25, 41,
+ 29, 30, 31, 37, 26, 70, 26, 26, 44, 69,
+ 68, 44, 67, 66, 65, 64, 63, 62, 61, 60,
+ 59, 58, 57, 56, 55, 45, 54, 53, 52, 51,
+ 50, 49, 48, 47, 46, 45, 27, 24, 24, 43,
+ 42, 39, 38, 35, 34, 33, 32, 28, 27, 24,
+ 71, 3, 71, 71, 71, 71, 71, 71, 71, 71,
+
+ 71, 71, 71, 71, 71, 71, 71, 71, 71, 71,
+ 71, 71, 71, 71, 71, 71, 71, 71, 71, 71,
+ 71
} ;
-static yyconst flex_int16_t yy_chk[87] =
+static yyconst flex_int16_t yy_chk[122] =
{ 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 2, 6, 6, 2, 10, 10, 20,
- 20, 25, 25, 44, 45, 44, 44, 46, 41, 40,
- 46, 39, 35, 34, 33, 30, 29, 28, 27, 24,
- 21, 19, 17, 16, 15, 14, 13, 12, 9, 7,
- 5, 3, 43, 43, 43, 43, 43, 43, 43, 43,
- 43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
- 43, 43, 43, 43, 43, 43
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 2,
+ 6, 6, 2, 10, 10, 16, 19, 25, 25, 19,
+ 30, 30, 73, 16, 72, 69, 72, 72, 74, 67,
+ 66, 74, 65, 63, 61, 59, 58, 55, 52, 51,
+ 50, 49, 48, 47, 46, 45, 42, 41, 40, 38,
+ 37, 36, 35, 34, 32, 29, 26, 24, 22, 21,
+ 20, 18, 17, 15, 14, 13, 12, 9, 7, 5,
+ 3, 71, 71, 71, 71, 71, 71, 71, 71, 71,
+
+ 71, 71, 71, 71, 71, 71, 71, 71, 71, 71,
+ 71, 71, 71, 71, 71, 71, 71, 71, 71, 71,
+ 71
} ;
static yy_state_type yy_last_accepting_state;
@@ -512,7 +531,7 @@ char *yytext;
int yyparse();
-#line 516 "engines/director/lingo/lingo-lex.cpp"
+#line 535 "engines/director/lingo/lingo-lex.cpp"
#define INITIAL 0
@@ -700,7 +719,7 @@ YY_DECL
#line 45 "engines/director/lingo/lingo-lex.l"
-#line 704 "engines/director/lingo/lingo-lex.cpp"
+#line 723 "engines/director/lingo/lingo-lex.cpp"
if ( !(yy_init) )
{
@@ -754,13 +773,13 @@ yy_match:
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
- if ( yy_current_state >= 44 )
+ if ( yy_current_state >= 72 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
++yy_cp;
}
- while ( yy_base[yy_current_state] != 63 );
+ while ( yy_base[yy_current_state] != 92 );
yy_find_action:
yy_act = yy_accept[yy_current_state];
@@ -801,71 +820,106 @@ YY_RULE_SETUP
YY_BREAK
case 4:
YY_RULE_SETUP
-#line 50 "engines/director/lingo/lingo-lex.l"
-{ return tINTO; }
+#line 51 "engines/director/lingo/lingo-lex.l"
+{ return tFRAME; }
YY_BREAK
case 5:
YY_RULE_SETUP
-#line 51 "engines/director/lingo/lingo-lex.l"
-{ return tMCI; }
+#line 52 "engines/director/lingo/lingo-lex.l"
+{ return tGO; }
YY_BREAK
case 6:
YY_RULE_SETUP
-#line 52 "engines/director/lingo/lingo-lex.l"
-{ return tMCIWAIT; }
+#line 53 "engines/director/lingo/lingo-lex.l"
+{ return tINTO; }
YY_BREAK
case 7:
YY_RULE_SETUP
-#line 53 "engines/director/lingo/lingo-lex.l"
-{ return tPUT; }
+#line 54 "engines/director/lingo/lingo-lex.l"
+{ return tLOOP; }
YY_BREAK
case 8:
YY_RULE_SETUP
-#line 54 "engines/director/lingo/lingo-lex.l"
-{ return tSET; }
+#line 55 "engines/director/lingo/lingo-lex.l"
+{ return tMCI; }
YY_BREAK
case 9:
YY_RULE_SETUP
-#line 55 "engines/director/lingo/lingo-lex.l"
-{ return tTO; }
+#line 56 "engines/director/lingo/lingo-lex.l"
+{ return tMCIWAIT; }
YY_BREAK
case 10:
YY_RULE_SETUP
#line 57 "engines/director/lingo/lingo-lex.l"
-{ yylval.s = new Common::String(yytext); return VAR; }
+{ return tMOVIE; }
YY_BREAK
case 11:
YY_RULE_SETUP
#line 58 "engines/director/lingo/lingo-lex.l"
-{ yylval.f = atof(yytext); return FLOAT; }
+{ return tNEXT; }
YY_BREAK
case 12:
YY_RULE_SETUP
#line 59 "engines/director/lingo/lingo-lex.l"
-{ yylval.i = strtol(yytext, NULL, 10); return INT; }
+{ return tOF; }
YY_BREAK
case 13:
YY_RULE_SETUP
#line 60 "engines/director/lingo/lingo-lex.l"
-{ return *yytext; }
+{ return tPREVIOUS; }
YY_BREAK
case 14:
-/* rule 14 can match eol */
YY_RULE_SETUP
#line 61 "engines/director/lingo/lingo-lex.l"
-{ return '\n'; }
+{ return tPUT; }
YY_BREAK
case 15:
YY_RULE_SETUP
#line 62 "engines/director/lingo/lingo-lex.l"
-{ yylval.s = new Common::String(&yytext[1]); yylval.s->deleteLastChar(); return STRING; }
+{ return tSET; }
YY_BREAK
case 16:
YY_RULE_SETUP
-#line 64 "engines/director/lingo/lingo-lex.l"
+#line 63 "engines/director/lingo/lingo-lex.l"
+{ return tTO; }
+ YY_BREAK
+case 17:
+YY_RULE_SETUP
+#line 65 "engines/director/lingo/lingo-lex.l"
+{ yylval.s = new Common::String(yytext); return VAR; }
+ YY_BREAK
+case 18:
+YY_RULE_SETUP
+#line 66 "engines/director/lingo/lingo-lex.l"
+{ yylval.f = atof(yytext); return FLOAT; }
+ YY_BREAK
+case 19:
+YY_RULE_SETUP
+#line 67 "engines/director/lingo/lingo-lex.l"
+{ yylval.i = strtol(yytext, NULL, 10); return INT; }
+ YY_BREAK
+case 20:
+YY_RULE_SETUP
+#line 68 "engines/director/lingo/lingo-lex.l"
+{ return *yytext; }
+ YY_BREAK
+case 21:
+/* rule 21 can match eol */
+YY_RULE_SETUP
+#line 69 "engines/director/lingo/lingo-lex.l"
+{ return '\n'; }
+ YY_BREAK
+case 22:
+YY_RULE_SETUP
+#line 70 "engines/director/lingo/lingo-lex.l"
+{ yylval.s = new Common::String(&yytext[1]); yylval.s->deleteLastChar(); return STRING; }
+ YY_BREAK
+case 23:
+YY_RULE_SETUP
+#line 72 "engines/director/lingo/lingo-lex.l"
ECHO;
YY_BREAK
-#line 869 "engines/director/lingo/lingo-lex.cpp"
+#line 923 "engines/director/lingo/lingo-lex.cpp"
case YY_STATE_EOF(INITIAL):
yyterminate();
@@ -1158,7 +1212,7 @@ static int yy_get_next_buffer (void)
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
- if ( yy_current_state >= 44 )
+ if ( yy_current_state >= 72 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
@@ -1186,11 +1240,11 @@ static int yy_get_next_buffer (void)
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
- if ( yy_current_state >= 44 )
+ if ( yy_current_state >= 72 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
- yy_is_jam = (yy_current_state == 43);
+ yy_is_jam = (yy_current_state == 71);
return yy_is_jam ? 0 : yy_current_state;
}
@@ -1865,7 +1919,7 @@ void yyfree (void * ptr )
#define YYTABLES_NAME "yytables"
-#line 64 "engines/director/lingo/lingo-lex.l"
+#line 72 "engines/director/lingo/lingo-lex.l"
diff --git a/engines/director/lingo/lingo-lex.l b/engines/director/lingo/lingo-lex.l
index 2e21c7e517..5823a36160 100644
--- a/engines/director/lingo/lingo-lex.l
+++ b/engines/director/lingo/lingo-lex.l
@@ -47,9 +47,17 @@ whitespace [\t ]
--[^\r\n]*
^{whitespace}
[\t]+ { return ' '; }
+
+frame { return tFRAME; }
+go { return tGO; }
into { return tINTO; }
+loop { return tLOOP; }
mci { return tMCI; }
mciwait { return tMCIWAIT; }
+movie { return tMOVIE; }
+next { return tNEXT; }
+of { return tOF; }
+previous { return tPREVIOUS; }
put { return tPUT; }
set { return tSET; }
to { return tTO; }
diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h
index 676f25798f..5341aff75f 100644
--- a/engines/director/lingo/lingo.h
+++ b/engines/director/lingo/lingo.h
@@ -132,8 +132,14 @@ public:
static void func_eval();
static void func_mci();
static void func_mciwait();
- int exec_mci(Common::String *s);
- void exec_mciwait(Common::String *s);
+ static void func_goto();
+ static void func_gotoloop();
+ static void func_gotonext();
+ static void func_gotoprevious();
+
+ void exec_mci(Common::String &s);
+ void exec_mciwait(Common::String &s);
+ void exec_goto(Common::String &frame, Common::String &movie);
private:
int parse(const char *code);