aboutsummaryrefslogtreecommitdiff
path: root/engines/director/lingo/lingo-funcs.cpp
diff options
context:
space:
mode:
authorEugene Sandulenko2016-08-08 20:53:30 +0200
committerEugene Sandulenko2016-08-08 20:53:30 +0200
commit83a3cb7db1f88560745c85a3aba4b023ed69d785 (patch)
tree922c24c8b3029f72a87d2dc12906a97d0e3ace7c /engines/director/lingo/lingo-funcs.cpp
parenta253d1f50e7ea624c5d8f53119506f5fd7e47baa (diff)
downloadscummvm-rg350-83a3cb7db1f88560745c85a3aba4b023ed69d785.tar.gz
scummvm-rg350-83a3cb7db1f88560745c85a3aba4b023ed69d785.tar.bz2
scummvm-rg350-83a3cb7db1f88560745c85a3aba4b023ed69d785.zip
DIRECTOR: Lingo: Made 'go to' and 'play' commands work with expressions
Diffstat (limited to 'engines/director/lingo/lingo-funcs.cpp')
-rw-r--r--engines/director/lingo/lingo-funcs.cpp36
1 files changed, 23 insertions, 13 deletions
diff --git a/engines/director/lingo/lingo-funcs.cpp b/engines/director/lingo/lingo-funcs.cpp
index 08b3d455ca..da2cd5f358 100644
--- a/engines/director/lingo/lingo-funcs.cpp
+++ b/engines/director/lingo/lingo-funcs.cpp
@@ -189,25 +189,35 @@ void Lingo::func_mciwait(Common::String &s) {
warning("STUB: MCI wait file: %s", s.c_str());
}
-void Lingo::func_goto(Common::String &frame, Common::String &movie) {
- if (!_vm->_movies || !_vm->_movies->contains(movie)) {
- warning("Movie %s does not exist", movie.c_str());
- return;
+void Lingo::func_goto(Datum &frame, Datum &movie) {
+ if (movie.type != VOID) {
+ movie.toString();
+
+ if (!_vm->_movies || !_vm->_movies->contains(*movie.u.s)) {
+ warning("Movie %s does not exist", movie.u.s->c_str());
+ return;
+ }
+
+ _vm->_currentScore = _vm->_movies->getVal(*movie.u.s);
+ _vm->_currentScore->loadArchive();
}
- _vm->_currentScore = _vm->_movies->getVal(movie);
- _vm->_currentScore->loadArchive();
+ if (!_vm->_currentScore) {
+ warning("func_goto: No score is loaded");
+ return;
+ }
- if (frame.empty())
+ if (frame.type == VOID)
return;
- for (uint16 i = 0; i < frame.size(); i++) {
- if (!Common::isDigit(frame[i])) {
- _vm->_currentScore->setStartToLabel(frame);
- return;
- }
+ if (frame.type == STRING) {
+ _vm->_currentScore->setStartToLabel(*frame.u.s);
+ return;
}
- _vm->_currentScore->setCurrentFrame(strtol(frame.c_str(), 0, 10));
+
+ frame.toInt();
+
+ _vm->_currentScore->setCurrentFrame(frame.u.i);
}
void Lingo::func_gotoloop() {