diff options
Diffstat (limited to 'engines/mohawk/livingbooks_code.cpp')
-rw-r--r-- | engines/mohawk/livingbooks_code.cpp | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/engines/mohawk/livingbooks_code.cpp b/engines/mohawk/livingbooks_code.cpp index 78345ab43e..dc72b2f974 100644 --- a/engines/mohawk/livingbooks_code.cpp +++ b/engines/mohawk/livingbooks_code.cpp @@ -71,6 +71,19 @@ bool LBValue::isZero() const { return toInt() == 0; // FIXME } +Common::String LBValue::toString() const { + switch (type) { + case kLBValueString: + return string; + case kLBValueInteger: + return Common::String::format("%d", integer); + case kLBValueReal: + return Common::String::format("%f", real); + default: + return string; // FIXME + } +} + int LBValue::toInt() const { return integer; // FIXME } @@ -79,6 +92,36 @@ double LBValue::toDouble() const { return real; // FIXME } +Common::Point LBValue::toPoint() const { + switch (type) { + case kLBValueString: + // FIXME + return Common::Point(); + case kLBValueInteger: + return Common::Point(integer, integer); + case kLBValuePoint: + return point; + default: + error("failed to convert to point"); + } +} + +Common::Rect LBValue::toRect() const { + switch (type) { + case kLBValueString: + // FIXME + return Common::Rect(); + case kLBValueInteger: + return Common::Rect(integer, integer, integer, integer); + case kLBValueRect: + return rect; + case kLBValueItemPtr: + return item->getRect(); + default: + error("failed to convert to rect"); + } +} + LBCode::LBCode(MohawkEngine_LivingBooks *vm) : _vm(vm) { Common::SeekableSubReadStreamEndian *bcodStream = _vm->wrapStreamEndian(ID_BCOD, 1000); |