[Scummvm-git-logs] scummvm master -> 1be7de067bf7b77bcc7aa4cb6c8fd760e7448205

rvanlaar noreply at scummvm.org
Sat Mar 5 21:37:20 UTC 2022


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

Summary:
1be7de067b DIRECTOR: LINGO: xPlayAnim improvements


Commit: 1be7de067bf7b77bcc7aa4cb6c8fd760e7448205
    https://github.com/scummvm/scummvm/commit/1be7de067bf7b77bcc7aa4cb6c8fd760e7448205
Author: Roland van Laar (roland at rolandvanlaar.nl)
Date: 2022-03-05T22:37:04+01:00

Commit Message:
DIRECTOR: LINGO: xPlayAnim improvements

- keep last played frame displayed on screen
- stop playing the video on mouse click

Changed paths:
    engines/director/lingo/lingo-builtins.cpp


diff --git a/engines/director/lingo/lingo-builtins.cpp b/engines/director/lingo/lingo-builtins.cpp
index c9c8388d2ab..dc8511d0f69 100644
--- a/engines/director/lingo/lingo-builtins.cpp
+++ b/engines/director/lingo/lingo-builtins.cpp
@@ -2717,18 +2717,26 @@ void LB::b_xPlayAnim(int nargs){
 	}
 
 	memcpy(origPalette, g_director->getPalette(), origCount * 3);
-
+	Graphics::Surface const *frame;
 	Common::Event event;
+	bool keepPlaying = true;
 	video->start();
-	while (!video->endOfVideo()) {
+	while (!video->endOfVideo() && keepPlaying) {
 		warning("LB::b_xPlayAnim: loop");
 
-		if (g_system->getEventManager()->pollEvent(event))
-			if (event.type == Common::EVENT_QUIT)
-				break;
-
+		if (g_system->getEventManager()->pollEvent(event)) {
+			switch(event.type) {
+				case Common::EVENT_QUIT:
+				case Common::EVENT_RBUTTONUP:
+				case Common::EVENT_LBUTTONUP:
+					keepPlaying = false;
+					break;
+				default:
+					continue;
+			}
+		}
 		if (video->needsUpdate()) {
-			Graphics::Surface const *frame = video->decodeNextFrame();
+			frame = video->decodeNextFrame();
 			g_system->copyRectToScreen(frame->getPixels(), frame->pitch, x, y, frame->w, frame->h);
 		}
 		if (video->hasDirtyPalette()) {
@@ -2740,6 +2748,11 @@ void LB::b_xPlayAnim(int nargs){
 		g_system->delayMillis(10);
 
 	}
+	// Display the last frame after the video is done
+	g_director->getCurrentWindow()->getSurface()->copyRectToSurface(
+		frame->getPixels(), frame->pitch, x, y, frame->w, frame->h
+	);
+
 	video->close();
 	delete video;
 	// restore the palette




More information about the Scummvm-git-logs mailing list