diff options
-rw-r--r-- | engines/mohawk/livingbooks.h | 1 | ||||
-rw-r--r-- | engines/mohawk/livingbooks_code.cpp | 13 | ||||
-rw-r--r-- | engines/mohawk/livingbooks_code.h | 1 |
3 files changed, 14 insertions, 1 deletions
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<LBItem *>::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<LBValue> ¶ms) { _stack.push(0); } +void LBCode::itemIsLoaded(const Common::Array<LBValue> ¶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<LBValue> ¶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<LBValue> ¶ms); void itemIsPlaying(const Common::Array<LBValue> ¶ms); + void itemIsLoaded(const Common::Array<LBValue> ¶ms); void itemMoveTo(const Common::Array<LBValue> ¶ms); void itemSeek(const Common::Array<LBValue> ¶ms); void itemSeekToFrame(const Common::Array<LBValue> ¶ms); |