diff options
author | Alyssa Milburn | 2011-11-26 23:50:45 +0100 |
---|---|---|
committer | Alyssa Milburn | 2011-11-26 23:50:45 +0100 |
commit | 9f56876165d10dbfc86d8f232345ea0a766966bf (patch) | |
tree | 66ef7bdb1f98a58709e3d54b0e978096a86fd50d /engines/mohawk/livingbooks_code.cpp | |
parent | dc02f6712796d63a34bbbd4bfbab309a11bdb879 (diff) | |
download | scummvm-rg350-9f56876165d10dbfc86d8f232345ea0a766966bf.tar.gz scummvm-rg350-9f56876165d10dbfc86d8f232345ea0a766966bf.tar.bz2 scummvm-rg350-9f56876165d10dbfc86d8f232345ea0a766966bf.zip |
MOHAWK: Add the start of support for LBXDataFile.
Diffstat (limited to 'engines/mohawk/livingbooks_code.cpp')
-rw-r--r-- | engines/mohawk/livingbooks_code.cpp | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/engines/mohawk/livingbooks_code.cpp b/engines/mohawk/livingbooks_code.cpp index 59b0510123..c18f49171c 100644 --- a/engines/mohawk/livingbooks_code.cpp +++ b/engines/mohawk/livingbooks_code.cpp @@ -21,6 +21,7 @@ */ #include "mohawk/livingbooks.h" +#include "mohawk/livingbooks_lbx.h" #include "mohawk/resource.h" #include "common/system.h" @@ -830,8 +831,8 @@ CodeCommandInfo generalCommandInfo[NUM_GENERAL_COMMANDS] = { { "setDisplay", &LBCode::cmdUnimplemented }, { "getDisplay", 0 }, { 0, 0 }, - { "lbxCreate", 0 }, - { "lbxFunc", 0 }, + { "lbxCreate", &LBCode::cmdLBXCreate }, + { "lbxFunc", &LBCode::cmdLBXFunc }, { "waitCursor", 0 }, { "debugBreak", 0 }, { "menuItemEnable", 0 }, @@ -1086,6 +1087,32 @@ void LBCode::cmdSetHitTest(const Common::Array<LBValue> ¶ms) { warning("ignoring setHitTest"); } +void LBCode::cmdLBXCreate(const Common::Array<LBValue> ¶ms) { + if (params.size() != 1) + error("incorrect number of parameters (%d) to lbxCreate", params.size()); + + _stack.push(createLBXObject(_vm, params[0].toInt())); +} + +void LBCode::cmdLBXFunc(const Common::Array<LBValue> ¶ms) { + if (params.size() < 2) + error("incorrect number of parameters (%d) to lbxFunc", params.size()); + + if (params[0].type != kLBValueLBX || !params[0].lbx) + error("invalid lbx object passed to lbxFunc"); + + Common::SharedPtr<LBXObject> lbx = params[0].lbx; + uint callId = params[1].toInt(); + + Common::Array<LBValue> callParams; + for (uint i = 0; i < params.size() - 2; i++) + callParams.push_back(params[i + 2]); + + LBValue result; + if (lbx->call(callId, callParams, result)) + _stack.push(result); +} + void LBCode::cmdKey(const Common::Array<LBValue> ¶ms) { _stack.push(0); // FIXME warning("ignoring Key"); |