[Scummvm-git-logs] scummvm master -> 09ad067fa52a7cb32f226026b0d434736d06b93c
sev-
sev at scummvm.org
Mon Jun 1 16:53:06 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:
09ad067fa5 DIRECTOR: Coordinates are in fact signed. Check for sanity.
Commit: 09ad067fa52a7cb32f226026b0d434736d06b93c
https://github.com/scummvm/scummvm/commit/09ad067fa52a7cb32f226026b0d434736d06b93c
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2020-06-01T18:52:43+02:00
Commit Message:
DIRECTOR: Coordinates are in fact signed. Check for sanity.
Original parses negative widths and just skips such sprites.
Do the same.
Changed paths:
engines/director/frame.cpp
engines/director/sprite.h
diff --git a/engines/director/frame.cpp b/engines/director/frame.cpp
index 782a39f64b..fd66254553 100644
--- a/engines/director/frame.cpp
+++ b/engines/director/frame.cpp
@@ -285,13 +285,13 @@ void Frame::readChannels(Common::ReadStreamEndian *stream) {
sprite._castId = stream->readUint16();
- sprite._startPoint.y = stream->readUint16();
- sprite._startPoint.x = stream->readUint16();
+ sprite._startPoint.y = (int16)stream->readUint16();
+ sprite._startPoint.x = (int16)stream->readUint16();
sprite._currentPoint = sprite._startPoint;
- sprite._height = stream->readUint16();
- sprite._width = stream->readUint16();
+ sprite._height = (int16)stream->readUint16();
+ sprite._width = (int16)stream->readUint16();
if (_vm->getVersion() == 4) {
sprite._scriptId = stream->readUint16();
@@ -316,11 +316,11 @@ void Frame::readChannels(Common::ReadStreamEndian *stream) {
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._startPoint.y = (int16)stream->readUint16();
+ sprite._startPoint.x = (int16)stream->readUint16();
- sprite._height = stream->readUint16();
- sprite._width = stream->readUint16();
+ sprite._height = (int16)stream->readUint16();
+ sprite._width = (int16)stream->readUint16();
sprite._colorcode = stream->readByte();
sprite._blendAmount = stream->readByte();
@@ -338,11 +338,11 @@ void Frame::readChannels(Common::ReadStreamEndian *stream) {
/* uint32 spriteId = */stream->readUint32();
- sprite._startPoint.y = stream->readUint16();
- sprite._startPoint.x = stream->readUint16();
+ sprite._startPoint.y = (int16)stream->readUint16();
+ sprite._startPoint.x = (int16)stream->readUint16();
- sprite._height = stream->readUint16();
- sprite._width = stream->readUint16();
+ sprite._height = (int16)stream->readUint16();
+ sprite._width = (int16)stream->readUint16();
sprite._colorcode = stream->readByte();
sprite._blendAmount = stream->readByte();
@@ -350,6 +350,11 @@ void Frame::readChannels(Common::ReadStreamEndian *stream) {
stream->readByte(); // unused
}
+ // Sometimes removed sprites leave garbage in the channel
+ // We set it to zero, so then could skip
+ if (sprite._width <= 0 || sprite._height <= 0)
+ sprite._width = sprite._height = 0;
+
sprite._ink = static_cast<InkType>(sprite._inkData & 0x3f);
sprite._editable = ((sprite._colorcode & 0x40) == 0x40);
sprite._moveable = ((sprite._colorcode & 0x80) == 0x80);
diff --git a/engines/director/sprite.h b/engines/director/sprite.h
index c0f11922d9..2117ab1677 100644
--- a/engines/director/sprite.h
+++ b/engines/director/sprite.h
@@ -92,8 +92,8 @@ public:
Common::Point _currentPoint;
Common::Rect _startBbox;
Common::Rect _currentBbox;
- uint16 _width;
- uint16 _height;
+ int16 _width;
+ int16 _height;
// TODO: default constraint = 0, if turned on, sprite is constrainted to the bounding rect
// As i know, constrainted != 0 only if sprite moveable
byte _constraint;
More information about the Scummvm-git-logs
mailing list