diff options
Diffstat (limited to 'engines/composer')
-rw-r--r-- | engines/composer/composer.cpp | 12 | ||||
-rw-r--r-- | engines/composer/composer.h | 1 | ||||
-rw-r--r-- | engines/composer/scripting.cpp | 18 |
3 files changed, 15 insertions, 16 deletions
diff --git a/engines/composer/composer.cpp b/engines/composer/composer.cpp index 595c2eca46..c2ebed32b6 100644 --- a/engines/composer/composer.cpp +++ b/engines/composer/composer.cpp @@ -571,4 +571,16 @@ const Button *ComposerEngine::getButtonFor(const Sprite *sprite, const Common::P return NULL; } +void ComposerEngine::setButtonActive(uint16 id, bool active) { + for (Common::List<Library>::iterator l = _libraries.begin(); l != _libraries.end(); l++) { + for (Common::List<Button>::iterator i = l->_buttons.begin(); i != l->_buttons.end(); i++) { + if (i->_id != id) + continue; + i->_active = active; + } + } + + onMouseMove(_lastMousePos); +} + } // End of namespace Composer diff --git a/engines/composer/composer.h b/engines/composer/composer.h index 1816d89d60..da146227e9 100644 --- a/engines/composer/composer.h +++ b/engines/composer/composer.h @@ -216,6 +216,7 @@ private: void removeSprite(uint16 id, uint16 animId); const Sprite *getSpriteAtPos(const Common::Point &pos); const Button *getButtonFor(const Sprite *sprite, const Common::Point &pos); + void setButtonActive(uint16 id, bool active); void dirtySprite(const Sprite &sprite); void redraw(); diff --git a/engines/composer/scripting.cpp b/engines/composer/scripting.cpp index 41e9151279..3f692c5d4e 100644 --- a/engines/composer/scripting.cpp +++ b/engines/composer/scripting.cpp @@ -570,25 +570,11 @@ int16 ComposerEngine::scriptFuncCall(uint16 id, int16 param1, int16 param2, int1 return 0; case kFuncActivateButton: debug(3, "kFuncActivateButton(%d)", param1); - for (Common::List<Library>::iterator l = _libraries.begin(); l != _libraries.end(); l++) { - for (Common::List<Button>::iterator i = l->_buttons.begin(); i != l->_buttons.end(); i++) { - if (i->_id != param1) - continue; - i->_active = true; - } - } - onMouseMove(_lastMousePos); + setButtonActive(param1, true); return 1; case kFuncDeactivateButton: debug(3, "kFuncDeactivateButton(%d)", param1); - for (Common::List<Library>::iterator l = _libraries.begin(); l != _libraries.end(); l++) { - for (Common::List<Button>::iterator i = l->_buttons.begin(); i != l->_buttons.end(); i++) { - if (i->_id != param1) - continue; - i->_active = false; - } - } - onMouseMove(_lastMousePos); + setButtonActive(param1, false); return 1; case kFuncNewPage: debug(3, "kFuncNewPage(%d, %d)", param1, param2); |