DIRECTOR: Lingo: Improve 'go to' command

This commit is contained in:
Eugene Sandulenko 2016-08-08 20:10:20 +02:00
parent b9badf61bf
commit 9985d07660
3 changed files with 299 additions and 324 deletions

View File

@ -674,13 +674,21 @@ void Lingo::c_mciwait() {
}
void Lingo::c_goto() {
Common::String frame((char *)&(*g_lingo->_currentScript)[g_lingo->_pc]);
g_lingo->_pc += g_lingo->calcStringAlignment(frame.c_str());
Datum mode = g_lingo->pop();
Datum frame, movie;
Common::String movie((char *)&(*g_lingo->_currentScript)[g_lingo->_pc]);
g_lingo->_pc += g_lingo->calcStringAlignment(movie.c_str());
if (mode.u.i == 1 || mode.u.i == 3)
frame = g_lingo->pop();
g_lingo->func_goto(frame, movie);
if (mode.u.i == 2 || mode.u.i == 3)
movie = g_lingo->pop();
frame.toString();
movie.toString();
warning("c_goto(%s, %s)", frame.u.s->c_str(), movie.u.s->c_str());
//g_lingo->func_goto(frame, movie);
}
void Lingo::c_gotoloop() {

File diff suppressed because it is too large Load Diff

View File

@ -90,7 +90,6 @@ void yyerror(char *s) {
%token tSPRITE tINTERSECTS tWITHIN
%type<code> asgn begin elseif elsestmtoneliner end expr if repeatwhile repeatwith stmtlist
%type<s> gotoframe gotomovie
%type<narg> argdef arglist
%right '='
@ -434,48 +433,34 @@ gotofunc: tGO tLOOP { g_lingo->code1(g_lingo->c_gotoloop); }
| tGO tNEXT { g_lingo->code1(g_lingo->c_gotonext); }
| tGO tPREVIOUS { g_lingo->code1(g_lingo->c_gotoprevious); }
| tGO gotoframe {
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString($2->c_str());
g_lingo->codeString("");
delete $2; }
g_lingo->codeConst(1);
g_lingo->code1(g_lingo->c_goto); }
| tGO gotoframe gotomovie {
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString($2->c_str());
g_lingo->codeString($3->c_str());
delete $2;
delete $3; }
g_lingo->codeConst(3);
g_lingo->code1(g_lingo->c_goto); }
| tGO gotomovie {
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString("");
g_lingo->codeString($2->c_str());
delete $2; }
g_lingo->codeConst(2);
g_lingo->code1(g_lingo->c_goto); }
;
gotoframe: tFRAME STRING { $$ = $2; }
| STRING { $$ = $1; }
gotoframe: tFRAME expr
| expr
;
gotomovie: tOF tMOVIE STRING { $$ = $3; }
| tMOVIE STRING { $$ = $2; }
gotomovie: tOF tMOVIE expr
| tMOVIE expr
;
playfunc: tPLAY tDONE { g_lingo->code1(g_lingo->c_playdone); }
| tPLAY gotoframe {
g_lingo->code1(g_lingo->c_play);
g_lingo->codeString($2->c_str());
g_lingo->codeString("");
delete $2; }
g_lingo->codeConst(1);
g_lingo->code1(g_lingo->c_play); }
| tPLAY gotoframe gotomovie {
g_lingo->code1(g_lingo->c_play);
g_lingo->codeString($2->c_str());
g_lingo->codeString($3->c_str());
delete $2;
delete $3; }
g_lingo->codeConst(3);
g_lingo->code1(g_lingo->c_play); }
| tPLAY gotomovie {
g_lingo->code1(g_lingo->c_play);
g_lingo->codeString("");
g_lingo->codeString($2->c_str());
delete $2; }
g_lingo->codeConst(2);
g_lingo->code1(g_lingo->c_play); }
;
// macro