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

sev- sev at scummvm.org
Thu Mar 26 23:19:37 UTC 2020


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

Summary:
d6a7f314a1 DIRECTOR: Fix transition names
4555461fce DIRECTOR: Clip transitions before drawing
0c0c21e917 DIRECTOR: Consolidated transition parameters calculations
0e2c0046b3 DIRECTOR: JANITORIAL: Remove redundant indentation
92225bcf66 DIRECTOR: Made transition interruptable like the original
ba0c449af4 DIRECTOR: Unified transitions code


Commit: d6a7f314a1de41b76b62bbc5f44f5c617dfe0917
    https://github.com/scummvm/scummvm/commit/d6a7f314a1de41b76b62bbc5f44f5c617dfe0917
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2020-03-26T18:20:51+01:00

Commit Message:
DIRECTOR: Fix transition names

Changed paths:
    engines/director/transitions.cpp
    engines/director/types.h


diff --git a/engines/director/transitions.cpp b/engines/director/transitions.cpp
index 1f08441892..f97dbc6ca5 100644
--- a/engines/director/transitions.cpp
+++ b/engines/director/transitions.cpp
@@ -105,8 +105,8 @@ struct {
 	TRANS(kTransRevealUp,				kTransAlgoReveal,	kTransDirNorth),		// 15
 	TRANS(kTransRevealUpRight,			kTransAlgoReveal,	kTransDirNorthEast),
 	TRANS(kTransRevealRight,			kTransAlgoReveal,	kTransDirEast),
-	TRANS(kTransRevealDown,				kTransAlgoReveal,	kTransDirSouthEast),
-	TRANS(kTransRevealDownRight,		kTransAlgoReveal,	kTransDirSouth),
+	TRANS(kTransRevealDownRight,		kTransAlgoReveal,	kTransDirSouthEast),
+	TRANS(kTransRevealDown,				kTransAlgoReveal,	kTransDirSouth),
 	TRANS(kTransRevealDownLeft,			kTransAlgoReveal,	kTransDirSouthWest),	// 20
 	TRANS(kTransRevealLeft,				kTransAlgoReveal,	kTransDirWest),
 	TRANS(kTransRevealUpLeft,			kTransAlgoReveal,	kTransDirNorthWest),
@@ -137,7 +137,7 @@ struct {
 	TRANS(kTransZoomOpen,				kTransAlgoZoom,		kTransDirIn),
 	TRANS(kTransZoomClose,				kTransAlgoZoom,		kTransDirOut),
 	TRANS(kTransVerticalBinds,			kTransAlgoBlinds,	kTransDirVertical),
-	TRANS(kTransDissolveBitsTrans,		kTransAlgoDissolve,	kTransDirBitsFast),		// 50
+	TRANS(kTransDissolveBitsFast,		kTransAlgoDissolve,	kTransDirBitsFast),		// 50
 	TRANS(kTransDissolvePixels,			kTransAlgoDissolve,	kTransDirPixels),
 	TRANS(kTransDissolveBits,			kTransAlgoDissolve,	kTransDirBits)
 };
diff --git a/engines/director/types.h b/engines/director/types.h
index 6e93e0944f..e89632a9b1 100644
--- a/engines/director/types.h
+++ b/engines/director/types.h
@@ -194,8 +194,8 @@ enum TransitionType {
 	kTransRevealUp,				// 15
 	kTransRevealUpRight,
 	kTransRevealRight,
-	kTransRevealDown,
 	kTransRevealDownRight,
+	kTransRevealDown,
 	kTransRevealDownLeft,		// 20
 	kTransRevealLeft,
 	kTransRevealUpLeft,
@@ -226,7 +226,7 @@ enum TransitionType {
 	kTransZoomOpen,
 	kTransZoomClose,
 	kTransVerticalBinds,
-	kTransDissolveBitsTrans,	// 50
+	kTransDissolveBitsFast,	// 50
 	kTransDissolvePixels,
 	kTransDissolveBits
 };


Commit: 4555461fce32a37a9339dbd22727623a4a5f73f9
    https://github.com/scummvm/scummvm/commit/4555461fce32a37a9339dbd22727623a4a5f73f9
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2020-03-26T23:26:40+01:00

Commit Message:
DIRECTOR: Clip transitions before drawing

Changed paths:
    engines/director/transitions.cpp


diff --git a/engines/director/transitions.cpp b/engines/director/transitions.cpp
index f97dbc6ca5..6229418016 100644
--- a/engines/director/transitions.cpp
+++ b/engines/director/transitions.cpp
@@ -167,7 +167,7 @@ struct TransParams {
 	}
 };
 
-static void initTransParams(TransParams &t, Score *score);
+static void initTransParams(TransParams &t, Score *score, Common::Rect &clipRect);
 
 void Frame::playTransition(Score *score) {
 	TransParams t;
@@ -176,25 +176,28 @@ void Frame::playTransition(Score *score) {
 	t.duration = MAX<uint16>(250, _transDuration); // When duration is < 1/4s, make it 1/4
 	t.chunkSize = MAX<uint>(1, _transChunkSize);
 
-	initTransParams(t, score);
+	Common::Rect clipRect(score->_movieRect);
+	clipRect.moveTo(0, 0);
+
+	Common::Rect r = clipRect;
+
+	initTransParams(t, score, clipRect);
 
 	switch (_transType) {
 	case kTransCenterOutHorizontal: // 5
 		{
-			Common::Rect r = score->_movieRect;
-
 			for (uint16 i = 0; i < t.steps; i++) {
 				t.xpos += t.xStepSize;
 
 				r.setWidth(t.xpos * 2);
-				r.moveTo(score->_movieRect.width() / 2 - t.xpos, 0);
+				r.moveTo(clipRect.width() / 2 - t.xpos, 0);
 
 				g_system->delayMillis(t.stepDuration);
 				processQuitEvent();
 
 				score->_backSurface->copyRectToSurface(*score->_surface, 0, 0, r);
 
-				g_system->copyRectToScreen(score->_backSurface->getPixels(), score->_backSurface->pitch, score->_movieRect.width() / 2 - t.xpos, 0, r.width(), r.height()); // transition
+				g_system->copyRectToScreen(score->_backSurface->getPixels(), score->_backSurface->pitch, r.left, r.top, r.width(), r.height()); // transition
 				g_system->updateScreen();
 			}
 		}
@@ -202,20 +205,18 @@ void Frame::playTransition(Score *score) {
 
 	case kTransCenterOutVertical: // 7
 		{
-			Common::Rect r = score->_movieRect;
-
 			for (uint16 i = 0; i < t.steps; i++) {
 				t.ypos += t.yStepSize;
 
 				r.setHeight(t.ypos * 2);
-				r.moveTo(0, score->_movieRect.height() / 2 - t.ypos);
+				r.moveTo(0, clipRect.height() / 2 - t.ypos);
 
 				g_system->delayMillis(t.stepDuration);
 				processQuitEvent();
 
 				score->_backSurface->copyRectToSurface(*score->_surface, 0, 0, r);
 
-				g_system->copyRectToScreen(score->_backSurface->getPixels(), score->_backSurface->pitch, 0, score->_movieRect.height() / 2 - t.ypos, r.width(), r.height()); // transition
+				g_system->copyRectToScreen(score->_backSurface->getPixels(), score->_backSurface->pitch, r.left, r.top, r.width(), r.height()); // transition
 				g_system->updateScreen();
 			}
 		}
@@ -223,11 +224,11 @@ void Frame::playTransition(Score *score) {
 
 	case kTransCoverDown:	// 29
 		{
-			uint16 stepSize = score->_movieRect.height() / t.steps;
-			Common::Rect r = score->_movieRect;
+			uint16 stepSize = clipRect.height() / t.steps;
 
 			for (uint16 i = 1; i < t.steps; i++) {
 				r.setHeight(stepSize * i);
+				r.clip(clipRect);
 
 				g_system->delayMillis(t.stepDuration);
 				processQuitEvent();
@@ -240,17 +241,18 @@ void Frame::playTransition(Score *score) {
 
 	case kTransCoverDownLeft: // 30
 		{
-			uint16 stepSize = score->_movieRect.width() / t.steps;
-			Common::Rect r = score->_movieRect;
+			uint16 stepSize = clipRect.width() / t.steps;
 
 			for (uint16 i = 1; i < t.steps; i++) {
 				r.setWidth(stepSize * i);
 				r.setHeight(stepSize * i);
+				r.moveTo(clipRect.width() - stepSize * i, 0);
+				r.clip(clipRect);
 
 				g_system->delayMillis(t.stepDuration);
 				processQuitEvent();
 
-				g_system->copyRectToScreen(score->_surface->getPixels(), score->_surface->pitch, score->_movieRect.width() - stepSize * i, 0, r.width(), r.height()); // transition
+				g_system->copyRectToScreen(score->_surface->getPixels(), score->_surface->pitch, r.left, r.top, r.width(), r.height()); // transition
 				g_system->updateScreen();
 			}
 		}
@@ -258,12 +260,12 @@ void Frame::playTransition(Score *score) {
 
 	case kTransCoverDownRight: // 31
 		{
-			uint16 stepSize = score->_movieRect.width() / t.steps;
-			Common::Rect r = score->_movieRect;
+			uint16 stepSize = clipRect.width() / t.steps;
 
 			for (uint16 i = 1; i < t.steps; i++) {
 				r.setWidth(stepSize * i);
 				r.setHeight(stepSize * i);
+				r.clip(clipRect);
 
 				g_system->delayMillis(t.stepDuration);
 				processQuitEvent();
@@ -276,16 +278,17 @@ void Frame::playTransition(Score *score) {
 
 	case kTransCoverLeft:	// 32
 		{
-			uint16 stepSize = score->_movieRect.width() / t.steps;
-			Common::Rect r = score->_movieRect;
+			uint16 stepSize = clipRect.width() / t.steps;
 
 			for (uint16 i = 1; i < t.steps; i++) {
 				r.setWidth(stepSize * i);
+				r.moveTo(clipRect.width() - stepSize * i, 0);
+				r.clip(clipRect);
 
 				g_system->delayMillis(t.stepDuration);
 				processQuitEvent();
 
-				g_system->copyRectToScreen(score->_surface->getPixels(), score->_surface->pitch, score->_movieRect.width() - stepSize * i, 0, r.width(), r.height()); // transition
+				g_system->copyRectToScreen(score->_surface->getPixels(), score->_surface->pitch, r.left, r.top, r.width(), r.height()); // transition
 				g_system->updateScreen();
 			}
 		}
@@ -293,11 +296,11 @@ void Frame::playTransition(Score *score) {
 
 	case kTransCoverRight:	// 33
 		{
-			uint16 stepSize = score->_movieRect.width() / t.steps;
-			Common::Rect r = score->_movieRect;
+			uint16 stepSize = clipRect.width() / t.steps;
 
 			for (uint16 i = 1; i < t.steps; i++) {
 				r.setWidth(stepSize * i);
+				r.clip(clipRect);
 
 				g_system->delayMillis(t.stepDuration);
 				processQuitEvent();
@@ -310,16 +313,17 @@ void Frame::playTransition(Score *score) {
 
 	case kTransCoverUp:		// 34
 		{
-			uint16 stepSize = score->_movieRect.height() / t.steps;
-			Common::Rect r = score->_movieRect;
+			uint16 stepSize = clipRect.height() / t.steps;
 
 			for (uint16 i = 1; i < t.steps; i++) {
 				r.setHeight(stepSize * i);
+				r.moveTo(0, clipRect.height() - stepSize * i);
+				r.clip(clipRect);
 
 				g_system->delayMillis(t.stepDuration);
 				processQuitEvent();
 
-				g_system->copyRectToScreen(score->_surface->getPixels(), score->_surface->pitch, 0, score->_movieRect.height() - stepSize * i, r.width(), r.height()); // transition
+				g_system->copyRectToScreen(score->_surface->getPixels(), score->_surface->pitch, r.left, r.top, r.width(), r.height()); // transition
 				g_system->updateScreen();
 			}
 		}
@@ -327,17 +331,19 @@ void Frame::playTransition(Score *score) {
 
 	case kTransCoverUpLeft:	// 35
 		{
-			uint16 stepSize = score->_movieRect.width() / t.steps;
-			Common::Rect r = score->_movieRect;
+			uint16 xStepSize = clipRect.width() / t.steps;
+			uint16 yStepSize = clipRect.height() / t.steps;
 
 			for (uint16 i = 1; i < t.steps; i++) {
-				r.setWidth(stepSize * i);
-				r.setHeight(stepSize * i);
+				r.setWidth(xStepSize * i);
+				r.setHeight(yStepSize * i);
+				r.moveTo(clipRect.width() - xStepSize * i, clipRect.height() - yStepSize * i);
+				r.clip(clipRect);
 
 				g_system->delayMillis(t.stepDuration);
 				processQuitEvent();
 
-				g_system->copyRectToScreen(score->_surface->getPixels(), score->_surface->pitch, score->_movieRect.width() - stepSize * i, score->_movieRect.height() - stepSize * i, r.width(), r.height()); // transition
+				g_system->copyRectToScreen(score->_surface->getPixels(), score->_surface->pitch, r.left, r.top, r.width(), r.height()); // transition
 				g_system->updateScreen();
 			}
 		}
@@ -345,17 +351,19 @@ void Frame::playTransition(Score *score) {
 
 	case kTransCoverUpRight:	// 36
 		{
-			uint16 stepSize = score->_movieRect.width() / t.steps;
-			Common::Rect r = score->_movieRect;
+			uint16 xStepSize = clipRect.width() / t.steps;
+			uint16 yStepSize = clipRect.height() / t.steps;
 
 			for (uint16 i = 1; i < t.steps; i++) {
-				r.setWidth(stepSize * i);
-				r.setHeight(stepSize * i);
+				r.setWidth(xStepSize * i);
+				r.setHeight(yStepSize * i);
+				r.moveTo(0, clipRect.height() - yStepSize * i);
+				r.clip(clipRect);
 
 				g_system->delayMillis(t.stepDuration);
 				processQuitEvent();
 
-				g_system->copyRectToScreen(score->_surface->getPixels(), score->_surface->pitch, 0, score->_movieRect.height() - stepSize * i, r.width(), r.height()); // transition
+				g_system->copyRectToScreen(score->_surface->getPixels(), score->_surface->pitch, r.left, r.top, r.width(), r.height()); // transition
 				g_system->updateScreen();
 			}
 		}
@@ -374,21 +382,21 @@ void Frame::playTransition(Score *score) {
 	}
 }
 
-static void initTransParams(TransParams &t, Score *score) {
+static void initTransParams(TransParams &t, Score *score, Common::Rect &clipRect) {
 	if (transProps[t.type].dir == kTransDirHorizontal) {
-		int w = score->_movieRect.width() / 2;
+		int w = clipRect.width() / 2;
 
 		t.steps = w / t.chunkSize;
 		t.xStepSize = w / t.steps;
 		t.xpos = w % t.steps;
 	} else if (transProps[t.type].dir == kTransDirVertical) {
-		int h = score->_movieRect.height() / 2;
+		int h = clipRect.height() / 2;
 
 		t.steps = h / t.chunkSize;
 		t.yStepSize = h / t.steps;
 		t.ypos = h % t.steps;
 	} else {
-		t.steps = score->_movieRect.width() / t.chunkSize;
+		t.steps = clipRect.width() / t.chunkSize;
 	}
 
 	t.stepDuration = t.duration / t.steps;


Commit: 0c0c21e9171f7e452a1d1b634ce3290b1b8d3117
    https://github.com/scummvm/scummvm/commit/0c0c21e9171f7e452a1d1b634ce3290b1b8d3117
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2020-03-26T23:54:09+01:00

Commit Message:
DIRECTOR: Consolidated transition parameters calculations

Changed paths:
    engines/director/transitions.cpp


diff --git a/engines/director/transitions.cpp b/engines/director/transitions.cpp
index 6229418016..b20457ad64 100644
--- a/engines/director/transitions.cpp
+++ b/engines/director/transitions.cpp
@@ -48,35 +48,10 @@ enum TransitionAlgo {
 };
 
 enum TransitionDirection {
-	kTransDirBits,
-	kTransDirBitsFast,
-	kTransDirBottomBuildLeft,
-	kTransDirBottomBuildRight,
-	kTransDirEast,
+	kTransDirNone,
 	kTransDirHorizontal,
-	kTransDirIn,
-	kTransDirLeftBuildDown,
-	kTransDirLeftBuildUp,
-	kTransDirNormal,
-	kTransDirNorth,
-	kTransDirNorthEast,
-	kTransDirNorthWest,
-	kTransDirOut,
-	kTransDirPattern,
-	kTransDirPixels,
-	kTransDirPixelsFast,
-	kTransDirRectangular,
-	kTransDirRightBuildDown,
-	kTransDirRightBuildUp,
-	kTransDirSouth,
-	kTransDirSouthEast,
-	kTransDirSouthWest,
-	kTransDirSquare,
-	kTransDirSymmetrical,
-	kTransDirTopBuildLeft,
-	kTransDirTopBuildRight,
 	kTransDirVertical,
-	kTransDirWest
+	kTransDirBoth
 };
 
 #define TRANS(t,a,d) {t,#t,a,d}
@@ -87,59 +62,59 @@ struct {
 	TransitionAlgo algo;
 	TransitionDirection dir;
 } static const transProps[] = {
-	TRANS(kTransNone, 					kTransAlgoWipe,		kTransDirEast),
-	TRANS(kTransWipeRight, 				kTransAlgoWipe,		kTransDirEast),
-	TRANS(kTransWipeLeft,				kTransAlgoWipe,		kTransDirWest),
-	TRANS(kTransWipeDown,				kTransAlgoWipe,		kTransDirSouth),
-	TRANS(kTransWipeUp,					kTransAlgoWipe,		kTransDirNorth),
+	TRANS(kTransNone, 					kTransAlgoWipe,		kTransDirNone),
+	TRANS(kTransWipeRight, 				kTransAlgoWipe,		kTransDirHorizontal),
+	TRANS(kTransWipeLeft,				kTransAlgoWipe,		kTransDirHorizontal),
+	TRANS(kTransWipeDown,				kTransAlgoWipe,		kTransDirVertical),
+	TRANS(kTransWipeUp,					kTransAlgoWipe,		kTransDirVertical),
 	TRANS(kTransCenterOutHorizontal, 	kTransAlgoCenterOut,kTransDirHorizontal),	// 5
 	TRANS(kTransEdgesInHorizontal, 		kTransAlgoEdgesIn,	kTransDirHorizontal),
 	TRANS(kTransCenterOutVertical,		kTransAlgoCenterOut,kTransDirVertical),
 	TRANS(kTransEdgesInVertical,		kTransAlgoEdgesIn,	kTransDirVertical),
-	TRANS(kTransCenterOutSquare,		kTransAlgoCenterOut,kTransDirSymmetrical),
-	TRANS(kTransEdgesInSquare,			kTransAlgoEdgesIn,	kTransDirSymmetrical),	// 10
-	TRANS(kTransPushLeft,				kTransAlgoPush,		kTransDirWest),
-	TRANS(kTransPushRight,				kTransAlgoPush,		kTransDirEast),
-	TRANS(kTransPushDown,				kTransAlgoPush,		kTransDirSouth),
-	TRANS(kTransPushUp,					kTransAlgoPush,		kTransDirNorth),
-	TRANS(kTransRevealUp,				kTransAlgoReveal,	kTransDirNorth),		// 15
-	TRANS(kTransRevealUpRight,			kTransAlgoReveal,	kTransDirNorthEast),
-	TRANS(kTransRevealRight,			kTransAlgoReveal,	kTransDirEast),
-	TRANS(kTransRevealDownRight,		kTransAlgoReveal,	kTransDirSouthEast),
-	TRANS(kTransRevealDown,				kTransAlgoReveal,	kTransDirSouth),
-	TRANS(kTransRevealDownLeft,			kTransAlgoReveal,	kTransDirSouthWest),	// 20
-	TRANS(kTransRevealLeft,				kTransAlgoReveal,	kTransDirWest),
-	TRANS(kTransRevealUpLeft,			kTransAlgoReveal,	kTransDirNorthWest),
-	TRANS(kTransDissolvePixelsFast,		kTransAlgoDissolve,	kTransDirPixelsFast),
-	TRANS(kTransDissolveBoxyRects,		kTransAlgoBoxy,		kTransDirRectangular),
-	TRANS(kTransDissolveBoxySquares,	kTransAlgoBoxy,		kTransDirSquare),		// 25
-	TRANS(kTransDissolvePatterns,		kTransAlgoDissolve,	kTransDirPattern),
+	TRANS(kTransCenterOutSquare,		kTransAlgoCenterOut,kTransDirBoth),
+	TRANS(kTransEdgesInSquare,			kTransAlgoEdgesIn,	kTransDirBoth),	// 10
+	TRANS(kTransPushLeft,				kTransAlgoPush,		kTransDirHorizontal),
+	TRANS(kTransPushRight,				kTransAlgoPush,		kTransDirHorizontal),
+	TRANS(kTransPushDown,				kTransAlgoPush,		kTransDirVertical),
+	TRANS(kTransPushUp,					kTransAlgoPush,		kTransDirVertical),
+	TRANS(kTransRevealUp,				kTransAlgoReveal,	kTransDirVertical),		// 15
+	TRANS(kTransRevealUpRight,			kTransAlgoReveal,	kTransDirBoth),
+	TRANS(kTransRevealRight,			kTransAlgoReveal,	kTransDirHorizontal),
+	TRANS(kTransRevealDownRight,		kTransAlgoReveal,	kTransDirBoth),
+	TRANS(kTransRevealDown,				kTransAlgoReveal,	kTransDirVertical),
+	TRANS(kTransRevealDownLeft,			kTransAlgoReveal,	kTransDirBoth),	// 20
+	TRANS(kTransRevealLeft,				kTransAlgoReveal,	kTransDirHorizontal),
+	TRANS(kTransRevealUpLeft,			kTransAlgoReveal,	kTransDirBoth),
+	TRANS(kTransDissolvePixelsFast,		kTransAlgoDissolve,	kTransDirNone),
+	TRANS(kTransDissolveBoxyRects,		kTransAlgoBoxy,		kTransDirBoth),
+	TRANS(kTransDissolveBoxySquares,	kTransAlgoBoxy,		kTransDirBoth),		// 25
+	TRANS(kTransDissolvePatterns,		kTransAlgoDissolve,	kTransDirNone),
 	TRANS(kTransRandomRows,				kTransAlgoRandomLines,kTransDirHorizontal),
 	TRANS(kTransRandomColumns,			kTransAlgoRandomLines,kTransDirVertical),
-	TRANS(kTransCoverDown,				kTransAlgoCover,	kTransDirSouth),
-	TRANS(kTransCoverDownLeft,			kTransAlgoCover,	kTransDirSouthWest),	// 30
-	TRANS(kTransCoverDownRight,			kTransAlgoCover,	kTransDirSouthEast),
-	TRANS(kTransCoverLeft,				kTransAlgoCover,	kTransDirWest),
-	TRANS(kTransCoverRight,				kTransAlgoCover,	kTransDirEast),
-	TRANS(kTransCoverUp,				kTransAlgoCover,	kTransDirNorth),
-	TRANS(kTransCoverUpLeft,			kTransAlgoCover,	kTransDirNorthWest),	// 35
-	TRANS(kTransCoverUpRight,			kTransAlgoCover,	kTransDirNorthEast),
+	TRANS(kTransCoverDown,				kTransAlgoCover,	kTransDirVertical),
+	TRANS(kTransCoverDownLeft,			kTransAlgoCover,	kTransDirBoth),	// 30
+	TRANS(kTransCoverDownRight,			kTransAlgoCover,	kTransDirBoth),
+	TRANS(kTransCoverLeft,				kTransAlgoCover,	kTransDirHorizontal),
+	TRANS(kTransCoverRight,				kTransAlgoCover,	kTransDirHorizontal),
+	TRANS(kTransCoverUp,				kTransAlgoCover,	kTransDirVertical),
+	TRANS(kTransCoverUpLeft,			kTransAlgoCover,	kTransDirBoth),	// 35
+	TRANS(kTransCoverUpRight,			kTransAlgoCover,	kTransDirBoth),
 	TRANS(kTransTypeVenitianBlind,		kTransAlgoBlinds,	kTransDirHorizontal),
-	TRANS(kTransTypeCheckerboard,		kTransAlgoCheckerBoard, kTransDirNormal),
-	TRANS(kTransTypeStripsBottomBuildLeft, kTransAlgoBuildStrips, kTransDirBottomBuildLeft),
-	TRANS(kTransTypeStripsBottomBuildRight, kTransAlgoBuildStrips, kTransDirBottomBuildRight), // 40
-	TRANS(kTransTypeStripsLeftBuildDown, kTransAlgoBuildStrips, kTransDirLeftBuildDown),
-	TRANS(kTransTypeStripsLeftBuildUp, kTransAlgoBuildStrips, kTransDirLeftBuildUp),
-	TRANS(kTransTypeStripsRightBuildDown, kTransAlgoBuildStrips, kTransDirRightBuildDown),
-	TRANS(kTransTypeStripsRightBuildUp, kTransAlgoBuildStrips, kTransDirRightBuildUp),
-	TRANS(kTransTypeStripsTopBuildLeft,	kTransAlgoBuildStrips, kTransDirTopBuildLeft),// 45
-	TRANS(kTransTypeStripsTopBuildRight, kTransAlgoBuildStrips, kTransDirTopBuildRight),
-	TRANS(kTransZoomOpen,				kTransAlgoZoom,		kTransDirIn),
-	TRANS(kTransZoomClose,				kTransAlgoZoom,		kTransDirOut),
-	TRANS(kTransVerticalBinds,			kTransAlgoBlinds,	kTransDirVertical),
-	TRANS(kTransDissolveBitsFast,		kTransAlgoDissolve,	kTransDirBitsFast),		// 50
-	TRANS(kTransDissolvePixels,			kTransAlgoDissolve,	kTransDirPixels),
-	TRANS(kTransDissolveBits,			kTransAlgoDissolve,	kTransDirBits)
+	TRANS(kTransTypeCheckerboard,		kTransAlgoCheckerBoard, kTransDirBoth),
+	TRANS(kTransTypeStripsBottomBuildLeft, kTransAlgoBuildStrips, kTransDirBoth),
+	TRANS(kTransTypeStripsBottomBuildRight, kTransAlgoBuildStrips, kTransDirBoth), // 40
+	TRANS(kTransTypeStripsLeftBuildDown, kTransAlgoBuildStrips, kTransDirBoth),
+	TRANS(kTransTypeStripsLeftBuildUp, kTransAlgoBuildStrips, kTransDirBoth),
+	TRANS(kTransTypeStripsRightBuildDown, kTransAlgoBuildStrips, kTransDirBoth),
+	TRANS(kTransTypeStripsRightBuildUp, kTransAlgoBuildStrips, kTransDirBoth),
+	TRANS(kTransTypeStripsTopBuildLeft,	kTransAlgoBuildStrips, kTransDirBoth),// 45
+	TRANS(kTransTypeStripsTopBuildRight, kTransAlgoBuildStrips, kTransDirBoth),
+	TRANS(kTransZoomOpen,				kTransAlgoZoom,		kTransDirBoth),
+	TRANS(kTransZoomClose,				kTransAlgoZoom,		kTransDirBoth),
+	TRANS(kTransVerticalBinds,			kTransAlgoBlinds,	kTransDirBoth),
+	TRANS(kTransDissolveBitsFast,		kTransAlgoDissolve,	kTransDirNone),		// 50
+	TRANS(kTransDissolvePixels,			kTransAlgoDissolve,	kTransDirNone),
+	TRANS(kTransDissolveBits,			kTransAlgoDissolve,	kTransDirNone)
 };
 
 struct TransParams {
@@ -224,10 +199,8 @@ void Frame::playTransition(Score *score) {
 
 	case kTransCoverDown:	// 29
 		{
-			uint16 stepSize = clipRect.height() / t.steps;
-
 			for (uint16 i = 1; i < t.steps; i++) {
-				r.setHeight(stepSize * i);
+				r.setHeight(t.yStepSize * i);
 				r.clip(clipRect);
 
 				g_system->delayMillis(t.stepDuration);
@@ -241,12 +214,10 @@ void Frame::playTransition(Score *score) {
 
 	case kTransCoverDownLeft: // 30
 		{
-			uint16 stepSize = clipRect.width() / t.steps;
-
 			for (uint16 i = 1; i < t.steps; i++) {
-				r.setWidth(stepSize * i);
-				r.setHeight(stepSize * i);
-				r.moveTo(clipRect.width() - stepSize * i, 0);
+				r.setWidth(t.xStepSize * i);
+				r.setHeight(t.yStepSize * i);
+				r.moveTo(clipRect.width() - t.xStepSize * i, 0);
 				r.clip(clipRect);
 
 				g_system->delayMillis(t.stepDuration);
@@ -260,11 +231,9 @@ void Frame::playTransition(Score *score) {
 
 	case kTransCoverDownRight: // 31
 		{
-			uint16 stepSize = clipRect.width() / t.steps;
-
 			for (uint16 i = 1; i < t.steps; i++) {
-				r.setWidth(stepSize * i);
-				r.setHeight(stepSize * i);
+				r.setWidth(t.xStepSize * i);
+				r.setHeight(t.yStepSize * i);
 				r.clip(clipRect);
 
 				g_system->delayMillis(t.stepDuration);
@@ -278,11 +247,9 @@ void Frame::playTransition(Score *score) {
 
 	case kTransCoverLeft:	// 32
 		{
-			uint16 stepSize = clipRect.width() / t.steps;
-
 			for (uint16 i = 1; i < t.steps; i++) {
-				r.setWidth(stepSize * i);
-				r.moveTo(clipRect.width() - stepSize * i, 0);
+				r.setWidth(t.xStepSize * i);
+				r.moveTo(clipRect.width() - t.xStepSize * i, 0);
 				r.clip(clipRect);
 
 				g_system->delayMillis(t.stepDuration);
@@ -296,10 +263,8 @@ void Frame::playTransition(Score *score) {
 
 	case kTransCoverRight:	// 33
 		{
-			uint16 stepSize = clipRect.width() / t.steps;
-
 			for (uint16 i = 1; i < t.steps; i++) {
-				r.setWidth(stepSize * i);
+				r.setWidth(t.xStepSize * i);
 				r.clip(clipRect);
 
 				g_system->delayMillis(t.stepDuration);
@@ -313,11 +278,9 @@ void Frame::playTransition(Score *score) {
 
 	case kTransCoverUp:		// 34
 		{
-			uint16 stepSize = clipRect.height() / t.steps;
-
 			for (uint16 i = 1; i < t.steps; i++) {
-				r.setHeight(stepSize * i);
-				r.moveTo(0, clipRect.height() - stepSize * i);
+				r.setHeight(t.yStepSize * i);
+				r.moveTo(0, clipRect.height() - t.yStepSize * i);
 				r.clip(clipRect);
 
 				g_system->delayMillis(t.stepDuration);
@@ -331,13 +294,10 @@ void Frame::playTransition(Score *score) {
 
 	case kTransCoverUpLeft:	// 35
 		{
-			uint16 xStepSize = clipRect.width() / t.steps;
-			uint16 yStepSize = clipRect.height() / t.steps;
-
 			for (uint16 i = 1; i < t.steps; i++) {
-				r.setWidth(xStepSize * i);
-				r.setHeight(yStepSize * i);
-				r.moveTo(clipRect.width() - xStepSize * i, clipRect.height() - yStepSize * i);
+				r.setWidth(t.xStepSize * i);
+				r.setHeight(t.yStepSize * i);
+				r.moveTo(clipRect.width() - t.xStepSize * i, clipRect.height() - t.yStepSize * i);
 				r.clip(clipRect);
 
 				g_system->delayMillis(t.stepDuration);
@@ -351,13 +311,10 @@ void Frame::playTransition(Score *score) {
 
 	case kTransCoverUpRight:	// 36
 		{
-			uint16 xStepSize = clipRect.width() / t.steps;
-			uint16 yStepSize = clipRect.height() / t.steps;
-
 			for (uint16 i = 1; i < t.steps; i++) {
-				r.setWidth(xStepSize * i);
-				r.setHeight(yStepSize * i);
-				r.moveTo(0, clipRect.height() - yStepSize * i);
+				r.setWidth(t.xStepSize * i);
+				r.setHeight(t.yStepSize * i);
+				r.moveTo(0, clipRect.height() - t.yStepSize * i);
 				r.clip(clipRect);
 
 				g_system->delayMillis(t.stepDuration);
@@ -383,23 +340,28 @@ void Frame::playTransition(Score *score) {
 }
 
 static void initTransParams(TransParams &t, Score *score, Common::Rect &clipRect) {
-	if (transProps[t.type].dir == kTransDirHorizontal) {
-		int w = clipRect.width() / 2;
+	int w = clipRect.width();
+	int h = clipRect.height();
+	int m = MIN(w, h);
+	TransitionDirection d = transProps[t.type].dir;
+	TransitionAlgo a = transProps[t.type].algo;
+
+	if (a == kTransAlgoCenterOut || a == kTransAlgoEdgesIn) {
+		w = (w + 1) >> 1;	// round up
+		h = (h + 1) >> 1;
+	}
+
+	t.steps = m / t.chunkSize;
+	t.stepDuration = t.duration / t.steps;
 
-		t.steps = w / t.chunkSize;
+	if (d == kTransDirHorizontal || d == kTransDirBoth) {
 		t.xStepSize = w / t.steps;
 		t.xpos = w % t.steps;
-	} else if (transProps[t.type].dir == kTransDirVertical) {
-		int h = clipRect.height() / 2;
-
-		t.steps = h / t.chunkSize;
+	}
+	if (d == kTransDirVertical || d == kTransDirBoth) {
 		t.yStepSize = h / t.steps;
 		t.ypos = h % t.steps;
-	} else {
-		t.steps = clipRect.width() / t.chunkSize;
 	}
-
-	t.stepDuration = t.duration / t.steps;
 }
 
 


Commit: 0e2c0046b343a50a1366abcc23d48ce2d68ec7e6
    https://github.com/scummvm/scummvm/commit/0e2c0046b343a50a1366abcc23d48ce2d68ec7e6
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2020-03-27T00:06:53+01:00

Commit Message:
DIRECTOR: JANITORIAL: Remove redundant indentation

Changed paths:
    engines/director/transitions.cpp


diff --git a/engines/director/transitions.cpp b/engines/director/transitions.cpp
index b20457ad64..a811436889 100644
--- a/engines/director/transitions.cpp
+++ b/engines/director/transitions.cpp
@@ -160,169 +160,149 @@ void Frame::playTransition(Score *score) {
 
 	switch (_transType) {
 	case kTransCenterOutHorizontal: // 5
-		{
-			for (uint16 i = 0; i < t.steps; i++) {
-				t.xpos += t.xStepSize;
+		for (uint16 i = 0; i < t.steps; i++) {
+			t.xpos += t.xStepSize;
 
-				r.setWidth(t.xpos * 2);
-				r.moveTo(clipRect.width() / 2 - t.xpos, 0);
+			r.setWidth(t.xpos * 2);
+			r.moveTo(clipRect.width() / 2 - t.xpos, 0);
 
-				g_system->delayMillis(t.stepDuration);
-				processQuitEvent();
+			g_system->delayMillis(t.stepDuration);
+			processQuitEvent();
 
-				score->_backSurface->copyRectToSurface(*score->_surface, 0, 0, r);
+			score->_backSurface->copyRectToSurface(*score->_surface, 0, 0, r);
 
-				g_system->copyRectToScreen(score->_backSurface->getPixels(), score->_backSurface->pitch, r.left, r.top, r.width(), r.height()); // transition
-				g_system->updateScreen();
-			}
+			g_system->copyRectToScreen(score->_backSurface->getPixels(), score->_backSurface->pitch, r.left, r.top, r.width(), r.height()); // transition
+			g_system->updateScreen();
 		}
 		break;
 
 	case kTransCenterOutVertical: // 7
-		{
-			for (uint16 i = 0; i < t.steps; i++) {
-				t.ypos += t.yStepSize;
+		for (uint16 i = 0; i < t.steps; i++) {
+			t.ypos += t.yStepSize;
 
-				r.setHeight(t.ypos * 2);
-				r.moveTo(0, clipRect.height() / 2 - t.ypos);
+			r.setHeight(t.ypos * 2);
+			r.moveTo(0, clipRect.height() / 2 - t.ypos);
 
-				g_system->delayMillis(t.stepDuration);
-				processQuitEvent();
+			g_system->delayMillis(t.stepDuration);
+			processQuitEvent();
 
-				score->_backSurface->copyRectToSurface(*score->_surface, 0, 0, r);
+			score->_backSurface->copyRectToSurface(*score->_surface, 0, 0, r);
 
-				g_system->copyRectToScreen(score->_backSurface->getPixels(), score->_backSurface->pitch, r.left, r.top, r.width(), r.height()); // transition
-				g_system->updateScreen();
-			}
+			g_system->copyRectToScreen(score->_backSurface->getPixels(), score->_backSurface->pitch, r.left, r.top, r.width(), r.height()); // transition
+			g_system->updateScreen();
 		}
 		break;
 
 	case kTransCoverDown:	// 29
-		{
-			for (uint16 i = 1; i < t.steps; i++) {
-				r.setHeight(t.yStepSize * i);
-				r.clip(clipRect);
+		for (uint16 i = 1; i < t.steps; i++) {
+			r.setHeight(t.yStepSize * i);
+			r.clip(clipRect);
 
-				g_system->delayMillis(t.stepDuration);
-				processQuitEvent();
+			g_system->delayMillis(t.stepDuration);
+			processQuitEvent();
 
-				g_system->copyRectToScreen(score->_surface->getPixels(), score->_surface->pitch, 0, 0, r.width(), r.height()); // transition
-				g_system->updateScreen();
-			}
+			g_system->copyRectToScreen(score->_surface->getPixels(), score->_surface->pitch, 0, 0, r.width(), r.height()); // transition
+			g_system->updateScreen();
 		}
 		break;
 
 	case kTransCoverDownLeft: // 30
-		{
-			for (uint16 i = 1; i < t.steps; i++) {
-				r.setWidth(t.xStepSize * i);
-				r.setHeight(t.yStepSize * i);
-				r.moveTo(clipRect.width() - t.xStepSize * i, 0);
-				r.clip(clipRect);
-
-				g_system->delayMillis(t.stepDuration);
-				processQuitEvent();
-
-				g_system->copyRectToScreen(score->_surface->getPixels(), score->_surface->pitch, r.left, r.top, r.width(), r.height()); // transition
-				g_system->updateScreen();
-			}
+		for (uint16 i = 1; i < t.steps; i++) {
+			r.setWidth(t.xStepSize * i);
+			r.setHeight(t.yStepSize * i);
+			r.moveTo(clipRect.width() - t.xStepSize * i, 0);
+			r.clip(clipRect);
+
+			g_system->delayMillis(t.stepDuration);
+			processQuitEvent();
+
+			g_system->copyRectToScreen(score->_surface->getPixels(), score->_surface->pitch, r.left, r.top, r.width(), r.height()); // transition
+			g_system->updateScreen();
 		}
 		break;
 
 	case kTransCoverDownRight: // 31
-		{
-			for (uint16 i = 1; i < t.steps; i++) {
-				r.setWidth(t.xStepSize * i);
-				r.setHeight(t.yStepSize * i);
-				r.clip(clipRect);
+		for (uint16 i = 1; i < t.steps; i++) {
+			r.setWidth(t.xStepSize * i);
+			r.setHeight(t.yStepSize * i);
+			r.clip(clipRect);
 
-				g_system->delayMillis(t.stepDuration);
-				processQuitEvent();
+			g_system->delayMillis(t.stepDuration);
+			processQuitEvent();
 
-				g_system->copyRectToScreen(score->_surface->getPixels(), score->_surface->pitch, 0, 0, r.width(), r.height()); // transition
-				g_system->updateScreen();
-			}
+			g_system->copyRectToScreen(score->_surface->getPixels(), score->_surface->pitch, 0, 0, r.width(), r.height()); // transition
+			g_system->updateScreen();
 		}
 		break;
 
 	case kTransCoverLeft:	// 32
-		{
-			for (uint16 i = 1; i < t.steps; i++) {
-				r.setWidth(t.xStepSize * i);
-				r.moveTo(clipRect.width() - t.xStepSize * i, 0);
-				r.clip(clipRect);
+		for (uint16 i = 1; i < t.steps; i++) {
+			r.setWidth(t.xStepSize * i);
+			r.moveTo(clipRect.width() - t.xStepSize * i, 0);
+			r.clip(clipRect);
 
-				g_system->delayMillis(t.stepDuration);
-				processQuitEvent();
+			g_system->delayMillis(t.stepDuration);
+			processQuitEvent();
 
-				g_system->copyRectToScreen(score->_surface->getPixels(), score->_surface->pitch, r.left, r.top, r.width(), r.height()); // transition
-				g_system->updateScreen();
-			}
+			g_system->copyRectToScreen(score->_surface->getPixels(), score->_surface->pitch, r.left, r.top, r.width(), r.height()); // transition
+			g_system->updateScreen();
 		}
 		break;
 
 	case kTransCoverRight:	// 33
-		{
-			for (uint16 i = 1; i < t.steps; i++) {
-				r.setWidth(t.xStepSize * i);
-				r.clip(clipRect);
+		for (uint16 i = 1; i < t.steps; i++) {
+			r.setWidth(t.xStepSize * i);
+			r.clip(clipRect);
 
-				g_system->delayMillis(t.stepDuration);
-				processQuitEvent();
+			g_system->delayMillis(t.stepDuration);
+			processQuitEvent();
 
-				g_system->copyRectToScreen(score->_surface->getPixels(), score->_surface->pitch, 0, 0, r.width(), r.height()); // transition
-				g_system->updateScreen();
-			}
+			g_system->copyRectToScreen(score->_surface->getPixels(), score->_surface->pitch, 0, 0, r.width(), r.height()); // transition
+			g_system->updateScreen();
 		}
 		break;
 
 	case kTransCoverUp:		// 34
-		{
-			for (uint16 i = 1; i < t.steps; i++) {
-				r.setHeight(t.yStepSize * i);
-				r.moveTo(0, clipRect.height() - t.yStepSize * i);
-				r.clip(clipRect);
+		for (uint16 i = 1; i < t.steps; i++) {
+			r.setHeight(t.yStepSize * i);
+			r.moveTo(0, clipRect.height() - t.yStepSize * i);
+			r.clip(clipRect);
 
-				g_system->delayMillis(t.stepDuration);
-				processQuitEvent();
+			g_system->delayMillis(t.stepDuration);
+			processQuitEvent();
 
-				g_system->copyRectToScreen(score->_surface->getPixels(), score->_surface->pitch, r.left, r.top, r.width(), r.height()); // transition
-				g_system->updateScreen();
-			}
+			g_system->copyRectToScreen(score->_surface->getPixels(), score->_surface->pitch, r.left, r.top, r.width(), r.height()); // transition
+			g_system->updateScreen();
 		}
 		break;
 
 	case kTransCoverUpLeft:	// 35
-		{
-			for (uint16 i = 1; i < t.steps; i++) {
-				r.setWidth(t.xStepSize * i);
-				r.setHeight(t.yStepSize * i);
-				r.moveTo(clipRect.width() - t.xStepSize * i, clipRect.height() - t.yStepSize * i);
-				r.clip(clipRect);
-
-				g_system->delayMillis(t.stepDuration);
-				processQuitEvent();
-
-				g_system->copyRectToScreen(score->_surface->getPixels(), score->_surface->pitch, r.left, r.top, r.width(), r.height()); // transition
-				g_system->updateScreen();
-			}
+		for (uint16 i = 1; i < t.steps; i++) {
+			r.setWidth(t.xStepSize * i);
+			r.setHeight(t.yStepSize * i);
+			r.moveTo(clipRect.width() - t.xStepSize * i, clipRect.height() - t.yStepSize * i);
+			r.clip(clipRect);
+
+			g_system->delayMillis(t.stepDuration);
+			processQuitEvent();
+
+			g_system->copyRectToScreen(score->_surface->getPixels(), score->_surface->pitch, r.left, r.top, r.width(), r.height()); // transition
+			g_system->updateScreen();
 		}
 		break;
 
 	case kTransCoverUpRight:	// 36
-		{
-			for (uint16 i = 1; i < t.steps; i++) {
-				r.setWidth(t.xStepSize * i);
-				r.setHeight(t.yStepSize * i);
-				r.moveTo(0, clipRect.height() - t.yStepSize * i);
-				r.clip(clipRect);
-
-				g_system->delayMillis(t.stepDuration);
-				processQuitEvent();
-
-				g_system->copyRectToScreen(score->_surface->getPixels(), score->_surface->pitch, r.left, r.top, r.width(), r.height()); // transition
-				g_system->updateScreen();
-			}
+		for (uint16 i = 1; i < t.steps; i++) {
+			r.setWidth(t.xStepSize * i);
+			r.setHeight(t.yStepSize * i);
+			r.moveTo(0, clipRect.height() - t.yStepSize * i);
+			r.clip(clipRect);
+
+			g_system->delayMillis(t.stepDuration);
+			processQuitEvent();
+
+			g_system->copyRectToScreen(score->_surface->getPixels(), score->_surface->pitch, r.left, r.top, r.width(), r.height()); // transition
+			g_system->updateScreen();
 		}
 		break;
 


Commit: 92225bcf6646cb2961fcff3f12a88a4d3f55dd4a
    https://github.com/scummvm/scummvm/commit/92225bcf6646cb2961fcff3f12a88a4d3f55dd4a
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2020-03-27T00:10:34+01:00

Commit Message:
DIRECTOR: Made transition interruptable like the original

Changed paths:
    engines/director/events.cpp
    engines/director/transitions.cpp
    engines/director/util.h


diff --git a/engines/director/events.cpp b/engines/director/events.cpp
index 793a6f8d82..89e5269206 100644
--- a/engines/director/events.cpp
+++ b/engines/director/events.cpp
@@ -32,13 +32,22 @@
 
 namespace Director {
 
-void processQuitEvent() {
+bool processQuitEvent(bool click) {
 	Common::Event event;
 
 	while (g_system->getEventManager()->pollEvent(event)) {
-		if (event.type == Common::EVENT_QUIT)
+		if (event.type == Common::EVENT_QUIT) {
 			g_director->getCurrentScore()->_stopPlay = true;
+			return true;
+		}
+
+		if (click) {
+			if (event.type == Common::EVENT_LBUTTONDOWN)
+				return true;
+		}
 	}
+
+	return false;
 }
 
 void DirectorEngine::processEvents() {
diff --git a/engines/director/transitions.cpp b/engines/director/transitions.cpp
index a811436889..bff9bfef67 100644
--- a/engines/director/transitions.cpp
+++ b/engines/director/transitions.cpp
@@ -167,7 +167,8 @@ void Frame::playTransition(Score *score) {
 			r.moveTo(clipRect.width() / 2 - t.xpos, 0);
 
 			g_system->delayMillis(t.stepDuration);
-			processQuitEvent();
+			if (processQuitEvent(true))
+				break;
 
 			score->_backSurface->copyRectToSurface(*score->_surface, 0, 0, r);
 
@@ -184,7 +185,8 @@ void Frame::playTransition(Score *score) {
 			r.moveTo(0, clipRect.height() / 2 - t.ypos);
 
 			g_system->delayMillis(t.stepDuration);
-			processQuitEvent();
+			if (processQuitEvent(true))
+				break;
 
 			score->_backSurface->copyRectToSurface(*score->_surface, 0, 0, r);
 
@@ -199,7 +201,8 @@ void Frame::playTransition(Score *score) {
 			r.clip(clipRect);
 
 			g_system->delayMillis(t.stepDuration);
-			processQuitEvent();
+			if (processQuitEvent(true))
+				break;
 
 			g_system->copyRectToScreen(score->_surface->getPixels(), score->_surface->pitch, 0, 0, r.width(), r.height()); // transition
 			g_system->updateScreen();
@@ -214,7 +217,8 @@ void Frame::playTransition(Score *score) {
 			r.clip(clipRect);
 
 			g_system->delayMillis(t.stepDuration);
-			processQuitEvent();
+			if (processQuitEvent(true))
+				break;
 
 			g_system->copyRectToScreen(score->_surface->getPixels(), score->_surface->pitch, r.left, r.top, r.width(), r.height()); // transition
 			g_system->updateScreen();
@@ -228,7 +232,8 @@ void Frame::playTransition(Score *score) {
 			r.clip(clipRect);
 
 			g_system->delayMillis(t.stepDuration);
-			processQuitEvent();
+			if (processQuitEvent(true))
+				break;
 
 			g_system->copyRectToScreen(score->_surface->getPixels(), score->_surface->pitch, 0, 0, r.width(), r.height()); // transition
 			g_system->updateScreen();
@@ -242,7 +247,8 @@ void Frame::playTransition(Score *score) {
 			r.clip(clipRect);
 
 			g_system->delayMillis(t.stepDuration);
-			processQuitEvent();
+			if (processQuitEvent(true))
+				break;
 
 			g_system->copyRectToScreen(score->_surface->getPixels(), score->_surface->pitch, r.left, r.top, r.width(), r.height()); // transition
 			g_system->updateScreen();
@@ -255,7 +261,8 @@ void Frame::playTransition(Score *score) {
 			r.clip(clipRect);
 
 			g_system->delayMillis(t.stepDuration);
-			processQuitEvent();
+			if (processQuitEvent(true))
+				break;
 
 			g_system->copyRectToScreen(score->_surface->getPixels(), score->_surface->pitch, 0, 0, r.width(), r.height()); // transition
 			g_system->updateScreen();
@@ -269,7 +276,9 @@ void Frame::playTransition(Score *score) {
 			r.clip(clipRect);
 
 			g_system->delayMillis(t.stepDuration);
-			processQuitEvent();
+
+			if (processQuitEvent(true))
+				break;
 
 			g_system->copyRectToScreen(score->_surface->getPixels(), score->_surface->pitch, r.left, r.top, r.width(), r.height()); // transition
 			g_system->updateScreen();
@@ -284,7 +293,8 @@ void Frame::playTransition(Score *score) {
 			r.clip(clipRect);
 
 			g_system->delayMillis(t.stepDuration);
-			processQuitEvent();
+			if (processQuitEvent(true))
+				break;
 
 			g_system->copyRectToScreen(score->_surface->getPixels(), score->_surface->pitch, r.left, r.top, r.width(), r.height()); // transition
 			g_system->updateScreen();
@@ -299,7 +309,8 @@ void Frame::playTransition(Score *score) {
 			r.clip(clipRect);
 
 			g_system->delayMillis(t.stepDuration);
-			processQuitEvent();
+			if (processQuitEvent(true))
+				break;
 
 			g_system->copyRectToScreen(score->_surface->getPixels(), score->_surface->pitch, r.left, r.top, r.width(), r.height()); // transition
 			g_system->updateScreen();
diff --git a/engines/director/util.h b/engines/director/util.h
index a31fcf4952..30a6f2d95f 100644
--- a/engines/director/util.h
+++ b/engines/director/util.h
@@ -42,7 +42,7 @@ Common::String pathMakeRelative(Common::String path, bool recursive = true);
 
 Common::String convertMacFilename(const char *name);
 
-void processQuitEvent(); // events.cpp
+bool processQuitEvent(bool click = false); // events.cpp
 
 } // End of namespace Director
 


Commit: ba0c449af42e24091668a750dddaadf0431375e1
    https://github.com/scummvm/scummvm/commit/ba0c449af42e24091668a750dddaadf0431375e1
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2020-03-27T00:19:11+01:00

Commit Message:
DIRECTOR: Unified transitions code

Changed paths:
    engines/director/transitions.cpp


diff --git a/engines/director/transitions.cpp b/engines/director/transitions.cpp
index bff9bfef67..49b313ba14 100644
--- a/engines/director/transitions.cpp
+++ b/engines/director/transitions.cpp
@@ -158,175 +158,86 @@ void Frame::playTransition(Score *score) {
 
 	initTransParams(t, score, clipRect);
 
-	switch (_transType) {
-	case kTransCenterOutHorizontal: // 5
-		for (uint16 i = 0; i < t.steps; i++) {
-			t.xpos += t.xStepSize;
+	for (uint16 i = 1; i < t.steps; i++) {
+		bool stop = false;
 
+		switch (_transType) {
+		case kTransCenterOutHorizontal: // 5
+			t.xpos += t.xStepSize;
 			r.setWidth(t.xpos * 2);
 			r.moveTo(clipRect.width() / 2 - t.xpos, 0);
+			break;
 
-			g_system->delayMillis(t.stepDuration);
-			if (processQuitEvent(true))
-				break;
-
-			score->_backSurface->copyRectToSurface(*score->_surface, 0, 0, r);
-
-			g_system->copyRectToScreen(score->_backSurface->getPixels(), score->_backSurface->pitch, r.left, r.top, r.width(), r.height()); // transition
-			g_system->updateScreen();
-		}
-		break;
-
-	case kTransCenterOutVertical: // 7
-		for (uint16 i = 0; i < t.steps; i++) {
+		case kTransCenterOutVertical: // 7
 			t.ypos += t.yStepSize;
-
 			r.setHeight(t.ypos * 2);
 			r.moveTo(0, clipRect.height() / 2 - t.ypos);
+			break;
 
-			g_system->delayMillis(t.stepDuration);
-			if (processQuitEvent(true))
-				break;
-
-			score->_backSurface->copyRectToSurface(*score->_surface, 0, 0, r);
-
-			g_system->copyRectToScreen(score->_backSurface->getPixels(), score->_backSurface->pitch, r.left, r.top, r.width(), r.height()); // transition
-			g_system->updateScreen();
-		}
-		break;
-
-	case kTransCoverDown:	// 29
-		for (uint16 i = 1; i < t.steps; i++) {
+		case kTransCoverDown:	// 29
 			r.setHeight(t.yStepSize * i);
-			r.clip(clipRect);
-
-			g_system->delayMillis(t.stepDuration);
-			if (processQuitEvent(true))
-				break;
+			break;
 
-			g_system->copyRectToScreen(score->_surface->getPixels(), score->_surface->pitch, 0, 0, r.width(), r.height()); // transition
-			g_system->updateScreen();
-		}
-		break;
-
-	case kTransCoverDownLeft: // 30
-		for (uint16 i = 1; i < t.steps; i++) {
+		case kTransCoverDownLeft: // 30
 			r.setWidth(t.xStepSize * i);
 			r.setHeight(t.yStepSize * i);
 			r.moveTo(clipRect.width() - t.xStepSize * i, 0);
-			r.clip(clipRect);
-
-			g_system->delayMillis(t.stepDuration);
-			if (processQuitEvent(true))
-				break;
+			break;
 
-			g_system->copyRectToScreen(score->_surface->getPixels(), score->_surface->pitch, r.left, r.top, r.width(), r.height()); // transition
-			g_system->updateScreen();
-		}
-		break;
-
-	case kTransCoverDownRight: // 31
-		for (uint16 i = 1; i < t.steps; i++) {
+		case kTransCoverDownRight: // 31
 			r.setWidth(t.xStepSize * i);
 			r.setHeight(t.yStepSize * i);
-			r.clip(clipRect);
-
-			g_system->delayMillis(t.stepDuration);
-			if (processQuitEvent(true))
-				break;
-
-			g_system->copyRectToScreen(score->_surface->getPixels(), score->_surface->pitch, 0, 0, r.width(), r.height()); // transition
-			g_system->updateScreen();
-		}
-		break;
+			break;
 
-	case kTransCoverLeft:	// 32
-		for (uint16 i = 1; i < t.steps; i++) {
+		case kTransCoverLeft:	// 32
 			r.setWidth(t.xStepSize * i);
 			r.moveTo(clipRect.width() - t.xStepSize * i, 0);
-			r.clip(clipRect);
+			break;
 
-			g_system->delayMillis(t.stepDuration);
-			if (processQuitEvent(true))
-				break;
-
-			g_system->copyRectToScreen(score->_surface->getPixels(), score->_surface->pitch, r.left, r.top, r.width(), r.height()); // transition
-			g_system->updateScreen();
-		}
-		break;
-
-	case kTransCoverRight:	// 33
-		for (uint16 i = 1; i < t.steps; i++) {
+		case kTransCoverRight:	// 33
 			r.setWidth(t.xStepSize * i);
-			r.clip(clipRect);
-
-			g_system->delayMillis(t.stepDuration);
-			if (processQuitEvent(true))
-				break;
-
-			g_system->copyRectToScreen(score->_surface->getPixels(), score->_surface->pitch, 0, 0, r.width(), r.height()); // transition
-			g_system->updateScreen();
-		}
-		break;
+			break;
 
-	case kTransCoverUp:		// 34
-		for (uint16 i = 1; i < t.steps; i++) {
+		case kTransCoverUp:		// 34
 			r.setHeight(t.yStepSize * i);
 			r.moveTo(0, clipRect.height() - t.yStepSize * i);
-			r.clip(clipRect);
-
-			g_system->delayMillis(t.stepDuration);
-
-			if (processQuitEvent(true))
-				break;
-
-			g_system->copyRectToScreen(score->_surface->getPixels(), score->_surface->pitch, r.left, r.top, r.width(), r.height()); // transition
-			g_system->updateScreen();
-		}
-		break;
+			break;
 
-	case kTransCoverUpLeft:	// 35
-		for (uint16 i = 1; i < t.steps; i++) {
+		case kTransCoverUpLeft:	// 35
 			r.setWidth(t.xStepSize * i);
 			r.setHeight(t.yStepSize * i);
 			r.moveTo(clipRect.width() - t.xStepSize * i, clipRect.height() - t.yStepSize * i);
-			r.clip(clipRect);
+			break;
 
-			g_system->delayMillis(t.stepDuration);
-			if (processQuitEvent(true))
-				break;
-
-			g_system->copyRectToScreen(score->_surface->getPixels(), score->_surface->pitch, r.left, r.top, r.width(), r.height()); // transition
-			g_system->updateScreen();
-		}
-		break;
-
-	case kTransCoverUpRight:	// 36
-		for (uint16 i = 1; i < t.steps; i++) {
+		case kTransCoverUpRight:	// 36
 			r.setWidth(t.xStepSize * i);
 			r.setHeight(t.yStepSize * i);
 			r.moveTo(0, clipRect.height() - t.yStepSize * i);
-			r.clip(clipRect);
 
-			g_system->delayMillis(t.stepDuration);
-			if (processQuitEvent(true))
-				break;
-
-			g_system->copyRectToScreen(score->_surface->getPixels(), score->_surface->pitch, r.left, r.top, r.width(), r.height()); // transition
-			g_system->updateScreen();
-		}
-		break;
+		case kTransDissolvePixels: // 51
+			warning("Frame::playTransition(): Unhandled transition type %s %d %d", transProps[_transType].name, t.duration, _transChunkSize);
+			stop = true;
+			break;
 
-	case kTransDissolvePixels: // 51
-		{
+		default:
 			warning("Frame::playTransition(): Unhandled transition type %s %d %d", transProps[_transType].name, t.duration, _transChunkSize);
+			stop = true;
+			break;
 		}
-		break;
 
-	default:
-		warning("Frame::playTransition(): Unhandled transition type %s %d %d", transProps[_transType].name, t.duration, _transChunkSize);
-		break;
+		if (stop)
+			break;
+
+		r.clip(clipRect);
+
+		g_system->delayMillis(t.stepDuration);
+		if (processQuitEvent(true))
+			break;
+
+		score->_backSurface->copyRectToSurface(*score->_surface, 0, 0, r);
 
+		g_system->copyRectToScreen(score->_backSurface->getPixels(), score->_backSurface->pitch, r.left, r.top, r.width(), r.height()); // transition
+		g_system->updateScreen();
 	}
 }
 




More information about the Scummvm-git-logs mailing list