aboutsummaryrefslogtreecommitdiff
path: root/engines/titanic
diff options
context:
space:
mode:
authorPaul Gilbert2016-06-27 19:44:16 -0400
committerPaul Gilbert2016-07-15 19:25:33 -0400
commit0e8148207070e92a5234e5c0a4e05fe401901736 (patch)
tree8e34ed86c07aadf4b370963caa520dcbdf545ae2 /engines/titanic
parentf141b337177bb0bd001c753f8cb17999b6ea2bf9 (diff)
downloadscummvm-rg350-0e8148207070e92a5234e5c0a4e05fe401901736.tar.gz
scummvm-rg350-0e8148207070e92a5234e5c0a4e05fe401901736.tar.bz2
scummvm-rg350-0e8148207070e92a5234e5c0a4e05fe401901736.zip
TITANIC: Added more CGameObject methods
Diffstat (limited to 'engines/titanic')
-rw-r--r--engines/titanic/core/game_object.cpp39
-rw-r--r--engines/titanic/core/game_object.h25
2 files changed, 64 insertions, 0 deletions
diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp
index 795ed92236..183cb6b6ee 100644
--- a/engines/titanic/core/game_object.cpp
+++ b/engines/titanic/core/game_object.cpp
@@ -850,6 +850,14 @@ void CGameObject::lockMouse() {
CScreenManager::_screenManagerPtr->_mouseCursor->hide();
}
+void CGameObject::hideMouse() {
+ CScreenManager::_screenManagerPtr->_mouseCursor->hide();
+}
+
+void CGameObject::showMouse() {
+ CScreenManager::_screenManagerPtr->_mouseCursor->show();
+}
+
void CGameObject::unlockMouse() {
if (CScreenManager::_screenManagerPtr->_mouseCursor)
CScreenManager::_screenManagerPtr->_mouseCursor->show();
@@ -898,6 +906,11 @@ void CGameObject::dragMove(const Point &pt) {
setPosition(Point(pt.x - _bounds.width() / 2, pt.y - _bounds.height() / 2));
}
+bool CGameObject::isObjectDragging() const {
+ CTreeItem *item = getGameManager()->_dragItem;
+ return item ? static_cast<CGameObject *>(item) != nullptr : false;
+}
+
Point CGameObject::getControid() const {
return Point(_bounds.left + _bounds.width() / 2,
_bounds.top + _bounds.height() / 2);
@@ -1294,4 +1307,30 @@ void CGameObject::endTalking(CTrueTalkNPC *npc, bool viewFlag, CViewItem *view)
pet->refreshNPC();
}
+void CGameObject::talkSetDialRegion(const CString &name, int dialNum, int regionNum) {
+ CGameManager *gameManager = getGameManager();
+ if (gameManager) {
+ CTrueTalkManager *talkManager = gameManager->getTalkManager();
+ if (talkManager) {
+ TTnpcScript *npcScript = talkManager->getTalker(name);
+ if (npcScript)
+ npcScript->setDialRegion(dialNum, regionNum);
+ }
+ }
+}
+
+int CGameObject::talkGetDIalRegion(const CString &name, int dialNum) {
+ CGameManager *gameManager = getGameManager();
+ if (gameManager) {
+ CTrueTalkManager *talkManager = gameManager->getTalkManager();
+ if (talkManager) {
+ TTnpcScript *npcScript = talkManager->getTalker(name);
+ if (npcScript)
+ return npcScript->getDialRegion(dialNum);
+ }
+ }
+
+ return 0;
+}
+
} // End of namespace Titanic
diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h
index a744cd116a..d9f382c2e4 100644
--- a/engines/titanic/core/game_object.h
+++ b/engines/titanic/core/game_object.h
@@ -137,6 +137,16 @@ protected:
void unlockMouse();
/**
+ * Hides the mouse cursor
+ */
+ void hideMouse();
+
+ /**
+ * Shows the mouse cursor
+ */
+ void showMouse();
+
+ /**
* Load a sound
*/
void loadSound(const CString &name);
@@ -564,6 +574,11 @@ public:
*/
void dragMove(const Point &pt);
+ /**
+ * Returns true if an item being dragged is a game object
+ */
+ bool isObjectDragging() const;
+
bool compareRoomFlags(int mode, uint flags1, uint flags2);
/*--- CGameManager Methods ---*/
@@ -723,6 +738,16 @@ public:
* Start a conversation with the NPC
*/
void startTalking(const CString &name, uint id, CViewItem *view = nullptr);
+
+ /**
+ * Sets a dial region for a given NPC
+ */
+ void talkSetDialRegion(const CString &name, int dialNum, int regionNum);
+
+ /**
+ * Gets a dial region for a given NPC
+ */
+ int talkGetDIalRegion(const CString &name, int dialNum);
};
} // End of namespace Titanic