[Scummvm-git-logs] scummvm master -> 7801d86e79fa84b0622baf639e630734ffa00ad0

rvanlaar noreply at scummvm.org
Sun Mar 6 09:07:58 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:
7801d86e79 DIRECTOR: LINGO: Improve events in xPlayAnim


Commit: 7801d86e79fa84b0622baf639e630734ffa00ad0
    https://github.com/scummvm/scummvm/commit/7801d86e79fa84b0622baf639e630734ffa00ad0
Author: Roland van Laar (roland at rolandvanlaar.nl)
Date: 2022-03-06T10:07:05+01:00

Commit Message:
DIRECTOR: LINGO: Improve events in xPlayAnim

- PACo stops playing on keydown and mousedown
- quit event quits scummvm
- refactor quit event handler to be callable from outside the main event
  loop

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


diff --git a/engines/director/director.h b/engines/director/director.h
index 2c6eb35f064..e27ebf9025e 100644
--- a/engines/director/director.h
+++ b/engines/director/director.h
@@ -249,6 +249,7 @@ public:
 
 	// events.cpp
 	bool processEvents(bool captureClick = false);
+	void processEventQUIT();
 	uint32 getMacTicks();
 
 public:
diff --git a/engines/director/events.cpp b/engines/director/events.cpp
index ecb660ee77a..17f94dcaa26 100644
--- a/engines/director/events.cpp
+++ b/engines/director/events.cpp
@@ -64,7 +64,7 @@ bool DirectorEngine::processEvents(bool captureClick) {
 		// We want to handle these events regardless.
 		switch (event.type) {
 		case Common::EVENT_QUIT:
-			_stage->getCurrentMovie()->getScore()->_playState = kPlayStopped;
+			processEventQUIT();
 			if (captureClick)
 				return true;
 			break;
@@ -80,6 +80,10 @@ bool DirectorEngine::processEvents(bool captureClick) {
 	return false;
 }
 
+void DirectorEngine::processEventQUIT() {
+	_stage->getCurrentMovie()->getScore()->_playState = kPlayStopped;
+}
+
 bool Window::processEvent(Common::Event &event) {
 	bool flag = MacWindow::processEvent(event);
 
diff --git a/engines/director/lingo/lingo-builtins.cpp b/engines/director/lingo/lingo-builtins.cpp
index dc8511d0f69..5a24463f3d6 100644
--- a/engines/director/lingo/lingo-builtins.cpp
+++ b/engines/director/lingo/lingo-builtins.cpp
@@ -2703,7 +2703,7 @@ void LB::b_xPlayAnim(int nargs){
 	int x = g_lingo->pop().asInt();
 	Common::String filename = g_lingo->pop().asString();
 
-	warning("LB::b_xPlayAnim: x: %i y: %i", x, y);
+	debugN(5, "LB::b_xPlayAnim: x: %i y: %i", x, y);
 	Video::PacoDecoder *video = new Video::PacoDecoder();
 	video->loadFile(Common::Path(filename, g_director->_dirSeparator));
 
@@ -2721,20 +2721,23 @@ void LB::b_xPlayAnim(int nargs){
 	Common::Event event;
 	bool keepPlaying = true;
 	video->start();
-	while (!video->endOfVideo() && keepPlaying) {
-		warning("LB::b_xPlayAnim: loop");
-
+	while (!video->endOfVideo()) {
 		if (g_system->getEventManager()->pollEvent(event)) {
 			switch(event.type) {
 				case Common::EVENT_QUIT:
-				case Common::EVENT_RBUTTONUP:
-				case Common::EVENT_LBUTTONUP:
+					g_director->processEventQUIT();
+					// fallthrough
+				case Common::EVENT_KEYDOWN:
+				case Common::EVENT_RBUTTONDOWN:
+				case Common::EVENT_LBUTTONDOWN:
 					keepPlaying = false;
 					break;
 				default:
-					continue;
+					break;
 			}
 		}
+		if (!keepPlaying)
+			break;
 		if (video->needsUpdate()) {
 			frame = video->decodeNextFrame();
 			g_system->copyRectToScreen(frame->getPixels(), frame->pitch, x, y, frame->w, frame->h);




More information about the Scummvm-git-logs mailing list