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

dreammaster dreammaster at scummvm.org
Tue Aug 1 04:20:55 CEST 2017


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:
bc29ee474a TITANIC: Handle brief freeze if prologue credits are skipped


Commit: bc29ee474a4e95b91c6be3a33fd67de2a402a112
    https://github.com/scummvm/scummvm/commit/bc29ee474a4e95b91c6be3a33fd67de2a402a112
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2017-07-31T22:20:50-04:00

Commit Message:
TITANIC: Handle brief freeze if prologue credits are skipped

Changed paths:
    engines/titanic/core/game_object.cpp
    engines/titanic/core/game_object.h
    engines/titanic/game/credits.cpp
    engines/titanic/support/avi_surface.cpp
    engines/titanic/support/avi_surface.h
    engines/titanic/support/movie.cpp
    engines/titanic/support/movie.h


diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp
index 3619d56..5a55d24 100644
--- a/engines/titanic/core/game_object.cpp
+++ b/engines/titanic/core/game_object.cpp
@@ -686,18 +686,21 @@ void CGameObject::playRandomClip(const char *const *names, uint flags) {
 	playClip(name, flags);
 }
 
-void CGameObject::playCutscene(uint startFrame, uint endFrame) {
+bool CGameObject::playCutscene(uint startFrame, uint endFrame) {
 	if (!_surface) {
 		if (!_resource.empty())
 			loadResource(_resource);
 		_resource.clear();
 	}
 
+	bool result = true;
 	if (_surface && _surface->loadIfReady() && _surface->_movie) {
 		disableMouse();
-		_surface->_movie->playCutscene(_bounds, startFrame, endFrame);
+		result = _surface->_movie->playCutscene(_bounds, startFrame, endFrame);
 		enableMouse();
 	}
+
+	return result;
 }
 
 void CGameObject::savePosition() {
diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h
index 0d2b8c9..c09577a 100644
--- a/engines/titanic/core/game_object.h
+++ b/engines/titanic/core/game_object.h
@@ -393,8 +393,9 @@ protected:
 
 	/**
 	 * Play a cutscene
+	 * @returns		True if the cutscene was not interrupted
 	 */
-	void playCutscene(uint startFrame, uint endFrame);
+	bool playCutscene(uint startFrame, uint endFrame);
 
 	/**
 	 * Play a clip randomly from a passed list of names
diff --git a/engines/titanic/game/credits.cpp b/engines/titanic/game/credits.cpp
index 02c2b08..8333343 100644
--- a/engines/titanic/game/credits.cpp
+++ b/engines/titanic/game/credits.cpp
@@ -61,11 +61,13 @@ bool CCredits::TimerMsg(CTimerMsg *msg) {
 	loadSound("a#16.wav");
 	loadSound("a#24.wav");
 
-	playCutscene(0, 18);
-	playGlobalSound("a#16.wav", VOL_NORMAL, false, false, 0);
-	playCutscene(19, 642);
-	playSound("a#24.wav");
-	playCutscene(643, 750);
+	if (playCutscene(0, 18)) {
+		playGlobalSound("a#16.wav", VOL_NORMAL, false, false, 0);
+		if (playCutscene(19, 642)) {
+			playSound("a#24.wav");
+			playCutscene(643, 750);
+		}
+	}
 
 	COpeningCreditsMsg creditsMsg;
 	creditsMsg.execute("Service Elevator Entity");
diff --git a/engines/titanic/support/avi_surface.cpp b/engines/titanic/support/avi_surface.cpp
index e52c2a7..86daeab 100644
--- a/engines/titanic/support/avi_surface.cpp
+++ b/engines/titanic/support/avi_surface.cpp
@@ -471,7 +471,7 @@ Graphics::ManagedSurface *AVISurface::duplicateTransparency() const {
 	}
 }
 
-void AVISurface::playCutscene(const Rect &r, uint startFrame, uint endFrame) {
+bool AVISurface::playCutscene(const Rect &r, uint startFrame, uint endFrame) {
 	bool isDifferent = false;
 	
 	if (_currentFrame != ((int)startFrame - 1) || startFrame == 0) {
@@ -487,6 +487,7 @@ void AVISurface::playCutscene(const Rect &r, uint startFrame, uint endFrame) {
 	isDifferent = _movieFrameSurface[0]->w != r.width() ||
 		_movieFrameSurface[0]->h != r.height();
 
+	bool isFinished = true;
 	while (_currentFrame < (int)endFrame && !g_vm->shouldQuit()) {
 		if (isNextFrame()) {
 			renderFrame();
@@ -507,11 +508,14 @@ void AVISurface::playCutscene(const Rect &r, uint startFrame, uint endFrame) {
 		}
 
 		// Brief wait, and check at the same time for clicks to abort the clip
-		if (g_vm->_events->waitForPress(10))
+		if (g_vm->_events->waitForPress(10)) {
+			isFinished = false;
 			break;
+		}
 	}
 
 	stop();
+	return isFinished;
 }
 
 uint AVISurface::getBitDepth() const {
diff --git a/engines/titanic/support/avi_surface.h b/engines/titanic/support/avi_surface.h
index fd21c9c..cb2e562 100644
--- a/engines/titanic/support/avi_surface.h
+++ b/engines/titanic/support/avi_surface.h
@@ -215,8 +215,9 @@ public:
 
 	/**
 	 * Plays an interruptable cutscene
+	 * @returns		True if the cutscene was not interrupted
 	 */
-	void playCutscene(const Rect &r, uint startFrame, uint endFrame);
+	bool playCutscene(const Rect &r, uint startFrame, uint endFrame);
 
 	/**
 	 * Returns the pixel depth of the movie in bits
diff --git a/engines/titanic/support/movie.cpp b/engines/titanic/support/movie.cpp
index eb65cf1..a57a84d 100644
--- a/engines/titanic/support/movie.cpp
+++ b/engines/titanic/support/movie.cpp
@@ -116,7 +116,7 @@ void OSMovie::play(uint startFrame, uint endFrame, uint initialFrame, uint flags
 		movieStarted();
 }
 
-void OSMovie::playCutscene(const Rect &drawRect, uint startFrame, uint endFrame) {
+bool OSMovie::playCutscene(const Rect &drawRect, uint startFrame, uint endFrame) {
 	if (!_movieSurface)
 		_movieSurface = CScreenManager::_screenManagerPtr->createSurface(600, 340, 32);
 
@@ -124,9 +124,10 @@ void OSMovie::playCutscene(const Rect &drawRect, uint startFrame, uint endFrame)
 	CEventTarget eventTarget;
 	g_vm->_events->addTarget(&eventTarget);
 
-	_aviSurface.playCutscene(drawRect, startFrame, endFrame);
+	bool result = _aviSurface.playCutscene(drawRect, startFrame, endFrame);
 
 	g_vm->_events->removeTarget();
+	return result;
 }
 
 void OSMovie::pause() {
diff --git a/engines/titanic/support/movie.h b/engines/titanic/support/movie.h
index caeba65..cedf7c4 100644
--- a/engines/titanic/support/movie.h
+++ b/engines/titanic/support/movie.h
@@ -86,8 +86,9 @@ public:
 	/**
 	 * Plays a sub-section of a movie, and doesn't return until either
 	 * the playback ends or a key has been pressed
+	 * @returns		True if the cutscene was not interrupted
 	 */
-	virtual void playCutscene(const Rect &drawRect, uint startFrame, uint endFrame) = 0;
+	virtual bool playCutscene(const Rect &drawRect, uint startFrame, uint endFrame) = 0;
 
 	/**
 	 * Pauses a movie
@@ -193,8 +194,9 @@ public:
 	/**
 	 * Plays a sub-section of a movie, and doesn't return until either
 	 * the playback ends or a key has been pressed
+	 * @returns		True if the cutscene was not interrupted
 	 */
-	virtual void playCutscene(const Rect &drawRect, uint startFrame, uint endFrame);
+	virtual bool playCutscene(const Rect &drawRect, uint startFrame, uint endFrame);
 
 	/**
 	 * Pauses a movie





More information about the Scummvm-git-logs mailing list