[Scummvm-git-logs] scummvm master -> 074981ba73519a8966891d115ffe72cc35c3cbe6

rvanlaar noreply at scummvm.org
Wed Sep 21 14:22:48 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:
074981ba73 DIRECTOR: filter cast list on id in debugger


Commit: 074981ba73519a8966891d115ffe72cc35c3cbe6
    https://github.com/scummvm/scummvm/commit/074981ba73519a8966891d115ffe72cc35c3cbe6
Author: Roland van Laar (roland at rolandvanlaar.nl)
Date: 2022-09-21T16:22:34+02:00

Commit Message:
DIRECTOR: filter cast list on id in debugger

Add option to only show the cast with castId in the debugger.

Changed paths:
    engines/director/cast.cpp
    engines/director/cast.h
    engines/director/debugger.cpp


diff --git a/engines/director/cast.cpp b/engines/director/cast.cpp
index 5be60224349..9979eac7dd1 100644
--- a/engines/director/cast.cpp
+++ b/engines/director/cast.cpp
@@ -1499,7 +1499,7 @@ void Cast::loadVWTL(Common::SeekableReadStreamEndian &stream) {
 
 }
 
-Common::String Cast::formatCastSummary() {
+Common::String Cast::formatCastSummary(int castId = -1) {
 	Common::String result;
 	Common::Array<int> castIds;
 	for (auto it = _loadedCast->begin(); it != _loadedCast->end(); ++it) {
@@ -1507,6 +1507,8 @@ Common::String Cast::formatCastSummary() {
 	}
 	Common::sort(castIds.begin(), castIds.end());
 	for (auto it = castIds.begin(); it != castIds.end(); ++it) {
+		if (castId > -1 &&  *it != castId)
+			continue;
 		CastMember *castMember = getCastMember(*it);
 		CastMemberInfo *castMemberInfo = getCastMemberInfo(*it);
 		result += Common::String::format("%d: type=%s, name=\"%s\"\n",
diff --git a/engines/director/cast.h b/engines/director/cast.h
index 35951561f0c..aec5ab69a9b 100644
--- a/engines/director/cast.h
+++ b/engines/director/cast.h
@@ -122,7 +122,7 @@ public:
 	Common::CodePage getFileEncoding();
 	Common::U32String decodeString(const Common::String &str);
 
-	Common::String formatCastSummary();
+	Common::String formatCastSummary(int castId);
 
 private:
 	void loadScriptText(Common::SeekableReadStreamEndian &stream, uint16 id);
diff --git a/engines/director/debugger.cpp b/engines/director/debugger.cpp
index 00866cc00dc..249dadb5653 100644
--- a/engines/director/debugger.cpp
+++ b/engines/director/debugger.cpp
@@ -101,7 +101,7 @@ bool Debugger::cmdHelp(int argc, const char **argv) {
 	//debugPrintf(" movieinfo - Show information for the current movie\n");
 	debugPrintf(" frame / f [frameNum] - Gets or sets the current score frame\n");
 	debugPrintf(" channels / chan [frameNum] - Shows channel information for a score frame\n");
-	debugPrintf(" cast - Shows the cast list for the current movie\n");
+	debugPrintf(" cast [castNum] - Shows the cast list or castNum for the current movie\n");
 	debugPrintf(" nextframe / nf [n] - Steps forward one or more score frames\n");
 	//debugPrintf(" nextmovie / nm - Steps forward until the next change of movie\n");
 	debugPrintf("\n");
@@ -184,16 +184,24 @@ bool Debugger::cmdCast(int argc, const char **argv) {
 	Cast *cast = g_director->getCurrentMovie()->getCast();
 	Cast *sharedCast = g_director->getCurrentMovie()->getSharedCast();
 
+	int castId = -1;
+	if (argc == 2)
+		castId = atoi(argv[1]);
+
 	debugPrintf("Cast:\n");
-	if (cast) {
-		debugPrintf("%s\n", cast->formatCastSummary().c_str());
+	if (castId > -1 && !cast->getCastMember(castId)) {
+		debugPrintf("[not found]\n");
+	} else if (cast) {
+		debugPrintf("%s\n", cast->formatCastSummary(castId).c_str());
 	} else {
 		debugPrintf("[empty]\n");
 	}
 	debugPrintf("\n");
 	debugPrintf("Shared cast:\n");
-	if (sharedCast) {
-		debugPrintf("%s\n", sharedCast->formatCastSummary().c_str());
+	if (castId > -1 && !sharedCast->getCastMember(castId)) {
+		debugPrintf("[not found]\n");
+	} else if (sharedCast) {
+		debugPrintf("%s\n", sharedCast->formatCastSummary(castId).c_str());
 	} else {
 		debugPrintf("[empty]\n");
 	}




More information about the Scummvm-git-logs mailing list