[Scummvm-cvs-logs] scummvm master -> 707afebbf19e62462f6ffd632f658fb2c1cf2cb4

dreammaster dreammaster at scummvm.org
Thu Sep 10 02:26:39 CEST 2015


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:
707afebbf1 SHERLOCK: 3DO: Move 3do movie playback method into ScalpelEngine


Commit: 707afebbf19e62462f6ffd632f658fb2c1cf2cb4
    https://github.com/scummvm/scummvm/commit/707afebbf19e62462f6ffd632f658fb2c1cf2cb4
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2015-09-09T20:26:05-04:00

Commit Message:
SHERLOCK: 3DO: Move 3do movie playback method into ScalpelEngine

Changed paths:
    engines/sherlock/debugger.cpp
    engines/sherlock/scalpel/3do/movie_decoder.cpp
    engines/sherlock/scalpel/3do/movie_decoder.h
    engines/sherlock/scalpel/scalpel.cpp
    engines/sherlock/scalpel/scalpel.h
    engines/sherlock/scalpel/scalpel_talk.cpp



diff --git a/engines/sherlock/debugger.cpp b/engines/sherlock/debugger.cpp
index 50293db..39f8da3 100644
--- a/engines/sherlock/debugger.cpp
+++ b/engines/sherlock/debugger.cpp
@@ -23,7 +23,7 @@
 #include "sherlock/debugger.h"
 #include "sherlock/sherlock.h"
 #include "sherlock/music.h"
-#include "sherlock/scalpel/3do/movie_decoder.h"
+#include "sherlock/scalpel/scalpel.h"
 #include "sherlock/scalpel/scalpel_debugger.h"
 #include "sherlock/tattoo/tattoo_debugger.h"
 #include "audio/mixer.h"
@@ -54,7 +54,7 @@ Debugger::Debugger(SherlockEngine *vm) : GUI::Debugger(), _vm(vm) {
 
 void Debugger::postEnter() {
 	if (!_3doPlayMovieFile.empty()) {
-		Scalpel3DOMoviePlay(_3doPlayMovieFile.c_str(), Common::Point(0, 0));
+		static_cast<Scalpel::ScalpelEngine *>(_vm)->play3doMovie(_3doPlayMovieFile, Common::Point(0, 0));
 
 		_3doPlayMovieFile.clear();
 	}
diff --git a/engines/sherlock/scalpel/3do/movie_decoder.cpp b/engines/sherlock/scalpel/3do/movie_decoder.cpp
index 8e8f99b..da4d08c 100644
--- a/engines/sherlock/scalpel/3do/movie_decoder.cpp
+++ b/engines/sherlock/scalpel/3do/movie_decoder.cpp
@@ -464,47 +464,4 @@ Audio::AudioStream *Scalpel3DOMovieDecoder::StreamAudioTrack::getAudioStream() c
 	return _audioStream;
 }
 
-// Test-code
-
-// Code for showing a movie. Only meant for testing/debug purposes
-bool Scalpel3DOMoviePlay(const char *filename, Common::Point pos) {
-	Scalpel3DOMovieDecoder *videoDecoder = new Scalpel3DOMovieDecoder();
-
-	if (!videoDecoder->loadFile(filename)) {
-		warning("Scalpel3DOMoviePlay: could not open '%s'", filename);
-		return false;
-	}
-
-	bool skipVideo = false;
-	//byte bytesPerPixel = videoDecoder->getPixelFormat().bytesPerPixel;
-	uint16 width = videoDecoder->getWidth();
-	uint16 height = videoDecoder->getHeight();
-	//uint16 pitch = videoDecoder->getWidth() * bytesPerPixel;
-
-	videoDecoder->start();
-
-	while (!g_engine->shouldQuit() && !videoDecoder->endOfVideo() && (!skipVideo)) {
-		if (videoDecoder->needsUpdate()) {
-			const Graphics::Surface *frame = videoDecoder->decodeNextFrame();
-
-			if (frame) {
-				g_system->copyRectToScreen(frame->getPixels(), frame->pitch, pos.x, pos.y, width, height);
-				g_system->updateScreen();
-			}
-		}
-
-		Common::Event event;
-		while (g_system->getEventManager()->pollEvent(event)) {
-			if ((event.type == Common::EVENT_KEYDOWN && event.kbd.keycode == Common::KEYCODE_ESCAPE))
-				skipVideo = true;
-		}
-
-		g_system->delayMillis(10);
-	}
-	videoDecoder->close();
-	delete videoDecoder;
-
-	return !skipVideo;
-}
-
 } // End of namespace Sherlock
diff --git a/engines/sherlock/scalpel/3do/movie_decoder.h b/engines/sherlock/scalpel/3do/movie_decoder.h
index 9f1670f..73b1254 100644
--- a/engines/sherlock/scalpel/3do/movie_decoder.h
+++ b/engines/sherlock/scalpel/3do/movie_decoder.h
@@ -119,9 +119,6 @@ private:
 	StreamAudioTrack *_audioTrack;
 };
 
-// Testing
-extern bool Scalpel3DOMoviePlay(const char *filename, Common::Point pos);
-
 } // End of namespace Sherlock
 
 #endif
