DIRECTOR: LINGO: store comments from frame labels

In Director only the first line of a label is seen as the frame label.
The other lines are treated as comments.

The label comment is now shown with debugging ouput.
This commit is contained in:
Roland van Laar 2022-01-20 23:36:55 +01:00
parent 7fa0835be7
commit eaa602bb3d
2 changed files with 23 additions and 5 deletions

View File

@ -344,9 +344,10 @@ struct CastMemberInfo {
};
struct Label {
Common::String comment;
Common::String name;
uint16 number;
Label(Common::String name1, uint16 number1) { name = name1; number = number1; }
Label(Common::String name1, uint16 number1, Common::String comment1) { name = name1; number = number1; comment = comment1;}
};
class PaletteCastMember : public CastMember {

View File

@ -916,13 +916,30 @@ void Score::loadLabels(Common::SeekableReadStreamEndian &stream) {
stream.seek(stringPos);
Common::String label;
Common::String comment = "";
char ch;
for (uint32 j = stringPos; j < nextStringPos; j++) {
label += stream.readByte();
uint32 j = stringPos;
// handle label
while(j < nextStringPos) {
j++;
ch = stream.readByte();
if (ch == '\r')
break;
label += ch;
}
// handle label comments
while(j < nextStringPos) {
j++;
ch = stream.readByte();
if (ch == '\r')
ch = '\n';
comment += ch;
}
label = _movie->getCast()->decodeString(label).encode(Common::kUtf8);
_labels->insert(new Label(label, frame));
_labels->insert(new Label(label, frame, comment));
stream.seek(streamPos);
frame = nextFrame;
@ -933,7 +950,7 @@ void Score::loadLabels(Common::SeekableReadStreamEndian &stream) {
debugC(2, kDebugLoading, "****** Loading labels");
for (j = _labels->begin(); j != _labels->end(); ++j) {
debugC(2, kDebugLoading, "Frame %d, Label '%s'", (*j)->number, utf8ToPrintable((*j)->name).c_str());
debugC(2, kDebugLoading, "Frame %d, Label '%s', Comment '%s'", (*j)->number, utf8ToPrintable((*j)->name).c_str(), (*j)->comment.c_str());
}
}