diff options
author | Filippos Karapetis | 2014-01-05 15:31:38 +0200 |
---|---|---|
committer | Filippos Karapetis | 2014-01-05 15:34:34 +0200 |
commit | 7ca33d1889815a63ace0148d34efe67066fdac87 (patch) | |
tree | 1f3c701148bae6b593a4e97cf2e07cdd0d54882b | |
parent | 1632d5f39a577b5fe1f6a6d89bd67896dbc54673 (diff) | |
download | scummvm-rg350-7ca33d1889815a63ace0148d34efe67066fdac87.tar.gz scummvm-rg350-7ca33d1889815a63ace0148d34efe67066fdac87.tar.bz2 scummvm-rg350-7ca33d1889815a63ace0148d34efe67066fdac87.zip |
FULLPIPE: Implement ModalVideoPlayer::play()
The intro Videos are encoded using Intel Indeo 5 (IV50), which isn't
supported yet. Thus, only the audio is heard for now
-rw-r--r-- | engines/fullpipe/modal.cpp | 40 |
1 files changed, 38 insertions, 2 deletions
diff --git a/engines/fullpipe/modal.cpp b/engines/fullpipe/modal.cpp index 516d761aa2..6db916ae4f 100644 --- a/engines/fullpipe/modal.cpp +++ b/engines/fullpipe/modal.cpp @@ -28,6 +28,9 @@ #include "fullpipe/scenes.h" #include "fullpipe/gameloader.h" +#include "graphics/palette.h" +#include "video/avi_decoder.h" + namespace Fullpipe { ModalIntro::ModalIntro() { @@ -224,8 +227,41 @@ void ModalIntro::finish() { g_fp->_gameLoader->updateSystems(42); } -void ModalVideoPlayer::play(const char *fname) { - warning("STUB: ModalVideoPlayer::play(%s)", fname); +void ModalVideoPlayer::play(const char *filename) { + // TODO: Videos are encoded using Intel Indeo 5 (IV50), which isn't supported yet + + Video::AVIDecoder *aviDecoder = new Video::AVIDecoder(); + + if (!aviDecoder->loadFile(filename)) + return; + + uint16 x = (g_system->getWidth() - aviDecoder->getWidth()) / 2; + uint16 y = (g_system->getHeight() - aviDecoder->getHeight()) / 2; + bool skipVideo = false; + + aviDecoder->start(); + + while (!g_fp->shouldQuit() && !aviDecoder->endOfVideo() && !skipVideo) { + if (aviDecoder->needsUpdate()) { + const Graphics::Surface *frame = aviDecoder->decodeNextFrame(); + if (frame) { + g_fp->_system->copyRectToScreen(frame->getPixels(), frame->pitch, x, y, frame->w, frame->h); + + if (aviDecoder->hasDirtyPalette()) + g_fp->_system->getPaletteManager()->setPalette(aviDecoder->getPalette(), 0, 256); + + g_fp->_system->updateScreen(); + } + } + + Common::Event event; + while (g_fp->_system->getEventManager()->pollEvent(event)) { + if ((event.type == Common::EVENT_KEYDOWN && event.kbd.keycode == Common::KEYCODE_ESCAPE) || event.type == Common::EVENT_LBUTTONUP) + skipVideo = true; + } + + g_fp->_system->delayMillis(aviDecoder->getTimeToNextFrame()); + } } void FullpipeEngine::openMap() { |