[Scummvm-git-logs] scummvm master -> ec306cf4b3b9c8ee044e64bc4b4fbe2db348893f

rvanlaar roland at rolandvanlaar.nl
Sun Mar 22 21:23:01 UTC 2020


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:
ec306cf4b3 DIRECTOR: make implicit transformColor explicit


Commit: ec306cf4b3b9c8ee044e64bc4b4fbe2db348893f
    https://github.com/scummvm/scummvm/commit/ec306cf4b3b9c8ee044e64bc4b4fbe2db348893f
Author: Roland van Laar (roland at rolandvanlaar.nl)
Date: 2020-03-22T22:20:29+01:00

Commit Message:
DIRECTOR: make implicit transformColor explicit

Color ids from director shapes and sprites need to be reversed
to be displayed correctly. The ids are stored as signed ints.
The original conversion to signed ints also reversed the ids:
       i.e. -128 .. 127 was transformed to 255 .. 0.

This commit converts the colors to signed ints,
the reversing itself is handled by the DirectorEngine::transformColor function.

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


diff --git a/engines/director/cast.cpp b/engines/director/cast.cpp
index 4c4cb8e4b6..16884117f5 100644
--- a/engines/director/cast.cpp
+++ b/engines/director/cast.cpp
@@ -298,8 +298,9 @@ ShapeCast::ShapeCast(Common::ReadStreamEndian &stream, uint16 version) {
 		_shapeType = static_cast<ShapeType>(stream.readByte());
 		_initialRect = Score::readRect(stream);
 		_pattern = stream.readUint16BE();
-		_fgCol = (127 - stream.readByte()) & 0xff; // -128 ... 127 -> 255 ... 0
-		_bgCol = (127 - stream.readByte()) & 0xff;
+		// Normalize D2 and D3 colors from -128 ... 127 to 0 ... 255.
+		_fgCol = g_director->transformColor((128 + stream.readByte()) & 0xff);
+		_bgCol = g_director->transformColor((128 + stream.readByte()) & 0xff);
 		_fillType = stream.readByte();
 		_ink = static_cast<InkType>(_fillType & 0x3f);
 		_lineThickness = stream.readByte();
diff --git a/engines/director/frame.cpp b/engines/director/frame.cpp
index c9b0556f1f..ec8d5fbf4e 100644
--- a/engines/director/frame.cpp
+++ b/engines/director/frame.cpp
@@ -205,8 +205,9 @@ void Frame::readChannels(Common::ReadStreamEndian *stream) {
 				sprite._foreColor = _vm->transformColor((uint8)stream->readByte());
 				sprite._backColor = _vm->transformColor((uint8)stream->readByte());
 			} else {
-				sprite._foreColor = (127 - stream->readByte()) & 0xff; // -128 ... 127 -> 255 ... 0
-				sprite._backColor = (127 - stream->readByte()) & 0xff;
+				// Normalize D2 and D3 colors from -128 ... 127 to 0 ... 255.
+				sprite._foreColor = _vm->transformColor((128 + stream->readByte()) & 0xff);
+				sprite._backColor = _vm->transformColor((128 + stream->readByte()) & 0xff);
 			}
 
 			sprite._flags = stream->readUint16();




More information about the Scummvm-git-logs mailing list