From 69ffcba521364919f36a3b5ed994f10242fad4ce Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sun, 9 Feb 2020 18:55:23 +0100 Subject: [PATCH] DIRECTOR: Fix processing channels --- engines/director/frame.cpp | 4 ++-- engines/director/lingo/lingo-events.cpp | 2 +- engines/director/lingo/lingo.cpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/engines/director/frame.cpp b/engines/director/frame.cpp index eb135d2fea6..732a9ef3c66 100644 --- a/engines/director/frame.cpp +++ b/engines/director/frame.cpp @@ -87,7 +87,7 @@ Frame::Frame(const Frame &frame) { _sprites.resize(_numChannels + 1); - for (uint16 i = 0; i < _numChannels + 1; i++) { + for (uint16 i = 0; i <= _numChannels; i++) { _sprites[i] = new Sprite(*frame._sprites[i]); } } @@ -581,7 +581,7 @@ void Frame::playTransition(Score *score) { } void Frame::renderSprites(Graphics::ManagedSurface &surface, bool renderTrail) { - for (uint16 i = 0; i < _numChannels; i++) { + for (uint16 i = 0; i <= _numChannels; i++) { if (!_sprites[i]->_enabled) continue; diff --git a/engines/director/lingo/lingo-events.cpp b/engines/director/lingo/lingo-events.cpp index 79aa68bdb04..b9aae882a08 100644 --- a/engines/director/lingo/lingo-events.cpp +++ b/engines/director/lingo/lingo-events.cpp @@ -258,7 +258,7 @@ void Lingo::processSpriteEvent(LEvent event) { Frame *currentFrame = score->_frames[score->getCurrentFrame()]; if (event == kEventBeginSprite) { // TODO: Check if this is also possibly a kSpriteScript? - for (uint16 i = 0; i < score->_numChannelsDisplayed; i++) + for (uint16 i = 0; i <= score->_numChannelsDisplayed; i++) if (currentFrame->_sprites[i]->_enabled) processEvent(event, kCastScript, currentFrame->_sprites[i]->_scriptId); diff --git a/engines/director/lingo/lingo.cpp b/engines/director/lingo/lingo.cpp index c58a7abfd7b..37b07a1bac2 100644 --- a/engines/director/lingo/lingo.cpp +++ b/engines/director/lingo/lingo.cpp @@ -601,7 +601,7 @@ void Lingo::runTests() { } void Lingo::executeImmediateScripts(Frame *frame) { - for (uint16 i = 0; i < _vm->getCurrentScore()->_numChannelsDisplayed; i++) { + for (uint16 i = 0; i <= _vm->getCurrentScore()->_numChannelsDisplayed; i++) { if (_vm->getCurrentScore()->_immediateActions.contains(frame->_sprites[i]->_scriptId)) { g_lingo->processEvent(kEventMouseUp, kFrameScript, frame->_sprites[i]->_scriptId); }