diff options
author | Andrei Prykhodko | 2018-07-17 20:03:51 +0300 |
---|---|---|
committer | Andrei Prykhodko | 2018-07-17 20:04:28 +0300 |
commit | b90816e8119e12c8823d7c6a1333d1eeb57f06fd (patch) | |
tree | 0274ab6b003751888e5af50e72aee379f37b8295 | |
parent | 0d6c83212ab62aeb6105475ff6239f63f409428c (diff) | |
download | scummvm-rg350-b90816e8119e12c8823d7c6a1333d1eeb57f06fd.tar.gz scummvm-rg350-b90816e8119e12c8823d7c6a1333d1eeb57f06fd.tar.bz2 scummvm-rg350-b90816e8119e12c8823d7c6a1333d1eeb57f06fd.zip |
PINK: fixed position of some sprites in PDA
-rw-r--r-- | engines/pink/objects/actions/action_cel.cpp | 9 | ||||
-rw-r--r-- | engines/pink/objects/actions/action_cel.h | 5 | ||||
-rw-r--r-- | engines/pink/objects/actors/pda_button_actor.cpp | 17 | ||||
-rw-r--r-- | engines/pink/objects/actors/pda_button_actor.h | 2 |
4 files changed, 25 insertions, 8 deletions
diff --git a/engines/pink/objects/actions/action_cel.cpp b/engines/pink/objects/actions/action_cel.cpp index 383f4ac77b..8737c38602 100644 --- a/engines/pink/objects/actions/action_cel.cpp +++ b/engines/pink/objects/actions/action_cel.cpp @@ -55,10 +55,6 @@ bool ActionCEL::initPalette(Director *director) { void ActionCEL::start() { loadDecoder(); - - Common::Point point = _decoder.getCenter(); - _bounds = Common::Rect::center(point.x, point.y, _decoder.getWidth(), _decoder.getHeight()); - _decoder.start(); this->onStart(); _actor->getPage()->getGame()->getDirector()->addSprite(this); @@ -84,8 +80,11 @@ Coordinates ActionCEL::getCoordinates() { } void ActionCEL::loadDecoder() { - if (!_decoder.isVideoLoaded()) + if (!_decoder.isVideoLoaded()) { _decoder.loadStream(_actor->getPage()->getResourceStream(_fileName)); + Common::Point point = _decoder.getCenter(); + _bounds = Common::Rect::center(point.x, point.y, _decoder.getWidth(), _decoder.getHeight()); + } } void ActionCEL::setFrame(uint frame) { diff --git a/engines/pink/objects/actions/action_cel.h b/engines/pink/objects/actions/action_cel.h index 729ad69af7..b2e4ef2869 100644 --- a/engines/pink/objects/actions/action_cel.h +++ b/engines/pink/objects/actions/action_cel.h @@ -54,14 +54,15 @@ public: void setCenter(const Common::Point ¢er); + + void loadDecoder(); + protected: virtual void onStart() = 0; void decodeNext(); void setFrame(uint frame); - void loadDecoder(); - CelDecoder _decoder; Common::String _fileName; Common::Rect _bounds; diff --git a/engines/pink/objects/actors/pda_button_actor.cpp b/engines/pink/objects/actors/pda_button_actor.cpp index 10dd563734..f919702097 100644 --- a/engines/pink/objects/actors/pda_button_actor.cpp +++ b/engines/pink/objects/actors/pda_button_actor.cpp @@ -25,7 +25,7 @@ #include "pink/pink.h" #include "pink/objects/pages/page.h" #include "pink/objects/actors/pda_button_actor.h" -#include "pink/objects/actions/action.h" +#include "pink/objects/actions/action_cel.h" namespace Pink { @@ -78,4 +78,19 @@ bool PDAButtonActor::isActive() { return _action && _action->getName() != "Inactive"; } +void PDAButtonActor::init(bool paused) { + if (_x != -1 && _y != -1) { + for (uint i = 0; i < _actions.size(); ++i) { + ActionCEL *action = dynamic_cast<ActionCEL*>(_actions[i]); + assert(action); + action->loadDecoder(); + Common::Point center; + center.x = _x + action->getDecoder()->getWidth() / 2; + center.y = _y + action->getDecoder()->getHeight() / 2; + action->setCenter(center); + } + } + Actor::init(paused); +} + } // End of namespace Pink diff --git a/engines/pink/objects/actors/pda_button_actor.h b/engines/pink/objects/actors/pda_button_actor.h index d2c8b24d81..dce90078ca 100644 --- a/engines/pink/objects/actors/pda_button_actor.h +++ b/engines/pink/objects/actors/pda_button_actor.h @@ -54,6 +54,8 @@ public: void toConsole() override; + void init(bool paused) override; + void onMouseOver(const Common::Point point, CursorMgr *mgr) override; void onLeftClickMessage() override; |