[Scummvm-git-logs] scummvm master -> 50d369631b616489e0705f293102b9b98c4c2cd6

rvanlaar noreply at scummvm.org
Fri Mar 25 17:09:08 UTC 2022


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:
50d369631b DIRECTOR: dump factory scripts with their names


Commit: 50d369631b616489e0705f293102b9b98c4c2cd6
    https://github.com/scummvm/scummvm/commit/50d369631b616489e0705f293102b9b98c4c2cd6
Author: Roland van Laar (roland at rolandvanlaar.nl)
Date: 2022-03-25T18:08:55+01:00

Commit Message:
DIRECTOR: dump factory scripts with their names

FactoryScripts are now dumped with their 'factory-<name>' in the dumped
filename.

Factory scripts are different in that they are not associated with a cast and have a
scripType that is kNoneScript, i.e. -1.

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


diff --git a/engines/director/lingo/lingo-bytecode.cpp b/engines/director/lingo/lingo-bytecode.cpp
index 63b2537684e..f459f2eaf1e 100644
--- a/engines/director/lingo/lingo-bytecode.cpp
+++ b/engines/director/lingo/lingo-bytecode.cpp
@@ -1192,7 +1192,12 @@ ScriptContext *LingoCompiler::compileLingoV4(Common::SeekableReadStreamEndian &s
 	bool skipdump = false;
 
 	if (ConfMan.getBool("dump_scripts")) {
-		Common::String buf = dumpScriptName(encodePathForDump(archName).c_str(), scriptType, castId, "lscr");
+		Common::String buf;
+		if (scriptFlags & kScriptFlagFactoryDef) {
+			buf = dumpFactoryName(encodePathForDump(archName).c_str(), factoryName.c_str(), "lscr");
+		} else {
+			buf = dumpScriptName(encodePathForDump(archName).c_str(), scriptType, castId, "lscr");
+		}
 
 		if (!out.open(buf, true)) {
 			warning("Lingo::addCodeV4(): Can not open dump file %s", buf.c_str());
diff --git a/engines/director/util.cpp b/engines/director/util.cpp
index 34861ac2128..21fa38bff44 100644
--- a/engines/director/util.cpp
+++ b/engines/director/util.cpp
@@ -764,9 +764,7 @@ Common::String dumpScriptName(const char *prefix, int type, int id, const char *
 
 	switch (type) {
 	case kNoneScript:
-	default:
 		typeName = "unknown";
-		warning("dumpScriptName(): Incorrect call (type %d)", type);
 		break;
 	case kMovieScript:
 		typeName = "movie";
@@ -780,11 +778,18 @@ Common::String dumpScriptName(const char *prefix, int type, int id, const char *
 	case kScoreScript:
 		typeName = "score";
 		break;
+	default:
+		error("dumpScriptName(): Incorrect call (type %d)", type);
+		break;
 	}
 
 	return Common::String::format("./dumps/%s-%s-%d.%s", prefix, typeName.c_str(), id, ext);
 }
 
+Common::String dumpFactoryName(const char *prefix, const char *name, const char *ext) {
+	return Common::String::format("./dumps/%s-factory-%s.%s", prefix, name, ext);
+}
+
 void RandomState::setSeed(int seed) {
 	init(32);
 
diff --git a/engines/director/util.h b/engines/director/util.h
index fbe5524eabb..97238f76002 100644
--- a/engines/director/util.h
+++ b/engines/director/util.h
@@ -54,6 +54,7 @@ Common::String stripMacPath(const char *name);
 Common::String convertMacFilename(const char *name);
 
 Common::String dumpScriptName(const char *prefix, int type, int id, const char *ext);
+Common::String dumpFactoryName(const char *prefix, const char *name, const char *ext);
 
 bool isButtonSprite(SpriteType spriteType);
 




More information about the Scummvm-git-logs mailing list