[Scummvm-git-logs] scummvm master -> 4406d6c598c1348152ef3f34ef63ccba39d2cbea

djsrv dservilla at gmail.com
Mon Aug 2 14:12:25 UTC 2021


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

Summary:
88f77b53c1 DIRECTOR: Modify _vm->processEvents to handle transition events
4406d6c598 DIRECTOR: Don't register idle event when new movie started


Commit: 88f77b53c1136ed3022c82c5967934dd0d59c325
    https://github.com/scummvm/scummvm/commit/88f77b53c1136ed3022c82c5967934dd0d59c325
Author: djsrv (dservilla at gmail.com)
Date: 2021-08-02T10:12:15-04:00

Commit Message:
DIRECTOR: Modify _vm->processEvents to handle transition events

processTransitionEvent skipped passing events to the window manager
and sent them directly to the current window, which is no good since the
event may need to go to another window. It also broke stopping
transitions on click.

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


diff --git a/engines/director/director.h b/engines/director/director.h
index 432bb0b4b9..83ebba285f 100644
--- a/engines/director/director.h
+++ b/engines/director/director.h
@@ -230,7 +230,7 @@ public:
 	Archive *createArchive();
 
 	// events.cpp
-	void processEvents();
+	bool processEvents(bool captureClick = false);
 	uint32 getMacTicks();
 
 public:
