From bcd4a82075e92ad29ea080ade28da45dfee48896 Mon Sep 17 00:00:00 2001 From: Harishankar Kumar Date: Sat, 10 Jun 2023 02:39:03 +0530 Subject: [PATCH] DIRECTOR: remove puppet checks when setting sprite properties In original engine it is possible to set non-puppted sprite properties like position, backcolor etc and then call updatestage to update the screen according to property. This is undocumented behaviour which is not present depicted in any books however with rigorous testing it is found to be true. This change only persist for the current frame and once the playback head is moving the change is lost. `ATD\HD\bdDREAMA.DXR` of 'totaldistortion' used some of this quirk to display moving bullets. --- engines/director/channel.cpp | 32 +++++++++++++------------------- 1 file changed, 13 insertions(+), 19 deletions(-) diff --git a/engines/director/channel.cpp b/engines/director/channel.cpp index 2370268b403..58c6d010445 100644 --- a/engines/director/channel.cpp +++ b/engines/director/channel.cpp @@ -538,23 +538,19 @@ void Channel::replaceSprite(Sprite *nextSprite) { } void Channel::setWidth(int w) { - if (_sprite->_puppet) { - if (!(_sprite->_cast && _sprite->_cast->_type == kCastShape) && !_sprite->_stretch) - return; - _width = MAX(w, 0); - } + if (!(_sprite->_cast && _sprite->_cast->_type == kCastShape) && !_sprite->_stretch) + return; + _width = MAX(w, 0); } void Channel::setHeight(int h) { - if (_sprite->_puppet) { - if (!(_sprite->_cast && _sprite->_cast->_type == kCastShape) && !_sprite->_stretch) - return; - _height = MAX(h, 0); - } + if (!(_sprite->_cast && _sprite->_cast->_type == kCastShape) && !_sprite->_stretch) + return; + _height = MAX(h, 0); } void Channel::setBbox(int l, int t, int r, int b) { - if (_sprite->_puppet || _sprite->_stretch) { + if (_sprite->_stretch) { if (!(_sprite->_cast && _sprite->_cast->_type == kCastShape) && !_sprite->_stretch) return; _width = r - l; @@ -573,15 +569,13 @@ void Channel::setBbox(int l, int t, int r, int b) { } void Channel::setPosition(int x, int y, bool force) { - if (_sprite->_puppet || force) { - Common::Point newPos(x, y); - if (_constraint > 0 && _score && _constraint <= _score->_channels.size()) { - Common::Rect constraintBbox = _score->_channels[_constraint]->getBbox(); - newPos.x = MIN(constraintBbox.right, MAX(constraintBbox.left, newPos.x)); - newPos.y = MIN(constraintBbox.bottom, MAX(constraintBbox.top, newPos.y)); - } - _currentPoint = newPos; + Common::Point newPos(x, y); + if (_constraint > 0 && _score && _constraint <= _score->_channels.size()) { + Common::Rect constraintBbox = _score->_channels[_constraint]->getBbox(); + newPos.x = MIN(constraintBbox.right, MAX(constraintBbox.left, newPos.x)); + newPos.y = MIN(constraintBbox.bottom, MAX(constraintBbox.top, newPos.y)); } + _currentPoint = newPos; } // here is the place for deciding whether the widget can be keep or not