aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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