[Scummvm-git-logs] scummvm master -> 2ef65a3b398fd6381aec216b4144e1dda16e04d2

djsrv dservilla at gmail.com
Wed Aug 5 16:19:28 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:
2ef65a3b39 DIRECTOR: LINGO: Make fewframesonly counter global


Commit: 2ef65a3b398fd6381aec216b4144e1dda16e04d2
    https://github.com/scummvm/scummvm/commit/2ef65a3b398fd6381aec216b4144e1dda16e04d2
Author: djsrv (dservilla at gmail.com)
Date: 2020-08-05T12:18:12-04:00

Commit Message:
DIRECTOR: LINGO: Make fewframesonly counter global

After a long script was killed, another script would sometimes be run,
causing errors if it depended on the results of the last script.

Changed paths:
    engines/director/lingo/lingo.cpp
    engines/director/lingo/lingo.h


diff --git a/engines/director/lingo/lingo.cpp b/engines/director/lingo/lingo.cpp
index d58996950d..2d9c58eb35 100644
--- a/engines/director/lingo/lingo.cpp
+++ b/engines/director/lingo/lingo.cpp
@@ -150,6 +150,7 @@ Lingo::Lingo(DirectorEngine *vm) : _vm(vm) {
 	_assemblyContext = nullptr;
 
 	_currentChannelId = -1;
+	_globalCounter = 0;
 	_pc = 0;
 	_abort = false;
 	_indef = kStateNone;
@@ -560,9 +561,15 @@ Common::String Lingo::decodeInstruction(LingoArchive *archive, ScriptData *sd, u
 }
 
 void Lingo::execute(uint pc) {
-	int counter = 0;
+	uint localCounter = 0;
 
 	for (_pc = pc; !_abort && (*_currentScript)[_pc] != STOP;) {
+		if (_globalCounter > 1000 && debugChannelSet(-1, kDebugFewFramesOnly)) {
+			warning("Lingo::execute(): Stopping due to debug few frames only");
+			_vm->getCurrentMovie()->getScore()->_playState = kPlayStopped;
+			break;
+		}
+	
 		Common::String instr = decodeInstruction(_currentArchive, _currentScript, _pc);
 		uint current = _pc;
 
@@ -594,14 +601,11 @@ void Lingo::execute(uint pc) {
 			break;
 		}
 
-		if (++counter > 1000 && debugChannelSet(-1, kDebugFewFramesOnly)) {
-			warning("Lingo::execute(): Stopping due to debug few frames only");
-			_vm->getCurrentMovie()->getScore()->_playState = kPlayStopped;
-			break;
-		}
+		_globalCounter++;
+		localCounter++;
 
 		// process events every so often
-		if (counter % 100 == 0) {
+		if (localCounter % 100 == 0) {
 			_vm->processEvents();
 			if (_vm->getCurrentMovie()->getScore()->_playState == kPlayStopped)
 				break;
diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h
index d6535a50eb..b3441dcef6 100644
--- a/engines/director/lingo/lingo.h
+++ b/engines/director/lingo/lingo.h
@@ -448,6 +448,7 @@ public:
 	Common::HashMap<int, LingoV4Bytecode *> _lingoV4;
 	Common::HashMap<int, LingoV4TheEntity *> _lingoV4TheEntity;
 
+	uint _globalCounter;
 	uint _pc;
 
 	StackData _stack;




More information about the Scummvm-git-logs mailing list