From 82ff40c5485f381e15d22b6bc274cd1c49846fd6 Mon Sep 17 00:00:00 2001 From: Alyssa Milburn Date: Fri, 2 Dec 2011 00:03:01 +0100 Subject: MOHAWK: Implement LBCode::itemIsLoaded. --- engines/mohawk/livingbooks.h | 1 + engines/mohawk/livingbooks_code.cpp | 13 ++++++++++++- engines/mohawk/livingbooks_code.h | 1 + 3 files changed, 14 insertions(+), 1 deletion(-) (limited to 'engines') diff --git a/engines/mohawk/livingbooks.h b/engines/mohawk/livingbooks.h index e79d134017..28dd49e78a 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::iterator _iterator; diff --git a/engines/mohawk/livingbooks_code.cpp b/engines/mohawk/livingbooks_code.cpp index 86f5a06178..138f35bbd3 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 ¶ms) { _stack.push(0); } +void LBCode::itemIsLoaded(const Common::Array ¶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 ¶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 ee61c2add2..2e9153f53b 100644 --- a/engines/mohawk/livingbooks_code.h +++ b/engines/mohawk/livingbooks_code.h @@ -275,6 +275,7 @@ public: void cmdKey(const Common::Array ¶ms); void itemIsPlaying(const Common::Array ¶ms); + void itemIsLoaded(const Common::Array ¶ms); void itemMoveTo(const Common::Array ¶ms); void itemSeek(const Common::Array ¶ms); void itemSeekToFrame(const Common::Array ¶ms); -- cgit v1.2.3