aboutsummaryrefslogtreecommitdiff
path: root/engines/mohawk/livingbooks.cpp
diff options
context:
space:
mode:
authorAlyssa Milburn2011-12-08 23:23:35 +0100
committerAlyssa Milburn2011-12-08 23:23:35 +0100
commit99d3b7b5c3042dcd0857aa733e2d43ed17864c0f (patch)
treeb964bc7acac20dd8c325a45ca862bba7f4ea212d /engines/mohawk/livingbooks.cpp
parent64c5a12d604f09a1c0322b698f35136d46b4d621 (diff)
downloadscummvm-rg350-99d3b7b5c3042dcd0857aa733e2d43ed17864c0f.tar.gz
scummvm-rg350-99d3b7b5c3042dcd0857aa733e2d43ed17864c0f.tar.bz2
scummvm-rg350-99d3b7b5c3042dcd0857aa733e2d43ed17864c0f.zip
MOHAWK: Stub LB clone command.
Diffstat (limited to 'engines/mohawk/livingbooks.cpp')
-rw-r--r--engines/mohawk/livingbooks.cpp63
1 files changed, 63 insertions, 0 deletions
diff --git a/engines/mohawk/livingbooks.cpp b/engines/mohawk/livingbooks.cpp
index bcc13e2707..08f3b86c7c 100644
--- a/engines/mohawk/livingbooks.cpp
+++ b/engines/mohawk/livingbooks.cpp
@@ -107,6 +107,11 @@ void LBPage::open(Archive *mhk, uint16 baseId) {
_items[i]->startPhase(kLBPhaseLoad);
}
+void LBPage::addClonedItem(LBItem *item) {
+ _vm->addItem(item);
+ _items.push_back(item);
+}
+
void LBPage::itemDestroyed(LBItem *item) {
for (uint i = 0; i < _items.size(); i++)
if (item == _items[i]) {
@@ -2670,6 +2675,24 @@ void LBItem::moveTo(const Common::Point &pos) {
_rect.moveTo(pos);
}
+LBItem *LBItem::clone(uint16 newId, const Common::String &newName) {
+ LBItem *item = createClone();
+
+ item->_itemId = newId;
+ item->_desc = newName;
+
+ item->_resourceId = _resourceId;
+ // FIXME: the rest
+
+ _page->addClonedItem(item);
+ // FIXME: zorder?
+ return item;
+}
+
+LBItem *LBItem::createClone() {
+ return new LBItem(_vm, _page, _rect);
+}
+
void LBItem::runScript(uint event, uint16 data, uint16 from) {
for (uint i = 0; i < _scriptEntries.size(); i++) {
LBScriptEntry *entry = _scriptEntries[i];
@@ -3075,6 +3098,10 @@ void LBSoundItem::stop() {
LBItem::stop();
}
+LBItem *LBSoundItem::createClone() {
+ return new LBSoundItem(_vm, _page, _rect);
+}
+
LBGroupItem::LBGroupItem(MohawkEngine_LivingBooks *vm, LBPage *page, Common::Rect rect) : LBItem(vm, page, rect) {
debug(3, "new LBGroupItem");
_starting = false;
@@ -3222,6 +3249,12 @@ void LBGroupItem::moveTo(const Common::Point &pos) {
}
}
+LBItem *LBGroupItem::createClone() {
+ // TODO: needed?
+ error("LBGroupItem::createClone unimplemented");
+ return new LBGroupItem(_vm, _page, _rect);
+}
+
LBPaletteItem::LBPaletteItem(MohawkEngine_LivingBooks *vm, LBPage *page, Common::Rect rect) : LBItem(vm, page, rect) {
debug(3, "new LBPaletteItem");
@@ -3307,6 +3340,10 @@ void LBPaletteItem::update() {
LBItem::update();
}
+LBItem *LBPaletteItem::createClone() {
+ error("can't clone LBPaletteItem");
+}
+
LBLiveTextItem::LBLiveTextItem(MohawkEngine_LivingBooks *vm, LBPage *page, Common::Rect rect) : LBItem(vm, page, rect) {
_currentPhrase = 0xFFFF;
_currentWord = 0xFFFF;
@@ -3554,6 +3591,10 @@ void LBLiveTextItem::notify(uint16 data, uint16 from) {
LBItem::notify(data, from);
}
+LBItem *LBLiveTextItem::createClone() {
+ error("can't clone LBLiveTextItem");
+}
+
LBPictureItem::LBPictureItem(MohawkEngine_LivingBooks *vm, LBPage *page, Common::Rect rect) : LBItem(vm, page, rect) {
debug(3, "new LBPictureItem");
}
@@ -3599,6 +3640,10 @@ void LBPictureItem::draw() {
_vm->_gfx->copyAnimImageToScreen(_resourceId, _rect.left, _rect.top);
}
+LBItem *LBPictureItem::createClone() {
+ return new LBPictureItem(_vm, _page, _rect);
+}
+
LBAnimationItem::LBAnimationItem(MohawkEngine_LivingBooks *vm, LBPage *page, Common::Rect rect) : LBItem(vm, page, rect) {
_anim = NULL;
_running = false;
@@ -3704,6 +3749,12 @@ void LBAnimationItem::draw() {
_anim->draw();
}
+LBItem *LBAnimationItem::createClone() {
+ LBAnimationItem *item = new LBAnimationItem(_vm, _page, _rect);
+ item->_anim = new LBAnimation(_vm, item, _resourceId);
+ return item;
+}
+
LBMovieItem::LBMovieItem(MohawkEngine_LivingBooks *vm, LBPage *page, Common::Rect rect) : LBItem(vm, page, rect) {
debug(3, "new LBMovieItem");
}
@@ -3733,6 +3784,10 @@ bool LBMovieItem::togglePlaying(bool playing, bool restart) {
return LBItem::togglePlaying(playing, restart);
}
+LBItem *LBMovieItem::createClone() {
+ return new LBMovieItem(_vm, _page, _rect);
+}
+
LBMiniGameItem::LBMiniGameItem(MohawkEngine_LivingBooks *vm, LBPage *page, Common::Rect rect) : LBItem(vm, page, rect) {
debug(3, "new LBMiniGameItem");
}
@@ -3768,6 +3823,10 @@ bool LBMiniGameItem::togglePlaying(bool playing, bool restart) {
return false;
}
+LBItem *LBMiniGameItem::createClone() {
+ error("can't clone LBMiniGameItem");
+}
+
LBProxyItem::LBProxyItem(MohawkEngine_LivingBooks *vm, LBPage *page, Common::Rect rect) : LBItem(vm, page, rect) {
debug(3, "new LBProxyItem");
@@ -3811,4 +3870,8 @@ void LBProxyItem::unload() {
LBItem::unload();
}
+LBItem *LBProxyItem::createClone() {
+ return new LBProxyItem(_vm, _page, _rect);
+}
+
} // End of namespace Mohawk