diff options
-rw-r--r-- | engines/sci/engine/kgraphics.cpp | 68 |
1 files changed, 27 insertions, 41 deletions
diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp index 7da3a27270..0b6cd7e6fc 100644 --- a/engines/sci/engine/kgraphics.cpp +++ b/engines/sci/engine/kgraphics.cpp @@ -1115,11 +1115,6 @@ reg_t kDisplay(EngineState *s, int argc, reg_t *argv) { reg_t kShowMovie(EngineState *s, int argc, reg_t *argv) { bool playedVideo = false; - // KQ6 Windows calls this with one argument. It doesn't seem - // to have a purpose... - if (argc == 1) - return NULL_REG; - // Hide the cursor if it's showing and then show it again if it was // previously visible. bool reshowCursor; @@ -1128,32 +1123,41 @@ reg_t kShowMovie(EngineState *s, int argc, reg_t *argv) { if (reshowCursor) s->_gfxCursor->kernelHide(); - // The Windows and DOS versions use different video format as well - // as a different argument set. - if (argv[0].toUint16() == 0) { - // Windows (SCI1.1/SCI2) - Common::String filename = s->_segMan->getString(argv[1]); + if (argv[0].segment != 0) { + // DOS SEQ + // SEQ's are called with no subops, just the string and delay + Common::String filename = s->_segMan->getString(argv[0]); + int delay = argv[1].toUint16(); // Time between frames in ticks - Graphics::AviDecoder *aviDecoder = new Graphics::AviDecoder(g_system->getMixer()); - Graphics::VideoPlayer *player = new Graphics::VideoPlayer(aviDecoder); - if (aviDecoder->loadFile(filename.c_str())) { + SeqDecoder *seqDecoder = new SeqDecoder(); + Graphics::VideoPlayer *player = new Graphics::VideoPlayer(seqDecoder); + if (seqDecoder->loadFile(filename.c_str(), delay)) { player->playVideo(); playedVideo = true; } else { warning("Failed to open movie file %s", filename.c_str()); } - aviDecoder->closeFile(); + seqDecoder->closeFile(); delete player; - delete aviDecoder; -#ifdef ENABLE_SCI32 - } else if (argv[0].toUint16() == 1) { - // Windows (SCI2.1) - + delete seqDecoder; + } else { + // Windows AVI (Macintosh QuickTime? Need to check KQ6 Macintosh) // TODO: This appears to be some sort of subop. case 0 contains the string // for the video, so we'll just play it from there for now. - switch (argv[1].toUint16()) { + +#ifdef ENABLE_SCI32 + if (getSciVersion() >= SCI_VERSION_2_1) { + // SCI2.1 always has argv[0] as 1, the rest of the arguments seem to + // follow SCI1.1/2. + if (argv[0].toUint16() != 1) + error("SCI2.1 kShowMovie argv[0] not 1"); + argv++; + argc--; + } +#endif + switch (argv[0].toUint16()) { case 0: { - Common::String filename = s->_segMan->getString(argv[2]); + Common::String filename = s->_segMan->getString(argv[1]); Graphics::AviDecoder *aviDecoder = new Graphics::AviDecoder(g_system->getMixer()); Graphics::VideoPlayer *player = new Graphics::VideoPlayer(aviDecoder); if (aviDecoder->loadFile(filename.c_str())) { @@ -1168,30 +1172,12 @@ reg_t kShowMovie(EngineState *s, int argc, reg_t *argv) { break; } default: - warning("Unhandled SCI2.1 kShowMovie subop %d", argv[1].toUint16()); + warning("Unhandled SCI kShowMovie subop %d", argv[1].toUint16()); } -#endif - } else { - // DOS - Common::String filename = s->_segMan->getString(argv[0]); - int delay = argv[1].toUint16(); // Time between frames in ticks - - SeqDecoder *seqDecoder = new SeqDecoder(); - Graphics::VideoPlayer *player = new Graphics::VideoPlayer(seqDecoder); - if (seqDecoder->loadFile(filename.c_str(), delay)) { - player->playVideo(); - playedVideo = true; - } else { - warning("Failed to open movie file %s", filename.c_str()); - } - seqDecoder->closeFile(); - delete player; - delete seqDecoder; } - if (playedVideo) { + if (playedVideo) s->_gfxScreen->kernelSyncWithFramebuffer(); - } if (reshowCursor) s->_gfxCursor->kernelShow(); |