aboutsummaryrefslogtreecommitdiff
path: root/engines
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
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')
-rw-r--r--engines/titanic/game_manager.cpp9
-rw-r--r--engines/titanic/game_manager.h6
-rw-r--r--engines/titanic/pet_control/pet_control.cpp5
-rw-r--r--engines/titanic/pet_control/pet_control.h5
-rw-r--r--engines/titanic/pet_control/pet_remote.cpp8
-rw-r--r--engines/titanic/pet_control/pet_remote_glyphs.cpp73
-rw-r--r--engines/titanic/pet_control/pet_remote_glyphs.h34
7 files changed, 134 insertions, 6 deletions
diff --git a/engines/titanic/game_manager.cpp b/engines/titanic/game_manager.cpp
index a82488e44e..0d1714a3a6 100644
--- a/engines/titanic/game_manager.cpp
+++ b/engines/titanic/game_manager.cpp
@@ -236,4 +236,13 @@ CScreenManager *CGameManager::setScreenManager() const {
return CScreenManager::setCurrent();
}
+CString CGameManager::getFullViewName() {
+ CViewItem *view = getView();
+ CNodeItem *node = view->findNode();
+ CRoomItem *room = node->findRoom();
+
+ return CString::format("%s.%s.%s", room->getName().c_str(),
+ node->getName().c_str(), view->getName().c_str());
+}
+
} // End of namespace Titanic
diff --git a/engines/titanic/game_manager.h b/engines/titanic/game_manager.h
index 102cc40316..e52426592b 100644
--- a/engines/titanic/game_manager.h
+++ b/engines/titanic/game_manager.h
@@ -186,6 +186,12 @@ public:
* Return the true talk manager
*/
CTrueTalkManager *getTalkManager() { return &_trueTalkManager; }
+
+ /**
+ * Return the full Id of the current view in a
+ * room.node.view tuplet form
+ */
+ CString getFullViewName();
};
} // End of namespace Titanic
diff --git a/engines/titanic/pet_control/pet_control.cpp b/engines/titanic/pet_control/pet_control.cpp
index c115cb5979..8571b5ea65 100644
--- a/engines/titanic/pet_control/pet_control.cpp
+++ b/engines/titanic/pet_control/pet_control.cpp
@@ -511,4 +511,9 @@ void CPetControl::setTimer44(int id, int val) {
getGameManager()->setTimer44(id, val);
}
+CString CPetControl::getFullViewName() {
+ CGameManager *gameManager = getGameManager();
+ return gameManager ? gameManager->getFullViewName() : CString();
+}
+
} // End of namespace Titanic
diff --git a/engines/titanic/pet_control/pet_control.h b/engines/titanic/pet_control/pet_control.h
index 7763dd91dc..23b4f61721 100644
--- a/engines/titanic/pet_control/pet_control.h
+++ b/engines/titanic/pet_control/pet_control.h
@@ -288,6 +288,11 @@ public:
*/
void stopPetTimer(uint timerIndex);
+ /**
+ * Return the full Id of the current view in a
+ * room.node.view tuplet form
+ */
+ CString getFullViewName();
};
} // End of namespace Titanic
diff --git a/engines/titanic/pet_control/pet_remote.cpp b/engines/titanic/pet_control/pet_remote.cpp
index 9149ed851e..fd2d5e1dc3 100644
--- a/engines/titanic/pet_control/pet_remote.cpp
+++ b/engines/titanic/pet_control/pet_remote.cpp
@@ -73,7 +73,7 @@ static const byte REMOTE_DATA[] = {
0x1C, 0x00,
0x1D, 0x02, GLYPH_SUMMON_ELEVATOR, 0x10,
0x1E, 0x0C,
- 0x05, 0x06, 0x07, 0x08, 0x03, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
+ 0x05, 0x06, 0x07, 0x08, GLYPH_ENTERTAINMENT_DEVICE, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
0x1F, 0x01, 0x10,
0x20, 0x02,
GLYPH_SUMMON_ELEVATOR, GLYPH_SUMMON_PELLERATOR,
@@ -318,6 +318,12 @@ bool CPetRemote::loadGlyph(int glyphIndex) {
break;
case GLYPH_TELEVISION_CONTROL:
+ glyph = new CTelevisionControlGlyph();
+ break;
+
+ case GLYPH_ENTERTAINMENT_DEVICE:
+ glyph = new CEntertainmentDeviceGlyph();
+ break;
default:
break;
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
diff --git a/engines/titanic/pet_control/pet_remote_glyphs.h b/engines/titanic/pet_control/pet_remote_glyphs.h
index 8a9cb88e99..e8f0c8d8c7 100644
--- a/engines/titanic/pet_control/pet_remote_glyphs.h
+++ b/engines/titanic/pet_control/pet_remote_glyphs.h
@@ -30,7 +30,7 @@ namespace Titanic {
enum RemoteGlyph {
GLYPH_SUMMON_ELEVATOR = 0, GLYPH_SUMMON_PELLERATOR = 1,
- GLYPH_TELEVISION_CONTROL = 2
+ GLYPH_TELEVISION_CONTROL = 2, GLYPH_ENTERTAINMENT_DEVICE = 3
};
enum RemoteMessage {
@@ -126,9 +126,14 @@ public:
virtual void draw2(CScreenManager *screenManager);
/**
- * Called for mouse button down messages
+ * Called for mouse button down messages to the default element
*/
- virtual bool MouseButtonDownMsg(const Point &pt);
+ bool elementMouseButtonDownMsg(const Point &pt);
+
+ /**
+ * Called for mouse button up messages to the default element
+ */
+ bool elementMouseButtonUpMsg(const Point &pt);
};
class CSummonElevatorGlyph : public CBasicRemoteGlyph {
@@ -179,17 +184,36 @@ public:
class CEntertainmentDeviceGlyph : public CToggleRemoteGlyph {
public:
- int _field3C;
+ bool _flag2;
CPetGfxElement *_gfxElement2, *_gfxElement3;
public:
CEntertainmentDeviceGlyph() : CToggleRemoteGlyph(),
- _field3C(0), _gfxElement2(nullptr), _gfxElement3(nullptr) {}
+ _flag2(false), _gfxElement2(nullptr), _gfxElement3(nullptr) {}
/**
* Setup the glyph
*/
virtual bool setup(CPetControl *petControl, CPetGlyphs *owner);
+ /**
+ * Handles any secondary drawing of the glyph
+ */
+ virtual void draw2(CScreenManager *screenManager);
+
+ /**
+ * Called for mouse button down messages
+ */
+ virtual bool MouseButtonDownMsg(const Point &pt);
+
+ /**
+ * Handles mouse button up messages
+ */
+ virtual bool MouseButtonUpMsg(const Point &pt);
+
+ /**
+ * Returns the tooltip text for when the glyph is selected
+ */
+ virtual void getTooltip(CPetText *text);
};
} // End of namespace Titanic