diff options
-rw-r--r-- | engines/mohawk/livingbooks.cpp | 34 | ||||
-rw-r--r-- | engines/mohawk/livingbooks.h | 11 |
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; |