DIRECTOR: use initialRect to represent sprite dimensions

This commit is contained in:
ysj1173886760 2021-06-22 21:49:49 +08:00 committed by Eugene Sandulenko
parent 2ea18a03fb
commit f097abea02

View File

@ -200,20 +200,8 @@ void Sprite::setCast(uint16 castId) {
// them properly.
if (_cast->_type != kCastShape) {
Common::Rect dims = _cast->getInitialRect();
//for the text cast members, we use the max number of size of the first sprite we saw and the initialRect, and we reset that cast too
// quite strange logic, but it's useful for now, but still we need to figure out the correct solution
if (_cast->_type == kCastButton || _cast->_type == kCastText) {
if (_cast->_boundingRect.isEmpty()) {
warning("Sprite::setCast(): trying to modify initialRect of cast with the first sprite size");
_cast->_boundingRect = Common::Rect(MAX<int>(_width, dims.width()), MAX<int>(_height, dims.height()));
_cast->_initialRect = _cast->_boundingRect;
}
_width = _cast->_initialRect.width();
_height = _cast->_initialRect.height();
} else {
_width = dims.width();
_height = dims.height();
}
_width = dims.width();
_height = dims.height();
}
} else {
warning("Sprite::setCast(): CastMember id %d(%s) has null member", castId, numToCastNum(castId));