[Scummvm-git-logs] scummvm master -> b866d0abb443ff0f0a2bdc062c2d4da6c7003eb7

djsrv dservilla at gmail.com
Fri Jul 10 19:03:29 UTC 2020


This automated email contains information about 4 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
37938f433c DIRECTOR: LINGO: Add kEventScript
91a7cc7676 DIRECTOR: LINGO: Fix D4 nobytecode event scripts
e599378565 DIRECTOR: LINGO: Load D4 bytecode event scripts
b866d0abb4 DIRECTOR: LINGO: Fix bytecode global var oddities


Commit: 37938f433c88b8328ef16927cc292e1a7181c386
    https://github.com/scummvm/scummvm/commit/37938f433c88b8328ef16927cc292e1a7181c386
Author: djsrv (dservilla at gmail.com)
Date: 2020-07-10T14:01:14-04:00

Commit Message:
DIRECTOR: LINGO: Add kEventScript

For generic handler-less event scripts

Changed paths:
    engines/director/lingo/lingo-builtins.cpp
    engines/director/lingo/lingo-events.cpp
    engines/director/lingo/lingo.cpp
    engines/director/types.h


diff --git a/engines/director/lingo/lingo-builtins.cpp b/engines/director/lingo/lingo-builtins.cpp
index e1653d2041..c9926f4bb5 100644
--- a/engines/director/lingo/lingo-builtins.cpp
+++ b/engines/director/lingo/lingo-builtins.cpp
@@ -524,7 +524,7 @@ void LB::b_value(int nargs) {
 	Common::String code = "scummvm_returnNumber " + expr;
 	// Compile the code to an anonymous function and call it
 	ScriptContext *sc = g_lingo->compileAnonymous(code.c_str());
-	Symbol sym = sc->_eventHandlers[kEventNone];
+	Symbol sym = sc->_eventHandlers[kEventScript];
 	LC::call(sym, 0);
 }
 
