diff --git a/engines/grim/movie/movie.cpp b/engines/grim/movie/movie.cpp index 880086e2c23..407515f63ad 100644 --- a/engines/grim/movie/movie.cpp +++ b/engines/grim/movie/movie.cpp @@ -180,6 +180,7 @@ bool MoviePlayer::loadFile(Common::String filename) { } void MoviePlayer::saveState(SaveGame *state) { + Common::StackLock lock(_frameMutex); state->beginSection('SMUS'); state->writeString(_fname); @@ -192,10 +193,13 @@ void MoviePlayer::saveState(SaveGame *state) { state->writeLESint32(_x); state->writeLESint32(_y); + save(state); + state->endSection(); } void MoviePlayer::restoreState(SaveGame *state) { + Common::StackLock lock(_frameMutex); state->beginSection('SMUS'); _fname = state->readString(); @@ -214,6 +218,8 @@ void MoviePlayer::restoreState(SaveGame *state) { _frame = frame; _movieTime = movieTime; + restore(state); + state->endSection(); } diff --git a/engines/grim/movie/movie.h b/engines/grim/movie/movie.h index 683b480faba..e53c9749251 100644 --- a/engines/grim/movie/movie.h +++ b/engines/grim/movie/movie.h @@ -80,14 +80,10 @@ public: /** * Saves the state of the video to a savegame - * - * If you overload this in a subclass, call this first thing in the - * overloaded function - * - * @param state the state to save to + * @param state The state to save to */ - virtual void saveState(SaveGame *state); - virtual void restoreState(SaveGame *state); + void saveState(SaveGame *state); + void restoreState(SaveGame *state); protected: static void timerCallback(void *ptr); @@ -151,6 +147,24 @@ protected: * @param filename The filename to be handled. */ virtual bool loadFile(Common::String filename); + + /** + * Saves subclass related state of the video to a savegame + * The base implementation of this does nothing, but it can be overridden + * by subclasses. + * + * @param state The state to save to + */ + virtual void save(SaveGame *state) {} + + /** + * Restores subclass related state of the video to a savegame + * The base implementation of this does nothing, but it can be overridden + * by subclasses. + * + * @param state The state to restore from + */ + virtual void restore(SaveGame *state) {} }; diff --git a/engines/grim/movie/smush.cpp b/engines/grim/movie/smush.cpp index 9f362a6b870..3bddd425a3a 100644 --- a/engines/grim/movie/smush.cpp +++ b/engines/grim/movie/smush.cpp @@ -78,9 +78,7 @@ void SmushPlayer::postHandleFrame() { } } -void SmushPlayer::restoreState(SaveGame *state) { - MoviePlayer::restoreState(state); - Common::StackLock lock(_frameMutex); +void SmushPlayer::restore(SaveGame *state) { if (isPlaying()) { _smushDecoder->seek((uint32)_movieTime); // Currently not fully working (out of synch) _smushDecoder->start(); diff --git a/engines/grim/movie/smush.h b/engines/grim/movie/smush.h index d52961cbf2a..27105730422 100644 --- a/engines/grim/movie/smush.h +++ b/engines/grim/movie/smush.h @@ -33,7 +33,8 @@ class SmushPlayer : public MoviePlayer { public: SmushPlayer(bool demo); - void restoreState(SaveGame *state); + void restore(SaveGame *state); + private: bool loadFile(Common::String filename); void handleFrame();