[Scummvm-cvs-logs] scummvm master -> 2b03a3a0e6569cd4a6b940304a4582860a97789f
fuzzie
fuzzie at fuzzie.org
Fri Jun 24 21:15:33 CEST 2011
This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
d7a5ba3b2f MOHAWK: Allow matching LBValue items by their name.
685934ee4a MOHAWK: Partial support for newer LB targeting types.
2b03a3a0e6 MOHAWK: Handle ++/-- operators in LBCode.
Commit: d7a5ba3b2f9fa6b17e5a6abfbbbc3960f8c7d9b1
https://github.com/scummvm/scummvm/commit/d7a5ba3b2f9fa6b17e5a6abfbbbc3960f8c7d9b1
Author: Alyssa Milburn (fuzzie at fuzzie.org)
Date: 2011-06-24T12:01:04-07:00
Commit Message:
MOHAWK: Allow matching LBValue items by their name.
Changed paths:
engines/mohawk/livingbooks_code.cpp
diff --git a/engines/mohawk/livingbooks_code.cpp b/engines/mohawk/livingbooks_code.cpp
index 165ca4a..5ae0e22 100644
--- a/engines/mohawk/livingbooks_code.cpp
+++ b/engines/mohawk/livingbooks_code.cpp
@@ -32,6 +32,10 @@ bool LBValue::operator==(const LBValue &x) const {
if (type != x.type) {
if (isNumeric() && x.isNumeric())
return toDouble() == x.toDouble();
+ else if (type == kLBValueString && x.type == kLBValueItemPtr)
+ return string == x.item->getName();
+ else if (type == kLBValueItemPtr && x.type == kLBValueString)
+ return item->getName() == x.string;
else
return false;
}
Commit: 685934ee4aea2b46b117f6c9351d500484b9ec6a
https://github.com/scummvm/scummvm/commit/685934ee4aea2b46b117f6c9351d500484b9ec6a
Author: Alyssa Milburn (fuzzie at fuzzie.org)
Date: 2011-06-24T12:01:56-07:00
Commit Message:
MOHAWK: Partial support for newer LB targeting types.
Changed paths:
engines/mohawk/livingbooks.cpp
engines/mohawk/livingbooks.h
diff --git a/engines/mohawk/livingbooks.cpp b/engines/mohawk/livingbooks.cpp
index 375806c..c1c1dfc 100644
--- a/engines/mohawk/livingbooks.cpp
+++ b/engines/mohawk/livingbooks.cpp
@@ -1999,30 +1999,36 @@ LBScriptEntry *LBItem::parseScriptEntry(uint16 type, uint16 &size, Common::Seeka
entry->argc = stream->readUint16();
size -= 2;
+ entry->targetingType = 0;
+
uint16 targetingType = entry->argc;
- if (targetingType == 0x3f3f || targetingType == 0xffff) {
- entry->argc = 0;
+ if (targetingType == kTargetTypeExpression || targetingType == kTargetTypeCode
+ || targetingType == kTargetTypeName) {
+ entry->targetingType = targetingType;
+
+ // FIXME
+ if (targetingType == kTargetTypeCode)
+ error("encountered kTargetTypeCode");
uint16 count = stream->readUint16();
size -= 2;
debug(4, "%d targets with targeting type %04x", count, targetingType);
- // FIXME: targeting by name
uint oldAlign = size % 2;
for (uint i = 0; i < count; i++) {
Common::String target = _vm->readString(stream);
- warning("ignoring target '%s' in script entry", target.c_str());
+ debug(4, "target '%s'", target.c_str());
+ entry->targets.push_back(target);
size -= target.size() + 1;
}
+ entry->argc = entry->targets.size();
if ((uint)(size % 2) != oldAlign) {
stream->skip(1);
size--;
}
- }
-
- if (entry->argc) {
+ } else if (entry->argc) {
entry->argvParam = new uint16[entry->argc];
entry->argvTarget = new uint16[entry->argc];
debug(4, "With %d targets:", entry->argc);
@@ -2612,15 +2618,58 @@ int LBItem::runScriptEntry(LBScriptEntry *entry) {
entry->type, entry->event, entry->opcode, entry->param);
if (entry->argc) {
- uint16 targetId = entry->argvTarget[n];
- // TODO: is this type, perhaps?
- uint16 param = entry->argvParam[n];
- target = _vm->getItemById(targetId);
- if (!target) {
- debug(2, "Target %04x (%04x) doesn't exist, skipping", targetId, param);
- continue;
+ switch (entry->targetingType) {
+ case kTargetTypeExpression:
+ {
+ // FIXME: this should be EVALUATED
+ LBValue &tgt = _vm->_variables[entry->targets[n]];
+ switch (tgt.type) {
+ case kLBValueItemPtr:
+ target = tgt.item;
+ break;
+ case kLBValueString:
+ // FIXME: handle 'self', at least
+ // TODO: correct otherwise? or only self?
+ target = _vm->getItemByName(tgt.string);
+ break;
+ case kLBValueInteger:
+ target = _vm->getItemById(tgt.integer);
+ break;
+ default:
+ // FIXME: handle list
+ debug(2, "Target '%s' (by expression) resulted in unknown type, skipping", entry->targets[n].c_str());
+ }
+ }
+ if (!target) {
+ debug(2, "Target '%s' (by expression) doesn't exist, skipping", entry->targets[n].c_str());
+ continue;
+ }
+ debug(2, "Target: '%s' (expression '%s')", target->_desc.c_str(), entry->targets[n].c_str());
+ break;
+ case kTargetTypeCode:
+ // FIXME
+ error("encountered kTargetTypeCode");
+ break;
+ case kTargetTypeName:
+ // FIXME: handle 'self'
+ target = _vm->getItemByName(entry->targets[n]);
+ if (!target) {
+ debug(2, "Target '%s' (by name) doesn't exist, skipping", entry->targets[n].c_str());
+ continue;
+ }
+ debug(2, "Target: '%s' (by name)", target->_desc.c_str());
+ break;
+ default:
+ uint16 targetId = entry->argvTarget[n];
+ // TODO: is this type, perhaps?
+ uint16 param = entry->argvParam[n];
+ target = _vm->getItemById(targetId);
+ if (!target) {
+ debug(2, "Target %04x (%04x) doesn't exist, skipping", targetId, param);
+ continue;
+ }
+ debug(2, "Target: %04x (%04x) '%s'", targetId, param, target->_desc.c_str());
}
- debug(2, "Target: %04x (%04x) '%s'", targetId, param, target->_desc.c_str());
} else {
target = this;
debug(2, "Self-target on '%s'", _desc.c_str());
diff --git a/engines/mohawk/livingbooks.h b/engines/mohawk/livingbooks.h
index 56107ad..02fe34e 100644
--- a/engines/mohawk/livingbooks.h
+++ b/engines/mohawk/livingbooks.h
@@ -233,6 +233,12 @@ enum {
kLBNotifyQuit = 0xd
};
+enum {
+ kTargetTypeExpression = 0x3f3f,
+ kTargetTypeCode = 0xfffe,
+ kTargetTypeName = 0xffff
+};
+
class MohawkEngine_LivingBooks;
class LBPage;
class LBGraphics;
@@ -253,6 +259,9 @@ struct LBScriptEntry {
uint16 *argvParam;
uint16 *argvTarget;
+ uint16 targetingType;
+ Common::Array<Common::String> targets;
+
// kLBNotifyChangeMode
uint16 newUnknown;
uint16 newMode;
Commit: 2b03a3a0e6569cd4a6b940304a4582860a97789f
https://github.com/scummvm/scummvm/commit/2b03a3a0e6569cd4a6b940304a4582860a97789f
Author: Alyssa Milburn (fuzzie at fuzzie.org)
Date: 2011-06-24T12:10:49-07:00
Commit Message:
MOHAWK: Handle ++/-- operators in LBCode.
Changed paths:
engines/mohawk/livingbooks_code.cpp
diff --git a/engines/mohawk/livingbooks_code.cpp b/engines/mohawk/livingbooks_code.cpp
index 5ae0e22..8791fc4 100644
--- a/engines/mohawk/livingbooks_code.cpp
+++ b/engines/mohawk/livingbooks_code.cpp
@@ -441,6 +441,33 @@ void LBCode::parseMain() {
}
break;
+ case kTokenPlusPlus:
+ case kTokenMinusMinus:
+ {
+ byte token = _currToken;
+ if (token == kTokenPlusPlus)
+ debugN("++");
+ else
+ debugN("--");
+ nextToken();
+
+ if (_currToken != kTokenIdentifier)
+ error("expected identifier");
+ assert(_currValue.type == kLBValueString);
+ Common::String varname = _currValue.string;
+ debugN("%s", varname.c_str());
+ LBValue &val = _vm->_variables[varname];
+
+ // FIXME: pre/postincrement for non-integers
+ if (token == kTokenPlusPlus)
+ val.integer++;
+ else
+ val.integer--;
+ _stack.push(val);
+ nextToken();
+ }
+ break;
+
case kTokenLiteral:
case kTokenConstMode:
case kTokenConstEventId:
More information about the Scummvm-git-logs
mailing list