diff options
Diffstat (limited to 'engines/titanic')
-rw-r--r-- | engines/titanic/core/game_object.cpp | 60 | ||||
-rw-r--r-- | engines/titanic/core/game_object.h | 25 | ||||
-rw-r--r-- | engines/titanic/star_control/star_control.cpp | 8 | ||||
-rw-r--r-- | engines/titanic/star_control/star_control.h | 2 |
4 files changed, 74 insertions, 21 deletions
diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp index 0bf54647f5..15bc1ec143 100644 --- a/engines/titanic/core/game_object.cpp +++ b/engines/titanic/core/game_object.cpp @@ -869,17 +869,6 @@ CMailMan *CGameObject::getMailMan() const { return dynamic_cast<CMailMan *>(getDontSaveChild(CMailMan::_type)); } -CStarControl *CGameObject::getStarControl() const { - CStarControl *starControl = static_cast<CStarControl *>(getDontSaveChild(CStarControl::_type)); - if (!starControl) { - CViewItem *view = getGameManager()->getView(); - if (view) - starControl = starControl = static_cast<CStarControl *>(view->findChildInstanceOf(CStarControl::_type)); - } - - return starControl; -} - CTreeItem *CGameObject::getDontSaveChild(ClassDef *classDef) const { CProjectItem *root = getRoot(); if (!root) @@ -892,11 +881,6 @@ CTreeItem *CGameObject::getDontSaveChild(ClassDef *classDef) const { return dontSave->findChildInstanceOf(classDef); } -CRoomItem *CGameObject::getRoom() const { - CGameManager *gameManager = getGameManager(); - return gameManager ? gameManager->getRoom() : nullptr; -} - CRoomItem *CGameObject::getHiddenRoom() const { CProjectItem *root = getRoot(); return root ? root->findHiddenRoom() : nullptr; @@ -1043,6 +1027,25 @@ void CGameObject::resetMail() { mailMan->resetValue(); } +/*------------------------------------------------------------------------*/ + +CRoomItem *CGameObject::getRoom() const { + CGameManager *gameManager = getGameManager(); + return gameManager ? gameManager->getRoom() : nullptr; +} + +CNodeItem *CGameObject::getNode() const { + CGameManager *gameManager = getGameManager(); + return gameManager ? gameManager->getNode() : nullptr; +} + +CViewItem *CGameObject::getView() const { + CGameManager *gameManager = getGameManager(); + return gameManager ? gameManager->getView() : nullptr; +} + +/*------------------------------------------------------------------------*/ + void CGameObject::petAddToCarryParcel(CGameObject *obj) { CPetControl *pet = getPetControl(); if (pet) { @@ -1150,6 +1153,31 @@ void CGameObject::petUnlockInput() { /*------------------------------------------------------------------------*/ +CStarControl *CGameObject::getStarControl() const { + CStarControl *starControl = static_cast<CStarControl *>(getDontSaveChild(CStarControl::_type)); + if (!starControl) { + CViewItem *view = getGameManager()->getView(); + if (view) + starControl = starControl = static_cast<CStarControl *>(view->findChildInstanceOf(CStarControl::_type)); + } + + return starControl; +} + +void CGameObject::starFn1(int v) { + CStarControl *starControl = getStarControl(); + if (starControl) + starControl->fn1(v); +} + +void CGameObject::starFn2() { + CStarControl *starControl = getStarControl(); + if (starControl) + starControl->fn4(); +} + +/*------------------------------------------------------------------------*/ + void CGameObject::startTalking(const CString &npcName, uint id, CViewItem *view) { CTrueTalkNPC *npc = static_cast<CTrueTalkNPC *>(getRoot()->findByName(npcName)); startTalking(npc, id, view); diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h index 67bf13141d..448b547e21 100644 --- a/engines/titanic/core/game_object.h +++ b/engines/titanic/core/game_object.h @@ -290,11 +290,6 @@ protected: CTreeItem *getDontSaveChild(ClassDef *classDef) const; /** - * Return the current room - */ - CRoomItem *getRoom() const; - - /** * Returns the special hidden room container */ CRoomItem *getHiddenRoom() const; @@ -529,6 +524,23 @@ public: bool compareRoomFlags(int mode, uint flags1, uint flags2); + /*--- CGameManager Methods ---*/ + + /** + * Return the current room + */ + CRoomItem *getRoom() const; + + /** + * Return the current node + */ + CNodeItem *getNode() const; + + /** + * Return the current room + */ + CViewItem *getView() const; + /*--- CPetControl Methods ---*/ /** @@ -624,6 +636,9 @@ public: */ CStarControl *getStarControl() const; + void starFn1(int v); + void starFn2(); + /*--- CTrueTalkManager Methods ---*/ /** diff --git a/engines/titanic/star_control/star_control.cpp b/engines/titanic/star_control/star_control.cpp index 3f84a947f3..f27f16dab2 100644 --- a/engines/titanic/star_control/star_control.cpp +++ b/engines/titanic/star_control/star_control.cpp @@ -57,4 +57,12 @@ void CStarControl::fn3() { warning("CStarControl::fn3"); } +void CStarControl::fn1(int v) { + warning("CStarControl::fn1"); +} + +void CStarControl::fn4() { + warning("CStarControl::fn4"); +} + } // End of namespace Titanic diff --git a/engines/titanic/star_control/star_control.h b/engines/titanic/star_control/star_control.h index 3e53db11bf..ee042b6bc8 100644 --- a/engines/titanic/star_control/star_control.h +++ b/engines/titanic/star_control/star_control.h @@ -53,7 +53,9 @@ public: */ virtual void load(SimpleFile *file); + void fn1(int v); void fn3(); + void fn4(); }; } // End of namespace Titanic |