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

dreammaster dreammaster at scummvm.org
Thu Sep 1 04:06:09 CEST 2016


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:
a1d51d3142 TITANIC: View change animations now partially working


Commit: a1d51d31420ca07228fbcbe05624b5cf3a407133
    https://github.com/scummvm/scummvm/commit/a1d51d31420ca07228fbcbe05624b5cf3a407133
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2016-08-31T22:05:58-04:00

Commit Message:
TITANIC: View change animations now partially working

Changed paths:
    engines/titanic/support/avi_surface.cpp
    engines/titanic/support/avi_surface.h
    engines/titanic/support/movie.cpp



diff --git a/engines/titanic/support/avi_surface.cpp b/engines/titanic/support/avi_surface.cpp
index c37bd83..e43127c 100644
--- a/engines/titanic/support/avi_surface.cpp
+++ b/engines/titanic/support/avi_surface.cpp
@@ -20,12 +20,13 @@
  *
  */
 
-#include "titanic/support/avi_surface.h"
-#include "titanic/support/screen_manager.h"
-#include "titanic/support/video_surface.h"
 #include "common/system.h"
 #include "graphics/pixelformat.h"
 #include "video/avi_decoder.h"
+#include "titanic/support/avi_surface.h"
+#include "titanic/support/screen_manager.h"
+#include "titanic/support/video_surface.h"
+#include "titanic/titanic.h"
 
 namespace Titanic {
 
@@ -358,4 +359,31 @@ Graphics::ManagedSurface *AVISurface::duplicateSecondaryFrame() const {
 	}
 }
 
+void AVISurface::playCutscene(const Rect &r, uint startFrame, uint endFrame) {
+	bool isDifferent = _movieFrameSurface[0]->w != r.width() ||
+		_movieFrameSurface[0]->h != r.height();
+
+	startAtFrame(startFrame);
+	while (getFrame() <= (int)endFrame) {
+		if (isNextFrame()) {
+			renderFrame();
+			_currentFrame = _decoders[0]->getCurFrame();
+
+			if (isDifferent) {
+				// Clear the destination area, and use the transBlitFrom method,
+				// which supports arbitrary scaling, to reduce to the desired size
+				g_vm->_screen->fillRect(r, 0);
+				g_vm->_screen->transBlitFrom(*_movieFrameSurface[0],
+					Common::Rect(0, 0, _movieFrameSurface[0]->w, _movieFrameSurface[0]->h), r);
+			} else {
+				g_vm->_screen->blitFrom(*_movieFrameSurface[0], Common::Point(r.left, r.top));
+			}
+		}
+
+		// Brief wait, and check at the same time for clicks to abort the clip
+		if (g_vm->_events->waitForPress(10))
+			break;
+	}
+}
+
 } // End of namespace Titanic
diff --git a/engines/titanic/support/avi_surface.h b/engines/titanic/support/avi_surface.h
index d21182b..54b0155 100644
--- a/engines/titanic/support/avi_surface.h
+++ b/engines/titanic/support/avi_surface.h
@@ -176,6 +176,11 @@ public:
 	 * Returns true if it's time for the next
 	 */
 	bool isNextFrame() const;
+
+	/**
+	 * Plays an interruptable cutscene
+	 */
+	void playCutscene(const Rect &r, uint startFrame, uint endFrame);
 };
 
 } // End of namespace Titanic
diff --git a/engines/titanic/support/movie.cpp b/engines/titanic/support/movie.cpp
index 50a55c8..cfdcecb 100644
--- a/engines/titanic/support/movie.cpp
+++ b/engines/titanic/support/movie.cpp
@@ -133,22 +133,8 @@ void OSMovie::playCutscene(const Rect &drawRect, uint startFrame, uint endFrame)
 		drawRect.top + (heightLess ? CLIP_HEIGHT_REDUCED : CLIP_HEIGHT)
 	);
 
-	uint timePerFrame = (uint)(1000.0 / _aviSurface._frameRate);
-
-	for (; startFrame < endFrame; ++startFrame) {
-		// Set the frame
-		_aviSurface.setFrame(startFrame);
-
-		// TODO: See if we need to do anything further here. The original had a bunch
-		// of calls and using of the _movieSurface; perhaps to allow scaling down
-		// videos to half-size
-		if (widthLess || heightLess)
-			warning("Not properly reducing clip size: %d %d", r.width(), r.height());
-
-		// Wait for the next frame, unless the user interrupts the clip
-		if (g_vm->_events->waitForPress(timePerFrame))
-			break;
-	}
+	_aviSurface.setFrame(startFrame);
+	_aviSurface.playCutscene(r, startFrame, endFrame);
 }
 
 void OSMovie::stop() {





More information about the Scummvm-git-logs mailing list