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.
This commit is contained in:
Roland van Laar 2020-03-22 22:10:27 +01:00
parent 8eac9606bc
commit ec306cf4b3
2 changed files with 6 additions and 4 deletions

View File

@ -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();

View File

@ -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();