[Scummvm-git-logs] scummvm master -> 181b298dad3905a968729044d502a99dcd564d00

sev- sev at scummvm.org
Tue Jul 21 21:36:09 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:
d70c3475c5 DIRECTOR: Implement getting labels by name
234f99395e DIRECTOR: LINGO: Implement b_label()
896ff77946 DIRECTOR: Implement 'the labelList'
181b298dad DIRECTOR: Catch unknown field in readChannels()


Commit: d70c3475c5108b078bfa9ff8e1e2967515ab8712
    https://github.com/scummvm/scummvm/commit/d70c3475c5108b078bfa9ff8e1e2967515ab8712
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2020-07-21T23:35:45+02:00

Commit Message:
DIRECTOR: Implement getting labels by name

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


diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index 164be0b7b9..2e99d30a6c 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -97,21 +97,29 @@ bool Score::processImmediateFrameScript(Common::String s, int id) {
 	return false;
 }
 
-void Score::setStartToLabel(Common::String label) {
+uint16 Score::getLabel(Common::String label) {
 	if (!_labels) {
-		warning("setStartToLabel: No labels set");
-		return;
+		warning("Score::getLabel: No labels set");
+		return 0;
 	}
-
 	Common::SortedArray<Label *>::iterator i;
 
 	for (i = _labels->begin(); i != _labels->end(); ++i) {
 		if ((*i)->name.equalsIgnoreCase(label)) {
-			_nextFrame = (*i)->number;
-			return;
+			return (*i)->number;
 		}
 	}
-	warning("Label %s not found", label.c_str());
+
+	return 0;
+}
+
+void Score::setStartToLabel(Common::String label) {
+	uint16 num = getLabel("label");
+
+	if (num == 0)
+		warning("Label %s not found", label.c_str());
+	else
+		_nextFrame = num;
 }
 
 void Score::gotoLoop() {
diff --git a/engines/director/score.h b/engines/director/score.h
index 948172ca9d..f2097553f7 100644
--- a/engines/director/score.h
+++ b/engines/director/score.h
@@ -70,6 +70,7 @@ public:
 	void loadActions(Common::SeekableSubReadStreamEndian &stream);
 
 	static int compareLabels(const void *a, const void *b);
+	uint16 getLabel(Common::String label);
 	void setStartToLabel(Common::String label);
 	void gotoLoop();
 	void gotoNext();


Commit: 234f99395ec5c8e884b3b4c169dbbbacf8db3a8b
    https://github.com/scummvm/scummvm/commit/234f99395ec5c8e884b3b4c169dbbbacf8db3a8b
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2020-07-21T23:35:45+02:00

Commit Message:
DIRECTOR: LINGO: Implement b_label()

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


diff --git a/engines/director/lingo/lingo-builtins.cpp b/engines/director/lingo/lingo-builtins.cpp
index f6dba65f49..f3ed22484a 100644
--- a/engines/director/lingo/lingo-builtins.cpp
+++ b/engines/director/lingo/lingo-builtins.cpp
@@ -1680,9 +1680,9 @@ Common::String Lingo::genMenuHandler(int *commandId, Common::String &command) {
 
 void LB::b_label(int nargs) {
 	Datum d = g_lingo->pop();
-	warning("STUB: b_label(%d)", d.asInt());
+	uint16 label = g_lingo->func_label(d);
 
-	g_lingo->push(Datum(0));
+	g_lingo->push(label);
 }
 
 void LB::b_marker(int nargs) {
diff --git a/engines/director/lingo/lingo-funcs.cpp b/engines/director/lingo/lingo-funcs.cpp
index 67df00d695..427103f18a 100644
--- a/engines/director/lingo/lingo-funcs.cpp
+++ b/engines/director/lingo/lingo-funcs.cpp
@@ -341,4 +341,23 @@ int Lingo::func_marker(int m) 	{
 	return labelNumber;
 }
 
+uint16 Lingo::func_label(Datum &label) {
+	Score *score = _vm->getCurrentMovie()->getScore();
+
+	if (!score->_labels)
+		return 0;
+
+	if (label.type == STRING)
+		return score->getLabel(*label.u.s);
+
+	int num = CLIP<int>(label.asInt() - 1, 0, score->_labels->size() - 1);
+
+	uint16 res = score->getNextLabelNumber(0);
+
+	while (--num > 0)
+		res = score->getNextLabelNumber(res);
+
+	return res;
+}
+
 }
diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h
index 4758a7bc4a..0e3a07a990 100644
--- a/engines/director/lingo/lingo.h
+++ b/engines/director/lingo/lingo.h
@@ -336,6 +336,7 @@ public:
 	void func_playdone();
 	void func_cursor(int cursorId, int maskId);
 	int func_marker(int m);
+	uint16 func_label(Datum &label);
 
 	// lingo-the.cpp
 public:


Commit: 896ff77946a26197d750e6430702060a3c231ade
    https://github.com/scummvm/scummvm/commit/896ff77946a26197d750e6430702060a3c231ade
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2020-07-21T23:35:45+02:00

Commit Message:
DIRECTOR: Implement 'the labelList'

Changed paths:
    engines/director/lingo/lingo-the.cpp
    engines/director/score.cpp
    engines/director/score.h


diff --git a/engines/director/lingo/lingo-the.cpp b/engines/director/lingo/lingo-the.cpp
index 2f07637784..f324c1bfc0 100644
--- a/engines/director/lingo/lingo-the.cpp
+++ b/engines/director/lingo/lingo-the.cpp
@@ -475,7 +475,8 @@ Datum Lingo::getTheEntity(int entity, Datum &id, int field) {
 			d.u.s = new Common::String();
 		break;
 	case kTheLabelList:
-		getTheEntitySTUB(kTheLabelList);
+		d.type = STRING;
+		d.u.s = _vm->getCurrentMovie()->getScore()->getLabelList();
 		break;
 	case kTheLastClick:
 		d.type = INT;
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index 2e99d30a6c..0edfaad0e8 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -102,9 +102,8 @@ uint16 Score::getLabel(Common::String label) {
 		warning("Score::getLabel: No labels set");
 		return 0;
 	}
-	Common::SortedArray<Label *>::iterator i;
 
-	for (i = _labels->begin(); i != _labels->end(); ++i) {
+	for (Common::SortedArray<Label *>::iterator i = _labels->begin(); i != _labels->end(); ++i) {
 		if ((*i)->name.equalsIgnoreCase(label)) {
 			return (*i)->number;
 		}
@@ -113,6 +112,17 @@ uint16 Score::getLabel(Common::String label) {
 	return 0;
 }
 
+Common::String *Score::getLabelList() {
+	Common::String *res = new Common::String;
+
+	for (Common::SortedArray<Label *>::iterator i = _labels->begin(); i != _labels->end(); ++i) {
+		*res += (*i)->name;
+		*res += '\n';
+	}
+
+	return res;
+}
+
 void Score::setStartToLabel(Common::String label) {
 	uint16 num = getLabel("label");
 
diff --git a/engines/director/score.h b/engines/director/score.h
index f2097553f7..006dd17c2b 100644
--- a/engines/director/score.h
+++ b/engines/director/score.h
@@ -71,6 +71,7 @@ public:
 
 	static int compareLabels(const void *a, const void *b);
 	uint16 getLabel(Common::String label);
+	Common::String *getLabelList();
 	void setStartToLabel(Common::String label);
 	void gotoLoop();
 	void gotoNext();


Commit: 181b298dad3905a968729044d502a99dcd564d00
    https://github.com/scummvm/scummvm/commit/181b298dad3905a968729044d502a99dcd564d00
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2020-07-21T23:35:45+02:00

Commit Message:
DIRECTOR: Catch unknown field in readChannels()

Changed paths:
    engines/director/frame.cpp


diff --git a/engines/director/frame.cpp b/engines/director/frame.cpp
index 58c308ff69..c73812b7df 100644
--- a/engines/director/frame.cpp
+++ b/engines/director/frame.cpp
@@ -186,6 +186,9 @@ void Frame::readChannels(Common::ReadStreamEndian *stream) {
 	} else if (_vm->getVersion() == 4) {
 		// Sound/Tempo/Transition
 		int unk1 = stream->readByte();
+		if (unk1) {
+			warning("Frame::readChannels(): STUB: unk1: %d 0x%x", unk1, unk1);
+		}
 		_soundType1 = stream->readByte(); // type: 0x17 for sounds (sound is cast id), 0x16 for MIDI (sound is cmd id)
 		uint8 transFlags = stream->readByte(); // 0x80 is whole stage (vs changed area), rest is duration in 1/4ths of a second
 




More information about the Scummvm-git-logs mailing list