[Scummvm-git-logs] scummvm master -> 3deabc987394c52f0cd3a809f11578979f9fbaaf

sluicebox 22204938+sluicebox at users.noreply.github.com
Mon Apr 20 23:02:18 UTC 2020


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:
3deabc9873 SCI32: Add QuickTime support for KQ7 Mac movies


Commit: 3deabc987394c52f0cd3a809f11578979f9fbaaf
    https://github.com/scummvm/scummvm/commit/3deabc987394c52f0cd3a809f11578979f9fbaaf
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2020-04-20T15:59:32-07:00

Commit Message:
SCI32: Add QuickTime support for KQ7 Mac movies

Changed paths:
    engines/sci/engine/kvideo.cpp
    engines/sci/graphics/video32.cpp
    engines/sci/graphics/video32.h


diff --git a/engines/sci/engine/kvideo.cpp b/engines/sci/engine/kvideo.cpp
index 964f28b190..c7e0d340fb 100644
--- a/engines/sci/engine/kvideo.cpp
+++ b/engines/sci/engine/kvideo.cpp
@@ -202,7 +202,11 @@ reg_t kShowMovie32(EngineState *s, int argc, reg_t *argv) {
 	const int16 x = argc > 3 ? argv[2].toSint16() : 0;
 	const int16 y = argc > 3 ? argv[3].toSint16() : 0;
 
-	g_sci->_video32->getSEQPlayer().play(fileName, numTicks, x, y);
+	if (g_sci->getPlatform() == Common::kPlatformMacintosh) {
+		g_sci->_video32->getQuickTimePlayer().play(fileName);
+	} else {
+		g_sci->_video32->getSEQPlayer().play(fileName, numTicks, x, y);
+	}
 
 	return s->r_acc;
 }
diff --git a/engines/sci/graphics/video32.cpp b/engines/sci/graphics/video32.cpp
index 264cfcf316..da806d48b2 100644
--- a/engines/sci/graphics/video32.cpp
+++ b/engines/sci/graphics/video32.cpp
@@ -50,6 +50,7 @@
 #include "sci/video/seq_decoder.h"       // for SEQDecoder
 #include "video/avi_decoder.h"           // for AVIDecoder
 #include "video/coktel_decoder.h"        // for AdvancedVMDDecoder
+#include "video/qt_decoder.h"            // for QuickTimeDecoder
 #include "sci/graphics/video32.h"
 
 namespace Graphics { struct Surface; }
@@ -504,6 +505,41 @@ uint16 AVIPlayer::getDuration() const {
 	return _decoder->getFrameCount();
 }
 
+#pragma mark -
+#pragma mark QuickTimePlayer
+
+QuickTimePlayer::QuickTimePlayer(EventManager *eventMan) :
+	VideoPlayer(eventMan) {}
+
+void QuickTimePlayer::play(const Common::String& fileName) {
+	_decoder.reset(new Video::QuickTimeDecoder());
+	
+	if (!VideoPlayer::open(fileName)) {
+		_decoder.reset();
+		return;
+	}
+
+	const int16 scriptWidth = g_sci->_gfxFrameout->getScriptWidth();
+	const int16 scriptHeight = g_sci->_gfxFrameout->getScriptHeight();
+	const int16 screenWidth = g_sci->_gfxFrameout->getScreenWidth();
+	const int16 screenHeight = g_sci->_gfxFrameout->getScreenHeight();
+
+	const int16 scaledWidth = (_decoder->getWidth() * Ratio(screenWidth, scriptWidth)).toInt();
+	const int16 scaledHeight = (_decoder->getHeight() * Ratio(screenHeight, scriptHeight)).toInt();
+
+	_drawRect.left = (screenWidth - scaledWidth) / 2;
+	_drawRect.top = (screenHeight - scaledHeight) / 2;
+	_drawRect.setWidth(scaledWidth);
+	_drawRect.setHeight(scaledHeight);
+
+	startHQVideo();
+	playUntilEvent(kEventFlagMouseDown | kEventFlagEscapeKey);
+	endHQVideo();
+
+	g_system->fillScreen(0);
+	_decoder.reset();
+}
+
 #pragma mark -
 #pragma mark VMDPlayer
 
diff --git a/engines/sci/graphics/video32.h b/engines/sci/graphics/video32.h
index 4c4b3562e4..658f563a96 100644
--- a/engines/sci/graphics/video32.h
+++ b/engines/sci/graphics/video32.h
@@ -275,6 +275,23 @@ private:
 	AVIStatus _status;
 };
 
+#pragma mark -
+#pragma mark QuickTimePlayer
+
+/**
+ * QuickTimePlayer is used to play QuickTime animations.
+ * Used by Mac version of KQ7.
+ */
+class QuickTimePlayer : public VideoPlayer {
+public:
+	QuickTimePlayer(EventManager *eventMan);
+	
+	/**
+	 * Plays a QuickTime animation with the given file name
+	 */
+	void play(const Common::String& fileName);
+};
+
 #pragma mark -
 #pragma mark VMDPlayer
 
@@ -764,6 +781,7 @@ public:
 	Video32(SegManager *segMan, EventManager *eventMan) :
 	_SEQPlayer(eventMan),
 	_AVIPlayer(eventMan),
+	_QuickTimePlayer(eventMan),
 	_VMDPlayer(eventMan, segMan),
 	_robotPlayer(segMan),
 	_duckPlayer(eventMan, segMan) {}
@@ -773,6 +791,7 @@ public:
 
 	SEQPlayer &getSEQPlayer() { return _SEQPlayer; }
 	AVIPlayer &getAVIPlayer() { return _AVIPlayer; }
+	QuickTimePlayer &getQuickTimePlayer() { return _QuickTimePlayer; }
 	VMDPlayer &getVMDPlayer() { return _VMDPlayer; }
 	RobotDecoder &getRobotPlayer() { return _robotPlayer; }
 	DuckPlayer &getDuckPlayer() { return _duckPlayer; }
@@ -780,6 +799,7 @@ public:
 private:
 	SEQPlayer _SEQPlayer;
 	AVIPlayer _AVIPlayer;
+	QuickTimePlayer _QuickTimePlayer;
 	VMDPlayer _VMDPlayer;
 	RobotDecoder _robotPlayer;
 	DuckPlayer _duckPlayer;




More information about the Scummvm-git-logs mailing list