aboutsummaryrefslogtreecommitdiff
path: root/engines/bladerunner/outtake.cpp
diff options
context:
space:
mode:
authorThomas Fach-Pedersen2014-05-20 11:30:16 +0200
committerEugene Sandulenko2016-09-29 22:33:11 +0200
commita67e9e16bdbb5acbb2d1eb52a87c3eb2d128c44d (patch)
treeee7a8fc9e98d09228948869f312d04b9db367e43 /engines/bladerunner/outtake.cpp
parent5fd05a41d7908dd63420c91134965b7d14c4b3ae (diff)
downloadscummvm-rg350-a67e9e16bdbb5acbb2d1eb52a87c3eb2d128c44d.tar.gz
scummvm-rg350-a67e9e16bdbb5acbb2d1eb52a87c3eb2d128c44d.tar.bz2
scummvm-rg350-a67e9e16bdbb5acbb2d1eb52a87c3eb2d128c44d.zip
BLADERUNNER: Rebuild VQADecoder on top of Video::VideoDecoder
Diffstat (limited to 'engines/bladerunner/outtake.cpp')
-rw-r--r--engines/bladerunner/outtake.cpp40
1 files changed, 24 insertions, 16 deletions
diff --git a/engines/bladerunner/outtake.cpp b/engines/bladerunner/outtake.cpp
index 01ceefad75..6ebede5663 100644
--- a/engines/bladerunner/outtake.cpp
+++ b/engines/bladerunner/outtake.cpp
@@ -23,8 +23,10 @@
#include "bladerunner/outtake.h"
#include "bladerunner/bladerunner.h"
-#include "bladerunner/vqa_player.h"
+#include "bladerunner/vqa_decoder.h"
+#include "common/debug.h"
+#include "common/events.h"
#include "common/system.h"
namespace BladeRunner {
@@ -41,27 +43,33 @@ void OuttakePlayer::play(const Common::String &name, bool noLocalization, int co
else
resName = name + "_E.VQA";
- _vqaPlayer = new VQAPlayer(_vm, &_vm->_surface1);
- _vqaPlayer->open(resName);
+ Common::SeekableReadStream *s = _vm->getResourceStream(resName);
- for (;;) {
- _vm->handleEvents();
- if (_vm->shouldQuit())
- break;
+ _vqaDecoder = new VQADecoder();
+ _vqaDecoder->loadStream(s);
- int r = _vqaPlayer->update();
- if (r == -3)
- break;
+ _vqaDecoder->start();
- if (r >= 0) {
- _vm->_system->copyRectToScreen(_vm->_surface1.getPixels(), _vm->_surface1.pitch, 0, 0, _vm->_surface1.w, _vm->_surface1.h);
+ uint32 last = _vm->_system->getMillis();
+
+ while (!_vqaDecoder->endOfVideo() && !_vm->shouldQuit()) {
+ if (_vqaDecoder->needsUpdate()) {
+ uint32 now = _vm->_system->getMillis();
+ debug("delta: %d", now - last);
+ last = now;
+
+ const Graphics::Surface *surface = _vqaDecoder->decodeNextFrame();
+ _vm->_system->copyRectToScreen((const byte *)surface->getBasePtr(0, 0), surface->pitch, 0, 0, 640, 480);
_vm->_system->updateScreen();
- _vm->_system->delayMillis(10);
}
- }
- delete _vqaPlayer;
- _vqaPlayer = nullptr;
+ Common::Event event;
+ while (_vm->_system->getEventManager()->pollEvent(event))
+ if ((event.type == Common::EVENT_KEYDOWN && event.kbd.keycode == Common::KEYCODE_ESCAPE) || event.type == Common::EVENT_LBUTTONUP)
+ return;
+
+ _vm->_system->delayMillis(10);
+ }
}
}; // End of namespace BladeRunner