diff --git a/engines/sherlock/scalpel/scalpel.cpp b/engines/sherlock/scalpel/scalpel.cpp
index 73ee33b..e91c774 100644
--- a/engines/sherlock/scalpel/scalpel.cpp
+++ b/engines/sherlock/scalpel/scalpel.cpp
@@ -32,7 +32,6 @@
 #include "sherlock/sherlock.h"
 #include "sherlock/music.h"
 #include "sherlock/animation.h"
-// for 3DO
 #include "sherlock/scalpel/3do/movie_decoder.h"
 
 namespace Sherlock {
@@ -660,7 +659,7 @@ bool ScalpelEngine::show3DOSplash() {
 
 	if (finished) {
 		// EA logo movie
-		Scalpel3DOMoviePlay("EAlogo.stream", Common::Point(20, 0));
+		play3doMovie("EAlogo.stream", Common::Point(20, 0));
 	}
 
 	// Always clear screen
@@ -1241,6 +1240,51 @@ void ScalpelEngine::showScummVMRestoreDialog() {
 	}
 }
 
+bool ScalpelEngine::play3doMovie(const Common::String &filename, const Common::Point &pos) {
+	Scalpel3DOMovieDecoder *videoDecoder = new Scalpel3DOMovieDecoder();
+
+	if (!videoDecoder->loadFile(filename)) {
+		warning("Scalpel3DOMoviePlay: could not open '%s'", filename.c_str());
+		return false;
+	}
+
+	bool skipVideo = false;
+	//byte bytesPerPixel = videoDecoder->getPixelFormat().bytesPerPixel;
+	uint16 width = videoDecoder->getWidth();
+	uint16 height = videoDecoder->getHeight();
+	//uint16 pitch = videoDecoder->getWidth() * bytesPerPixel;
+
+	_events->clearEvents();
+	videoDecoder->start();
+
+	while (!shouldQuit() && !videoDecoder->endOfVideo() && !skipVideo) {
+		if (videoDecoder->needsUpdate()) {
+			const Graphics::Surface *frame = videoDecoder->decodeNextFrame();
+
+			if (frame) {
+				g_system->copyRectToScreen(frame->getPixels(), frame->pitch, pos.x, pos.y, width, height);
+				g_system->updateScreen();
+			}
+		}
+
+		_events->pollEventsAndWait();
+		_events->setButtonState();
+
+		if (_events->kbHit()) {
+			Common::KeyState keyState = _events->getKey();
+			if (keyState.keycode == Common::KEYCODE_ESCAPE)
+				skipVideo = true;
+		} else if (_events->_pressed) {
+			skipVideo = true;
+		}
+	}
+
+	videoDecoder->close();
+	delete videoDecoder;
+
+	return !skipVideo;
+}
+
 } // End of namespace Scalpel
 
 } // End of namespace Sherlock
diff --git a/engines/sherlock/scalpel/scalpel.h b/engines/sherlock/scalpel/scalpel.h
index 5c46b16..1a208d7 100644
--- a/engines/sherlock/scalpel/scalpel.h
+++ b/engines/sherlock/scalpel/scalpel.h
@@ -138,6 +138,11 @@ public:
 	 * Show the ScummVM restore savegame dialog
 	 */
 	void showScummVMRestoreDialog();
+
+	/**
+	 * Play back a 3do movie
+	 */
+	bool play3doMovie(const Common::String &filename, const Common::Point &pos);
 };
 
 } // End of namespace Scalpel
diff --git a/engines/sherlock/scalpel/scalpel_talk.cpp b/engines/sherlock/scalpel/scalpel_talk.cpp
index 2dda817..0c0feed 100644
--- a/engines/sherlock/scalpel/scalpel_talk.cpp
+++ b/engines/sherlock/scalpel/scalpel_talk.cpp
@@ -554,6 +554,9 @@ void ScalpelTalk::switchSpeaker() {
 }
 
 void ScalpelTalk::talk3DOMovieTrigger(int subIndex) {
+	ScalpelEngine &vm = *(ScalpelEngine *)_vm;
+	Screen &screen = *_vm->_screen;
+
 	// Find out a few things that we need
 	int userSelector = _vm->_ui->_selector;
 	int scriptSelector = _scriptSelect;
@@ -569,13 +572,13 @@ void ScalpelTalk::talk3DOMovieTrigger(int subIndex) {
 			selector = scriptSelector;
 			subIndex--; // for scripts we adjust subIndex, b/c we won't get called from doTalkControl()
 		} else {
-		warning("talk3DOMovieTrigger: unable to find selector");
-		return;
+			warning("talk3DOMovieTrigger: unable to find selector");
+			return;
 		}
 	}
 
 	// Make a quick update, so that current text is shown on screen
-	_vm->_screen->update();
+	screen.update();
 
 	// Figure out that movie filename
 	Common::String movieFilename;
@@ -597,7 +600,7 @@ void ScalpelTalk::talk3DOMovieTrigger(int subIndex) {
 	warning("selector: %d", selector);
 	warning("subindex: %d", subIndex);
 
-	Scalpel3DOMoviePlay(movieFilename.c_str(), Common::Point(5, 5));
+	vm.play3doMovie(movieFilename, Common::Point(5, 5));
 
 	// Restore screen HACK
 	_vm->_screen->makeAllDirty();






More information about the Scummvm-git-logs mailing list