[Scummvm-git-logs] scummvm master -> 177283249e7e917b67f9a74ff536f8b99f43d3aa
djsrv
dservilla at gmail.com
Fri Jul 24 18:10:26 UTC 2020
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:
177283249e DIRECTOR: Fix event segfaults
Commit: 177283249e7e917b67f9a74ff536f8b99f43d3aa
https://github.com/scummvm/scummvm/commit/177283249e7e917b67f9a74ff536f8b99f43d3aa
Author: djsrv (dservilla at gmail.com)
Date: 2020-07-24T14:10:13-04:00
Commit Message:
DIRECTOR: Fix event segfaults
Changed paths:
engines/director/events.cpp
engines/director/lingo/lingo-events.cpp
diff --git a/engines/director/events.cpp b/engines/director/events.cpp
index e9177bb3a8..bf7b6f4d89 100644
--- a/engines/director/events.cpp
+++ b/engines/director/events.cpp
@@ -169,7 +169,7 @@ bool Movie::processEvent(Common::Event &event) {
_currentDraggedChannel = nullptr;
{
- CastMember *cast = g_director->getCurrentMovie()->getCastMember(sc->getSpriteById(spriteId)->_castId);
+ CastMember *cast = getCastMember(sc->getSpriteById(spriteId)->_castId);
if (cast && cast->_type == kCastButton)
cast->_hilite = !cast->_hilite;
}
diff --git a/engines/director/lingo/lingo-events.cpp b/engines/director/lingo/lingo-events.cpp
index ac4f1e6626..518772fe20 100644
--- a/engines/director/lingo/lingo-events.cpp
+++ b/engines/director/lingo/lingo-events.cpp
@@ -123,15 +123,13 @@ void Movie::queueSpriteEvent(LEvent event, int eventId, int spriteId) {
* When more than one movie script [...]
* [D4 docs] */
- Movie *movie = _vm->getCurrentMovie();
- Score *score = movie->getScore();
- Frame *currentFrame = score->_frames[score->getCurrentFrame()];
+ Frame *currentFrame = _score->_frames[_score->getCurrentFrame()];
assert(currentFrame != nullptr);
- Sprite *sprite = score->getSpriteById(spriteId);
+ Sprite *sprite = _score->getSpriteById(spriteId);
// Sprite (score) script
if (sprite->_scriptId) {
- ScriptContext *script = movie->getScriptContext(kScoreScript, sprite->_scriptId);
+ ScriptContext *script = getScriptContext(kScoreScript, sprite->_scriptId);
if (script) {
// In D3 the event lingo is not contained in a handler
// If sprite is immediate, its script is run on mouseDown, otherwise on mouseUp
@@ -145,7 +143,7 @@ void Movie::queueSpriteEvent(LEvent event, int eventId, int spriteId) {
}
// Cast script
- ScriptContext *script = movie->getScriptContext(kCastScript, sprite->_castId);
+ ScriptContext *script = getScriptContext(kCastScript, sprite->_castId);
if (script && script->_eventHandlers.contains(event)) {
_eventQueue.push(LingoEvent(event, eventId, kCastScript, sprite->_castId, false, spriteId));
}
@@ -159,19 +157,16 @@ void Movie::queueFrameEvent(LEvent event, int eventId) {
* [p.81 of D4 docs]
*/
- Movie *movie = _vm->getCurrentMovie();
- Score *score = movie->getScore();
-
// if (event == kEventPrepareFrame || event == kEventIdle) {
// entity = score->getCurrentFrame();
// } else {
- assert(score->_frames[score->getCurrentFrame()] != nullptr);
- int scriptId = score->_frames[score->getCurrentFrame()]->_actionId;
+ assert(_score->_frames[_score->getCurrentFrame()] != nullptr);
+ int scriptId = _score->_frames[_score->getCurrentFrame()]->_actionId;
if (!scriptId)
return;
- ScriptContext *script = movie->getScriptContext(kScoreScript, scriptId);
+ ScriptContext *script = getScriptContext(kScoreScript, scriptId);
if (!script)
return;
@@ -189,8 +184,7 @@ void Movie::queueMovieEvent(LEvent event, int eventId) {
*/
// FIXME: shared cast movie scripts could come before main movie ones
- Movie *movie = g_director->getCurrentMovie();
- LingoArchive *mainArchive = movie->getMainLingoArch();
+ LingoArchive *mainArchive = getMainLingoArch();
for (ScriptContextHash::iterator it = mainArchive->scriptContexts[kMovieScript].begin();
it != mainArchive->scriptContexts[kMovieScript].end(); ++it) {
if (it->_value->_eventHandlers.contains(event)) {
@@ -198,7 +192,7 @@ void Movie::queueMovieEvent(LEvent event, int eventId) {
return;
}
}
- LingoArchive *sharedArchive = movie->getSharedLingoArch();
+ LingoArchive *sharedArchive = getSharedLingoArch();
if (sharedArchive) {
for (ScriptContextHash::iterator it = sharedArchive->scriptContexts[kMovieScript].begin();
it != sharedArchive->scriptContexts[kMovieScript].end(); ++it) {
@@ -234,7 +228,7 @@ void Movie::registerEvent(LEvent event, int spriteId) {
case kEventKeyUp:
case kEventKeyDown:
case kEventTimeout:
- if (g_director->getCurrentMovie()->getScriptContext(kGlobalScript, event)) {
+ if (getScriptContext(kGlobalScript, event)) {
_eventQueue.push(LingoEvent(kEventScript, eventId, kGlobalScript, event, true));
}
break;
More information about the Scummvm-git-logs
mailing list