[Scummvm-git-logs] scummvm master -> 1cff1d2f4ce572021f049fd4b898634954018b37

sev- sev at scummvm.org
Wed Mar 25 01:02:07 UTC 2020


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

Summary:
05b3a648b7 DIRECTOR: More work on score parsing
d6461cdc8b DIRECTOR: Normalize reading of thickness and ink data reading from score
f069d431e1 DIRECTOR: Added score parsing for D6 sprites
bfce506fa9 DIRECTOR: Normalize score reading for D4
c54aa81b82 DIRECTOR: Stubbed D5 channels 0,1 reading
5272b6ef3e DIRECTOR: Normalize transition duration during load
1cff1d2f4c DIRECTOR: Added metadata for transitions


Commit: 05b3a648b734a37d81499ca14f2027438c491f2d
    https://github.com/scummvm/scummvm/commit/05b3a648b734a37d81499ca14f2027438c491f2d
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2020-03-25T02:01:44+01:00

Commit Message:
DIRECTOR: More work on score parsing

Changed paths:
    engines/director/frame.cpp
    engines/director/sprite.cpp
    engines/director/sprite.h


diff --git a/engines/director/frame.cpp b/engines/director/frame.cpp
index 2a5c4e8070..c41eb4fe95 100644
--- a/engines/director/frame.cpp
+++ b/engines/director/frame.cpp
@@ -121,6 +121,7 @@ void Frame::readChannels(Common::ReadStreamEndian *stream) {
 	byte unk[16];
 
 	if (_vm->getVersion() < 4) {
+		// Sound/Tempo/Transition
 		_actionId = stream->readByte();
 		_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
@@ -135,6 +136,10 @@ void Frame::readChannels(Common::ReadStreamEndian *stream) {
 		_tempo = stream->readByte();
 		_transType = static_cast<TransitionType>(stream->readByte());
 		_sound1 = stream->readUint16();
+
+		if (_tempo & 0x80 && _sound1 & 0x8000)
+			warning("D4-style transition");
+
 		if (_vm->getPlatform() == Common::kPlatformMacintosh) {
 			_sound2 = stream->readUint16();
 			_soundType2 = stream->readByte();
@@ -151,6 +156,7 @@ void Frame::readChannels(Common::ReadStreamEndian *stream) {
 			_soundType2 = stream->readByte();
 		}
 
+		// palette
 		uint16 palette = stream->readUint16();
 
 		if (palette) {
@@ -168,10 +174,17 @@ void Frame::readChannels(Common::ReadStreamEndian *stream) {
 
 		_palette->cycleCount = stream->readUint16();
 	} else if (_vm->getVersion() < 5) {
+		// Sound/Tempo/Transitio
+		// palette
 		stream->read(unk, 16);
 		_actionId = stream->readUint16();
 		stream->read(unk, 5);
 	} else {
+		// Sound[2]
+		// palette
+		// Transition
+		// Tempo
+		// Script
 		stream->read(unk, 16);
 		stream->read(unk, 16);
 		stream->read(unk, 10);
@@ -201,7 +214,7 @@ void Frame::readChannels(Common::ReadStreamEndian *stream) {
 			sprite._scriptId = stream->readByte();
 			sprite._spriteType = stream->readByte();
 			sprite._enabled = sprite._spriteType != 0;
-			if (_vm->getVersion() >= 4) {
+			if (_vm->getVersion() == 4) {
 				sprite._foreColor = _vm->transformColor((uint8)stream->readByte());
 				sprite._backColor = _vm->transformColor((uint8)stream->readByte());
 			} else {
@@ -226,30 +239,46 @@ void Frame::readChannels(Common::ReadStreamEndian *stream) {
 			sprite._height = stream->readUint16();
 			sprite._width = stream->readUint16();
 
-			if (_vm->getPlatform() == Common::kPlatformMacintosh && _vm->getVersion() >= 4) {
+			if (_vm->getPlatform() == Common::kPlatformMacintosh && _vm->getVersion() == 4) {
 				sprite._scriptId = stream->readUint16();
-				sprite._flags2 = stream->readByte(); // 0x40 editable, 0x80 moveable
-				sprite._unk2 = stream->readByte();
-				sprite._moveable = ((sprite._flags2 & 0x80) == 0x80);
+				// & 0x0f scorecolor
+				// 0x10 forecolor is rgb
+				// 0x20 bgcolor is rgb
+				// 0x40 editable
+				// 0x80 moveable
+				sprite._colorcode = stream->readByte();
+				sprite._blendAmount = stream->readByte();
+				sprite._moveable = ((sprite._colorcode & 0x80) == 0x80);
 
 				if (_vm->getVersion() >= 5)
 					sprite._unk3 = stream->readUint32();
 			}
 		} else {
-			stream->readUint16();
-			sprite._scriptId = stream->readByte();
 			sprite._spriteType = stream->readByte();
-			sprite._enabled = sprite._spriteType != 0;
+			sprite._flags = stream->readByte();
+			sprite._ink = static_cast<InkType>(sprite._flags & 0x3f);
+			if (sprite._flags & 0x40)
+				sprite._trails = 1;
+			else
+				sprite._trails = 0;
+
+			sprite._castIndex = stream->readUint16();
 			sprite._castId = stream->readUint16();
-			stream->readUint32();
-			sprite._flags = stream->readUint16();
+
+			sprite._scriptCastIndex = stream->readUint16();
+			sprite._scriptId = stream->readUint16();
+			sprite._foreColor = _vm->transformColor((uint8)stream->readByte());
+			sprite._backColor = _vm->transformColor((uint8)stream->readByte());
+
 			sprite._startPoint.y = stream->readUint16();
 			sprite._startPoint.x = stream->readUint16();
 			sprite._height = stream->readUint16();
 			sprite._width = stream->readUint16();
-			stream->readUint16();
-			stream->readUint16();
-
+			sprite._colorcode = stream->readByte();
+			sprite._blendAmount = stream->readByte();
+			sprite._moveable = ((sprite._colorcode & 0x80) == 0x80);
+			sprite._lineSize = stream->readByte();
+			stream->readByte();	// unused
 		}
 
 		if (sprite._castId) {
@@ -257,7 +286,7 @@ void Frame::readChannels(Common::ReadStreamEndian *stream) {
 				i + 1, sprite._castId, numToCastNum(sprite._castId), sprite._flags,
 				sprite._ink, sprite._trails, sprite._lineSize, sprite._width, sprite._height,
 				sprite._startPoint.x, sprite._startPoint.y,
-				sprite._spriteType, sprite._foreColor, sprite._backColor, sprite._scriptId, sprite._flags2, sprite._unk2, sprite._unk3);
+				sprite._spriteType, sprite._foreColor, sprite._backColor, sprite._scriptId, sprite._colorcode, sprite._blendAmount, sprite._unk3);
 		} else {
 			debugC(4, kDebugLoading, "CH: %-3d castId: 000", i + 1);
 		}
diff --git a/engines/director/sprite.cpp b/engines/director/sprite.cpp
index d953ebadaf..ada4685255 100644
--- a/engines/director/sprite.cpp
+++ b/engines/director/sprite.cpp
@@ -37,6 +37,7 @@ Sprite::Sprite() {
 	_constraint = 0;
 	_moveable = 0;
 	_castId = 0;
+	_castIndex = 0;
 	_backColor = 255;
 	_foreColor = 0;
 	_left = 0;
@@ -58,8 +59,9 @@ Sprite::Sprite() {
 	_lineSize = 1;
 
 	_scriptId = 0;
-	_flags2 = 0;
-	_unk2 = 0;
+	_scriptCastIndex = 0;
+	_colorcode = 0;
+	_blendAmount = 0;
 	_unk3 = 0;
 	_spriteType = 0;
 }
@@ -67,6 +69,7 @@ Sprite::Sprite() {
 Sprite::Sprite(const Sprite &sprite) {
 	_enabled = sprite._enabled;
 	_castId = sprite._castId;
+	_castIndex = sprite._castIndex;
 	_flags = sprite._flags;
 	_trails = sprite._trails;
 	_ink = sprite._ink;
@@ -97,8 +100,9 @@ Sprite::Sprite(const Sprite &sprite) {
 	_lineSize = sprite._lineSize;
 
 	_scriptId = sprite._scriptId;
-	_flags2 = sprite._flags2;
-	_unk2 = sprite._unk2;
+	_scriptCastIndex = sprite._scriptCastIndex;
+	_colorcode = sprite._colorcode;
+	_blendAmount = sprite._blendAmount;
 	_unk3 = sprite._unk3;
 	_spriteType = sprite._spriteType;
 }
diff --git a/engines/director/sprite.h b/engines/director/sprite.h
index 8ac0dcbb8a..3a21fc6208 100644
--- a/engines/director/sprite.h
+++ b/engines/director/sprite.h
@@ -67,12 +67,14 @@ public:
 	void setPattern(uint16 pattern);
 
 	uint16 _scriptId;
-	byte _flags2;  // x40 editable, 0x80 moveable
-	byte _unk2;
+	uint16 _scriptCastIndex;
+	byte _colorcode;  // x40 editable, 0x80 moveable
+	byte _blendAmount;
 	uint32 _unk3;
 
 	bool _enabled;
 	uint16 _castId;
+	uint16 _castIndex;
 	byte _spriteType;
 	InkType _ink;
 	uint16 _trails;


Commit: d6461cdc8b61e9cb4a1c46ac46b8b32160c8be91
    https://github.com/scummvm/scummvm/commit/d6461cdc8b61e9cb4a1c46ac46b8b32160c8be91
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2020-03-25T02:01:44+01:00

Commit Message:
DIRECTOR: Normalize reading of thickness and ink data reading from score

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


diff --git a/engines/director/frame.cpp b/engines/director/frame.cpp
index c41eb4fe95..d5ce0c0689 100644
--- a/engines/director/frame.cpp
+++ b/engines/director/frame.cpp
@@ -223,15 +223,8 @@ void Frame::readChannels(Common::ReadStreamEndian *stream) {
 				sprite._backColor = _vm->transformColor((128 + stream->readByte()) & 0xff);
 			}
 
-			sprite._flags = stream->readUint16();
-			sprite._ink = static_cast<InkType>(sprite._flags & 0x3f);
-
-			if (sprite._flags & 0x40)
-				sprite._trails = 1;
-			else
-				sprite._trails = 0;
-
-			sprite._lineSize = ((sprite._flags >> 8) & 0x07);
+			sprite._thickness = stream->readByte();
+			sprite._inkData = stream->readByte();
 
 			sprite._castId = stream->readUint16();
 			sprite._startPoint.y = stream->readUint16();
@@ -255,12 +248,7 @@ void Frame::readChannels(Common::ReadStreamEndian *stream) {
 			}
 		} else {
 			sprite._spriteType = stream->readByte();
-			sprite._flags = stream->readByte();
-			sprite._ink = static_cast<InkType>(sprite._flags & 0x3f);
-			if (sprite._flags & 0x40)
-				sprite._trails = 1;
-			else
-				sprite._trails = 0;
+			sprite._inkData = stream->readByte();
 
 			sprite._castIndex = stream->readUint16();
 			sprite._castId = stream->readUint16();
@@ -277,14 +265,22 @@ void Frame::readChannels(Common::ReadStreamEndian *stream) {
 			sprite._colorcode = stream->readByte();
 			sprite._blendAmount = stream->readByte();
 			sprite._moveable = ((sprite._colorcode & 0x80) == 0x80);
-			sprite._lineSize = stream->readByte();
+			sprite._thickness = stream->readByte();
 			stream->readByte();	// unused
 		}
 
+		sprite._ink = static_cast<InkType>(sprite._inkData & 0x3f);
+
+		if (sprite._inkData & 0x40)
+			sprite._trails = 1;
+		else
+			sprite._trails = 0;
+
+
 		if (sprite._castId) {
 			debugC(4, kDebugLoading, "CH: %-3d castId: %03d(%s) [flags:%04x [ink: %x trails: %d line: %d], %dx%d@%d,%d type: %d fg: %d bg: %d] script: %d, flags2: %x, unk2: %x, unk3: %x",
-				i + 1, sprite._castId, numToCastNum(sprite._castId), sprite._flags,
-				sprite._ink, sprite._trails, sprite._lineSize, sprite._width, sprite._height,
+				i + 1, sprite._castId, numToCastNum(sprite._castId), sprite._inkData,
+				sprite._ink, sprite._trails, sprite._thickness, sprite._width, sprite._height,
 				sprite._startPoint.x, sprite._startPoint.y,
 				sprite._spriteType, sprite._foreColor, sprite._backColor, sprite._scriptId, sprite._colorcode, sprite._blendAmount, sprite._unk3);
 		} else {
@@ -399,10 +395,11 @@ void Frame::readSprite(Common::SeekableSubReadStreamEndian &stream, uint16 offse
 			fieldPosition += 2;
 			break;
 		case kSpritePositionFlags:
-			sprite._flags = stream.readUint16();
-			sprite._ink = static_cast<InkType>(sprite._flags & 0x3f);
+			sprite._thickness = stream.readByte();
+			sprite._inkData = stream.readByte();
+			sprite._ink = static_cast<InkType>(sprite._inkData & 0x3f);
 
-			if (sprite._flags & 0x40)
+			if (sprite._inkData & 0x40)
 				sprite._trails = 1;
 			else
 				sprite._trails = 0;
@@ -436,7 +433,7 @@ void Frame::readSprite(Common::SeekableSubReadStreamEndian &stream, uint16 offse
 			break;
 		}
 	}
-	warning("Frame::readSprite(): %03d(%d)[%x,%x,%04x,%d/%d/%d/%d]", sprite._castId, sprite._enabled, x1, x2, sprite._flags, sprite._startPoint.x, sprite._startPoint.y, sprite._width, sprite._height);
+	warning("Frame::readSprite(): %03d(%d)[%x,%x,%02x %02x,%d/%d/%d/%d]", sprite._castId, sprite._enabled, x1, x2, sprite._thickness, sprite._inkData, sprite._startPoint.x, sprite._startPoint.y, sprite._width, sprite._height);
 
 }
 
@@ -571,7 +568,7 @@ void Frame::renderShape(Graphics::ManagedSurface &surface, uint16 spriteId) {
 	byte spriteType = sp->_spriteType;
 	byte foreColor = sp->_foreColor;
 	byte backColor = sp->_backColor;
-	int lineSize = sp->_lineSize;
+	int lineSize = sp->_thickness & 0x3;
 	if (spriteType == kCastMemberSprite && sp->_cast != NULL) {
 		switch (sp->_cast->_type) {
 		case kCastShape:
diff --git a/engines/director/lingo/lingo-the.cpp b/engines/director/lingo/lingo-the.cpp
index 63d97ce6f5..279f045f34 100644
--- a/engines/director/lingo/lingo-the.cpp
+++ b/engines/director/lingo/lingo-the.cpp
@@ -523,7 +523,7 @@ Datum Lingo::getTheSprite(Datum &id1, int field) {
 		d.u.i = sprite->_left;
 		break;
 	case kTheLineSize:
-		d.u.i = sprite->_lineSize;
+		d.u.i = sprite->_thickness & 0x3;
 		break;
 	case kTheLocH:
 		d.u.i = sprite->_startPoint.x;
@@ -640,7 +640,7 @@ void Lingo::setTheSprite(Datum &id1, int field, Datum &d) {
 		sprite->_left = d.u.i;
 		break;
 	case kTheLineSize:
-		sprite->_lineSize = d.u.i;
+		sprite->_thickness = d.u.i;
 		break;
 	case kTheLocH:
 		sprite->_startPoint.x = d.u.i;
diff --git a/engines/director/sprite.cpp b/engines/director/sprite.cpp
index ada4685255..49e69d809f 100644
--- a/engines/director/sprite.cpp
+++ b/engines/director/sprite.cpp
@@ -31,7 +31,7 @@ Sprite::Sprite() {
 	_trails = 0;
 	_width = 0;
 	_ink = kInkTypeCopy;
-	_flags = 0;
+	_inkData = 0;
 	_height = 0;
 	_castId = 0;
 	_constraint = 0;
@@ -56,7 +56,7 @@ Sprite::Sprite() {
 	_cast = nullptr;
 
 	_blend = 0;
-	_lineSize = 1;
+	_thickness = 0;
 
 	_scriptId = 0;
 	_scriptCastIndex = 0;
@@ -70,9 +70,9 @@ Sprite::Sprite(const Sprite &sprite) {
 	_enabled = sprite._enabled;
 	_castId = sprite._castId;
 	_castIndex = sprite._castIndex;
-	_flags = sprite._flags;
 	_trails = sprite._trails;
 	_ink = sprite._ink;
+	_inkData = sprite._inkData;
 	_width = sprite._width;
 	_height = sprite._height;
 	_startPoint.x = sprite._startPoint.x;
@@ -97,7 +97,7 @@ Sprite::Sprite(const Sprite &sprite) {
 	_moveable = sprite._moveable;
 	_blend = sprite._blend;
 	_startTime = sprite._startTime;
-	_lineSize = sprite._lineSize;
+	_thickness = sprite._thickness;
 
 	_scriptId = sprite._scriptId;
 	_scriptCastIndex = sprite._scriptCastIndex;
diff --git a/engines/director/sprite.h b/engines/director/sprite.h
index 3a21fc6208..2ebd8fbaff 100644
--- a/engines/director/sprite.h
+++ b/engines/director/sprite.h
@@ -76,12 +76,13 @@ public:
 	uint16 _castId;
 	uint16 _castIndex;
 	byte _spriteType;
+	byte _inkData;
 	InkType _ink;
 	uint16 _trails;
 
 	Cast *_cast;
 
-	uint16 _flags;
+	byte _thickness;
 	Common::Point _startPoint;
 	uint16 _width;
 	uint16 _height;
@@ -106,8 +107,7 @@ public:
 	uint16 _stopTime;
 	byte _volume;
 	byte _stretch;
-	// Using in shape sprites
-	byte _lineSize;
+
 	// Using in text sprites
 	Common::String _editableText;
 };


Commit: f069d431e180b2b1b30577b1de53cc2ce844b20a
    https://github.com/scummvm/scummvm/commit/f069d431e180b2b1b30577b1de53cc2ce844b20a
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2020-03-25T02:01:44+01:00

Commit Message:
DIRECTOR: Added score parsing for D6 sprites

Changed paths:
    engines/director/frame.cpp


diff --git a/engines/director/frame.cpp b/engines/director/frame.cpp
index d5ce0c0689..41bd0336a1 100644
--- a/engines/director/frame.cpp
+++ b/engines/director/frame.cpp
@@ -227,8 +227,10 @@ void Frame::readChannels(Common::ReadStreamEndian *stream) {
 			sprite._inkData = stream->readByte();
 
 			sprite._castId = stream->readUint16();
+
 			sprite._startPoint.y = stream->readUint16();
 			sprite._startPoint.x = stream->readUint16();
+
 			sprite._height = stream->readUint16();
 			sprite._width = stream->readUint16();
 
@@ -241,12 +243,8 @@ void Frame::readChannels(Common::ReadStreamEndian *stream) {
 				// 0x80 moveable
 				sprite._colorcode = stream->readByte();
 				sprite._blendAmount = stream->readByte();
-				sprite._moveable = ((sprite._colorcode & 0x80) == 0x80);
-
-				if (_vm->getVersion() >= 5)
-					sprite._unk3 = stream->readUint32();
 			}
-		} else {
+		} else if (_vm->getVersion() == 5) {
 			sprite._spriteType = stream->readByte();
 			sprite._inkData = stream->readByte();
 
@@ -255,13 +253,38 @@ void Frame::readChannels(Common::ReadStreamEndian *stream) {
 
 			sprite._scriptCastIndex = stream->readUint16();
 			sprite._scriptId = stream->readUint16();
+
 			sprite._foreColor = _vm->transformColor((uint8)stream->readByte());
 			sprite._backColor = _vm->transformColor((uint8)stream->readByte());
 
 			sprite._startPoint.y = stream->readUint16();
 			sprite._startPoint.x = stream->readUint16();
+
 			sprite._height = stream->readUint16();
 			sprite._width = stream->readUint16();
+
+			sprite._colorcode = stream->readByte();
+			sprite._blendAmount = stream->readByte();
+			sprite._thickness = stream->readByte();
+			stream->readByte();	// unused
+		} else if (_vm->getVersion() == 6) {
+			sprite._spriteType = stream->readByte();
+			sprite._inkData = stream->readByte();
+
+			sprite._foreColor = _vm->transformColor((uint8)stream->readByte());
+			sprite._backColor = _vm->transformColor((uint8)stream->readByte());
+
+			sprite._castIndex = stream->readUint16();
+			sprite._castId = stream->readUint16();
+
+			/* uint32 spriteId = */stream->readUint32();
+
+			sprite._startPoint.y = stream->readUint16();
+			sprite._startPoint.x = stream->readUint16();
+
+			sprite._height = stream->readUint16();
+			sprite._width = stream->readUint16();
+
 			sprite._colorcode = stream->readByte();
 			sprite._blendAmount = stream->readByte();
 			sprite._moveable = ((sprite._colorcode & 0x80) == 0x80);
@@ -276,6 +299,7 @@ void Frame::readChannels(Common::ReadStreamEndian *stream) {
 		else
 			sprite._trails = 0;
 
+		sprite._moveable = ((sprite._colorcode & 0x80) == 0x80);
 
 		if (sprite._castId) {
 			debugC(4, kDebugLoading, "CH: %-3d castId: %03d(%s) [flags:%04x [ink: %x trails: %d line: %d], %dx%d@%d,%d type: %d fg: %d bg: %d] script: %d, flags2: %x, unk2: %x, unk3: %x",


Commit: bfce506fa9d5e8878986e3258e24d8038d6d26ea
    https://github.com/scummvm/scummvm/commit/bfce506fa9d5e8878986e3258e24d8038d6d26ea
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2020-03-25T02:01:44+01:00

Commit Message:
DIRECTOR: Normalize score reading for D4

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


diff --git a/engines/director/frame.cpp b/engines/director/frame.cpp
index 41bd0336a1..0635b49036 100644
--- a/engines/director/frame.cpp
+++ b/engines/director/frame.cpp
@@ -58,6 +58,12 @@ Frame::Frame(DirectorEngine *vm, int numChannels) {
 
 	_palette = NULL;
 
+	_colorTempo = 0;
+	_colorSound1 = 0;
+	_colorSound2 = 0;
+	_colorScript = 0;
+	_colorTrans = 0;
+
 	_sprites.resize(_numChannels + 1);
 
 	for (uint16 i = 0; i < _sprites.size(); i++) {
@@ -81,6 +87,13 @@ Frame::Frame(const Frame &frame) {
 	_soundType2 = frame._soundType2;
 	_skipFrameFlag = frame._skipFrameFlag;
 	_blend = frame._blend;
+
+	_colorTempo = frame._colorTempo;
+	_colorSound1 = frame._colorSound1;
+	_colorSound2 = frame._colorSound2;
+	_colorScript = frame._colorScript;
+	_colorTrans = frame._colorTrans;
+
 	_palette = new PaletteInfo();
 
 	debugC(1, kDebugLoading, "Frame. action: %d transType: %d transDuration: %d", _actionId, _transType, _transDuration);
@@ -137,9 +150,6 @@ void Frame::readChannels(Common::ReadStreamEndian *stream) {
 		_transType = static_cast<TransitionType>(stream->readByte());
 		_sound1 = stream->readUint16();
 
-		if (_tempo & 0x80 && _sound1 & 0x8000)
-			warning("D4-style transition");
-
 		if (_vm->getPlatform() == Common::kPlatformMacintosh) {
 			_sound2 = stream->readUint16();
 			_soundType2 = stream->readByte();
@@ -173,12 +183,70 @@ void Frame::readChannels(Common::ReadStreamEndian *stream) {
 		_palette->frameCount = stream->readUint16();
 
 		_palette->cycleCount = stream->readUint16();
-	} else if (_vm->getVersion() < 5) {
-		// Sound/Tempo/Transitio
-		// palette
-		stream->read(unk, 16);
+
+		stream->read(unk, 6);
+
+		if (_vm->getPlatform() == Common::kPlatformMacintosh)
+			stream->read(unk, 3);
+	} else if (_vm->getVersion() == 4) {
+		// Sound/Tempo/Transition
+		_actionId = stream->readByte();
+		_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
+
+		if (transFlags & 0x80)
+			_transArea = 1;
+		else
+			_transArea = 0;
+		_transDuration = transFlags & 0x7f;
+
+		_transChunkSize = stream->readByte();
+		_tempo = stream->readByte();
+		_transType = static_cast<TransitionType>(stream->readByte());
+		_sound1 = stream->readUint16();
+
+		_sound2 = stream->readUint16();
+		_soundType2 = stream->readByte();
+
+		_skipFrameFlag = stream->readByte();
+		_blend = stream->readByte();
+
+		_colorTempo = stream->readByte();
+		_colorSound1 = stream->readByte();
+		_colorSound2 = stream->readByte();
+
 		_actionId = stream->readUint16();
-		stream->read(unk, 5);
+
+		_colorScript = stream->readByte();
+		_colorTrans = stream->readByte();
+
+		// palette
+		uint16 palette = stream->readUint16();
+
+		if (palette) {
+			warning("Frame::readChannels(): STUB: Palette info");
+		}
+
+		debugC(8, kDebugLoading, "Frame::readChannels(): %d %d %d %d %d %d %d %d %d %d %d", _actionId, _soundType1, _transDuration, _transChunkSize, _tempo, _transType, _sound1, _skipFrameFlag, _blend, _sound2, _soundType2);
+
+		_palette = new PaletteInfo();
+		_palette->firstColor = stream->readByte(); // for cycles. note: these start at 0x80 (for pal entry 0)!
+		_palette->lastColor = stream->readByte();
+		_palette->flags = stream->readByte();
+		_palette->speed = stream->readByte();
+		_palette->frameCount = stream->readUint16();
+
+		_palette->cycleCount = stream->readUint16();
+		_palette->fade = stream->readByte();
+		_palette->delay = stream->readByte();
+		_palette->style = stream->readByte();
+
+		stream->readByte();
+		stream->readUint16();
+		stream->readUint16();
+
+		_palette->colorCode = stream->readByte();
+		stream->readByte();
 	} else {
 		// Sound[2]
 		// palette
@@ -188,22 +256,10 @@ void Frame::readChannels(Common::ReadStreamEndian *stream) {
 		stream->read(unk, 16);
 		stream->read(unk, 16);
 		stream->read(unk, 10);
-	}
-
 
-	stream->read(unk, 6);
-
-	if (_vm->getPlatform() == Common::kPlatformMacintosh) {
-		if (_vm->getVersion() < 4) {
-			stream->read(unk, 3);
-		} else {
+		if (_vm->getPlatform() == Common::kPlatformMacintosh) {
 			stream->read(unk, 11);
-			//Common::hexdump(unk, 11);
-
-			if (_vm->getVersion() >= 5) {
-				stream->read(unk, 7);
-				//Common::hexdump(unk, 7);
-			}
+			stream->read(unk, 7);
 		}
 	}
 
diff --git a/engines/director/frame.h b/engines/director/frame.h
index fde5432015..ba98be4cd5 100644
--- a/engines/director/frame.h
+++ b/engines/director/frame.h
@@ -47,12 +47,16 @@ enum {
 };
 
 struct PaletteInfo {
-	uint8 firstColor;
-	uint8 lastColor;
-	uint8 flags;
-	uint8 speed;
+	byte firstColor;
+	byte lastColor;
+	byte flags;
+	byte speed;
 	uint16 frameCount;
 	uint16 cycleCount;
+	byte fade;
+	byte delay;
+	byte style;
+	byte colorCode;
 };
 
 struct FrameEntity {
@@ -110,6 +114,12 @@ public:
 	uint16 _sound2;
 	uint8 _soundType2;
 
+	byte _colorTempo;
+	byte _colorSound1;
+	byte _colorSound2;
+	byte _colorScript;
+	byte _colorTrans;
+
 	uint8 _skipFrameFlag;
 	uint8 _blend;
 	Common::Array<Sprite *> _sprites;


Commit: c54aa81b8296b8275e8201b08d019027fc4229a4
    https://github.com/scummvm/scummvm/commit/c54aa81b8296b8275e8201b08d019027fc4229a4
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2020-03-25T02:01:44+01:00

Commit Message:
DIRECTOR: Stubbed D5 channels 0,1 reading

Changed paths:
    engines/director/frame.cpp


diff --git a/engines/director/frame.cpp b/engines/director/frame.cpp
index 0635b49036..0f12ee7421 100644
--- a/engines/director/frame.cpp
+++ b/engines/director/frame.cpp
@@ -131,7 +131,7 @@ void Frame::readChannel(Common::SeekableSubReadStreamEndian &stream, uint16 offs
 }
 
 void Frame::readChannels(Common::ReadStreamEndian *stream) {
-	byte unk[16];
+	byte unk[48];
 
 	if (_vm->getVersion() < 4) {
 		// Sound/Tempo/Transition
@@ -247,20 +247,18 @@ void Frame::readChannels(Common::ReadStreamEndian *stream) {
 
 		_palette->colorCode = stream->readByte();
 		stream->readByte();
+	} else if (_vm->getVersion() == 5) {
+		// Sound/Tempo/Transition channel
+		stream->read(unk, 24);
+
+		// palette
+		stream->read(unk, 24);
 	} else {
 		// Sound[2]
 		// palette
 		// Transition
 		// Tempo
 		// Script
-		stream->read(unk, 16);
-		stream->read(unk, 16);
-		stream->read(unk, 10);
-
-		if (_vm->getPlatform() == Common::kPlatformMacintosh) {
-			stream->read(unk, 11);
-			stream->read(unk, 7);
-		}
 	}
 
 	for (int i = 0; i < _numChannels; i++) {


Commit: 5272b6ef3e34ce5d06ca0fd3a189a9fe9bb9bcff
    https://github.com/scummvm/scummvm/commit/5272b6ef3e34ce5d06ca0fd3a189a9fe9bb9bcff
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2020-03-25T02:01:44+01:00

Commit Message:
DIRECTOR: Normalize transition duration during load

Changed paths:
    engines/director/frame.cpp
    engines/director/frame.h
    engines/director/transitions.cpp


diff --git a/engines/director/frame.cpp b/engines/director/frame.cpp
index 0f12ee7421..79bcb726ac 100644
--- a/engines/director/frame.cpp
+++ b/engines/director/frame.cpp
@@ -143,7 +143,7 @@ void Frame::readChannels(Common::ReadStreamEndian *stream) {
 			_transArea = 1;
 		else
 			_transArea = 0;
-		_transDuration = transFlags & 0x7f;
+		_transDuration = (transFlags & 0x7f) * 250; // Duration is in 1/4 secs
 
 		_transChunkSize = stream->readByte();
 		_tempo = stream->readByte();
@@ -198,7 +198,7 @@ void Frame::readChannels(Common::ReadStreamEndian *stream) {
 			_transArea = 1;
 		else
 			_transArea = 0;
-		_transDuration = transFlags & 0x7f;
+		_transDuration = (transFlags & 0x7f) * 250; // Duration is 1/4 secs
 
 		_transChunkSize = stream->readByte();
 		_tempo = stream->readByte();
@@ -261,6 +261,9 @@ void Frame::readChannels(Common::ReadStreamEndian *stream) {
 		// Script
 	}
 
+	_transChunkSize = CLIP<byte>(_transChunkSize, 0, 128);
+	_transDuration = CLIP<uint16>(_transDuration, 0, 32000);  // restrict to 32 secs
+
 	for (int i = 0; i < _numChannels; i++) {
 		Sprite &sprite = *_sprites[i + 1];
 
@@ -386,7 +389,7 @@ void Frame::readMainChannels(Common::SeekableSubReadStreamEndian &stream, uint16
 					_transArea = 1;
 				else
 					_transArea = 0;
-				_transDuration = transFlags & 0x7f;
+				_transDuration = (transFlags & 0x7f) * 250; // Duration is in 1/4 secs
 				offset++;
 			}
 			break;
diff --git a/engines/director/frame.h b/engines/director/frame.h
index ba98be4cd5..fb9cdd253d 100644
--- a/engines/director/frame.h
+++ b/engines/director/frame.h
@@ -102,7 +102,7 @@ public:
 	int _numChannels;
 	byte _channelData[kChannelDataSize];
 	uint8 _actionId;
-	uint8 _transDuration;
+	uint16 _transDuration;
 	uint8 _transArea; // 1 - Whole Stage, 0 - Changing Area
 	uint8 _transChunkSize;
 	TransitionType _transType;
diff --git a/engines/director/transitions.cpp b/engines/director/transitions.cpp
index 88663ae9b4..d55466c475 100644
--- a/engines/director/transitions.cpp
+++ b/engines/director/transitions.cpp
@@ -32,8 +32,7 @@
 namespace Director {
 
 void Frame::playTransition(Score *score) {
-	uint16 duration = _transDuration * 250; // _transDuration in 1/4 of sec
-	duration = (duration == 0 ? 250 : duration); // director supports transition duration = 0, but animation play like value = 1, idk.
+	uint16 duration = MAX<uint16>(250, _transDuration); // When duration is < 1/4s, make it 1/4
 
 	if (_transChunkSize == 0)
 		_transChunkSize = 1; // equal to 1 step


Commit: 1cff1d2f4ce572021f049fd4b898634954018b37
    https://github.com/scummvm/scummvm/commit/1cff1d2f4ce572021f049fd4b898634954018b37
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2020-03-25T02:01:44+01:00

Commit Message:
DIRECTOR: Added metadata for transitions

Changed paths:
    engines/director/transitions.cpp


diff --git a/engines/director/transitions.cpp b/engines/director/transitions.cpp
index d55466c475..6fc99c94d6 100644
--- a/engines/director/transitions.cpp
+++ b/engines/director/transitions.cpp
@@ -31,6 +31,117 @@
 
 namespace Director {
 
+enum TransitionAlgo {
+	kTransAlgoBlinds,
+	kTransAlgoBoxy,
+	kTransAlgoBuildStrips,
+	kTransAlgoCenterOut,
+	kTransAlgoCheckerBoard,
+	kTransAlgoCover,
+	kTransAlgoDissolve,
+	kTransAlgoEdgesIn,
+	kTransAlgoPush,
+	kTransAlgoRandomLines,
+	kTransAlgoReveal,
+	kTransAlgoWipe,
+	kTransAlgoZoom
+};
+
+enum TransitionDirection {
+	kTransDirBits,
+	kTransDirBitsFast,
+	kTransDirBottomBuildLeft,
+	kTransDirBottomBuildRight,
+	kTransDirEast,
+	kTransDirHorizontal,
+	kTransDirIn,
+	kTransDirLeftBuildDown,
+	kTransDirLeftBuildUp,
+	kTransDirNormal,
+	kTransDirNorth,
+	kTransDirNorthEast,
+	kTransDirNorthWest,
+	kTransDirOut,
+	kTransDirPattern,
+	kTransDirPixels,
+	kTransDirPixelsFast,
+	kTransDirRectangular,
+	kTransDirRightBuildDown,
+	kTransDirRightBuildUp,
+	kTransDirSouth,
+	kTransDirSouthEast,
+	kTransDirSouthWest,
+	kTransDirSquare,
+	kTransDirSymmetrical,
+	kTransDirTopBuildLeft,
+	kTransDirTopBuildRight,
+	kTransDirVertical,
+	kTransDirWest
+};
+
+#define TRANS(t,a,d) {t,#t,a,d}
+
+struct {
+	TransitionType type;
+	const char *name;
+	TransitionAlgo algo;
+	TransitionDirection dir;
+} static const transProps[] = {
+	TRANS(kTransNone, 					kTransAlgoWipe,		kTransDirEast),
+	TRANS(kTransWipeRight, 				kTransAlgoWipe,		kTransDirEast),
+	TRANS(kTransWipeLeft,				kTransAlgoWipe,		kTransDirWest),
+	TRANS(kTransWipeDown,				kTransAlgoWipe,		kTransDirSouth),
+	TRANS(kTransWipeUp,					kTransAlgoWipe,		kTransDirNorth),
+	TRANS(kTransCenterOutHorizontal, 	kTransAlgoCenterOut,kTransDirHorizontal),	// 5
+	TRANS(kTransEdgesInHorizontal, 		kTransAlgoEdgesIn,	kTransDirHorizontal),
+	TRANS(kTransCenterOutVertical,		kTransAlgoCenterOut,kTransDirVertical),
+	TRANS(kTransEdgesInVertical,		kTransAlgoEdgesIn,	kTransDirVertical),
+	TRANS(kTransCenterOutSquare,		kTransAlgoCenterOut,kTransDirSymmetrical),
+	TRANS(kTransEdgesInSquare,			kTransAlgoEdgesIn,	kTransDirSymmetrical),	// 10
+	TRANS(kTransPushLeft,				kTransAlgoPush,		kTransDirWest),
+	TRANS(kTransPushRight,				kTransAlgoPush,		kTransDirEast),
+	TRANS(kTransPushDown,				kTransAlgoPush,		kTransDirSouth),
+	TRANS(kTransPushUp,					kTransAlgoPush,		kTransDirNorth),
+	TRANS(kTransRevealUp,				kTransAlgoReveal,	kTransDirNorth),		// 15
+	TRANS(kTransRevealUpRight,			kTransAlgoReveal,	kTransDirNorthEast),
+	TRANS(kTransRevealRight,			kTransAlgoReveal,	kTransDirEast),
+	TRANS(kTransRevealDown,				kTransAlgoReveal,	kTransDirSouthEast),
+	TRANS(kTransRevealDownRight,		kTransAlgoReveal,	kTransDirSouth),
+	TRANS(kTransRevealDownLeft,			kTransAlgoReveal,	kTransDirSouthWest),	// 20
+	TRANS(kTransRevealLeft,				kTransAlgoReveal,	kTransDirWest),
+	TRANS(kTransRevealUpLeft,			kTransAlgoReveal,	kTransDirNorthWest),
+	TRANS(kTransDissolvePixelsFast,		kTransAlgoDissolve,	kTransDirPixelsFast),
+	TRANS(kTransDissolveBoxyRects,		kTransAlgoBoxy,		kTransDirRectangular),
+	TRANS(kTransDissolveBoxySquares,	kTransAlgoBoxy,		kTransDirSquare),		// 25
+	TRANS(kTransDissolvePatterns,		kTransAlgoDissolve,	kTransDirPattern),
+	TRANS(kTransRandomRows,				kTransAlgoRandomLines,kTransDirHorizontal),
+	TRANS(kTransRandomColumns,			kTransAlgoRandomLines,kTransDirVertical),
+	TRANS(kTransCoverDown,				kTransAlgoCover,	kTransDirSouth),
+	TRANS(kTransCoverDownLeft,			kTransAlgoCover,	kTransDirSouthWest),	// 30
+	TRANS(kTransCoverDownRight,			kTransAlgoCover,	kTransDirSouthEast),
+	TRANS(kTransCoverLeft,				kTransAlgoCover,	kTransDirWest),
+	TRANS(kTransCoverRight,				kTransAlgoCover,	kTransDirEast),
+	TRANS(kTransCoverUp,				kTransAlgoCover,	kTransDirNorth),
+	TRANS(kTransCoverUpLeft,			kTransAlgoCover,	kTransDirNorthWest),	// 35
+	TRANS(kTransCoverUpRight,			kTransAlgoCover,	kTransDirNorthEast),
+	TRANS(kTransTypeVenitianBlind,		kTransAlgoBlinds,	kTransDirHorizontal),
+	TRANS(kTransTypeCheckerboard,		kTransAlgoCheckerBoard, kTransDirNormal),
+	TRANS(kTransTypeStripsBottomBuildLeft, kTransAlgoBuildStrips, kTransDirBottomBuildLeft),
+	TRANS(kTransTypeStripsBottomBuildRight, kTransAlgoBuildStrips, kTransDirBottomBuildRight), // 40
+	TRANS(kTransTypeStripsLeftBuildDown, kTransAlgoBuildStrips, kTransDirLeftBuildDown),
+	TRANS(kTransTypeStripsLeftBuildUp, kTransAlgoBuildStrips, kTransDirLeftBuildUp),
+	TRANS(kTransTypeStripsRightBuildDown, kTransAlgoBuildStrips, kTransDirRightBuildDown),
+	TRANS(kTransTypeStripsRightBuildUp, kTransAlgoBuildStrips, kTransDirRightBuildUp),
+	TRANS(kTransTypeStripsTopBuildLeft,	kTransAlgoBuildStrips, kTransDirTopBuildLeft),// 45
+	TRANS(kTransTypeStripsTopBuildRight, kTransAlgoBuildStrips, kTransDirTopBuildRight),
+	TRANS(kTransZoomOpen,				kTransAlgoZoom,		kTransDirIn),
+	TRANS(kTransZoomClose,				kTransAlgoZoom,		kTransDirOut),
+	TRANS(kTransVerticalBinds,			kTransAlgoBlinds,	kTransDirVertical),
+	TRANS(kTransDissolveBitsTrans,		kTransAlgoDissolve,	kTransDirBitsFast),		// 50
+	TRANS(kTransDissolvePixels,			kTransAlgoDissolve,	kTransDirPixels),
+	TRANS(kTransDissolveBits,			kTransAlgoDissolve,	kTransDirBits)
+};
+
 void Frame::playTransition(Score *score) {
 	uint16 duration = MAX<uint16>(250, _transDuration); // When duration is < 1/4s, make it 1/4
 
@@ -223,12 +334,12 @@ void Frame::playTransition(Score *score) {
 
 	case kTransDissolvePixels: // 51
 		{
-			warning("Frame::playTransition(): Unhandled transition type kTransDissolvePixels %d %d", duration, _transChunkSize);
+			warning("Frame::playTransition(): Unhandled transition type %s %d %d", transProps[_transType].name, duration, _transChunkSize);
 		}
 		break;
 
 	default:
-		warning("Frame::playTransition(): Unhandled transition type %d %d %d", _transType, duration, _transChunkSize);
+		warning("Frame::playTransition(): Unhandled transition type %s %d %d", transProps[_transType].name, duration, _transChunkSize);
 		break;
 
 	}




More information about the Scummvm-git-logs mailing list