From 1fbee2f51ef8f1027a638d1a9895fc859568fa4a Mon Sep 17 00:00:00 2001 From: Colin Snover Date: Thu, 18 May 2017 12:09:24 -0500 Subject: SCI32: Allow skipping SEQ animations In SSCI, SEQ animations cannot be skipped. --- engines/sci/graphics/video32.cpp | 30 ++++++++++++++++++++++++++++-- engines/sci/graphics/video32.h | 5 +++-- 2 files changed, 31 insertions(+), 4 deletions(-) (limited to 'engines/sci') diff --git a/engines/sci/graphics/video32.cpp b/engines/sci/graphics/video32.cpp index f4b15517fe..fc35d40e1f 100644 --- a/engines/sci/graphics/video32.cpp +++ b/engines/sci/graphics/video32.cpp @@ -71,8 +71,9 @@ static bool flushEvents(EventManager *eventMan) { #pragma mark SEQPlayer -SEQPlayer::SEQPlayer(SegManager *segMan) : +SEQPlayer::SEQPlayer(SegManager *segMan, EventManager *eventMan) : _segMan(segMan), + _eventMan(eventMan), _decoder(nullptr), _plane(nullptr), _screenItem(nullptr) {} @@ -114,7 +115,32 @@ void SEQPlayer::play(const Common::String &fileName, const int16 numTicks, const while (!g_engine->shouldQuit() && !_decoder->endOfVideo()) { g_sci->sleep(_decoder->getTimeToNextFrame()); - renderFrame(bitmap); + + while (_decoder->needsUpdate()) { + renderFrame(bitmap); + } + + // SSCI did not allow SEQ animations to be bypassed like this + SciEvent event = _eventMan->getSciEvent(SCI_EVENT_MOUSE_PRESS | SCI_EVENT_PEEK); + if (event.type == SCI_EVENT_MOUSE_PRESS) { + break; + } + + event = _eventMan->getSciEvent(SCI_EVENT_KEYBOARD | SCI_EVENT_PEEK); + if (event.type == SCI_EVENT_KEYBOARD) { + bool stop = false; + while ((event = _eventMan->getSciEvent(SCI_EVENT_KEYBOARD)), + event.type != SCI_EVENT_NONE) { + if (event.character == SCI_KEY_ESC) { + stop = true; + break; + } + } + + if (stop) { + break; + } + } } _segMan->freeBitmap(bitmapId); diff --git a/engines/sci/graphics/video32.h b/engines/sci/graphics/video32.h index 7b71b37fb0..41e3016f12 100644 --- a/engines/sci/graphics/video32.h +++ b/engines/sci/graphics/video32.h @@ -50,7 +50,7 @@ struct Palette; */ class SEQPlayer { public: - SEQPlayer(SegManager *segMan); + SEQPlayer(SegManager *segMan, EventManager *eventMan); /** * Plays a SEQ animation with the given @@ -61,6 +61,7 @@ public: private: SegManager *_segMan; + EventManager *_eventMan; SEQDecoder *_decoder; /** @@ -655,7 +656,7 @@ private: class Video32 : public Common::Serializable { public: Video32(SegManager *segMan, EventManager *eventMan) : - _SEQPlayer(segMan), + _SEQPlayer(segMan, eventMan), _AVIPlayer(segMan, eventMan), _VMDPlayer(segMan, eventMan), _robotPlayer(segMan), -- cgit v1.2.3