mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-26 12:48:16 +00:00
DIRECTOR: Lingo: Fix 'if' statement
This commit is contained in:
parent
db2380077f
commit
34acb99ec5
@ -84,7 +84,12 @@ go to \"Chair\"\n\
|
||||
set x = 2 + 3 * (4 / 2)\n\
|
||||
put x\n", kMovieScript, 2);
|
||||
|
||||
_lingo->executeScript(kMovieScript, 2);
|
||||
_lingo->addCode("set x = 5\n\
|
||||
if 4 > 3 then x end if\n", kMovieScript, 3);
|
||||
|
||||
_lingo->executeScript(kMovieScript, 3);
|
||||
|
||||
return Common::kNoError;
|
||||
|
||||
//FIXME
|
||||
_mainArchive = new RIFFArchive();
|
||||
|
@ -394,17 +394,25 @@ void Lingo::func_ifcode() {
|
||||
Datum d;
|
||||
int savepc = g_lingo->_pc; /* then part */
|
||||
|
||||
int then = READ_LE_UINT32(&(*g_lingo->_currentScript)[savepc]);
|
||||
int elsep = READ_LE_UINT32(&(*g_lingo->_currentScript)[savepc + 1]);
|
||||
int end = READ_LE_UINT32(&(*g_lingo->_currentScript)[savepc + 2]);
|
||||
|
||||
warning("cond: %d end: %d then: %d elesp: %d", savepc + 3, end, then, elsep);
|
||||
|
||||
g_lingo->execute(savepc + 3); /* condition */
|
||||
|
||||
d = g_lingo->pop();
|
||||
warning("res: %d", d.val);
|
||||
|
||||
if (d.val)
|
||||
g_lingo->execute(savepc);
|
||||
else if ((*g_lingo->_currentScript)[savepc + 1]) /* else part? */
|
||||
g_lingo->execute(savepc + 1);
|
||||
if (d.val) {
|
||||
g_lingo->execute(then);
|
||||
} else if (elsep) { /* else part? */
|
||||
g_lingo->execute(elsep);
|
||||
}
|
||||
|
||||
//if (!returning)
|
||||
g_lingo->_pc = savepc + 2; /* next stmt */
|
||||
g_lingo->_pc = end; /* next stmt */
|
||||
}
|
||||
|
||||
//************************
|
||||
|
@ -141,7 +141,7 @@
|
||||
|
||||
extern int yylex();
|
||||
extern int yyparse();
|
||||
void yyerror(char *s) { warning("%s", s); }
|
||||
void yyerror(char *s) { error("%s", s); }
|
||||
|
||||
using namespace Director;
|
||||
|
||||
|
@ -56,7 +56,7 @@
|
||||
|
||||
extern int yylex();
|
||||
extern int yyparse();
|
||||
void yyerror(char *s) { warning("%s", s); }
|
||||
void yyerror(char *s) { error("%s", s); }
|
||||
|
||||
using namespace Director;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user