From 2176aa55fc71fb7ac8b44f81fcc070c927e3d505 Mon Sep 17 00:00:00 2001 From: richiesams Date: Sat, 10 Aug 2013 17:18:29 -0500 Subject: ZVISION: Implement ActionStreamVideo --- engines/zvision/actions.cpp | 31 +++++++++++++++++++++++++++++++ engines/zvision/actions.h | 15 +++++++++++++++ engines/zvision/scr_file_handling.cpp | 3 +-- 3 files changed, 47 insertions(+), 2 deletions(-) (limited to 'engines') diff --git a/engines/zvision/actions.cpp b/engines/zvision/actions.cpp index 81b6960378..8c10837a1f 100644 --- a/engines/zvision/actions.cpp +++ b/engines/zvision/actions.cpp @@ -32,6 +32,7 @@ #include "zvision/render_manager.h" #include "zvision/action_node.h" #include "zvision/zork_raw.h" +#include "zvision/zork_avi_decoder.h" namespace ZVision { @@ -248,6 +249,36 @@ bool ActionSetScreen::execute(ZVision *engine) { } +////////////////////////////////////////////////////////////////////////////// +// ActionStreamVideo +////////////////////////////////////////////////////////////////////////////// + +ActionStreamVideo::ActionStreamVideo(const Common::String &line) { + char fileName[25]; + uint skippable; + + sscanf(line.c_str(), "%*[^(](%25s %u %u %u %u %u %u)", fileName, &_x, &_y, &_width, &_height, &_flags, &skippable); + + _fileName = Common::String(fileName); + _skippable = (skippable == 0) ? false : true; +} + +bool ActionStreamVideo::execute(ZVision *engine) { + ZorkAVIDecoder decoder; + if (!decoder.loadFile(_fileName)) { + return true; + } + + Common::Rect destRect; + if ((_flags & 0x1) == 0x1) { + destRect = Common::Rect(_x, _y, _x + _width, _y + _height); + } + + engine->playVideo(decoder, destRect, _skippable); + return true; +} + + ////////////////////////////////////////////////////////////////////////////// // ActionTimer ////////////////////////////////////////////////////////////////////////////// diff --git a/engines/zvision/actions.h b/engines/zvision/actions.h index 48703b95e5..bb446171fe 100644 --- a/engines/zvision/actions.h +++ b/engines/zvision/actions.h @@ -286,6 +286,21 @@ private: Common::String _fileName; }; +class ActionStreamVideo : public ResultAction { +public: + ActionStreamVideo(const Common::String &line); + bool execute(ZVision *engine); + +private: + Common::String _fileName; + uint _x; + uint _y; + uint _width; + uint _height; + uint _flags; + bool _skippable; +}; + class ActionTimer : public ResultAction { public: ActionTimer(const Common::String &line); diff --git a/engines/zvision/scr_file_handling.cpp b/engines/zvision/scr_file_handling.cpp index 0bb8d2690b..061079cd85 100644 --- a/engines/zvision/scr_file_handling.cpp +++ b/engines/zvision/scr_file_handling.cpp @@ -239,8 +239,7 @@ void ScriptManager::parseResults(Common::SeekableReadStream &stream, Common::Lis } else if (line.matchString("*:streamvideo*", true)) { - - + actionList.push_back(Common::SharedPtr(new ActionStreamVideo(line))); } else if (line.matchString("*:syncsound*", true)) { -- cgit v1.2.3