DIRECTOR: Address undrawing edge case

When the castId of a puppeted sprite changes, we want to undraw the old sprite
before taking on the new bounding box.
This commit is contained in:
Nathanael Gentry committed 2020-06-17 22:38:48 -04:00
1 parent 2e86cf35a4
commit 1afefb7852
3 files changed
+18 -9

No files matched your search

+1
View File
@@ -827,6 +827,7 @@ void Lingo::setTheSprite(Datum &id1, int field, Datum &d) {
sprite->_blend = d.asInt();
break;
case kTheCastNum:
score->unrenderSprite(id);
sprite->setCast(d.asInt());
break;
case kTheConstraint:
+16 -9
View File
@@ -566,15 +566,11 @@ void Score::renderFrame(uint16 frameId, bool forceUpdate, bool updateStageOnly)
needsUpdate = needsUpdate || (currentSprite->_ink == kInkTypeReverse);
if (needsUpdate || forceUpdate) {
if (!currentSprite->_trails) {
Common::Rect currentBbox = channel->getBbox();
_maskSurface->fillRect(currentBbox, 1);
_surface->fillRect(currentBbox, _stageColor);
}
}
unrenderSprite(i);
channel->_sprite = nextSprite;
channel->updateLocation();
channel->_sprite = nextSprite;
channel->updateLocation();
}
}
for (uint id = 0; id < _channels.size(); id++) {
@@ -588,7 +584,7 @@ void Score::renderFrame(uint16 frameId, bool forceUpdate, bool updateStageOnly)
// Sprites marked moveable are constrained to the same bounding box until
// the moveable is disabled
if (!sprite->_moveable)
if (!sprite->_puppet && !sprite->_moveable)
channel->_currentPoint = sprite->_startPoint;
Common::Rect currentBbox = channel->getBbox();
@@ -630,6 +626,17 @@ void Score::renderFrame(uint16 frameId, bool forceUpdate, bool updateStageOnly)
g_system->copyRectToScreen(_surface->getPixels(), _surface->pitch, 0, 0, _surface->getBounds().width(), _surface->getBounds().height());
}
void Score::unrenderSprite(int spriteId) {
Channel *channel = _channels[spriteId];
Sprite *currentSprite = channel->_sprite;
if (!currentSprite->_trails) {
Common::Rect currentBbox = channel->getBbox();
_maskSurface->fillRect(currentBbox, 1);
_surface->fillRect(currentBbox, _stageColor);
}
}
void Score::renderShape(uint16 spriteId) {
Sprite *sp = _channels[spriteId]->_sprite;
+1
View File
@@ -146,6 +146,7 @@ public:
Cast *getCastMember(int castId);
const Stxt *getStxt(int castId);
void renderFrame(uint16 frameId, bool forceUpdate = false, bool updateStageOnly = false);
void unrenderSprite(int spriteId);
private:
void update();