aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorAlyssa Milburn2011-05-13 23:02:06 +0200
committerAlyssa Milburn2011-05-13 23:02:06 +0200
commit15856a18439fc8652e41c6b7a5ca9d2ab5d0b283 (patch)
tree3e352bbffb24f3f3b36a1ba55446c0229ffed7c9 /engines
parent0c3ef4bbe48e4c0268869d0badad3df7b53262ba (diff)
downloadscummvm-rg350-15856a18439fc8652e41c6b7a5ca9d2ab5d0b283.tar.gz
scummvm-rg350-15856a18439fc8652e41c6b7a5ca9d2ab5d0b283.tar.bz2
scummvm-rg350-15856a18439fc8652e41c6b7a5ca9d2ab5d0b283.zip
MOHAWK: Add basic LBProxyItem support.
Diffstat (limited to 'engines')
-rw-r--r--engines/mohawk/livingbooks.cpp34
-rw-r--r--engines/mohawk/livingbooks.h11
2 files changed, 45 insertions, 0 deletions
diff --git a/engines/mohawk/livingbooks.cpp b/engines/mohawk/livingbooks.cpp
index 1fb9f4a477..f91711302c 100644
--- a/engines/mohawk/livingbooks.cpp
+++ b/engines/mohawk/livingbooks.cpp
@@ -743,6 +743,9 @@ void LBPage::loadBITL(uint16 resourceId) {
case kLBMiniGameItem:
res = new LBMiniGameItem(_vm, this, rect);
break;
+ case kLBProxyItem:
+ res = new LBProxyItem(_vm, this, rect);
+ break;
default:
warning("Unknown item type %04x", type);
case 3: // often used for buttons
@@ -3745,4 +3748,35 @@ bool LBMiniGameItem::togglePlaying(bool playing, bool restart) {
return false;
}
+LBProxyItem::LBProxyItem(MohawkEngine_LivingBooks *vm, LBPage *page, Common::Rect rect) : LBItem(vm, page, rect) {
+ debug(3, "new LBProxyItem");
+
+ _page = NULL;
+}
+
+LBProxyItem::~LBProxyItem() {
+ delete _page;
+}
+
+void LBProxyItem::init() {
+ Common::String leftover;
+ Common::String filename = _vm->getFileNameFromConfig("Proxies", _desc.c_str(), leftover);
+ if (!leftover.empty())
+ error("LBProxyItem tried loading proxy '%s' but got leftover '%s'", _desc.c_str(), leftover.c_str());
+ uint16 baseId;
+ for (uint i = 0; i < filename.size(); i++) {
+ if (filename[i] == ';') {
+ baseId = atoi(filename.c_str() + i + 1);
+ filename = Common::String(filename.c_str(), i);
+ }
+ }
+
+ debug(1, "LBProxyItem loading archive '%s' with id %d", filename.c_str(), baseId);
+ MohawkArchive *pageArchive = _vm->createMohawkArchive();
+ if (!pageArchive->open(filename))
+ error("failed to open archive '%s' (for proxy '%s')", filename.c_str(), _desc.c_str());
+ _page = new LBPage(_vm);
+ _page->open(pageArchive, baseId);
+}
+
} // End of namespace Mohawk
diff --git a/engines/mohawk/livingbooks.h b/engines/mohawk/livingbooks.h
index 81a049c5fe..de84b0f13f 100644
--- a/engines/mohawk/livingbooks.h
+++ b/engines/mohawk/livingbooks.h
@@ -571,6 +571,17 @@ public:
bool togglePlaying(bool playing, bool restart);
};
+class LBProxyItem : public LBItem {
+public:
+ LBProxyItem(MohawkEngine_LivingBooks *_vm, LBPage *page, Common::Rect rect);
+ ~LBProxyItem();
+
+ void init();
+
+protected:
+ class LBPage *_page;
+};
+
struct NotifyEvent {
NotifyEvent(uint t, uint p) : type(t), param(p), newUnknown(0), newMode(0), newPage(0), newSubpage(0) { }
uint type;