aboutsummaryrefslogtreecommitdiff
path: root/engines/titanic/pet_control/pet_remote_glyphs.cpp
diff options
context:
space:
mode:
authorPaul Gilbert2016-05-02 19:23:29 -0400
committerPaul Gilbert2016-07-10 16:38:08 -0400
commit9a6ad7d1e012a5cb1a4ca955b0f738f12c0a7874 (patch)
treeb42b03e7a68a6ce814ee3f5a46a56eb26b8b32e1 /engines/titanic/pet_control/pet_remote_glyphs.cpp
parent947d9e344c2e51c7ad8e4fe1f78fb131cafc921a (diff)
downloadscummvm-rg350-9a6ad7d1e012a5cb1a4ca955b0f738f12c0a7874.tar.gz
scummvm-rg350-9a6ad7d1e012a5cb1a4ca955b0f738f12c0a7874.tar.bz2
scummvm-rg350-9a6ad7d1e012a5cb1a4ca955b0f738f12c0a7874.zip
TITANIC: Implemented remote entertainment device glyph
Diffstat (limited to 'engines/titanic/pet_control/pet_remote_glyphs.cpp')
-rw-r--r--engines/titanic/pet_control/pet_remote_glyphs.cpp73
1 files changed, 73 insertions, 0 deletions
diff --git a/engines/titanic/pet_control/pet_remote_glyphs.cpp b/engines/titanic/pet_control/pet_remote_glyphs.cpp
index 85c4fb8889..e0334fef31 100644
--- a/engines/titanic/pet_control/pet_remote_glyphs.cpp
+++ b/engines/titanic/pet_control/pet_remote_glyphs.cpp
@@ -22,6 +22,8 @@
#include "titanic/pet_control/pet_remote_glyphs.h"
#include "titanic/pet_control/pet_remote.h"
+#include "titanic/pet_control/pet_control.h"
+#include "titanic/messages/pet_messages.h"
namespace Titanic {
@@ -95,6 +97,25 @@ void CToggleRemoteGlyph::draw2(CScreenManager *screenManager) {
_gfxElement->draw(screenManager);
}
+bool CToggleRemoteGlyph::elementMouseButtonDownMsg(const Point &pt) {
+ return _gfxElement->MouseButtonDownMsg(pt);
+}
+
+bool CToggleRemoteGlyph::elementMouseButtonUpMsg(const Point &pt) {
+ if (!_gfxElement->MouseButtonUpMsg(pt))
+ return false;
+
+ CTreeItem *target = getPetControl()->_remoteTarget;
+ if (target) {
+ CPETActivateMsg msg("SGTSelector", -1);
+ msg.execute(target);
+ _flag = !_flag;
+ _gfxElement->setMode(_flag ? MODE_SELECTED : MODE_UNSELECTED);
+ }
+
+ return true;
+}
+
/*------------------------------------------------------------------------*/
bool CTelevisionControlGlyph::setup(CPetControl *petControl, CPetGlyphs *owner) {
@@ -163,4 +184,56 @@ bool CEntertainmentDeviceGlyph::setup(CPetControl *petControl, CPetGlyphs *owner
return true;
}
+void CEntertainmentDeviceGlyph::draw2(CScreenManager *screenManager) {
+ CString viewName = getPetControl()->getFullViewName();
+ if (viewName == "SGTState.Node 1.S") {
+ _gfxElement->setSelected(_flag);
+ _gfxElement->draw(screenManager);
+ } else if (viewName == "SGTState.Node 4.E") {
+ _gfxElement->setSelected(_flag2);
+ _gfxElement->draw(screenManager);
+ _gfxElement2->draw(screenManager);
+ _gfxElement3->draw(screenManager);
+ }
+}
+
+bool CEntertainmentDeviceGlyph::MouseButtonDownMsg(const Point &pt) {
+ CString viewName = getPetControl()->getFullViewName();
+ if (viewName == "SGTState.Node 1.S") {
+ return elementMouseButtonDownMsg(pt);
+ } else if (viewName == "SGTState.Node 4.E") {
+ return _gfxElement->MouseButtonDownMsg(pt)
+ || _gfxElement2->MouseButtonDownMsg(pt)
+ || _gfxElement3->MouseButtonDownMsg(pt);
+ }
+
+ return false;
+}
+
+bool CEntertainmentDeviceGlyph::MouseButtonUpMsg(const Point &pt) {
+ CString viewName = getPetControl()->getFullViewName();
+ if (viewName == "SGTState.Node 1.S") {
+ return elementMouseButtonUpMsg(pt);
+ } else if (viewName == "SGTState.Node 4.E") {
+ if (_gfxElement->MouseButtonUpMsg(pt)) {
+ _flag2 = !_flag2;
+ getOwner()->generateMessage(RMSG_ACTIVATE, "Television");
+ return true;
+ } else if (_gfxElement2->MouseButtonUpMsg(pt)) {
+ getOwner()->generateMessage(RMSG_UP, "Television");
+ return true;
+ }
+ else if (_gfxElement3->MouseButtonUpMsg(pt)) {
+ getOwner()->generateMessage(RMSG_DOWN, "Television");
+ return true;
+ }
+ }
+
+ return false;
+}
+
+void CEntertainmentDeviceGlyph::getTooltip(CPetText *text) {
+ text->setText("Operate visual entertainment device");
+}
+
} // End of namespace Titanic