Skip to content

Commit

Permalink
DIRECTOR: Correctly return TextCast rectangle for D2/3.
Browse files Browse the repository at this point in the history
  • Loading branch information
stevenhoefel committed Mar 3, 2017
1 parent 64b970e commit aafd10d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
19 changes: 15 additions & 4 deletions engines/director/cast.cpp
Expand Up @@ -94,12 +94,23 @@ TextCast::TextCast(Common::ReadStreamEndian &stream, uint16 version) {
palinfo2 = stream.readUint16();
palinfo3 = stream.readUint16();

int t = stream.readUint32();
if (t != 0) { // In D2 there are values
warning("TextCast: t: %x", t);
if (version == 2) {
int t = stream.readUint16();
if (t != 0) { // In D2 there are values
warning("TextCast: t: %x", t);
}

initialRect = Score::readRect(stream);
stream.readUint16();
} else {
int t = stream.readUint32();
if (t != 0) { // In D2 there are values

This comment has been minimized.

Copy link
@bluegr

bluegr Mar 3, 2017

Member

This warning and comment looks a bit off here, since this code branch is not for D2

warning("TextCast: t: %x", t);
}

initialRect = Score::readRect(stream);
}

initialRect = Score::readRect(stream);
textShadow = static_cast<SizeType>(stream.readByte());
byte flags = stream.readByte();
if (flags & 0x1)
Expand Down
4 changes: 2 additions & 2 deletions engines/director/frame.cpp
Expand Up @@ -906,8 +906,8 @@ void Frame::renderText(Graphics::ManagedSurface &surface, uint16 spriteId, Commo

int x = _sprites[spriteId]->_startPoint.x; // +rectLeft;
int y = _sprites[spriteId]->_startPoint.y; // +rectTop;
int height = _sprites[spriteId]->_height;
int width = _sprites[spriteId]->_width;
int height = _sprites[spriteId]->_cast->initialRect.height(); //_sprites[spriteId]->_height;
int width = _sprites[spriteId]->_cast->initialRect.width(); //_sprites[spriteId]->_width;

if (_vm->getVersion() >= 4 && textSize != NULL)
width = textCast->initialRect.right;
Expand Down

0 comments on commit aafd10d

Please sign in to comment.