[Scummvm-git-logs] scummvm master -> ab9df75abae1c122491667230bcc3f8d9b353190

sev- noreply at scummvm.org
Wed Jul 1 21:42:42 UTC 2026


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .

Summary:
ab9df75aba DIRECTOR: Fix filmloop position shift when swapping cast member via Lingo


Commit: ab9df75abae1c122491667230bcc3f8d9b353190
    https://github.com/scummvm/scummvm/commit/ab9df75abae1c122491667230bcc3f8d9b353190
Author: ramyak-sharma (ramyaksharma1 at gmail.com)
Date: 2026-07-01T23:42:37+02:00

Commit Message:
DIRECTOR: Fix filmloop position shift when swapping cast member via Lingo

When set the castNum of sprite X to Y is called with a film loop cast
member, the sprite's _startPoint was not adjusted to account for the
difference in registration offset between the previous cast member
(top-left, 0,0) and the film loop (center, width/2, height/2).

Fix by saving the visual bbox before the cast swap in Channel::setCast(),
then adjusting _startPoint by the difference after the swap so the sprite
stays at the same visual position on screen.

Fixes position shift of animal sprites when clicking film loops in
shotgal.dir (guscarn-win).

Changed paths:
    engines/director/channel.cpp


diff --git a/engines/director/channel.cpp b/engines/director/channel.cpp
index 2d5b3936faa..02614e45a73 100644
--- a/engines/director/channel.cpp
+++ b/engines/director/channel.cpp
@@ -456,6 +456,10 @@ void Channel::setCast(CastMemberID memberID) {
 		_sprite->_cast->releaseWidget();
 
 	bool hasChanged = _sprite->_castId != memberID;
+
+	// Save bbox before swapping cast so we can restore visual position afterward.
+	Common::Rect oldBbox = getBbox();
+
 	// Replace the cast member in the sprite.
 	// Only change the dimensions if the "stretch" flag is set,
 	// indicating that the sprite has already been warped away from cast
@@ -464,6 +468,14 @@ void Channel::setCast(CastMemberID memberID) {
 	// those custom dimensions to stick around.
 	_sprite->setCast(memberID, !_sprite->_stretch);
 
+	// If the new cast member is a film loop, adjust _startPoint so the sprite
+	// stays at the same visual position regardless of registration offset changes.
+	if (hasChanged && _sprite->_cast && _sprite->_cast->_type == kCastFilmLoop) {
+		Common::Rect newBbox = getBbox();
+		_sprite->_startPoint.x += oldBbox.left - newBbox.left;
+		_sprite->_startPoint.y += oldBbox.top - newBbox.top;
+	}
+
 	// Duplicate of the special cases in setClean.
 	// Maybe it makes sense to force setClean to use setCast instead?
 	if (hasChanged && _sprite->_cast) {




More information about the Scummvm-git-logs mailing list