diff options
Diffstat (limited to 'engines/mohawk')
-rw-r--r-- | engines/mohawk/livingbooks_code.cpp | 20 | ||||
-rw-r--r-- | engines/mohawk/livingbooks_code.h | 2 |
2 files changed, 20 insertions, 2 deletions
diff --git a/engines/mohawk/livingbooks_code.cpp b/engines/mohawk/livingbooks_code.cpp index 6dcd8c3ce7..3b2941a6f4 100644 --- a/engines/mohawk/livingbooks_code.cpp +++ b/engines/mohawk/livingbooks_code.cpp @@ -852,8 +852,8 @@ CodeCommandInfo generalCommandInfo[NUM_GENERAL_COMMANDS] = { { "resetDragParams", 0 }, { "enableRollover", &LBCode::cmdUnimplemented /* FIXME */ }, { "setCursor", 0 }, - { "width", 0 }, - { "height", 0 }, + { "width", &LBCode::cmdWidth }, + { "height", &LBCode::cmdHeight }, { "getFrameBounds", 0 }, // also "getFrameRect" { "traceRect", 0 }, { "sqrt", 0 }, @@ -1131,6 +1131,22 @@ void LBCode::cmdRight(const Common::Array<LBValue> ¶ms) { _stack.push(rect.right); } +void LBCode::cmdWidth(const Common::Array<LBValue> ¶ms) { + if (params.size() > 1) + error("too many parameters (%d) to width", params.size()); + + Common::Rect rect = getRectFromParams(params); + _stack.push(rect.width()); +} + +void LBCode::cmdHeight(const Common::Array<LBValue> ¶ms) { + if (params.size() > 1) + error("too many parameters (%d) to height", params.size()); + + Common::Rect rect = getRectFromParams(params); + _stack.push(rect.height()); +} + 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()); diff --git a/engines/mohawk/livingbooks_code.h b/engines/mohawk/livingbooks_code.h index 080377ce99..b6b38b61fc 100644 --- a/engines/mohawk/livingbooks_code.h +++ b/engines/mohawk/livingbooks_code.h @@ -263,6 +263,8 @@ public: void cmdLeft(const Common::Array<LBValue> ¶ms); void cmdBottom(const Common::Array<LBValue> ¶ms); void cmdRight(const Common::Array<LBValue> ¶ms); + void cmdWidth(const Common::Array<LBValue> ¶ms); + void cmdHeight(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); |