aboutsummaryrefslogtreecommitdiff
path: root/engines/illusions/illusions.cpp
diff options
context:
space:
mode:
authorEric Fry2018-04-29 13:56:42 +1000
committerEugene Sandulenko2018-07-20 06:43:33 +0000
commit9be0a7b08589163d9c0ff151d3fcd15e0e766bba (patch)
tree174e83cd841b973e13bce9b401bff0f8b7d605cd /engines/illusions/illusions.cpp
parent2d836d4ec0f0b13c340e48aeafb651008c6771c3 (diff)
downloadscummvm-rg350-9be0a7b08589163d9c0ff151d3fcd15e0e766bba.tar.gz
scummvm-rg350-9be0a7b08589163d9c0ff151d3fcd15e0e766bba.tar.bz2
scummvm-rg350-9be0a7b08589163d9c0ff151d3fcd15e0e766bba.zip
ILLUSIONS: Play video files
Diffstat (limited to 'engines/illusions/illusions.cpp')
-rw-r--r--engines/illusions/illusions.cpp39
1 files changed, 38 insertions, 1 deletions
diff --git a/engines/illusions/illusions.cpp b/engines/illusions/illusions.cpp
index 79570012c0..9224ba9139 100644
--- a/engines/illusions/illusions.cpp
+++ b/engines/illusions/illusions.cpp
@@ -45,6 +45,8 @@
#include "illusions/threads/talkthread.h"
#include "audio/audiostream.h"
+#include "video/video_decoder.h"
+#include "video/avi_decoder.h"
#include "common/config-manager.h"
#include "common/debug-channels.h"
#include "common/error.h"
@@ -260,7 +262,42 @@ bool IllusionsEngine::calcPointDirection(Common::Point &srcPt, Common::Point &ds
}
void IllusionsEngine::playVideo(uint32 videoId, uint32 objectId, uint32 priority, uint32 threadId) {
- // TODO
+ Video::VideoDecoder *videoDecoder = new Video::AVIDecoder();
+ Common::String filename = Common::String::format("%08X.AVI", objectId);
+ if (!videoDecoder->loadFile(filename)) {
+ delete videoDecoder;
+ warning("Unable to open video %s", filename.c_str());
+ return;
+ }
+
+ videoDecoder->start();
+
+ bool skipVideo = false;
+
+ while (!shouldQuit() && !videoDecoder->endOfVideo() && !skipVideo) {
+ if (videoDecoder->needsUpdate()) {
+ const Graphics::Surface *frame = videoDecoder->decodeNextFrame();
+ if (videoDecoder->hasDirtyPalette()) {
+ const byte *palette = videoDecoder->getPalette();
+ _system->getPaletteManager()->setPalette(palette, 0, 256);
+ }
+
+ if (frame) {
+ _system->copyRectToScreen(frame->getPixels(), frame->pitch, 0, 0, frame->w, frame->h);
+ _system->updateScreen();
+ }
+ }
+
+ Common::Event event;
+ while (_eventMan->pollEvent(event)) {
+ if ((event.type == Common::EVENT_KEYDOWN && event.kbd.keycode == Common::KEYCODE_ESCAPE) ||
+ event.type == Common::EVENT_LBUTTONUP)
+ skipVideo = true;
+ }
+ }
+
+ videoDecoder->close();
+ delete videoDecoder;
}
bool IllusionsEngine::isSoundActive() {