[Scummvm-git-logs] scummvm master -> 8e35962584e29f86c2f1ea73eb82eef052e88f1f

neuromancer neuromancer at users.noreply.github.com
Sat Mar 13 20:29:40 UTC 2021


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:
8e35962584 PRIVATE: allow to properly save during pause


Commit: 8e35962584e29f86c2f1ea73eb82eef052e88f1f
    https://github.com/scummvm/scummvm/commit/8e35962584e29f86c2f1ea73eb82eef052e88f1f
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2021-03-13T17:27:53-03:00

Commit Message:
PRIVATE: allow to properly save during pause

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


diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index cda06a06df..b636a618fc 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -70,6 +70,7 @@ PrivateEngine::PrivateEngine(OSystem *syst, const ADGameDescription *gd)
 
 	// Movies
 	_nextMovie = "";
+	_currentMovie = "";
 	_nextVS = "";
 	_repeatedMovieExit = "";
 
@@ -250,6 +251,7 @@ Common::Error PrivateEngine::run() {
 			removeTimer();
 			_videoDecoder = new Video::SmackerDecoder();
 			playVideo(_nextMovie);
+			_currentMovie = _nextMovie;
 			_nextMovie = "";
 			continue;
 		}
@@ -266,6 +268,7 @@ Common::Error PrivateEngine::run() {
 				_videoDecoder->close();
 				delete _videoDecoder;
 				_videoDecoder = nullptr;
+				_currentMovie = "";
 			} else if (_videoDecoder->needsUpdate()) {
 				drawScreen();
 			}
@@ -775,6 +778,17 @@ Common::Error PrivateEngine::loadGameStream(Common::SeekableReadStream *stream)
 	// Paused setting
 	_pausedSetting = stream->readString();
 
+	// Restore a movie that was playing
+	_currentMovie = stream->readString();
+	int currentTime = stream->readUint32LE();
+
+	if (!_currentMovie.empty()) {
+		_videoDecoder = new Video::SmackerDecoder();
+		playVideo(_currentMovie);
+		_videoDecoder->pauseVideo(true);
+		// TODO: implement seek
+	}
+
 	if (_pausedSetting.empty())
 		_nextSetting = "kStartGame";
 	else
@@ -862,6 +876,14 @@ Common::Error PrivateEngine::saveGameStream(Common::WriteStream *stream, bool is
 	stream->writeString(_pausedSetting);
 	stream->writeByte(0);
 
+	// If we were playing a movie
+	stream->writeString(_currentMovie);
+	stream->writeByte(0);
+	if (_videoDecoder)
+		stream->writeUint32LE(_videoDecoder->getCurFrame());
+	else
+		stream->writeUint32LE(0);
+
 	return Common::kNoError;
 }
 
@@ -928,6 +950,7 @@ void PrivateEngine::skipVideo() {
 	_videoDecoder->close();
 	delete _videoDecoder;
 	_videoDecoder = nullptr;
+	_currentMovie = "";
 }
 
 void PrivateEngine::stopSound(bool all) {
diff --git a/engines/private/private.h b/engines/private/private.h
index cd57ae84ce..4e998126c3 100644
--- a/engines/private/private.h
+++ b/engines/private/private.h
@@ -210,6 +210,7 @@ public:
 	Common::String _framePath;
 	Graphics::Surface *_frame;
 	Common::String _nextVS;
+	Common::Point _origin;
 	void drawScreen();
 
 	// settings
@@ -217,9 +218,9 @@ public:
 	Common::String _pausedSetting;
 	Common::String _currentSetting;
 
+	// movies
 	Common::String _nextMovie;
-	Common::Point  _origin;
-	bool		   _toTake;
+	Common::String _currentMovie;
 
 	// Dossiers
 	DossierArray _dossiers;
@@ -246,6 +247,7 @@ public:
 	Common::String _diaryLocPrefix;
 	void loadLocations(const Common::Rect &);
 	void loadInventory(uint32, const Common::Rect &, const Common::Rect &);
+	bool _toTake;
 
 	// Save/Load games
 	MaskInfo _saveGameMask;




More information about the Scummvm-git-logs mailing list