From 327899c7d214c418250f2fcc6481f12256fe190c Mon Sep 17 00:00:00 2001 From: Alyssa Milburn Date: Fri, 3 Jul 2015 17:31:40 +0200 Subject: MOHAWK: Implement width/height for LB. --- engines/mohawk/livingbooks_code.cpp | 20 ++++++++++++++++++-- engines/mohawk/livingbooks_code.h | 2 ++ 2 files changed, 20 insertions(+), 2 deletions(-) (limited to 'engines/mohawk') 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 ¶ms) { _stack.push(rect.right); } +void LBCode::cmdWidth(const Common::Array ¶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 ¶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 ¶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 ¶ms); void cmdBottom(const Common::Array ¶ms); void cmdRight(const Common::Array ¶ms); + void cmdWidth(const Common::Array ¶ms); + void cmdHeight(const Common::Array ¶ms); void cmdMove(const Common::Array ¶ms); void cmdSetDragParams(const Common::Array ¶ms); void cmdNewList(const Common::Array ¶ms); -- cgit v1.2.3