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

ysj1173886760 42030331+ysj1173886760 at users.noreply.github.com
Wed Jul 21 12:44:15 UTC 2021


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

Summary:
4cbc1cc5ff DIRECTOR: clean the code.
a96793a4d5 DIRECTOR: fix calculating registeration offset for scale bitmap castmember.
e8bfee1742 DIRECTOR: keep update sprite info when we are dealing with QDShape


Commit: 4cbc1cc5ff04e90eafe45cbc9d40a5019cbfe880
    https://github.com/scummvm/scummvm/commit/4cbc1cc5ff04e90eafe45cbc9d40a5019cbfe880
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-07-21T20:43:56+08:00

Commit Message:
DIRECTOR: clean the code.

Changed paths:
    engines/director/sound.cpp
    engines/director/sound.h


diff --git a/engines/director/sound.cpp b/engines/director/sound.cpp
index 609328c87f..2f0ab2049e 100644
--- a/engines/director/sound.cpp
+++ b/engines/director/sound.cpp
@@ -103,6 +103,9 @@ void DirectorSound::playStream(Audio::AudioStream &stream, uint8 soundChannel) {
 }
 
 void DirectorSound::playCastMember(CastMemberID memberID, uint8 soundChannel, bool allowRepeat) {
+	if (!isChannelValid(soundChannel))
+		return;
+
 	if (memberID.member == 0) {
 		stopSound(soundChannel);
 	} else {
@@ -111,7 +114,7 @@ void DirectorSound::playCastMember(CastMemberID memberID, uint8 soundChannel, bo
 			if (soundCast->_type != kCastSound) {
 				warning("DirectorSound::playCastMember: attempted to play a non-SoundCastMember %s", memberID.asString().c_str());
 			} else {
-				if (!allowRepeat && lastPlayingCast(soundChannel) == memberID && !_channels[soundChannel - 1]._movieChanged)
+				if (!allowRepeat && checkLastPlayCast(soundChannel, memberID))
 					return;
 				bool looping = ((SoundCastMember *)soundCast)->_looping;
 				AudioDecoder *ad = ((SoundCastMember *)soundCast)->_audio;
@@ -128,8 +131,7 @@ void DirectorSound::playCastMember(CastMemberID memberID, uint8 soundChannel, bo
 					return;
 				}
 				playStream(*as, soundChannel);
-				_channels[soundChannel - 1].lastPlayingCast = memberID;
-				_channels[soundChannel - 1]._movieChanged = false;
+				setLastPlayCast(soundChannel, memberID);
 			}
 		} else {
 			warning("DirectorSound::playCastMember: couldn't find %s", memberID.asString().c_str());
@@ -253,12 +255,11 @@ void DirectorSound::playExternalSound(AudioDecoder *ad, uint8 soundChannel, uint
 
 	// use castMemberID info to check, castLib -1 represent for externalSound
 	// this should be amended by some kind of union which contains CastMemberID and externalSound info
-	if (isChannelActive(soundChannel) && (lastPlayingCast(soundChannel) == CastMemberID(externalSoundID, -1)) && !_channels[soundChannel - 1]._movieChanged)
+	if (isChannelActive(soundChannel) && checkLastPlayCast(soundChannel, CastMemberID(externalSoundID, -1)))
 		return;
 
 	playStream(*(ad->getAudioStream()), soundChannel);
-	_channels[soundChannel - 1].lastPlayingCast = CastMemberID(externalSoundID, -1);
-	_channels[soundChannel - 1]._movieChanged = false;
+	setLastPlayCast(soundChannel, CastMemberID(externalSoundID, -1));
 }
 
 void DirectorSound::changingMovie() {
@@ -266,11 +267,13 @@ void DirectorSound::changingMovie() {
 		_channels[i]._movieChanged = true;
 }
 
-CastMemberID DirectorSound::lastPlayingCast(uint8 soundChannel) {
-	if (!isChannelValid(soundChannel))
-		return CastMemberID(0, 0);
+void DirectorSound::setLastPlayCast(uint8 soundChannel, CastMemberID castMemberId) {
+	_channels[soundChannel - 1].lastPlayingCast = castMemberId;
+	_channels[soundChannel - 1]._movieChanged = false;
+}
 
-	return _channels[soundChannel - 1].lastPlayingCast;
+bool DirectorSound::checkLastPlayCast(uint8 soundChannel, const CastMemberID &castMemberId) {
+	return !_channels[soundChannel - 1]._movieChanged && _channels[soundChannel - 1].lastPlayingCast == castMemberId;
 }
 
 void DirectorSound::stopSound(uint8 soundChannel) {
@@ -279,8 +282,7 @@ void DirectorSound::stopSound(uint8 soundChannel) {
 
 	cancelFade(soundChannel);
 	_mixer->stopHandle(_channels[soundChannel - 1].handle);
-	_channels[soundChannel - 1].lastPlayingCast = CastMemberID(0, 0);
-	_channels[soundChannel - 1]._movieChanged = false;
+	setLastPlayCast(soundChannel, CastMemberID(0, 0));
 	return;
 }
 
@@ -289,8 +291,7 @@ void DirectorSound::stopSound() {
 		cancelFade(i + 1);
 
 		_mixer->stopHandle(_channels[i].handle);
-		_channels[i].lastPlayingCast = CastMemberID(0, 0);
-		_channels[i]._movieChanged = false;
+		setLastPlayCast(i + 1, CastMemberID(0, 0));
 	}
 
 	_mixer->stopHandle(_scriptSound);
diff --git a/engines/director/sound.h b/engines/director/sound.h
index 1c30be2de0..d766fb1e34 100644
--- a/engines/director/sound.h
+++ b/engines/director/sound.h
@@ -95,6 +95,9 @@ public:
 	void systemBeep();
 	void changingMovie();
 
+	void setLastPlayCast(uint8 soundChannel, CastMemberID castMemberId);
+	bool checkLastPlayCast(uint8 soundChannel, const CastMemberID &castMemberId);
+
 	bool getSoundEnabled() { return _enable; }
 
 	Common::String getCurrentSound() { return _currentSoundName; }
@@ -103,7 +106,6 @@ public:
 	bool fadeChannel(uint8 soundChannel);
 
 	bool isChannelActive(uint8 soundChannel);
-	CastMemberID lastPlayingCast(uint8 soundChannel);
 	void stopSound(uint8 soundChannel);
 	void stopSound();
 


Commit: a96793a4d53f89ddb8b616c9501044d2c73ebc93
    https://github.com/scummvm/scummvm/commit/a96793a4d53f89ddb8b616c9501044d2c73ebc93
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-07-21T20:43:56+08:00

Commit Message:
DIRECTOR: fix calculating registeration offset for scale bitmap castmember.

Changed paths:
    engines/director/channel.cpp


diff --git a/engines/director/channel.cpp b/engines/director/channel.cpp
index 63223d0433..eb73177d22 100644
--- a/engines/director/channel.cpp
+++ b/engines/director/channel.cpp
@@ -543,7 +543,7 @@ void Channel::addRegistrationOffset(Common::Point &pos, bool subtract) {
 
 		Common::Point point(0, 0);
 		// stretch the offset
-		if (!_sprite->_stretch && (_width < bc->_initialRect.width() || _height < bc->_initialRect.height())) {
+		if (!_sprite->_stretch && (_width != bc->_initialRect.width() || _height != bc->_initialRect.height())) {
 			point.x = (bc->_initialRect.left - bc->_regX) * _width / bc->_initialRect.width();
 			point.y = (bc->_initialRect.top - bc->_regY) * _height / bc->_initialRect.height();
 		} else {


Commit: e8bfee1742c9f94f6dba84ba65d8a8f9460e2c7a
    https://github.com/scummvm/scummvm/commit/e8bfee1742c9f94f6dba84ba65d8a8f9460e2c7a
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-07-21T20:43:56+08:00

Commit Message:
DIRECTOR: keep update sprite info when we are dealing with QDShape

Changed paths:
    engines/director/channel.cpp


diff --git a/engines/director/channel.cpp b/engines/director/channel.cpp
index eb73177d22..d62a6dda73 100644
--- a/engines/director/channel.cpp
+++ b/engines/director/channel.cpp
@@ -324,7 +324,9 @@ void Channel::setClean(Sprite *nextSprite, int spriteId, bool partial) {
 			}
 		}
 
-		if (_sprite->_puppet || partial) {
+		// for the non-puppet QDShape, since we won't use isDirty to check whether the QDShape is changed.
+		// so we may always keep the sprite info because we need it to draw QDShape.
+		if (_sprite->_puppet || (!nextSprite->isQDShape() && partial)) {
 			// Updating scripts, etc. does not require a full re-render
 			_sprite->_scriptId = nextSprite->_scriptId;
 		} else {




More information about the Scummvm-git-logs mailing list