aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorAlyssa Milburn2010-12-09 21:25:05 +0000
committerAlyssa Milburn2010-12-09 21:25:05 +0000
commit0257f2a2171349446e820e7b21334b6d71016b3c (patch)
tree6aadcbf04ee542b9aa4d545d22b96f021259e67d /engines
parenteecc2bcb12a7bff3573092e0a844cd0d37856599 (diff)
downloadscummvm-rg350-0257f2a2171349446e820e7b21334b6d71016b3c.tar.gz
scummvm-rg350-0257f2a2171349446e820e7b21334b6d71016b3c.tar.bz2
scummvm-rg350-0257f2a2171349446e820e7b21334b6d71016b3c.zip
MOHAWK: Implement LBMovieItem
svn-id: r54845
Diffstat (limited to 'engines')
-rw-r--r--engines/mohawk/livingbooks.cpp37
-rw-r--r--engines/mohawk/livingbooks.h15
2 files changed, 51 insertions, 1 deletions
diff --git a/engines/mohawk/livingbooks.cpp b/engines/mohawk/livingbooks.cpp
index ff259c269b..e750e2c2f2 100644
--- a/engines/mohawk/livingbooks.cpp
+++ b/engines/mohawk/livingbooks.cpp
@@ -26,6 +26,7 @@
#include "mohawk/livingbooks.h"
#include "mohawk/resource.h"
#include "mohawk/cursors.h"
+#include "mohawk/video.h"
#include "common/events.h"
#include "common/EventRecorder.h"
@@ -180,6 +181,9 @@ Common::Error MohawkEngine_LivingBooks::run() {
updatePage();
+ if (_video->updateBackgroundMovies())
+ _needsUpdate = true;
+
if (_needsUpdate) {
_system->updateScreen();
_needsUpdate = false;
@@ -245,6 +249,7 @@ Common::String MohawkEngine_LivingBooks::stringForMode(LBMode mode) {
void MohawkEngine_LivingBooks::destroyPage() {
_sound->stopSound();
_gfx->clearCache();
+ _video->stopVideos();
_eventQueue.clear();
@@ -546,6 +551,9 @@ void MohawkEngine_LivingBooks::loadBITL(uint16 resourceId) {
case kLBLiveTextItem:
res = new LBLiveTextItem(this, rect);
break;
+ case kLBMovieItem:
+ res = new LBMovieItem(this, rect);
+ break;
default:
warning("Unknown item type %04x", type);
case 3: // often used for buttons
@@ -3128,4 +3136,33 @@ void LBAnimationItem::draw() {
_anim->draw();
}
+LBMovieItem::LBMovieItem(MohawkEngine_LivingBooks *vm, Common::Rect rect) : LBItem(vm, rect) {
+ debug(3, "new LBMovieItem");
+}
+
+LBMovieItem::~LBMovieItem() {
+}
+
+void LBMovieItem::update() {
+ if (_playing) {
+ VideoHandle videoHandle = _vm->_video->findVideoHandle(_resourceId);
+ if (_vm->_video->endOfVideo(videoHandle))
+ done(true);
+ }
+
+ LBItem::update();
+}
+
+bool LBMovieItem::togglePlaying(bool playing, bool restart) {
+ if (playing) {
+ if ((!_neverEnabled && _enabled && _globalEnabled) || _phase == 0x7FFF) {
+ _vm->_video->playBackgroundMovie(_resourceId, _rect.left, _rect.top);
+
+ return true;
+ }
+ }
+
+ return LBItem::togglePlaying(playing, restart);
+}
+
} // End of namespace Mohawk
diff --git a/engines/mohawk/livingbooks.h b/engines/mohawk/livingbooks.h
index ead232ddb6..fe4c47dc48 100644
--- a/engines/mohawk/livingbooks.h
+++ b/engines/mohawk/livingbooks.h
@@ -63,7 +63,11 @@ enum {
kLBAnimationItem = 0x40,
kLBSoundItem = 0x41,
kLBGroupItem = 0x42,
- kLBPaletteItem = 0x45 // v3
+ kLBMovieItem = 0x43,
+ kLBPaletteAItem = 0x44, // unused?
+ kLBPaletteItem = 0x45,
+ kLBProxyItem = 0x46,
+ kLBXDataFileItem = 0x3e9
};
enum {
@@ -499,6 +503,15 @@ protected:
bool _running;
};
+class LBMovieItem : public LBItem {
+public:
+ LBMovieItem(MohawkEngine_LivingBooks *_vm, Common::Rect rect);
+ ~LBMovieItem();
+
+ void update();
+ bool togglePlaying(bool playing, bool restart);
+};
+
struct NotifyEvent {
NotifyEvent(uint t, uint p) : type(t), param(p) { }
uint type;