mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-15 06:08:35 +00:00
DIRECTOR: Fix calling convention for b_go
This commit is contained in:
parent
e86c71ae20
commit
7c919f70d4
@ -893,36 +893,60 @@ void Lingo::b_do(int nargs) {
|
||||
}
|
||||
|
||||
void Lingo::b_go(int nargs) {
|
||||
// Builtin function for go as used by the Director bytecode engine.
|
||||
//
|
||||
// Accepted arguments:
|
||||
// "loop"
|
||||
// "next"
|
||||
// "previous"
|
||||
// (STRING|INT) frame
|
||||
// STRING movie, (STRING|INT) frame
|
||||
|
||||
if (nargs >= 1 && nargs <= 2) {
|
||||
Datum frame = g_lingo->pop();
|
||||
Datum firstArg = g_lingo->pop();
|
||||
nargs -= 1;
|
||||
if (frame.type == STRING) {
|
||||
if (*frame.u.s == "loop") {
|
||||
bool callSpecial = false;
|
||||
|
||||
if (firstArg.type == STRING) {
|
||||
if (*firstArg.u.s == "loop") {
|
||||
g_lingo->func_gotoloop();
|
||||
} else if (*frame.u.s == "next") {
|
||||
callSpecial = true;
|
||||
} else if (*firstArg.u.s == "next") {
|
||||
g_lingo->func_gotonext();
|
||||
} else if (*frame.u.s == "previous") {
|
||||
callSpecial = true;
|
||||
} else if (*firstArg.u.s == "previous") {
|
||||
g_lingo->func_gotoprevious();
|
||||
} else {
|
||||
Datum movie;
|
||||
if (nargs > 0) {
|
||||
movie = g_lingo->pop();
|
||||
nargs -= 1;
|
||||
if (movie.type != STRING) {
|
||||
warning("b_go: movie arg should be of type STRING, not %s", movie.type2str());
|
||||
}
|
||||
}
|
||||
g_lingo->func_goto(frame, movie);
|
||||
callSpecial = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!callSpecial) {
|
||||
Datum movie;
|
||||
Datum frame;
|
||||
|
||||
if (nargs > 0) {
|
||||
warning("b_go: ignoring %d extra args", nargs);
|
||||
g_lingo->dropStack(nargs);
|
||||
movie = firstArg;
|
||||
if (movie.type != STRING) {
|
||||
warning("b_go: movie arg should be of type STRING, not %s", movie.type2str());
|
||||
}
|
||||
frame = g_lingo->pop();
|
||||
nargs -= 1;
|
||||
} else {
|
||||
frame = firstArg;
|
||||
}
|
||||
|
||||
} else {
|
||||
warning("b_go: frame arg should be of type STRING, not %s", frame.type2str());
|
||||
if (frame.type != STRING && frame.type != INT) {
|
||||
warning("b_go: frame arg should be of type STRING or INT, not %s", frame.type2str());
|
||||
}
|
||||
|
||||
g_lingo->func_goto(frame, movie);
|
||||
}
|
||||
|
||||
if (nargs > 0) {
|
||||
warning("b_go: ignoring %d extra args", nargs);
|
||||
g_lingo->dropStack(nargs);
|
||||
}
|
||||
|
||||
} else {
|
||||
warning("b_go: expected 1 or 2 args, not %d", nargs);
|
||||
g_lingo->dropStack(nargs);
|
||||
|
Loading…
Reference in New Issue
Block a user