diff --git a/engines/director/events.cpp b/engines/director/events.cpp
index 9e6d7da679..81bcc0c924 100644
--- a/engines/director/events.cpp
+++ b/engines/director/events.cpp
@@ -36,67 +36,31 @@
 
 namespace Director {
 
-bool processQuitEvent(bool click) {
-	Common::Event event;
-
-	while (g_system->getEventManager()->pollEvent(event)) {
-		if (event.type == Common::EVENT_QUIT) {
-			g_director->getCurrentMovie()->getScore()->_playState = kPlayStopped;
-			return true;
-		}
-
-		if (click) {
-			if (event.type == Common::EVENT_LBUTTONDOWN)
-				return true;
-		}
-	}
-
-	return false;
-}
-
-bool Window::processTransitionEvent(bool click) {
-	Common::Event event;
-
-	while (g_system->getEventManager()->pollEvent(event)) {
-		if (event.type == Common::EVENT_QUIT)
-			return true;
-		if (!processEvent(event)) {
-			if (click && event.type == Common::EVENT_LBUTTONDOWN)
-				return true;
-		}
-	}
-	return false;
-}
-
 uint32 DirectorEngine::getMacTicks() { return g_system->getMillis() * 60 / 1000.; }
 
-void DirectorEngine::processEvents() {
+bool DirectorEngine::processEvents(bool captureClick) {
 	debugC(3, kDebugEvents, "\n@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@");
 	debugC(3, kDebugEvents, "@@@@   Processing events");
 	debugC(3, kDebugEvents, "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n");
 
 	Common::Event event;
-
-	uint endTime = g_system->getMillis() + 10;
-
-	while (g_system->getMillis() < endTime) {
-		while (g_system->getEventManager()->pollEvent(event)) {
-			if (_wm->processEvent(event)) {
-				// window manager has done something! update the channels
-				continue;
-			}
-
-			switch (event.type) {
-			case Common::EVENT_QUIT:
-				_stage->getCurrentMovie()->getScore()->_playState = kPlayStopped;
-				break;
-			default:
-				break;
-			}
+	while (g_system->getEventManager()->pollEvent(event)) {
+		_wm->processEvent(event);
+
+		switch (event.type) {
+		case Common::EVENT_QUIT:
+			_stage->getCurrentMovie()->getScore()->_playState = kPlayStopped;
+			break;
+		case Common::EVENT_LBUTTONDOWN:
+			if (captureClick)
+				return true;
+			break;
+		default:
+			break;
 		}
-
-		g_system->delayMillis(10);
 	}
+
+	return false;
 }
 
 bool Window::processEvent(Common::Event &event) {
diff --git a/engines/director/transitions.cpp b/engines/director/transitions.cpp
index 69ed0b421d..774368092b 100644
--- a/engines/director/transitions.cpp
+++ b/engines/director/transitions.cpp
@@ -515,7 +515,7 @@ void Window::playTransition(uint16 transDuration, uint8 transArea, uint8 transCh
 		_composeSurface->blitFrom(*blitFrom, rfrom, Common::Point(rto.left, rto.top));
 
 		g_system->delayMillis(t.stepDuration);
-		if (processTransitionEvent(true)) {
+		if (_vm->processEvents(true)) {
 			exitTransition(&nextFrame, clipRect);
 			break;
 		}
@@ -714,7 +714,7 @@ void Window::dissolveTrans(TransParams &t, Common::Rect &clipRect, Graphics::Man
 
 		g_lingo->executePerFrameHook(t.frame, i + 1);
 
-		if (processTransitionEvent(true)) {
+		if (_vm->processEvents(true)) {
 			exitTransition(nextFrame, clipRect);
 			break;
 		}
@@ -817,7 +817,7 @@ void Window::dissolvePatternsTrans(TransParams &t, Common::Rect &clipRect, Graph
 
 		g_lingo->executePerFrameHook(t.frame, i + 1);
 
-		if (processTransitionEvent(true)) {
+		if (_vm->processEvents(true)) {
 			exitTransition(nextFrame, clipRect);
 			break;
 		}
@@ -992,7 +992,7 @@ void Window::transMultiPass(TransParams &t, Common::Rect &clipRect, Graphics::Ma
 
 		g_system->delayMillis(t.stepDuration);
 
-		if (processTransitionEvent(true)) {
+		if (_vm->processEvents(true)) {
 			exitTransition(nextFrame, clipRect);
 			break;
 		}
@@ -1039,7 +1039,7 @@ void Window::transZoom(TransParams &t, Common::Rect &clipRect, Graphics::Managed
 
 		g_system->delayMillis(t.stepDuration);
 
-		if (processTransitionEvent(true)) {
+		if (_vm->processEvents(true)) {
 			exitTransition(nextFrame, clipRect);
 			break;
 		}
diff --git a/engines/director/util.h b/engines/director/util.h
index 049fe13651..a67893a035 100644
--- a/engines/director/util.h
+++ b/engines/director/util.h
@@ -56,8 +56,6 @@ Common::String dumpScriptName(const char *prefix, int type, int id, const char *
 
 bool isButtonSprite(SpriteType spriteType);
 
-bool processQuitEvent(bool click = false); // events.cpp
-
 class RandomState {
 public:
 	uint32 _seed;
diff --git a/engines/director/window.h b/engines/director/window.h
index 42488c039f..1a07f85ffa 100644
--- a/engines/director/window.h
+++ b/engines/director/window.h
@@ -134,7 +134,6 @@ public:
 
 	// events.cpp
 	virtual bool processEvent(Common::Event &event) override;
-	bool processTransitionEvent(bool click);
 
 	// tests.cpp
 	Common::HashMap<Common::String, Movie *> *scanMovies(const Common::String &folder);


Commit: 4406d6c598c1348152ef3f34ef63ccba39d2cbea
    https://github.com/scummvm/scummvm/commit/4406d6c598c1348152ef3f34ef63ccba39d2cbea
Author: djsrv (dservilla at gmail.com)
Date: 2021-08-02T10:12:15-04:00

Commit Message:
DIRECTOR: Don't register idle event when new movie started

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


diff --git a/engines/director/lingo/lingo-events.cpp b/engines/director/lingo/lingo-events.cpp
index bbfe666d9c..8b6395808b 100644
--- a/engines/director/lingo/lingo-events.cpp
+++ b/engines/director/lingo/lingo-events.cpp
@@ -29,6 +29,7 @@
 #include "director/frame.h"
 #include "director/score.h"
 #include "director/sprite.h"
+#include "director/window.h"
 
 namespace Director {
 
@@ -322,10 +323,11 @@ void Movie::processEvent(LEvent event, int targetId) {
 
 void Lingo::processEvents() {
 	int lastEventId = -1;
+	Window *window = _vm->getCurrentWindow();
 	Movie *movie = _vm->getCurrentMovie();
 	Score *sc = movie->getScore();
 
-	if (_vm->getVersion() >= 300 && sc->getCurrentFrame() > 0 && sc->_playState != kPlayStopped && movie->_eventQueue.empty())
+	if (_vm->getVersion() >= 300 && !window->_newMovieStarted && sc->_playState != kPlayStopped && movie->_eventQueue.empty())
 		movie->registerEvent(kEventIdle);
 
 	while (!movie->_eventQueue.empty()) {




More information about the Scummvm-git-logs mailing list