[Scummvm-git-logs] scummvm master -> 01bcf5288a27cff90b942e27d24e1eb116733aef

neuromancer neuromancer at users.noreply.github.com
Mon Mar 8 22:20:54 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:
dd3e3f1892 PRIVATE: better pause handling when a movie is playing
01bcf5288a PRIVATE: save and restore VSPicture


Commit: dd3e3f18925b72a1fa8b0f0e688bc16349a361c1
    https://github.com/scummvm/scummvm/commit/dd3e3f18925b72a1fa8b0f0e688bc16349a361c1
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2021-03-08T19:18:30-03:00

Commit Message:
PRIVATE: better pause handling when a movie is playing

Changed paths:
    engines/private/funcs.cpp
    engines/private/private.cpp


diff --git a/engines/private/funcs.cpp b/engines/private/funcs.cpp
index 1aeb259eed..57adb05431 100644
--- a/engines/private/funcs.cpp
+++ b/engines/private/funcs.cpp
@@ -462,6 +462,8 @@ static void fResume(ArgArray args) {
 	g_private->_pausedSetting = "";
 	g_private->_mode = 1;
 	g_private->_origin = Common::Point(kOriginOne[0], kOriginOne[1]);
+	if (g_private->_videoDecoder)
+		g_private->_videoDecoder->pauseVideo(false);
 }
 
 static void fMovie(ArgArray args) {
diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index 7f6402267f..ada1897cc0 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -260,7 +260,7 @@ Common::Error PrivateEngine::run() {
 			drawScreen();
 		}
 
-		if (_videoDecoder) {
+		if (_videoDecoder && !_videoDecoder->isPaused()) {
 			if (_videoDecoder->getCurFrame() == 0)
 				stopSound(true);
 			if (_videoDecoder->endOfVideo()) {
@@ -441,7 +441,8 @@ bool PrivateEngine::cursorMask(Common::Point mousePos) {
 
 bool PrivateEngine::cursorPauseMovie(Common::Point mousePos) {
 	if (_mode == 1) {
-		Common::Rect window(_origin.x, _origin.y, _screenW - _origin.x, _screenH - _origin.y);
+		uint32 tol = 15;
+		Common::Rect window(_origin.x - tol, _origin.y - tol, _screenW - _origin.x + tol, _screenH - _origin.y + tol);
 		if (!window.contains(mousePos)) {
 			return true;
 		}
@@ -451,11 +452,19 @@ bool PrivateEngine::cursorPauseMovie(Common::Point mousePos) {
 
 void PrivateEngine::selectPauseMovie(Common::Point mousePos) {
 	if (_mode == 1) {
-		Common::Rect window(_origin.x, _origin.y, _screenW - _origin.x, _screenH - _origin.y);
+		uint32 tol = 15;
+		Common::Rect window(_origin.x - tol, _origin.y - tol, _screenW - _origin.x + tol, _screenH - _origin.y + tol);
 		if (!window.contains(mousePos)) {
-			if (!_pausedSetting.empty()) {
-				_pausedSetting = _currentSetting;
+			if (_pausedSetting.empty()) {
+				if (!_nextSetting.empty())
+					_pausedSetting = _nextSetting;
+				else
+					_pausedSetting = _currentSetting;
+
 				_nextSetting = "kPauseMovie";
+				if (_videoDecoder) {
+					_videoDecoder->pauseVideo(true);
+				}
 			}
 		}
 	}
@@ -681,6 +690,9 @@ void PrivateEngine::restartGame() {
 	_repeatedMovieExit = "";
 	_playedMovies.clear();
 
+	// Pause
+	_pausedSetting = "";
+
 }
 
 Common::Error PrivateEngine::loadGameStream(Common::SeekableReadStream *stream) {
@@ -689,7 +701,6 @@ Common::Error PrivateEngine::loadGameStream(Common::SeekableReadStream *stream)
 
 	Common::Serializer s(stream, nullptr);
 	debugC(1, kPrivateDebugFunction, "loadGameStream");
-	_nextSetting = "kStartGame";
 	int val;
 
 	for (NameList::iterator it = maps.variableList.begin(); it != maps.variableList.end(); ++it) {
@@ -757,6 +768,14 @@ Common::Error PrivateEngine::loadGameStream(Common::SeekableReadStream *stream)
 		_playedPhoneClips.setVal(stream->readString(), true);
 	}
 
+	// Paused setting
+	_pausedSetting = stream->readString();
+
+	if (_pausedSetting.empty())
+		_nextSetting = "kStartGame";
+	else
+		_nextSetting = "kPauseMovie";
+
 	return Common::kNoError;
 }
 
@@ -831,6 +850,10 @@ Common::Error PrivateEngine::saveGameStream(Common::WriteStream *stream, bool is
 		stream->writeByte(0);
 	}
 
+	// In case the game was saved during a pause
+	stream->writeString(_pausedSetting);
+	stream->writeByte(0);
+
 	return Common::kNoError;
 }
 
@@ -960,7 +983,7 @@ void PrivateEngine::drawMask(Graphics::ManagedSurface *surf) {
 void PrivateEngine::drawScreen() {
 	Graphics::ManagedSurface *surface = _compositeSurface;
 
-	if (_videoDecoder) {
+	if (_videoDecoder && !_videoDecoder->isPaused()) {
 		const Graphics::Surface *frame = _videoDecoder->decodeNextFrame();
 		Graphics::Surface *cframe = frame->convertTo(_pixelFormat, _videoDecoder->getPalette());
 		Common::Point center((_screenW - _videoDecoder->getWidth())/2, (_screenH - _videoDecoder->getHeight())/2);


Commit: 01bcf5288a27cff90b942e27d24e1eb116733aef
    https://github.com/scummvm/scummvm/commit/01bcf5288a27cff90b942e27d24e1eb116733aef
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2021-03-08T19:18:30-03:00

Commit Message:
PRIVATE: save and restore VSPicture

Changed paths:
    engines/private/private.cpp


diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index ada1897cc0..7b87480953 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -693,6 +693,8 @@ void PrivateEngine::restartGame() {
 	// Pause
 	_pausedSetting = "";
 
+	// VSPicture
+	_nextVS = "";
 }
 
 Common::Error PrivateEngine::loadGameStream(Common::SeekableReadStream *stream) {
@@ -768,6 +770,9 @@ Common::Error PrivateEngine::loadGameStream(Common::SeekableReadStream *stream)
 		_playedPhoneClips.setVal(stream->readString(), true);
 	}
 
+	// VSPicture
+	_nextVS = stream->readString();
+
 	// Paused setting
 	_pausedSetting = stream->readString();
 
@@ -850,6 +855,10 @@ Common::Error PrivateEngine::saveGameStream(Common::WriteStream *stream, bool is
 		stream->writeByte(0);
 	}
 
+	// VSPicture
+	stream->writeString(_nextVS);
+	stream->writeByte(0);
+
 	// In case the game was saved during a pause
 	stream->writeString(_pausedSetting);
 	stream->writeByte(0);




More information about the Scummvm-git-logs mailing list