aboutsummaryrefslogtreecommitdiff
path: root/engines/director
diff options
context:
space:
mode:
Diffstat (limited to 'engines/director')
-rw-r--r--engines/director/lingo/lingo-builtins.cpp17
-rw-r--r--engines/director/lingo/lingo-codegen.cpp4
2 files changed, 14 insertions, 7 deletions
diff --git a/engines/director/lingo/lingo-builtins.cpp b/engines/director/lingo/lingo-builtins.cpp
index f416636c27..97afef64da 100644
--- a/engines/director/lingo/lingo-builtins.cpp
+++ b/engines/director/lingo/lingo-builtins.cpp
@@ -1157,6 +1157,12 @@ void Lingo::b_importFileInto(int nargs) {
g_lingo->dropStack(nargs);
}
+void menuCommandsCallback(int action, Common::String &text, void *data) {
+ Common::String name = Common::String::format("scummvmMenu%d", action);
+
+ g_lingo->call(name, 0);
+}
+
void Lingo::b_installMenu(int nargs) {
// installMenu castNum
Datum d = g_lingo->pop();
@@ -1185,6 +1191,8 @@ void Lingo::b_installMenu(int nargs) {
Common::String handlers;
+ menu->setCommandsCallback(menuCommandsCallback, g_director);
+
for (const byte *s = (const byte *)menuStxt.c_str(); *s; s++) {
// Get next line
line.clear();
@@ -1213,9 +1221,8 @@ void Lingo::b_installMenu(int nargs) {
p++;
if (!submenuText.empty()) { // Adding submenu for previous menu
- submenuText += Common::String::format("[%d]", commandId);
handlers += g_lingo->genMenuHandler(&commandId, command);
- commandId++;
+ submenuText += Common::String::format("[%d]", commandId);
menu->createSubMenuFromString(submenu, submenuText.c_str(), 0);
}
@@ -1223,7 +1230,6 @@ void Lingo::b_installMenu(int nargs) {
if (!strcmp(p, "@"))
p = "\xf0"; // Apple symbol
- warning("menu: '%s'", Common::toPrintable(p).c_str());
submenu = menu->addMenuItem(nullptr, Common::String(p));
submenuText.clear();
@@ -1249,9 +1255,8 @@ void Lingo::b_installMenu(int nargs) {
command.trim();
if (!submenuText.empty()) {
- submenuText += Common::String::format("[%d];", commandId);
handlers += g_lingo->genMenuHandler(&commandId, command);
- commandId++;
+ submenuText += Common::String::format("[%d];", commandId);
}
submenuText += text;
@@ -1261,8 +1266,8 @@ void Lingo::b_installMenu(int nargs) {
}
if (!submenuText.empty()) {
- submenuText += Common::String::format("[%d]", commandId);
handlers += g_lingo->genMenuHandler(&commandId, command);
+ submenuText += Common::String::format("[%d]", commandId);
menu->createSubMenuFromString(submenu, submenuText.c_str(), 0);
}
diff --git a/engines/director/lingo/lingo-codegen.cpp b/engines/director/lingo/lingo-codegen.cpp
index 44683897a3..c00e2faa1a 100644
--- a/engines/director/lingo/lingo-codegen.cpp
+++ b/engines/director/lingo/lingo-codegen.cpp
@@ -218,7 +218,9 @@ Symbol *Lingo::define(Common::String &name, int start, int nargs, Common::String
if (prefix)
name = *prefix + "-" + name;
- debugC(1, kDebugLingoCompile, "define(\"%s\"(len: %d), %d, %d, \"%s\", %d)", name.c_str(), _currentScript->size() - 1, start, nargs, (prefix ? prefix->c_str() : ""), end);
+ debugC(1, kDebugLingoCompile, "define(\"%s\"(len: %d), %d, %d, \"%s\", %d) entity: %d",
+ name.c_str(), _currentScript->size() - 1, start, nargs, (prefix ? prefix->c_str() : ""),
+ end, _currentEntityId);
Symbol *sym = getHandler(name);
if (sym == NULL) { // Create variable if it was not defined