diff options
author | Eugene Sandulenko | 2016-06-25 16:38:31 +0200 |
---|---|---|
committer | Eugene Sandulenko | 2016-08-03 23:40:36 +0200 |
commit | c48f1b5756368f5c30c706c1861eac1d63b1ef22 (patch) | |
tree | a94c50b104efff84999ecafdb5517796163b7165 | |
parent | a910fe22dbe5452acf8ad75ef5c66162c77f7733 (diff) | |
download | scummvm-rg350-c48f1b5756368f5c30c706c1861eac1d63b1ef22.tar.gz scummvm-rg350-c48f1b5756368f5c30c706c1861eac1d63b1ef22.tar.bz2 scummvm-rg350-c48f1b5756368f5c30c706c1861eac1d63b1ef22.zip |
DIRECTOR: Lingo: Implement calling user-defined functions without parameters
-rw-r--r-- | engines/director/director.cpp | 2 | ||||
-rw-r--r-- | engines/director/lingo/lingo-code.cpp | 16 |
2 files changed, 13 insertions, 5 deletions
diff --git a/engines/director/director.cpp b/engines/director/director.cpp index 4e3b1f3024..8c07214268 100644 --- a/engines/director/director.cpp +++ b/engines/director/director.cpp @@ -102,7 +102,7 @@ if par1 = 3 then\n\ else\n\ put 9\n\ end if\n\ -\n\ +shipx\n\ ", kMovieScript, 1); return Common::kNoError; diff --git a/engines/director/lingo/lingo-code.cpp b/engines/director/lingo/lingo-code.cpp index cc5777a50d..d7cbe8108d 100644 --- a/engines/director/lingo/lingo-code.cpp +++ b/engines/director/lingo/lingo-code.cpp @@ -408,11 +408,19 @@ int Lingo::codeId(Common::String &s) { return g_lingo->codeId_(s); } -int Lingo::codeId_(Common::String &s) { - int ret = code1(c_varpush); +int Lingo::codeId_(Common::String &name) { + int ret; - codeString(s.c_str()); - code1(c_eval); + if (!_handlers.contains(name)) { // This is a call + ret = code1(c_call); + codeString(name.c_str()); + code1((inst)0); // Zero arguments + } else { + ret = code1(c_varpush); + + codeString(name.c_str()); + code1(c_eval); + } return ret; } |