[Scummvm-cvs-logs] scummvm master -> 3be628735bb9e1b36fafe96bd704fa0005a3d7b5
fuzzie
fuzzie at fuzzie.org
Fri Dec 2 00:10:32 CET 2011
This automated email contains information about 10 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
d015a37e00 MOHAWK: Fix parameterless calls when parsing LB scripts.
553d32a818 MOHAWK: Implement LBCode::cmdMousePos.
3553e58bb0 MOHAWK: Run LB load-time scripts properly.
3a2bd43c75 MOHAWK: Fix kLBOpBreakExpression.
43d6d49e2e MOHAWK: Handle LB conversion from string to point/rect.
446822369b MOHAWK: Implement LB move/moveTo.
9b00b3d5b7 MOHAWK: LB list improvements, implement &= operator.
82ff40c548 MOHAWK: Implement LBCode::itemIsLoaded.
2657d14636 MOHAWK: Implement LB add,addAt,setAt.
3be628735b MOHAWK: Implement LB exec,return.
Commit: d015a37e00b5c3c1ca03ee04bd523730cd5ace05
https://github.com/scummvm/scummvm/commit/d015a37e00b5c3c1ca03ee04bd523730cd5ace05
Author: Alyssa Milburn (fuzzie at fuzzie.org)
Date: 2011-12-01T14:51:52-08:00
Commit Message:
MOHAWK: Fix parameterless calls when parsing LB scripts.
Changed paths:
engines/mohawk/livingbooks_code.cpp
diff --git a/engines/mohawk/livingbooks_code.cpp b/engines/mohawk/livingbooks_code.cpp
index 836ad8c..be4173f 100644
--- a/engines/mohawk/livingbooks_code.cpp
+++ b/engines/mohawk/livingbooks_code.cpp
@@ -682,7 +682,7 @@ Common::Array<LBValue> LBCode::readParams() {
byte numParams = _data[_currOffset++];
if (!numParams) {
- debugN("()\n");
+ debugN("()");
nextToken();
return params;
}
@@ -1486,6 +1486,8 @@ uint LBCode::parseCode(const Common::String &source) {
break;
// open bracket
case '(':
+ bool parameterless;
+ parameterless = false;
if (wasFunction) {
// function call parameters
wasFunction = false;
@@ -1501,6 +1503,7 @@ uint LBCode::parseCode(const Common::String &source) {
continue;
if (source[i] != ')')
break;
+ parameterless = true;
code[code.size() - 1] = 0;
break;
}
@@ -1508,14 +1511,20 @@ uint LBCode::parseCode(const Common::String &source) {
// brackets around expression
counterPositions.push_back(0);
}
- code.push_back(kTokenOpenBracket);
+ if (!parameterless)
+ code.push_back(kTokenOpenBracket);
break;
// close bracket
case ')':
if (counterPositions.empty())
error("while parsing script '%s', encountered unmatched )", source.c_str());
+
+ // don't push a kTokenCloseBracket for a parameterless function call
+ uint counterPos2;
+ counterPos2 = counterPositions.back();
+ if (!counterPos2 || code[counterPos2])
+ code.push_back(kTokenCloseBracket);
counterPositions.pop_back();
- code.push_back(kTokenCloseBracket);
break;
// comma (seperating function params)
case ',':
Commit: 553d32a81808844eefbb603fb09adff7e96234ef
https://github.com/scummvm/scummvm/commit/553d32a81808844eefbb603fb09adff7e96234ef
Author: Alyssa Milburn (fuzzie at fuzzie.org)
Date: 2011-12-01T14:52:47-08:00
Commit Message:
MOHAWK: Implement LBCode::cmdMousePos.
Changed paths:
engines/mohawk/livingbooks_code.cpp
engines/mohawk/livingbooks_code.h
diff --git a/engines/mohawk/livingbooks_code.cpp b/engines/mohawk/livingbooks_code.cpp
index be4173f..caf00c7 100644
--- a/engines/mohawk/livingbooks_code.cpp
+++ b/engines/mohawk/livingbooks_code.cpp
@@ -24,6 +24,7 @@
#include "mohawk/livingbooks_lbx.h"
#include "mohawk/resource.h"
+#include "common/events.h"
#include "common/system.h"
#include "common/textconsole.h"
@@ -751,7 +752,7 @@ CodeCommandInfo generalCommandInfo[NUM_GENERAL_COMMANDS] = {
{ "makePt", &LBCode::cmdMakePoint }, // also "makePair"
{ "topLeft", &LBCode::cmdTopLeft },
{ "bottomRight", &LBCode::cmdBottomRight },
- { "mousePos", 0 },
+ { "mousePos", &LBCode::cmdMousePos },
{ "top", &LBCode::cmdTop },
{ "left", &LBCode::cmdLeft },
{ "bottom", &LBCode::cmdBottom },
@@ -1006,6 +1007,14 @@ void LBCode::cmdBottomRight(const Common::Array<LBValue> ¶ms) {
_stack.push(Common::Point(rect.bottom, rect.right));
}
+void LBCode::cmdMousePos(const Common::Array<LBValue> ¶ms) {
+ if (params.size() != 0)
+ error("too many parameters (%d) to mousePos", params.size());
+
+ Common::Point pt = _vm->_system->getEventManager()->getMousePos();
+ _stack.push(pt);
+}
+
void LBCode::cmdTop(const Common::Array<LBValue> ¶ms) {
if (params.size() > 1)
error("too many parameters (%d) to top", params.size());
diff --git a/engines/mohawk/livingbooks_code.h b/engines/mohawk/livingbooks_code.h
index e866fca..973a674 100644
--- a/engines/mohawk/livingbooks_code.h
+++ b/engines/mohawk/livingbooks_code.h
@@ -257,6 +257,7 @@ public:
void cmdMakePoint(const Common::Array<LBValue> ¶ms);
void cmdTopLeft(const Common::Array<LBValue> ¶ms);
void cmdBottomRight(const Common::Array<LBValue> ¶ms);
+ void cmdMousePos(const Common::Array<LBValue> ¶ms);
void cmdTop(const Common::Array<LBValue> ¶ms);
void cmdLeft(const Common::Array<LBValue> ¶ms);
void cmdBottom(const Common::Array<LBValue> ¶ms);
Commit: 3553e58bb0c22be4a9bb6d96dfc101a6d4923081
https://github.com/scummvm/scummvm/commit/3553e58bb0c22be4a9bb6d96dfc101a6d4923081
Author: Alyssa Milburn (fuzzie at fuzzie.org)
Date: 2011-12-01T14:54:18-08:00
Commit Message:
MOHAWK: Run LB load-time scripts properly.
Changed paths:
engines/mohawk/livingbooks.cpp
diff --git a/engines/mohawk/livingbooks.cpp b/engines/mohawk/livingbooks.cpp
index 486ecb5..73c91ad 100644
--- a/engines/mohawk/livingbooks.cpp
+++ b/engines/mohawk/livingbooks.cpp
@@ -2583,10 +2583,7 @@ void LBItem::startPhase(uint phase) {
switch (phase) {
case 0xFFFE:
- if (_timingMode == kLBAutoLoad) {
- debug(2, "Phase load: time startup");
- setNextTime(_periodMin, _periodMax);
- }
+ runScript(kLBEventListLoad);
break;
case 0xFFFF:
runScript(kLBEventPhaseCreate);
@@ -2647,6 +2644,10 @@ void LBItem::load() {
_loaded = true;
// FIXME: events etc
+ if (_timingMode == kLBAutoLoad) {
+ debug(2, "Load: time startup");
+ setNextTime(_periodMin, _periodMax);
+ }
}
void LBItem::unload() {
Commit: 3a2bd43c7560542cd5de6b1eae28a5af99ac985a
https://github.com/scummvm/scummvm/commit/3a2bd43c7560542cd5de6b1eae28a5af99ac985a
Author: Alyssa Milburn (fuzzie at fuzzie.org)
Date: 2011-12-01T14:54:48-08:00
Commit Message:
MOHAWK: Fix kLBOpBreakExpression.
Changed paths:
engines/mohawk/livingbooks.cpp
diff --git a/engines/mohawk/livingbooks.cpp b/engines/mohawk/livingbooks.cpp
index 73c91ad..f2d66cc 100644
--- a/engines/mohawk/livingbooks.cpp
+++ b/engines/mohawk/livingbooks.cpp
@@ -2958,6 +2958,7 @@ int LBItem::runScriptEntry(LBScriptEntry *entry) {
case kLBOpBreakExpression:
debug(2, "BreakExpression");
i = entry->subentries.size();
+ break;
case kLBOpJumpToExpression:
debug(2, "JumpToExpression got %d (on %d, of %d)", e, i, entry->subentries.size());
i = e - 1;
Commit: 43d6d49e2edcb85ee4dbcdfb93b396c7dcfbbffa
https://github.com/scummvm/scummvm/commit/43d6d49e2edcb85ee4dbcdfb93b396c7dcfbbffa
Author: Alyssa Milburn (fuzzie at fuzzie.org)
Date: 2011-12-01T14:55:40-08:00
Commit Message:
MOHAWK: Handle LB conversion from string to point/rect.
Changed paths:
engines/mohawk/livingbooks_code.cpp
diff --git a/engines/mohawk/livingbooks_code.cpp b/engines/mohawk/livingbooks_code.cpp
index caf00c7..d0feffd 100644
--- a/engines/mohawk/livingbooks_code.cpp
+++ b/engines/mohawk/livingbooks_code.cpp
@@ -101,8 +101,11 @@ double LBValue::toDouble() const {
Common::Point LBValue::toPoint() const {
switch (type) {
case kLBValueString:
- // FIXME
- return Common::Point();
+ {
+ Common::Point ret;
+ sscanf(string.c_str(), "%hd , %hd", &ret.x, &ret.y);
+ return ret;
+ }
case kLBValueInteger:
return Common::Point(integer, integer);
case kLBValuePoint:
@@ -117,8 +120,11 @@ Common::Point LBValue::toPoint() const {
Common::Rect LBValue::toRect() const {
switch (type) {
case kLBValueString:
- // FIXME
- return Common::Rect();
+ {
+ Common::Rect ret;
+ sscanf(string.c_str(), "%hd , %hd , %hd , %hd", &ret.left, &ret.top, &ret.right, &ret.bottom);
+ return ret;
+ }
case kLBValueInteger:
return Common::Rect(integer, integer, integer, integer);
case kLBValuePoint:
Commit: 446822369b671c96185cd721c972537d31aebf6c
https://github.com/scummvm/scummvm/commit/446822369b671c96185cd721c972537d31aebf6c
Author: Alyssa Milburn (fuzzie at fuzzie.org)
Date: 2011-12-01T14:59:15-08:00
Commit Message:
MOHAWK: Implement LB move/moveTo.
Changed paths:
engines/mohawk/livingbooks.cpp
engines/mohawk/livingbooks.h
engines/mohawk/livingbooks_code.cpp
engines/mohawk/livingbooks_code.h
diff --git a/engines/mohawk/livingbooks.cpp b/engines/mohawk/livingbooks.cpp
index f2d66cc..f0d9181 100644
--- a/engines/mohawk/livingbooks.cpp
+++ b/engines/mohawk/livingbooks.cpp
@@ -2659,6 +2659,14 @@ void LBItem::unload() {
// FIXME: stuff
}
+void LBItem::moveBy(const Common::Point &pos) {
+ _rect.translate(pos.x, pos.y);
+}
+
+void LBItem::moveTo(const Common::Point &pos) {
+ _rect.moveTo(pos);
+}
+
void LBItem::runScript(uint event, uint16 data, uint16 from) {
for (uint i = 0; i < _scriptEntries.size(); i++) {
LBScriptEntry *entry = _scriptEntries[i];
@@ -3179,6 +3187,38 @@ void LBGroupItem::stop() {
}
}
+void LBGroupItem::load() {
+ for (uint i = 0; i < _groupEntries.size(); i++) {
+ LBItem *item = _vm->getItemById(_groupEntries[i].entryId);
+ if (item)
+ item->load();
+ }
+}
+
+void LBGroupItem::unload() {
+ for (uint i = 0; i < _groupEntries.size(); i++) {
+ LBItem *item = _vm->getItemById(_groupEntries[i].entryId);
+ if (item)
+ item->unload();
+ }
+}
+
+void LBGroupItem::moveBy(const Common::Point &pos) {
+ for (uint i = 0; i < _groupEntries.size(); i++) {
+ LBItem *item = _vm->getItemById(_groupEntries[i].entryId);
+ if (item)
+ item->moveBy(pos);
+ }
+}
+
+void LBGroupItem::moveTo(const Common::Point &pos) {
+ for (uint i = 0; i < _groupEntries.size(); i++) {
+ LBItem *item = _vm->getItemById(_groupEntries[i].entryId);
+ if (item)
+ item->moveTo(pos);
+ }
+}
+
LBPaletteItem::LBPaletteItem(MohawkEngine_LivingBooks *vm, LBPage *page, Common::Rect rect) : LBItem(vm, page, rect) {
debug(3, "new LBPaletteItem");
diff --git a/engines/mohawk/livingbooks.h b/engines/mohawk/livingbooks.h
index 39bd9ca..e79d134 100644
--- a/engines/mohawk/livingbooks.h
+++ b/engines/mohawk/livingbooks.h
@@ -403,6 +403,8 @@ public:
virtual void notify(uint16 data, uint16 from); // 0x1A
virtual void load();
virtual void unload();
+ virtual void moveBy(const Common::Point &pos);
+ virtual void moveTo(const Common::Point &pos);
uint16 getId() { return _itemId; }
const Common::String &getName() { return _desc; }
@@ -482,6 +484,10 @@ public:
void setGlobalVisible(bool visible);
void startPhase(uint phase);
void stop();
+ void load();
+ void unload();
+ void moveBy(const Common::Point &pos);
+ void moveTo(const Common::Point &pos);
protected:
bool _starting;
diff --git a/engines/mohawk/livingbooks_code.cpp b/engines/mohawk/livingbooks_code.cpp
index d0feffd..60ace17 100644
--- a/engines/mohawk/livingbooks_code.cpp
+++ b/engines/mohawk/livingbooks_code.cpp
@@ -767,7 +767,7 @@ CodeCommandInfo generalCommandInfo[NUM_GENERAL_COMMANDS] = {
{ "xpos", 0 },
{ "ypos", 0 },
{ "playFrom", 0 },
- { "move", 0 },
+ { "move", &LBCode::cmdMove },
{ 0, 0 },
{ 0, 0 },
{ "setDragParams", &LBCode::cmdSetDragParams },
@@ -1053,6 +1053,24 @@ void LBCode::cmdRight(const Common::Array<LBValue> ¶ms) {
_stack.push(rect.right);
}
+void LBCode::cmdMove(const Common::Array<LBValue> ¶ms) {
+ if (params.size() != 1 && params.size() != 2)
+ error("incorrect number of parameters (%d) to move", params.size());
+
+ LBItem *target = _currSource;
+ Common::Point pt;
+ if (params.size() == 1) {
+ pt = params[0].toPoint();
+ } else {
+ target = resolveItem(params[0]);
+ if (!target)
+ error("attempted move on invalid item (%s)", params[0].toString().c_str());
+ pt = params[1].toPoint();
+ }
+
+ target->moveBy(pt);
+}
+
void LBCode::cmdSetDragParams(const Common::Array<LBValue> ¶ms) {
warning("ignoring setDragParams");
}
@@ -1224,7 +1242,21 @@ void LBCode::itemIsPlaying(const Common::Array<LBValue> ¶ms) {
}
void LBCode::itemMoveTo(const Common::Array<LBValue> ¶ms) {
- warning("ignoring moveTo");
+ if (params.size() != 1 && params.size() != 2)
+ error("incorrect number of parameters (%d) to moveTo", params.size());
+
+ LBItem *target = _currSource;
+ Common::Point pt;
+ if (params.size() == 1) {
+ pt = params[0].toPoint();
+ } else {
+ target = resolveItem(params[0]);
+ if (!target)
+ error("attempted moveTo on invalid item (%s)", params[0].toString().c_str());
+ pt = params[1].toPoint();
+ }
+
+ target->moveTo(pt);
}
void LBCode::itemSeek(const Common::Array<LBValue> ¶ms) {
diff --git a/engines/mohawk/livingbooks_code.h b/engines/mohawk/livingbooks_code.h
index 973a674..bfe047b 100644
--- a/engines/mohawk/livingbooks_code.h
+++ b/engines/mohawk/livingbooks_code.h
@@ -262,6 +262,7 @@ public:
void cmdLeft(const Common::Array<LBValue> ¶ms);
void cmdBottom(const Common::Array<LBValue> ¶ms);
void cmdRight(const Common::Array<LBValue> ¶ms);
+ void cmdMove(const Common::Array<LBValue> ¶ms);
void cmdSetDragParams(const Common::Array<LBValue> ¶ms);
void cmdNewList(const Common::Array<LBValue> ¶ms);
void cmdListLen(const Common::Array<LBValue> ¶ms);
Commit: 9b00b3d5b745801241a6d9b9e1383413e0c85ba6
https://github.com/scummvm/scummvm/commit/9b00b3d5b745801241a6d9b9e1383413e0c85ba6
Author: Alyssa Milburn (fuzzie at fuzzie.org)
Date: 2011-12-01T15:01:06-08:00
Commit Message:
MOHAWK: LB list improvements, implement &= operator.
Changed paths:
engines/mohawk/livingbooks_code.cpp
engines/mohawk/livingbooks_code.h
diff --git a/engines/mohawk/livingbooks_code.cpp b/engines/mohawk/livingbooks_code.cpp
index 60ace17..86f5a06 100644
--- a/engines/mohawk/livingbooks_code.cpp
+++ b/engines/mohawk/livingbooks_code.cpp
@@ -490,8 +490,8 @@ void LBCode::parseMain() {
break;
}
bool indexing = false;
- LBValue index;
- if (_currToken == kTokenListStart) {
+ Common::Array<LBValue> index;
+ while (_currToken == kTokenListStart) {
debugN("[");
nextToken();
parseStatement();
@@ -502,7 +502,7 @@ void LBCode::parseMain() {
if (!_stack.size())
error("index failed");
indexing = true;
- index = _stack.pop();
+ index.push_back(_stack.pop());
}
if (_currToken == kTokenAssign) {
debugN(" = ");
@@ -515,11 +515,29 @@ void LBCode::parseMain() {
val = getIndexedVar(varname, index);
else
val = &_vm->_variables[varname];
- if (val)
+ if (val) {
*val = _stack.pop();
+ _stack.push(*val);
+ } else
+ _stack.push(LBValue());
+ } else if (_currToken == kTokenAndEquals) {
+ debugN(" &= ");
+ nextToken();
+ parseStatement();
+ if (!_stack.size())
+ error("assignment failed");
+ LBValue *val;
+ if (indexing)
+ val = getIndexedVar(varname, index);
else
- *val = LBValue();
- _stack.push(*val);
+ val = &_vm->_variables[varname];
+ if (val) {
+ if (val->type != kLBValueString)
+ error("operator &= used on non-string");
+ val->string = val->string + _stack.pop().toString();
+ _stack.push(*val);
+ } else
+ _stack.push(LBValue());
} else {
if (indexing) {
LBValue *val = getIndexedVar(varname, index);
@@ -619,6 +637,28 @@ void LBCode::parseMain() {
nextToken();
break;
+ case kTokenListStart:
+ debugN("[");
+ nextToken();
+ {
+ Common::SharedPtr<LBList> list = Common::SharedPtr<LBList>(new LBList);
+ while (_currToken != kTokenListEnd) {
+ parseStatement();
+ if (!_stack.size())
+ error("unexpected empty stack during literal list evaluation");
+ list->array.push_back(_stack.pop());
+ if (_currToken == kTokenComma) {
+ debugN(", ");
+ nextToken();
+ } else if (_currToken != kTokenListEnd)
+ error("encountered unexpected token %02x during literal list", _currToken);
+ }
+ debugN("]");
+ nextToken();
+ _stack.push(list);
+ }
+ break;
+
case kTokenNot:
debugN("!");
nextToken();
@@ -659,15 +699,18 @@ void LBCode::parseMain() {
}
}
-LBValue *LBCode::getIndexedVar(Common::String varname, const LBValue &index) {
- LBValue &var = _vm->_variables[varname];
- if (var.type != kLBValueList)
- error("variable '%s' was indexed, but isn't a list", varname.c_str());
- if (index.type != kLBValueInteger)
- error("index wasn't an integer");
- if (index.integer < 1 || index.integer > (int)var.list->array.size())
- return NULL;
- return &var.list->array[index.integer - 1];
+LBValue *LBCode::getIndexedVar(Common::String varname, const Common::Array<LBValue> &index) {
+ LBValue *var = &_vm->_variables[varname];
+ for (uint i = 0; i < index.size(); i++) {
+ if (var->type != kLBValueList)
+ error("variable '%s' was indexed, but isn't a list after %d indexes", varname.c_str(), i);
+ if (index[i].type != kLBValueInteger)
+ error("index %d wasn't an integer", i);
+ if (index[i].integer < 1 || index[i].integer > (int)var->list->array.size())
+ return NULL;
+ var = &var->list->array[index[i].integer - 1];
+ }
+ return var;
}
LBItem *LBCode::resolveItem(const LBValue &value) {
diff --git a/engines/mohawk/livingbooks_code.h b/engines/mohawk/livingbooks_code.h
index bfe047b..ee61c2a 100644
--- a/engines/mohawk/livingbooks_code.h
+++ b/engines/mohawk/livingbooks_code.h
@@ -232,7 +232,7 @@ protected:
void parseArithmetic2();
void parseMain();
- LBValue *getIndexedVar(Common::String varname, const LBValue &index);
+ LBValue *getIndexedVar(Common::String varname, const Common::Array<LBValue> &index);
LBItem *resolveItem(const LBValue &value);
Common::Array<LBValue> readParams();
Common::Rect getRectFromParams(const Common::Array<LBValue> ¶ms);
Commit: 82ff40c5485f381e15d22b6bc274cd1c49846fd6
https://github.com/scummvm/scummvm/commit/82ff40c5485f381e15d22b6bc274cd1c49846fd6
Author: Alyssa Milburn (fuzzie at fuzzie.org)
Date: 2011-12-01T15:03:01-08:00
Commit Message:
MOHAWK: Implement LBCode::itemIsLoaded.
Changed paths:
engines/mohawk/livingbooks.h
engines/mohawk/livingbooks_code.cpp
engines/mohawk/livingbooks_code.h
diff --git a/engines/mohawk/livingbooks.h b/engines/mohawk/livingbooks.h
index e79d134..28dd49e 100644
--- a/engines/mohawk/livingbooks.h
+++ b/engines/mohawk/livingbooks.h
@@ -410,6 +410,7 @@ public:
const Common::String &getName() { return _desc; }
const Common::Rect &getRect() { return _rect; }
uint16 getSoundPriority() { return _soundMode; }
+ bool isLoaded() { return _loaded; }
bool isAmbient() { return _isAmbient; }
Common::List<LBItem *>::iterator _iterator;
diff --git a/engines/mohawk/livingbooks_code.cpp b/engines/mohawk/livingbooks_code.cpp
index 86f5a06..138f35b 100644
--- a/engines/mohawk/livingbooks_code.cpp
+++ b/engines/mohawk/livingbooks_code.cpp
@@ -1246,7 +1246,7 @@ CodeCommandInfo itemCommandInfo[NUM_ITEM_COMMANDS] = {
{ "isMuted", 0 },
{ "isPlaying", &LBCode::itemIsPlaying },
{ "isVisible", 0 },
- { "isLoaded", 0 },
+ { "isLoaded", &LBCode::itemIsLoaded },
{ "isDragging", 0 },
{ "load", 0 },
{ "moveTo", &LBCode::itemMoveTo },
@@ -1284,6 +1284,17 @@ void LBCode::itemIsPlaying(const Common::Array<LBValue> ¶ms) {
_stack.push(0);
}
+void LBCode::itemIsLoaded(const Common::Array<LBValue> ¶ms) {
+ if (params.size() != 1)
+ error("incorrect number of parameters (%d) to isLoaded", params.size());
+
+ LBItem *item = resolveItem(params[0]);
+ if (!item || !item->isLoaded())
+ _stack.push(0);
+ else
+ _stack.push(1);
+}
+
void LBCode::itemMoveTo(const Common::Array<LBValue> ¶ms) {
if (params.size() != 1 && params.size() != 2)
error("incorrect number of parameters (%d) to moveTo", params.size());
diff --git a/engines/mohawk/livingbooks_code.h b/engines/mohawk/livingbooks_code.h
index ee61c2a..2e9153f 100644
--- a/engines/mohawk/livingbooks_code.h
+++ b/engines/mohawk/livingbooks_code.h
@@ -275,6 +275,7 @@ public:
void cmdKey(const Common::Array<LBValue> ¶ms);
void itemIsPlaying(const Common::Array<LBValue> ¶ms);
+ void itemIsLoaded(const Common::Array<LBValue> ¶ms);
void itemMoveTo(const Common::Array<LBValue> ¶ms);
void itemSeek(const Common::Array<LBValue> ¶ms);
void itemSeekToFrame(const Common::Array<LBValue> ¶ms);
Commit: 2657d14636847affdfc0f2e488465ceb3549da24
https://github.com/scummvm/scummvm/commit/2657d14636847affdfc0f2e488465ceb3549da24
Author: Alyssa Milburn (fuzzie at fuzzie.org)
Date: 2011-12-01T15:05:45-08:00
Commit Message:
MOHAWK: Implement LB add,addAt,setAt.
Changed paths:
engines/mohawk/livingbooks_code.cpp
engines/mohawk/livingbooks_code.h
diff --git a/engines/mohawk/livingbooks_code.cpp b/engines/mohawk/livingbooks_code.cpp
index 138f35b..421a964 100644
--- a/engines/mohawk/livingbooks_code.cpp
+++ b/engines/mohawk/livingbooks_code.cpp
@@ -835,14 +835,14 @@ CodeCommandInfo generalCommandInfo[NUM_GENERAL_COMMANDS] = {
{ "isWorldWrap", 0 },
{ "newList", &LBCode::cmdNewList },
{ "deleteList", 0 },
- { "add", 0 },
+ { "add", &LBCode::cmdAdd },
{ 0, 0 },
- { "addAt", 0 },
+ { "addAt", &LBCode::cmdAddAt },
{ "getAt", 0 },
// 0x30
{ 0, 0 },
{ "getIndex", 0 },
- { "setAt", 0 },
+ { "setAt", &LBCode::cmdSetAt },
{ "listLen", &LBCode::cmdListLen },
{ "deleteAt", &LBCode::cmdDeleteAt },
{ "clearList", &LBCode::cmdUnimplemented },
@@ -1125,6 +1125,46 @@ void LBCode::cmdNewList(const Common::Array<LBValue> ¶ms) {
_stack.push(Common::SharedPtr<LBList>(new LBList));
}
+void LBCode::cmdAdd(const Common::Array<LBValue> ¶ms) {
+ if (params.size() != 2)
+ error("incorrect number of parameters (%d) to add", params.size());
+
+ if (params[0].type != kLBValueList || !params[0].list)
+ error("invalid lbx object passed to add");
+
+ params[0].list->array.push_back(params[1]);
+}
+
+void LBCode::cmdAddAt(const Common::Array<LBValue> ¶ms) {
+ if (params.size() != 3)
+ error("incorrect number of parameters (%d) to addAt", params.size());
+
+ if (params[0].type != kLBValueList || !params[0].list)
+ error("invalid lbx object passed to addAt");
+
+ if (params[1].type != kLBValueInteger || params[1].integer < 1)
+ error("invalid index passed to addAt");
+
+ if ((uint)params[1].integer > params[0].list->array.size())
+ params[0].list->array.resize(params[1].integer);
+ params[0].list->array.insert_at(params[1].integer - 1, params[2]);
+}
+
+void LBCode::cmdSetAt(const Common::Array<LBValue> ¶ms) {
+ if (params.size() != 3)
+ error("incorrect number of parameters (%d) to setAt", params.size());
+
+ if (params[0].type != kLBValueList || !params[0].list)
+ error("invalid lbx object passed to setAt");
+
+ if (params[1].type != kLBValueInteger || params[1].integer < 1)
+ error("invalid index passed to setAt");
+
+ if ((uint)params[1].integer > params[0].list->array.size())
+ params[0].list->array.resize(params[1].integer);
+ params[0].list->array[params[1].integer - 1] = params[2];
+}
+
void LBCode::cmdListLen(const Common::Array<LBValue> ¶ms) {
if (params.size() != 1)
error("incorrect number of parameters (%d) to listLen", params.size());
diff --git a/engines/mohawk/livingbooks_code.h b/engines/mohawk/livingbooks_code.h
index 2e9153f..71328bb 100644
--- a/engines/mohawk/livingbooks_code.h
+++ b/engines/mohawk/livingbooks_code.h
@@ -265,6 +265,9 @@ public:
void cmdMove(const Common::Array<LBValue> ¶ms);
void cmdSetDragParams(const Common::Array<LBValue> ¶ms);
void cmdNewList(const Common::Array<LBValue> ¶ms);
+ void cmdAdd(const Common::Array<LBValue> ¶ms);
+ void cmdAddAt(const Common::Array<LBValue> ¶ms);
+ void cmdSetAt(const Common::Array<LBValue> ¶ms);
void cmdListLen(const Common::Array<LBValue> ¶ms);
void cmdDeleteAt(const Common::Array<LBValue> ¶ms);
void cmdSetPlayParams(const Common::Array<LBValue> ¶ms);
Commit: 3be628735bb9e1b36fafe96bd704fa0005a3d7b5
https://github.com/scummvm/scummvm/commit/3be628735bb9e1b36fafe96bd704fa0005a3d7b5
Author: Alyssa Milburn (fuzzie at fuzzie.org)
Date: 2011-12-01T15:06:58-08:00
Commit Message:
MOHAWK: Implement LB exec,return.
Changed paths:
engines/mohawk/livingbooks_code.cpp
engines/mohawk/livingbooks_code.h
diff --git a/engines/mohawk/livingbooks_code.cpp b/engines/mohawk/livingbooks_code.cpp
index 421a964..8e7c69b 100644
--- a/engines/mohawk/livingbooks_code.cpp
+++ b/engines/mohawk/livingbooks_code.cpp
@@ -851,8 +851,8 @@ CodeCommandInfo generalCommandInfo[NUM_GENERAL_COMMANDS] = {
{ "getProperty", 0 },
{ "copyList", 0 },
{ "invoke", 0 },
- { "exec", 0 },
- { "return", 0 },
+ { "exec", &LBCode::cmdExec },
+ { "return", &LBCode::cmdReturn },
{ "sendSync", 0 },
{ "moveViewOrigin", 0 },
{ "addToGroup", 0 },
@@ -1189,6 +1189,38 @@ void LBCode::cmdDeleteAt(const Common::Array<LBValue> ¶ms) {
params[0].list->array.remove_at(params[1].integer - 1);
}
+void LBCode::cmdExec(const Common::Array<LBValue> ¶ms) {
+ if (params.size() != 1)
+ error("incorrect number of parameters (%d) to exec", params.size());
+ if (params[0].type != kLBValueInteger || params[0].integer < 0)
+ error("invalid offset passed to exec");
+ uint offset = (uint)params[0].integer;
+
+ uint32 oldOffset = _currOffset;
+ byte oldToken = _currToken;
+ LBValue val = runCode(_currSource, offset);
+ _currOffset = oldOffset;
+ _currToken = oldToken;
+
+ _stack.push(val);
+ _stack.push(val);
+}
+
+void LBCode::cmdReturn(const Common::Array<LBValue> ¶ms) {
+ if (params.size() != 2)
+ error("incorrect number of parameters (%d) to return", params.size());
+
+ if (!_stack.size())
+ error("empty stack on entry to return");
+
+ if (params[0] == _stack.top()) {
+ _stack.pop();
+ _stack.push(params[1]);
+ _currToken = kTokenEndOfFile;
+ } else
+ _stack.push(_stack.top());
+}
+
void LBCode::cmdSetPlayParams(const Common::Array<LBValue> ¶ms) {
if (params.size() > 8)
error("too many parameters (%d) to setPlayParams", params.size());
diff --git a/engines/mohawk/livingbooks_code.h b/engines/mohawk/livingbooks_code.h
index 71328bb..2cb1994 100644
--- a/engines/mohawk/livingbooks_code.h
+++ b/engines/mohawk/livingbooks_code.h
@@ -270,6 +270,8 @@ public:
void cmdSetAt(const Common::Array<LBValue> ¶ms);
void cmdListLen(const Common::Array<LBValue> ¶ms);
void cmdDeleteAt(const Common::Array<LBValue> ¶ms);
+ void cmdExec(const Common::Array<LBValue> ¶ms);
+ void cmdReturn(const Common::Array<LBValue> ¶ms);
void cmdSetPlayParams(const Common::Array<LBValue> ¶ms);
void cmdSetKeyEvent(const Common::Array<LBValue> ¶ms);
void cmdSetHitTest(const Common::Array<LBValue> ¶ms);
More information about the Scummvm-git-logs
mailing list