diff --git a/engines/director/lingo/lingo-events.cpp b/engines/director/lingo/lingo-events.cpp
index 288751d41b..dfbfd53a4c 100644
--- a/engines/director/lingo/lingo-events.cpp
+++ b/engines/director/lingo/lingo-events.cpp
@@ -73,7 +73,9 @@ struct EventHandlerType {
 
 	{ kEventStartUp,			"startUp" },
 
-	{ kEventNone,				0 },
+	{ kEventScript,				"scummvm_script" },
+
+	{ kEventNone, 0 }
 };
 
 void Lingo::initEventHandlerTypes() {
@@ -134,7 +136,7 @@ void Lingo::queueSpriteEvent(LEvent event, int eventId, int spriteId) {
 			// If sprite is immediate, its script is run on mouseDown, otherwise on mouseUp
 			if ((event == kEventMouseDown && sprite->_immediate)
 					|| (event == kEventMouseUp && !sprite->_immediate)) {
-				_eventQueue.push(LingoEvent(kEventNone, eventId, kScoreScript, sprite->_scriptId, false, spriteId));
+				_eventQueue.push(LingoEvent(kEventScript, eventId, kScoreScript, sprite->_scriptId, false, spriteId));
 			}
 		} else {
 			ScriptContext *script = movie->getScriptContext(kScoreScript, sprite->_scriptId);
@@ -171,7 +173,7 @@ void Lingo::queueFrameEvent(LEvent event, int eventId) {
 
 	if (scriptId) {
 		if (event == kEventEnterFrame && _vm->getVersion() <= 3) {
-			_eventQueue.push(LingoEvent(kEventNone, eventId, kScoreScript, scriptId, false));
+			_eventQueue.push(LingoEvent(kEventScript, eventId, kScoreScript, scriptId, false));
 		} else {
 			ScriptContext *script = movie->getScriptContext(kScoreScript, scriptId);
 			if (script && script->_eventHandlers.contains(event)) {
@@ -234,7 +236,7 @@ void Lingo::registerEvent(LEvent event, int spriteId) {
 	case kEventKeyDown:
 	case kEventTimeout:
 		if (g_director->getCurrentMovie()->getScriptContext(kGlobalScript, event)) {
-			_eventQueue.push(LingoEvent(kEventNone, eventId, kGlobalScript, event, true));
+			_eventQueue.push(LingoEvent(kEventScript, eventId, kGlobalScript, event, true));
 		}
 		break;
 	default:
diff --git a/engines/director/lingo/lingo.cpp b/engines/director/lingo/lingo.cpp
index 421943d5e1..6f3cd29248 100644
--- a/engines/director/lingo/lingo.cpp
+++ b/engines/director/lingo/lingo.cpp
@@ -428,7 +428,7 @@ ScriptContext *Lingo::compileLingo(const char *code, LingoArchive *archive, Scri
 	currentFunc.argNames = argNames;
 	currentFunc.varNames = varNames;
 	_currentAssembly = nullptr;
-	_assemblyContext->_eventHandlers[kEventNone] = currentFunc;
+	_assemblyContext->_eventHandlers[kEventScript] = currentFunc;
 	_assemblyContext = nullptr;
 	_assemblyArchive = nullptr;
 	return mainContext;
@@ -613,7 +613,7 @@ void Lingo::executeScript(ScriptType type, uint16 id) {
 
 	debugC(1, kDebugLingoExec, "Executing script type: %s, id: %d", scriptType2str(type), id);
 
-	Symbol sym = sc->_eventHandlers[kEventNone];
+	Symbol sym = sc->_eventHandlers[kEventScript];
 	LC::call(sym, 0);
 	execute(_pc);
 }
@@ -1123,7 +1123,7 @@ void Lingo::executeImmediateScripts(Frame *frame) {
 			// From D5 only explicit event handlers are processed
 			// Before that you could specify commands which will be executed on mouse up
 			if (_vm->getVersion() < 5)
-				g_lingo->processEvent(kEventNone, kScoreScript, frame->_sprites[i]->_scriptId, i);
+				g_lingo->processEvent(kEventScript, kScoreScript, frame->_sprites[i]->_scriptId, i);
 			else
 				g_lingo->processEvent(kEventMouseUp, kScoreScript, frame->_sprites[i]->_scriptId, i);
 		}
diff --git a/engines/director/types.h b/engines/director/types.h
index 8b31a93005..b264254e6d 100644
--- a/engines/director/types.h
+++ b/engines/director/types.h
@@ -181,6 +181,7 @@ enum LEvent {
 	kEventEndSprite,
 
 	kEventNone,
+	kEventScript,
 	kEventEnterFrame,
 	kEventPrepareFrame,
 	kEventIdle,


Commit: 91a7cc7676fbabe627b0e28ef8ce9ea6117ea9d2
    https://github.com/scummvm/scummvm/commit/91a7cc7676fbabe627b0e28ef8ce9ea6117ea9d2
Author: djsrv (dservilla at gmail.com)
Date: 2020-07-10T14:02:16-04:00

Commit Message:
DIRECTOR: LINGO: Fix D4 nobytecode event scripts

Changed paths:
    engines/director/lingo/lingo-events.cpp
    engines/director/lingo/lingo.cpp


diff --git a/engines/director/lingo/lingo-events.cpp b/engines/director/lingo/lingo-events.cpp
index dfbfd53a4c..fa9be0f171 100644
--- a/engines/director/lingo/lingo-events.cpp
+++ b/engines/director/lingo/lingo-events.cpp
@@ -131,16 +131,14 @@ void Lingo::queueSpriteEvent(LEvent event, int eventId, int spriteId) {
 
 	// Sprite (score) script
 	if (sprite->_scriptId) {
-		if (_vm->getVersion() <= 3) {
+		ScriptContext *script = movie->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
-			if ((event == kEventMouseDown && sprite->_immediate)
-					|| (event == kEventMouseUp && !sprite->_immediate)) {
+			if (((event == kEventMouseDown && sprite->_immediate) || (event == kEventMouseUp && !sprite->_immediate))
+					&& script->_eventHandlers.contains(kEventScript)) {
 				_eventQueue.push(LingoEvent(kEventScript, eventId, kScoreScript, sprite->_scriptId, false, spriteId));
-			}
-		} else {
-			ScriptContext *script = movie->getScriptContext(kScoreScript, sprite->_scriptId);
-			if (script && script->_eventHandlers.contains(event)) {
+			} else if (script->_eventHandlers.contains(event)) {
 				_eventQueue.push(LingoEvent(event, eventId, kScoreScript, sprite->_scriptId, false, spriteId));
 			}
 		}
@@ -170,16 +168,17 @@ void Lingo::queueFrameEvent(LEvent event, int eventId) {
 
 	assert(score->_frames[score->getCurrentFrame()] != nullptr);
 	int scriptId = score->_frames[score->getCurrentFrame()]->_actionId;
+	if (!scriptId)
+		return;
 
-	if (scriptId) {
-		if (event == kEventEnterFrame && _vm->getVersion() <= 3) {
-			_eventQueue.push(LingoEvent(kEventScript, eventId, kScoreScript, scriptId, false));
-		} else {
-			ScriptContext *script = movie->getScriptContext(kScoreScript, scriptId);
-			if (script && script->_eventHandlers.contains(event)) {
-				_eventQueue.push(LingoEvent(event, eventId, kScoreScript, scriptId, false));
-			}
-		}
+	ScriptContext *script = movie->getScriptContext(kScoreScript, scriptId);
+	if (!script)
+		return;
+
+	if (event == kEventEnterFrame && script->_eventHandlers.contains(kEventScript)) {
+		_eventQueue.push(LingoEvent(kEventScript, eventId, kScoreScript, scriptId, false));
+	} else if (script->_eventHandlers.contains(event)) {
+		_eventQueue.push(LingoEvent(event, eventId, kScoreScript, scriptId, false));
 	}
 }
 
diff --git a/engines/director/lingo/lingo.cpp b/engines/director/lingo/lingo.cpp
index 6f3cd29248..5a15e41fd7 100644
--- a/engines/director/lingo/lingo.cpp
+++ b/engines/director/lingo/lingo.cpp
@@ -355,80 +355,80 @@ ScriptContext *Lingo::compileLingo(const char *code, LingoArchive *archive, Scri
 			begin = end;
 		} while ((end = findNextDefinition(begin + 1)));
 
+		_inFactory = false;
+		_assemblyContext = mainContext;
+
 		debugC(1, kDebugCompile, "Last code chunk:\n#####\n%s\n#####", begin);
-		parse(begin);
+	}
 
+	parse(begin);
+
+	// for D4 and above, there usually won't be any code left.
+	// all scoped methods will be defined and stored by the code parser
+	// however D3 and below allow scopeless functions!
+	// and these can show up in D4 when imported from other movies
+
+	if (!_currentAssembly->empty()) {
 		// end of script, add a c_procret so stack frames work as expected
 		code1(LC::c_procret);
 		code1(STOP);
-	} else {
-		parse(code);
 
-		code1(LC::c_procret);
-		code1(STOP);
-	}
+		if (debugChannelSet(3, kDebugCompile)) {
+			if (_currentAssembly->size() && !_hadError)
+				Common::hexdump((byte *)&_currentAssembly->front(), _currentAssembly->size() * sizeof(inst));
 
-	_inFactory = false;
-	_assemblyContext = mainContext;
-
-	if (debugChannelSet(3, kDebugCompile)) {
-		if (_currentAssembly->size() && !_hadError)
-			Common::hexdump((byte *)&_currentAssembly->front(), _currentAssembly->size() * sizeof(inst));
-
-		debugC(2, kDebugCompile, "<resulting code>");
-		uint pc = 0;
-		while (pc < _currentAssembly->size()) {
-			uint spc = pc;
-			Common::String instr = decodeInstruction(_assemblyArchive, _currentAssembly, pc, &pc);
-			debugC(2, kDebugCompile, "[%5d] %s", spc, instr.c_str());
+			debugC(2, kDebugCompile, "<resulting code>");
+			uint pc = 0;
+			while (pc < _currentAssembly->size()) {
+				uint spc = pc;
+				Common::String instr = decodeInstruction(_assemblyArchive, _currentAssembly, pc, &pc);
+				debugC(2, kDebugCompile, "[%5d] %s", spc, instr.c_str());
+			}
+			debugC(2, kDebugCompile, "<end code>");
 		}
-		debugC(2, kDebugCompile, "<end code>");
-	}
 
-	// for D4 and above, there won't be any code left. all scoped methods
-	// will be defined and stored by the code parser, and this function we save
-	// will be blank.
-	// however D3 and below allow scopeless functions!
-	Symbol currentFunc;
-
-	currentFunc.type = HANDLER;
-	currentFunc.u.defn = _currentAssembly;
-	Common::String typeStr = Common::String(scriptType2str(type));
-	currentFunc.name = new Common::String("[" + typeStr + " " + _assemblyContext->getName() + "]");
-	currentFunc.ctx = _assemblyContext;
-	currentFunc.archive = archive;
-	currentFunc.anonymous = anonymous;
-	// arg names should be empty, but just in case
-	Common::Array<Common::String> *argNames = new Common::Array<Common::String>;
-	for (uint i = 0; i < _argstack.size(); i++) {
-		argNames->push_back(Common::String(_argstack[i]->c_str()));
-	}
-	Common::Array<Common::String> *varNames = new Common::Array<Common::String>;
-	for (Common::HashMap<Common::String, VarType, Common::IgnoreCase_Hash, Common::IgnoreCase_EqualTo>::iterator it = _methodVars->begin(); it != _methodVars->end(); ++it) {
-		if (it->_value == kVarLocal)
-			varNames->push_back(Common::String(it->_key));
-	}
-	delete _methodVars;
-	_methodVars = nullptr;
-
-	if (debugChannelSet(1, kDebugCompile)) {
-		debug("Function vars");
-		debugN("  Args: ");
-		for (uint i = 0; i < argNames->size(); i++) {
-			debugN("%s, ", (*argNames)[i].c_str());
+		Symbol currentFunc;
+
+		currentFunc.type = HANDLER;
+		currentFunc.u.defn = _currentAssembly;
+		Common::String typeStr = Common::String(scriptType2str(type));
+		currentFunc.name = new Common::String("[" + typeStr + " " + _assemblyContext->getName() + "]");
+		currentFunc.ctx = _assemblyContext;
+		currentFunc.archive = archive;
+		currentFunc.anonymous = anonymous;
+		// arg names should be empty, but just in case
+		Common::Array<Common::String> *argNames = new Common::Array<Common::String>;
+		for (uint i = 0; i < _argstack.size(); i++) {
+			argNames->push_back(Common::String(_argstack[i]->c_str()));
 		}
-		debugN("\n");
-		debugN("  Local vars: ");
-		for (uint i = 0; i < varNames->size(); i++) {
-			debugN("%s, ", (*varNames)[i].c_str());
+		Common::Array<Common::String> *varNames = new Common::Array<Common::String>;
+		for (Common::HashMap<Common::String, VarType, Common::IgnoreCase_Hash, Common::IgnoreCase_EqualTo>::iterator it = _methodVars->begin(); it != _methodVars->end(); ++it) {
+			if (it->_value == kVarLocal)
+				varNames->push_back(Common::String(it->_key));
 		}
-		debugN("\n");
+
+		if (debugChannelSet(1, kDebugCompile)) {
+			debug("Function vars");
+			debugN("  Args: ");
+			for (uint i = 0; i < argNames->size(); i++) {
+				debugN("%s, ", (*argNames)[i].c_str());
+			}
+			debugN("\n");
+			debugN("  Local vars: ");
+			for (uint i = 0; i < varNames->size(); i++) {
+				debugN("%s, ", (*varNames)[i].c_str());
+			}
+			debugN("\n");
+		}
+
+		currentFunc.argNames = argNames;
+		currentFunc.varNames = varNames;
+		_assemblyContext->_eventHandlers[kEventScript] = currentFunc;
 	}
 
-	currentFunc.argNames = argNames;
-	currentFunc.varNames = varNames;
+	delete _methodVars;
+	_methodVars = nullptr;
 	_currentAssembly = nullptr;
-	_assemblyContext->_eventHandlers[kEventScript] = currentFunc;
 	_assemblyContext = nullptr;
 	_assemblyArchive = nullptr;
 	return mainContext;


Commit: e599378565a68902b1f60cda2333ab542929c756
    https://github.com/scummvm/scummvm/commit/e599378565a68902b1f60cda2333ab542929c756
Author: djsrv (dservilla at gmail.com)
Date: 2020-07-10T14:03:39-04:00

Commit Message:
DIRECTOR: LINGO: Load D4 bytecode event scripts

Changed paths:
    engines/director/lingo/lingo-bytecode.cpp
    engines/director/types.h


diff --git a/engines/director/lingo/lingo-bytecode.cpp b/engines/director/lingo/lingo-bytecode.cpp
index 9d0ff0fb8c..aea3fa395d 100644
--- a/engines/director/lingo/lingo-bytecode.cpp
+++ b/engines/director/lingo/lingo-bytecode.cpp
@@ -857,7 +857,7 @@ ScriptContext *Lingo::compileLingoV4(Common::SeekableSubReadStreamEndian &stream
 	debugC(1, kDebugCompile, "Script flags:");
 	debugC(1, kDebugCompile, "unk0: %d global: %d unk2: %d unk3: %d", (scriptFlags & kScriptFlagUnk0) != 0, (scriptFlags & kScriptFlagGlobal) != 0, (scriptFlags & kScriptFlagUnk2) != 0, (scriptFlags & kScriptFlagUnk3) != 0);
 	debugC(1, kDebugCompile, "factoryDef: %d unk5: %d unk6: %d unk7: %d", (scriptFlags & kScriptFlagFactoryDef) != 0, (scriptFlags & kScriptFlagUnk5) != 0, (scriptFlags & kScriptFlagUnk6) != 0, (scriptFlags & kScriptFlagUnk7) != 0);
-	debugC(1, kDebugCompile, "hasFactory: %d unk9: %d unkA: %d unkB: %d", (scriptFlags & kScriptFlagHasFactory) != 0, (scriptFlags & kScriptFlagUnk9) != 0, (scriptFlags & kScriptFlagUnkA) != 0, (scriptFlags & kScriptFlagUnkB) != 0);
+	debugC(1, kDebugCompile, "hasFactory: %d eventScript: %d eventScript2: %d unkB: %d", (scriptFlags & kScriptFlagHasFactory) != 0, (scriptFlags & kScriptFlagEventScript) != 0, (scriptFlags & kScriptFlagEventScript2) != 0, (scriptFlags & kScriptFlagUnkB) != 0);
 	debugC(1, kDebugCompile, "unkC: %d unkD: %d unkE: %d unkF: %d", (scriptFlags & kScriptFlagUnkC) != 0, (scriptFlags & kScriptFlagUnkD) != 0, (scriptFlags & kScriptFlagUnkE) != 0, (scriptFlags & kScriptFlagUnkF) != 0);
 	// unk4
 	for (uint32 i = 0; i < 0x4; i++) {
@@ -1392,10 +1392,19 @@ ScriptContext *Lingo::compileLingoV4(Common::SeekableSubReadStreamEndian &stream
 		}
 
 		// Attach to handlers
-		Symbol sym;
+		
+		Common::String functionName;
 		if (0 <= nameIndex && nameIndex < (int16)archive->names.size()) {
-			debugC(5, kDebugLoading, "Function %d binding: %s()", i, archive->names[nameIndex].c_str());
-			sym = _assemblyContext->define(archive->names[nameIndex], argCount, _currentAssembly, argNames, varNames);
+			functionName = archive->names[nameIndex];
+		} else if (i == 0 && (scriptFlags & kScriptFlagEventScript)) {
+			// event script (lingo not contained within a handler)
+			functionName = "scummvm_script";
+		}
+
+		Symbol sym;
+		if (!functionName.empty()) {
+			debugC(5, kDebugLoading, "Function %d binding: %s()", i, functionName.c_str());
+			sym = _assemblyContext->define(functionName, argCount, _currentAssembly, argNames, varNames);
 		} else {
 			warning("Function has unknown name id %d, skipping define", nameIndex);
 			sym.name = new Common::String();
diff --git a/engines/director/types.h b/engines/director/types.h
index b264254e6d..f49586531f 100644
--- a/engines/director/types.h
+++ b/engines/director/types.h
@@ -60,8 +60,8 @@ enum ScriptFlag {
 	kScriptFlagUnk6			= (1 << 0x6),
 	kScriptFlagUnk7			= (1 << 0x7),
 	kScriptFlagHasFactory	= (1 << 0x8),
-	kScriptFlagUnk9			= (1 << 0x9),
-	kScriptFlagUnkA			= (1 << 0xa),
+	kScriptFlagEventScript	= (1 << 0x9),
+	kScriptFlagEventScript2	= (1 << 0xa),
 	kScriptFlagUnkB			= (1 << 0xb),
 	kScriptFlagUnkC			= (1 << 0xc),
 	kScriptFlagUnkD			= (1 << 0xd),


Commit: b866d0abb443ff0f0a2bdc062c2d4da6c7003eb7
    https://github.com/scummvm/scummvm/commit/b866d0abb443ff0f0a2bdc062c2d4da6c7003eb7
Author: djsrv (dservilla at gmail.com)
Date: 2020-07-10T14:59:34-04:00

Commit Message:
DIRECTOR: LINGO: Fix bytecode global var oddities

Changed paths:
    engines/director/lingo/lingo-bytecode.cpp
    engines/director/types.h


diff --git a/engines/director/lingo/lingo-bytecode.cpp b/engines/director/lingo/lingo-bytecode.cpp
index aea3fa395d..88c4be9424 100644
--- a/engines/director/lingo/lingo-bytecode.cpp
+++ b/engines/director/lingo/lingo-bytecode.cpp
@@ -77,10 +77,12 @@ static LingoV4Bytecode lingoV4[] = {
 	// 0x44, push a constant
 	{ 0x45, LC::c_namepush,		"b" },
 	{ 0x46, LC::cb_objectpush,  "b" },
+	{ 0x48, LC::cb_globalpush,	"b" }, // used in event scripts
 	{ 0x49, LC::cb_globalpush,	"b" },
 	{ 0x4a, LC::cb_thepush,		"b" },
 	{ 0x4b, LC::cb_varpush,		"bpa" },
 	{ 0x4c, LC::cb_varpush,		"bpv" },
+	{ 0x4e, LC::cb_globalassign,"b" }, // used in event scripts
 	{ 0x4f, LC::cb_globalassign,"b" },
 	{ 0x50, LC::cb_theassign,	"b" },
 	{ 0x51, LC::cb_varassign,	"bpa" },
@@ -110,10 +112,12 @@ static LingoV4Bytecode lingoV4[] = {
 	// 0x84, push a constant
 	{ 0x85, LC::c_namepush,		"w" },
 	{ 0x86, LC::cb_objectpush,  "w" },
+	{ 0x88, LC::cb_globalpush,	"w" }, // used in event scripts
 	{ 0x89, LC::cb_globalpush,	"w" },
 	{ 0x8a, LC::cb_thepush,		"w" },
 	{ 0x8b, LC::cb_varpush,		"wpa" },
 	{ 0x8c, LC::cb_varpush,		"wpv" },
+	{ 0x8e, LC::cb_globalassign,"w" }, // used in event scripts
 	{ 0x8f, LC::cb_globalassign,"w" },
 	{ 0x90, LC::cb_theassign, 	"w" },
 	{ 0x91, LC::cb_varassign,	"wpa" },
@@ -855,7 +859,7 @@ ScriptContext *Lingo::compileLingoV4(Common::SeekableSubReadStreamEndian &stream
 	/* uint16 unk3 = */ stream.readUint16();
 	uint32 scriptFlags = stream.readUint32();
 	debugC(1, kDebugCompile, "Script flags:");
-	debugC(1, kDebugCompile, "unk0: %d global: %d unk2: %d unk3: %d", (scriptFlags & kScriptFlagUnk0) != 0, (scriptFlags & kScriptFlagGlobal) != 0, (scriptFlags & kScriptFlagUnk2) != 0, (scriptFlags & kScriptFlagUnk3) != 0);
+	debugC(1, kDebugCompile, "unk0: %d funcsGlobal: %d varsGlobal: %d unk3: %d", (scriptFlags & kScriptFlagUnk0) != 0, (scriptFlags & kScriptFlagFuncsGlobal) != 0, (scriptFlags & kScriptFlagVarsGlobal) != 0, (scriptFlags & kScriptFlagUnk3) != 0);
 	debugC(1, kDebugCompile, "factoryDef: %d unk5: %d unk6: %d unk7: %d", (scriptFlags & kScriptFlagFactoryDef) != 0, (scriptFlags & kScriptFlagUnk5) != 0, (scriptFlags & kScriptFlagUnk6) != 0, (scriptFlags & kScriptFlagUnk7) != 0);
 	debugC(1, kDebugCompile, "hasFactory: %d eventScript: %d eventScript2: %d unkB: %d", (scriptFlags & kScriptFlagHasFactory) != 0, (scriptFlags & kScriptFlagEventScript) != 0, (scriptFlags & kScriptFlagEventScript2) != 0, (scriptFlags & kScriptFlagUnkB) != 0);
 	debugC(1, kDebugCompile, "unkC: %d unkD: %d unkE: %d unkF: %d", (scriptFlags & kScriptFlagUnkC) != 0, (scriptFlags & kScriptFlagUnkD) != 0, (scriptFlags & kScriptFlagUnkE) != 0, (scriptFlags & kScriptFlagUnkF) != 0);
diff --git a/engines/director/types.h b/engines/director/types.h
index f49586531f..e3b2151216 100644
--- a/engines/director/types.h
+++ b/engines/director/types.h
@@ -52,8 +52,8 @@ enum ScriptType {
 
 enum ScriptFlag {
 	kScriptFlagUnk0			= (1 << 0x0),
-	kScriptFlagGlobal		= (1 << 0x1),
-	kScriptFlagUnk2			= (1 << 0x2),
+	kScriptFlagFuncsGlobal	= (1 << 0x1),
+	kScriptFlagVarsGlobal	= (1 << 0x2),	// Occurs in event scripts (which have no local vars). Correlated with use of alternate global var opcodes.
 	kScriptFlagUnk3			= (1 << 0x3),
 	kScriptFlagFactoryDef	= (1 << 0x4),
 	kScriptFlagUnk5			= (1 << 0x5),




More information about the Scummvm-git-logs mailing list