diff options
author | whiterandrek | 2018-06-01 22:34:09 +0300 |
---|---|---|
committer | Eugene Sandulenko | 2018-06-28 23:51:32 +0200 |
commit | 127e2fdf55117777198926cc1a809ea9f71ea1c2 (patch) | |
tree | 8784a2403ae899e81489ef30564be4c3970a0f00 /engines/pink/objects/actors/pda_button_actor.cpp | |
parent | 9f23b4238c0643e6e9fa5af52be2747219f0bfe0 (diff) | |
download | scummvm-rg350-127e2fdf55117777198926cc1a809ea9f71ea1c2.tar.gz scummvm-rg350-127e2fdf55117777198926cc1a809ea9f71ea1c2.tar.bz2 scummvm-rg350-127e2fdf55117777198926cc1a809ea9f71ea1c2.zip |
PINK: add PDAButtonActor(Pokus) implementation
Peril's pda actor is different
Diffstat (limited to 'engines/pink/objects/actors/pda_button_actor.cpp')
-rw-r--r-- | engines/pink/objects/actors/pda_button_actor.cpp | 34 |
1 files changed, 29 insertions, 5 deletions
diff --git a/engines/pink/objects/actors/pda_button_actor.cpp b/engines/pink/objects/actors/pda_button_actor.cpp index 65e3f7ba21..a54e04b8ca 100644 --- a/engines/pink/objects/actors/pda_button_actor.cpp +++ b/engines/pink/objects/actors/pda_button_actor.cpp @@ -20,23 +20,47 @@ * */ +#include "pink/constants.h" +#include "pink/cursor_mgr.h" +#include "pink/pink.h" +#include "pink/objects/pages/page.h" #include "pink/objects/actors/pda_button_actor.h" namespace Pink { void PDAButtonActor::deserialize(Archive &archive) { Actor::deserialize(archive); + _x = archive.readDWORD(); + _y = archive.readDWORD(); _hideOnStop = (bool) archive.readDWORD(); _opaque = (bool) archive.readDWORD(); - int comm = archive.readDWORD(); - assert(comm <= 4); - _command = (Command) comm; + int type = archive.readDWORD(); + assert(type != 0); + _command.type = (Command::CommandType) type; + _command.arg = archive.readString(); } void PDAButtonActor::toConsole() { - debug("PDAButtonActor: _name = %s, _x = %u _y = %u _hideOnStop = %u, _opaque = %u, _command = %u", - _name.c_str(), _x, _y, _hideOnStop, _opaque, (int) _command); + debug("PDAButtonActor: _name = %s, _x = %u _y = %u _hideOnStop = %u, _opaque = %u, _commandType = %u, _arg = %s", + _name.c_str(), _x, _y, _hideOnStop, _opaque, (int) _command.type, _command.arg.c_str()); +} + +void PDAButtonActor::onClick() { + if (isActive()) { + _page->getGame()->getPdaMgr().execute(_command); + } +} + +void PDAButtonActor::onMouseOver(Common::Point point, CursorMgr *mgr) { + if (_command.type == Command::Unk || !isActive()) + mgr->setCursor(kPDADefaultCursor, point, Common::String()); + else + mgr->setCursor(kPDAClickableFirstFrameCursor, point, Common::String()); +} + +bool PDAButtonActor::isActive() { + return _name != "Inactive"; } } // End of namespace Pink |