Fix for ending warp bug

When popping down the stack frame it is assumed that you keep using the
previous warp state rather than looking at the warp state of the level
you just popped out to. This causes the loss of screen updates if the
warping block was the last statement in a loop as the loop does not obey
it's 'non warp' status.
This commit is contained in:
griffpatch 2017-01-26 11:29:58 +00:00
parent bdabe2efa3
commit 5f100129b6

View file

@ -131,12 +131,17 @@ Sequencer.prototype.stepThread = function (thread) {
// If no next block has been found at this point, look on the stack. // If no next block has been found at this point, look on the stack.
while (!thread.peekStack()) { while (!thread.peekStack()) {
thread.popStack(); thread.popStack();
if (thread.stack.length === 0) { if (thread.stack.length === 0) {
// No more stack to run! // No more stack to run!
thread.status = Thread.STATUS_DONE; thread.status = Thread.STATUS_DONE;
return; return;
} }
if (thread.peekStackFrame().isLoop) {
var stackFrame = thread.peekStackFrame();
isWarpMode = stackFrame.warpMode;
if (stackFrame.isLoop) {
// The current level of the stack is marked as a loop. // The current level of the stack is marked as a loop.
// Return to yield for the frame/tick in general. // Return to yield for the frame/tick in general.
// Unless we're in warp mode - then only return if the // Unless we're in warp mode - then only return if the
@ -151,7 +156,7 @@ Sequencer.prototype.stepThread = function (thread) {
// since loops need to be re-executed. // since loops need to be re-executed.
continue; continue;
} }
} else if (thread.peekStackFrame().waitingReporter) { } else if (stackFrame.waitingReporter) {
// This level of the stack was waiting for a value. // This level of the stack was waiting for a value.
// This means a reporter has just returned - so don't go // This means a reporter has just returned - so don't go
// to the next block for this level of the stack. // to the next block for this level of the stack.