[Scummvm-git-logs] scummvm master -> 48c4b08d0a5669f02c107aadd7cacf1554efb0be
djsrv
dservilla at gmail.com
Fri Aug 13 21:11:24 UTC 2021
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
48c4b08d0a DIRECTOR: LINGO: Allow scripts to call event handlers
Commit: 48c4b08d0a5669f02c107aadd7cacf1554efb0be
https://github.com/scummvm/scummvm/commit/48c4b08d0a5669f02c107aadd7cacf1554efb0be
Author: djsrv (dservilla at gmail.com)
Date: 2021-08-13T17:10:25-04:00
Commit Message:
DIRECTOR: LINGO: Allow scripts to call event handlers
Changed paths:
engines/director/lingo/lingo-object.cpp
engines/director/lingo/lingo.cpp
engines/director/movie.cpp
diff --git a/engines/director/lingo/lingo-object.cpp b/engines/director/lingo/lingo-object.cpp
index 9edbdc5a37..168f63a131 100644
--- a/engines/director/lingo/lingo-object.cpp
+++ b/engines/director/lingo/lingo-object.cpp
@@ -271,9 +271,8 @@ Symbol ScriptContext::define(const Common::String &name, ScriptData *code, Commo
debugC(1, kDebugCompile, "<end define code>");
}
- if (!g_lingo->_eventHandlerTypeIds.contains(name)) {
- _functionHandlers[name] = sym;
- } else {
+ _functionHandlers[name] = sym;
+ if (g_lingo->_eventHandlerTypeIds.contains(name)) {
_eventHandlers[g_lingo->_eventHandlerTypeIds[name]] = sym;
}
diff --git a/engines/director/lingo/lingo.cpp b/engines/director/lingo/lingo.cpp
index bd213c7b13..f7ac210b02 100644
--- a/engines/director/lingo/lingo.cpp
+++ b/engines/director/lingo/lingo.cpp
@@ -236,15 +236,15 @@ Common::String LingoArchive::getName(uint16 id) {
Symbol Lingo::getHandler(const Common::String &name) {
Symbol sym;
- if (!_eventHandlerTypeIds.contains(name)) {
- // local functions
- if (_currentScriptContext && _currentScriptContext->_functionHandlers.contains(name))
- return _currentScriptContext->_functionHandlers[name];
-
- sym = g_director->getCurrentMovie()->getHandler(name);
- if (sym.type != VOIDSYM)
- return sym;
- }
+
+ // local functions
+ if (_currentScriptContext && _currentScriptContext->_functionHandlers.contains(name))
+ return _currentScriptContext->_functionHandlers[name];
+
+ sym = g_director->getCurrentMovie()->getHandler(name);
+ if (sym.type != VOIDSYM)
+ return sym;
+
sym.type = VOIDSYM;
sym.name = new Common::String(name);
return sym;
diff --git a/engines/director/movie.cpp b/engines/director/movie.cpp
index e77ccd58a3..c98bbedbd8 100644
--- a/engines/director/movie.cpp
+++ b/engines/director/movie.cpp
@@ -380,13 +380,12 @@ ScriptContext *Movie::getScriptContext(ScriptType type, CastMemberID id) {
}
Symbol Movie::getHandler(const Common::String &name) {
- if (!g_lingo->_eventHandlerTypeIds.contains(name)) {
- if (_cast->_lingoArchive->functionHandlers.contains(name))
- return _cast->_lingoArchive->functionHandlers[name];
+ if (_cast->_lingoArchive->functionHandlers.contains(name))
+ return _cast->_lingoArchive->functionHandlers[name];
+
+ if (_sharedCast && _sharedCast->_lingoArchive->functionHandlers.contains(name))
+ return _sharedCast->_lingoArchive->functionHandlers[name];
- if (_sharedCast && _sharedCast->_lingoArchive->functionHandlers.contains(name))
- return _sharedCast->_lingoArchive->functionHandlers[name];
- }
return Symbol();
}
More information about the Scummvm-git-logs
mailing list