diff options
author | Paul Gilbert | 2017-07-31 22:20:50 -0400 |
---|---|---|
committer | Paul Gilbert | 2017-07-31 22:20:50 -0400 |
commit | bc29ee474a4e95b91c6be3a33fd67de2a402a112 (patch) | |
tree | 036a706f2cbf84553cfc84a8b3359466ac91e77b /engines | |
parent | a42172485efb47638bd4cb27f7be8d32247a5605 (diff) | |
download | scummvm-rg350-bc29ee474a4e95b91c6be3a33fd67de2a402a112.tar.gz scummvm-rg350-bc29ee474a4e95b91c6be3a33fd67de2a402a112.tar.bz2 scummvm-rg350-bc29ee474a4e95b91c6be3a33fd67de2a402a112.zip |
TITANIC: Handle brief freeze if prologue credits are skipped
Diffstat (limited to 'engines')
-rw-r--r-- | engines/titanic/core/game_object.cpp | 7 | ||||
-rw-r--r-- | engines/titanic/core/game_object.h | 3 | ||||
-rw-r--r-- | engines/titanic/game/credits.cpp | 12 | ||||
-rw-r--r-- | engines/titanic/support/avi_surface.cpp | 8 | ||||
-rw-r--r-- | engines/titanic/support/avi_surface.h | 3 | ||||
-rw-r--r-- | engines/titanic/support/movie.cpp | 5 | ||||
-rw-r--r-- | engines/titanic/support/movie.h | 6 |
7 files changed, 29 insertions, 15 deletions
diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp index 3619d56330..5a55d247ee 100644 --- a/engines/titanic/core/game_object.cpp +++ b/engines/titanic/core/game_object.cpp @@ -686,18 +686,21 @@ void CGameObject::playRandomClip(const char *const *names, uint flags) { playClip(name, flags); } -void CGameObject::playCutscene(uint startFrame, uint endFrame) { +bool CGameObject::playCutscene(uint startFrame, uint endFrame) { if (!_surface) { if (!_resource.empty()) loadResource(_resource); _resource.clear(); } + bool result = true; if (_surface && _surface->loadIfReady() && _surface->_movie) { disableMouse(); - _surface->_movie->playCutscene(_bounds, startFrame, endFrame); + result = _surface->_movie->playCutscene(_bounds, startFrame, endFrame); enableMouse(); } + + return result; } void CGameObject::savePosition() { diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h index 0d2b8c976d..c09577a53f 100644 --- a/engines/titanic/core/game_object.h +++ b/engines/titanic/core/game_object.h @@ -393,8 +393,9 @@ protected: /** * Play a cutscene + * @returns True if the cutscene was not interrupted */ - void playCutscene(uint startFrame, uint endFrame); + bool playCutscene(uint startFrame, uint endFrame); /** * Play a clip randomly from a passed list of names diff --git a/engines/titanic/game/credits.cpp b/engines/titanic/game/credits.cpp index 02c2b08441..8333343cde 100644 --- a/engines/titanic/game/credits.cpp +++ b/engines/titanic/game/credits.cpp @@ -61,11 +61,13 @@ bool CCredits::TimerMsg(CTimerMsg *msg) { loadSound("a#16.wav"); loadSound("a#24.wav"); - playCutscene(0, 18); - playGlobalSound("a#16.wav", VOL_NORMAL, false, false, 0); - playCutscene(19, 642); - playSound("a#24.wav"); - playCutscene(643, 750); + if (playCutscene(0, 18)) { + playGlobalSound("a#16.wav", VOL_NORMAL, false, false, 0); + if (playCutscene(19, 642)) { + playSound("a#24.wav"); + playCutscene(643, 750); + } + } COpeningCreditsMsg creditsMsg; creditsMsg.execute("Service Elevator Entity"); diff --git a/engines/titanic/support/avi_surface.cpp b/engines/titanic/support/avi_surface.cpp index e52c2a7ea5..86daeab344 100644 --- a/engines/titanic/support/avi_surface.cpp +++ b/engines/titanic/support/avi_surface.cpp @@ -471,7 +471,7 @@ Graphics::ManagedSurface *AVISurface::duplicateTransparency() const { } } -void AVISurface::playCutscene(const Rect &r, uint startFrame, uint endFrame) { +bool AVISurface::playCutscene(const Rect &r, uint startFrame, uint endFrame) { bool isDifferent = false; if (_currentFrame != ((int)startFrame - 1) || startFrame == 0) { @@ -487,6 +487,7 @@ void AVISurface::playCutscene(const Rect &r, uint startFrame, uint endFrame) { isDifferent = _movieFrameSurface[0]->w != r.width() || _movieFrameSurface[0]->h != r.height(); + bool isFinished = true; while (_currentFrame < (int)endFrame && !g_vm->shouldQuit()) { if (isNextFrame()) { renderFrame(); @@ -507,11 +508,14 @@ void AVISurface::playCutscene(const Rect &r, uint startFrame, uint endFrame) { } // Brief wait, and check at the same time for clicks to abort the clip - if (g_vm->_events->waitForPress(10)) + if (g_vm->_events->waitForPress(10)) { + isFinished = false; break; + } } stop(); + return isFinished; } uint AVISurface::getBitDepth() const { diff --git a/engines/titanic/support/avi_surface.h b/engines/titanic/support/avi_surface.h index fd21c9ceab..cb2e562d54 100644 --- a/engines/titanic/support/avi_surface.h +++ b/engines/titanic/support/avi_surface.h @@ -215,8 +215,9 @@ public: /** * Plays an interruptable cutscene + * @returns True if the cutscene was not interrupted */ - void playCutscene(const Rect &r, uint startFrame, uint endFrame); + bool playCutscene(const Rect &r, uint startFrame, uint endFrame); /** * Returns the pixel depth of the movie in bits diff --git a/engines/titanic/support/movie.cpp b/engines/titanic/support/movie.cpp index eb65cf1a8a..a57a84d5b0 100644 --- a/engines/titanic/support/movie.cpp +++ b/engines/titanic/support/movie.cpp @@ -116,7 +116,7 @@ void OSMovie::play(uint startFrame, uint endFrame, uint initialFrame, uint flags movieStarted(); } -void OSMovie::playCutscene(const Rect &drawRect, uint startFrame, uint endFrame) { +bool OSMovie::playCutscene(const Rect &drawRect, uint startFrame, uint endFrame) { if (!_movieSurface) _movieSurface = CScreenManager::_screenManagerPtr->createSurface(600, 340, 32); @@ -124,9 +124,10 @@ void OSMovie::playCutscene(const Rect &drawRect, uint startFrame, uint endFrame) CEventTarget eventTarget; g_vm->_events->addTarget(&eventTarget); - _aviSurface.playCutscene(drawRect, startFrame, endFrame); + bool result = _aviSurface.playCutscene(drawRect, startFrame, endFrame); g_vm->_events->removeTarget(); + return result; } void OSMovie::pause() { diff --git a/engines/titanic/support/movie.h b/engines/titanic/support/movie.h index caeba65584..cedf7c4d20 100644 --- a/engines/titanic/support/movie.h +++ b/engines/titanic/support/movie.h @@ -86,8 +86,9 @@ public: /** * Plays a sub-section of a movie, and doesn't return until either * the playback ends or a key has been pressed + * @returns True if the cutscene was not interrupted */ - virtual void playCutscene(const Rect &drawRect, uint startFrame, uint endFrame) = 0; + virtual bool playCutscene(const Rect &drawRect, uint startFrame, uint endFrame) = 0; /** * Pauses a movie @@ -193,8 +194,9 @@ public: /** * Plays a sub-section of a movie, and doesn't return until either * the playback ends or a key has been pressed + * @returns True if the cutscene was not interrupted */ - virtual void playCutscene(const Rect &drawRect, uint startFrame, uint endFrame); + virtual bool playCutscene(const Rect &drawRect, uint startFrame, uint endFrame); /** * Pauses a movie |