aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/engine
diff options
context:
space:
mode:
authorFilippos Karapetis2009-10-15 15:17:54 +0000
committerFilippos Karapetis2009-10-15 15:17:54 +0000
commitda7652deb3425427de3693cb21ef1bf8af3e8d96 (patch)
tree48bacadf2db988a39a58d9fde94ecf8e9cacb5f6 /engines/sci/engine
parent6d95f8ca618b2f881fb1dd83705d5cc33a6da886 (diff)
downloadscummvm-rg350-da7652deb3425427de3693cb21ef1bf8af3e8d96.tar.gz
scummvm-rg350-da7652deb3425427de3693cb21ef1bf8af3e8d96.tar.bz2
scummvm-rg350-da7652deb3425427de3693cb21ef1bf8af3e8d96.zip
Changed the KQ6 floppy SEQ decoder to use the common VideoPlayer interface. Some cleanup
svn-id: r45124
Diffstat (limited to 'engines/sci/engine')
-rw-r--r--engines/sci/engine/kgraphics.cpp59
1 files changed, 15 insertions, 44 deletions
diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp
index 7fc77bbdff..c8782eb933 100644
--- a/engines/sci/engine/kgraphics.cpp
+++ b/engines/sci/engine/kgraphics.cpp
@@ -1059,52 +1059,23 @@ static reg_t kShowMovie_Windows(EngineState *s, int argc, reg_t *argv) {
static reg_t kShowMovie_DOS(EngineState *s, int argc, reg_t *argv) {
Common::String filename = s->_segMan->getString(argv[0]);
int delay = argv[1].toUint16(); // Time between frames in ticks
- SeqDecoder seq;
- if (!seq.loadFile(filename, s->resMan) &&
- !seq.loadFile(Common::String("SEQ/") + filename, s->resMan)) {
+ Common::Event stopEvent;
+ Common::List<Common::Event> stopEvents;
+ stopEvents.clear();
+ stopEvent.type = Common::EVENT_KEYDOWN;
+ stopEvent.kbd = Common::KEYCODE_ESCAPE;
+ stopEvents.push_back(stopEvent);
+
+ Graphics::SeqDecoder *seqDecoder = new Graphics::SeqDecoder();
+ Graphics::VideoPlayer *player = new Graphics::VideoPlayer(seqDecoder);
+ if (seqDecoder->loadFile(filename.c_str(), delay))
+ player->playVideo(stopEvents);
+ else
warning("Failed to open movie file %s", filename.c_str());
- return s->r_acc;
- }
-
- bool play = true;
- while (play) {
- uint32 startTime = g_system->getMillis();
- SeqFrame *frame = seq.getFrame(play);
- Common::Rect frameRect = frame->frameRect;
-
- byte *scr = (byte *)g_system->lockScreen()->pixels;
- int cur = 0;
- for (int y = frameRect.top; y < frameRect.bottom; y++) {
- for (int x = frameRect.left; x < frameRect.right; x++) {
- if (frame->data[cur] != frame->colorKey)
- scr[y * 320 + x] = frame->data[cur];
- cur++;
- }
- }
- g_system->unlockScreen();
- g_system->updateScreen();
-
- delete frame->data;
- delete frame;
-
- // Wait before showing the next frame
- while (play && (g_system->getMillis() < startTime + (delay * 1000 / 60))) {
- // FIXME: we should probably make a function that handles quitting in these kinds of situations
- Common::Event curEvent;
- Common::EventManager *eventMan = g_system->getEventManager();
-
- // Process quit events
- while (eventMan->pollEvent(curEvent)) {
- if (curEvent.type == Common::EVENT_QUIT) {
- play = false;
- quit_vm();
- }
- }
-
- g_system->delayMillis(10);
- }
- }
+ seqDecoder->closeFile();
+ delete player;
+ delete seqDecoder;
return s->r_acc;
}