aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Gilbert2016-04-15 08:01:39 -0400
committerPaul Gilbert2016-07-10 16:11:10 -0400
commit95c885f877ac1fa243479d113b59e6f83a360c71 (patch)
tree636668ce5345cf70149991baa6997a5e57f6df0f
parent2dcda26eb1253d884d6a921a3f2ead76021b9bc4 (diff)
downloadscummvm-rg350-95c885f877ac1fa243479d113b59e6f83a360c71.tar.gz
scummvm-rg350-95c885f877ac1fa243479d113b59e6f83a360c71.tar.bz2
scummvm-rg350-95c885f877ac1fa243479d113b59e6f83a360c71.zip
TITANIC: Implementing CCarryParrot msg handlers
-rw-r--r--engines/titanic/carry/carry_parrot.cpp91
-rw-r--r--engines/titanic/carry/carry_parrot.h13
-rw-r--r--engines/titanic/core/game_object.cpp4
-rw-r--r--engines/titanic/core/game_object.h3
-rw-r--r--engines/titanic/core/tree_item.cpp7
-rw-r--r--engines/titanic/core/tree_item.h5
-rw-r--r--engines/titanic/messages/messages.h2
-rw-r--r--engines/titanic/npcs/parrot.h2
-rw-r--r--engines/titanic/sound/sound.h1
-rw-r--r--engines/titanic/sound/sound_manager.cpp2
-rw-r--r--engines/titanic/sound/sound_manager.h4
11 files changed, 129 insertions, 5 deletions
diff --git a/engines/titanic/carry/carry_parrot.cpp b/engines/titanic/carry/carry_parrot.cpp
index 80c833261c..1081980121 100644
--- a/engines/titanic/carry/carry_parrot.cpp
+++ b/engines/titanic/carry/carry_parrot.cpp
@@ -21,9 +21,23 @@
*/
#include "titanic/carry/carry_parrot.h"
+#include "titanic/game/cage.h"
+#include "titanic/npcs/parrot.h"
namespace Titanic {
+BEGIN_MESSAGE_MAP(CCarryParrot, CCarry)
+ ON_MESSAGE(PETGainedObjectMsg)
+ ON_MESSAGE(TimerMsg)
+ ON_MESSAGE(IsParrotPresentMsg)
+ ON_MESSAGE(LeaveViewMsg)
+ ON_MESSAGE(MouseDragEndMsg)
+ ON_MESSAGE(PassOnDragStartMsg)
+ ON_MESSAGE(PreEnterViewMsg)
+ ON_MESSAGE(UseWithCharMsg)
+ ON_MESSAGE(ActMsg)
+END_MESSAGE_MAP()
+
CCarryParrot::CCarryParrot() : CCarry(), _string6("PerchedParrot"),
_field138(0), _field13C(0), _field140(0), _field144(10),
_field148(25), _field14C(0), _field150(8) {
@@ -49,4 +63,81 @@ void CCarryParrot::load(SimpleFile *file) {
CCarry::load(file);
}
+bool CCarryParrot::PETGainedObjectMsg(CPETGainedObjectMsg *msg) {
+ CParrot::_v4 = 4;
+ CActMsg actMsg("Shut");
+ actMsg.execute("ParrotCage");
+
+ return true;
+}
+
+bool CCarryParrot::TimerMsg(CTimerMsg *msg) {
+ if (CParrot::_v4 == 1 || CParrot::_v4 == 4) {
+ if (++_field13C >= 30) {
+ CActMsg actMsg("FreeParrot");
+ actMsg.execute(this);
+ }
+ }
+
+ return true;
+}
+
+bool CCarryParrot::IsParrotPresentMsg(CIsParrotPresentMsg *msg) {
+ msg->_value = true;
+ return true;
+}
+
+bool CCarryParrot::LeaveViewMsg(CLeaveViewMsg *msg) {
+ if (_visible) {
+ setVisible(false);
+ _fieldE0 = 0;
+ CParrot::_v4 = 2;
+ }
+
+ return true;
+}
+
+bool CCarryParrot::MouseDragEndMsg(CMouseDragEndMsg *msg) {
+ stopMovie();
+
+ if (msg->_mousePos.y >= 360) {
+ dropOnPet();
+ return true;
+ }
+
+ if (compareViewNameTo("ParrotLobby.Node 1.N")) {
+ if (msg->_mousePos.x >= 75 && msg->_mousePos.x <= 565 &&
+ !CParrot::_v2 && !CCage::_v2) {
+ setVisible(false);
+ // TODO
+ } else {
+ // TODO
+ }
+ } else {
+ // TODO
+ }
+
+ return true;
+}
+
+bool CCarryParrot::PassOnDragStartMsg(CPassOnDragStartMsg *msg) {
+ // TODO
+ return true;
+}
+
+bool CCarryParrot::PreEnterViewMsg(CPreEnterViewMsg *msg) {
+ // TODO
+ return true;
+}
+
+bool CCarryParrot::UseWithCharMsg(CUseWithCharMsg *msg) {
+ // TODO
+ return true;
+}
+
+bool CCarryParrot::ActMsg(CActMsg *msg) {
+ // TODO
+ return true;
+}
+
} // End of namespace Titanic
diff --git a/engines/titanic/carry/carry_parrot.h b/engines/titanic/carry/carry_parrot.h
index a2b17004ac..fc1bbba255 100644
--- a/engines/titanic/carry/carry_parrot.h
+++ b/engines/titanic/carry/carry_parrot.h
@@ -24,10 +24,23 @@
#define TITANIC_CARRY_PARROT_H
#include "titanic/carry/carry.h"
+#include "titanic/messages/messages.h"
+#include "titanic/messages/mouse_messages.h"
+#include "titanic/messages/pet_messages.h"
namespace Titanic {
class CCarryParrot : public CCarry {
+ DECLARE_MESSAGE_MAP
+ bool PETGainedObjectMsg(CPETGainedObjectMsg *msg);
+ bool TimerMsg(CTimerMsg *msg);
+ bool IsParrotPresentMsg(CIsParrotPresentMsg *msg);
+ bool LeaveViewMsg(CLeaveViewMsg *msg);
+ bool MouseDragEndMsg(CMouseDragEndMsg *msg);
+ bool PassOnDragStartMsg(CPassOnDragStartMsg *msg);
+ bool PreEnterViewMsg(CPreEnterViewMsg *msg);
+ bool UseWithCharMsg(CUseWithCharMsg *msg);
+ bool ActMsg(CActMsg *msg);
private:
CString _string6;
int _field138;
diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp
index e0ca5ff6b9..362dbfe0c8 100644
--- a/engines/titanic/core/game_object.cpp
+++ b/engines/titanic/core/game_object.cpp
@@ -445,6 +445,10 @@ int CGameObject::getSurface45() const {
return _surface ? _surface->proc45() : 0;
}
+void CGameObject::sound8(bool flag) const {
+ getGameManager()->_sound.managerProc8(flag ? 3 : 0);
+}
+
bool CGameObject::playSound(const CString &name, int val2, int val3, int val4) {
CProximity prox;
prox._field8 = val2;
diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h
index 3848222436..653230a74f 100644
--- a/engines/titanic/core/game_object.h
+++ b/engines/titanic/core/game_object.h
@@ -254,6 +254,7 @@ public:
int getMovie19() const;
int getSurface45() const;
+ void sound8(bool flag) const;
/**
* Loads a frame
@@ -279,6 +280,8 @@ public:
* Sets whether the object is visible
*/
void setVisible(bool val);
+
+
};
} // End of namespace Titanic
diff --git a/engines/titanic/core/tree_item.cpp b/engines/titanic/core/tree_item.cpp
index 03bf0e764e..abd6f6c51b 100644
--- a/engines/titanic/core/tree_item.cpp
+++ b/engines/titanic/core/tree_item.cpp
@@ -201,6 +201,13 @@ void CTreeItem::addSibling(CTreeItem *item) {
item->_nextSibling = this;
}
+void CTreeItem::moveUnder(CTreeItem *newParent) {
+ if (newParent) {
+ detach();
+ addUnder(newParent);
+ }
+}
+
void CTreeItem::destroyAll() {
destroyOthers();
detach();
diff --git a/engines/titanic/core/tree_item.h b/engines/titanic/core/tree_item.h
index 2f4ebc39f1..151addee2e 100644
--- a/engines/titanic/core/tree_item.h
+++ b/engines/titanic/core/tree_item.h
@@ -215,6 +215,11 @@ public:
void addSibling(CTreeItem *item);
/**
+ * Moves the tree item to be under another parent
+ */
+ void moveUnder(CTreeItem *newParent);
+
+ /**
* Destroys both the item as well as any of it's children
*/
void destroyAll();
diff --git a/engines/titanic/messages/messages.h b/engines/titanic/messages/messages.h
index f1b782b9a1..76469a85e5 100644
--- a/engines/titanic/messages/messages.h
+++ b/engines/titanic/messages/messages.h
@@ -264,7 +264,7 @@ MESSAGE2(CHoseConnectedMsg, int, value1, 1, int, value2, 0);
MESSAGE0(CInitializeAnimMsg);
MESSAGE1(CIsEarBowlPuzzleDone, int, value, 0);
MESSAGE3(CIsHookedOnMsg, Rect, rect, Rect(), bool, result, false, CString, string1, "");
-MESSAGE1(CIsParrotPresentMsg, int, value, 0);
+MESSAGE1(CIsParrotPresentMsg, bool, value, false);
MESSAGE1(CKeyCharMsg, int, value, 32);
MESSAGE2(CLeaveNodeMsg, CNodeItem *, oldNode, nullptr, CNodeItem *, newNode, nullptr);
MESSAGE2(CLeaveRoomMsg, CRoomItem *, oldRoom, nullptr, CRoomItem *, newRoom, nullptr);
diff --git a/engines/titanic/npcs/parrot.h b/engines/titanic/npcs/parrot.h
index b69c8723d3..0019437ce0 100644
--- a/engines/titanic/npcs/parrot.h
+++ b/engines/titanic/npcs/parrot.h
@@ -28,7 +28,7 @@
namespace Titanic {
class CParrot : public CTrueTalkNPC {
-private:
+public:
static int _v1;
static int _v2;
static int _v3;
diff --git a/engines/titanic/sound/sound.h b/engines/titanic/sound/sound.h
index 804263c59d..07300264af 100644
--- a/engines/titanic/sound/sound.h
+++ b/engines/titanic/sound/sound.h
@@ -76,6 +76,7 @@ public:
bool fn1(int val);
void fn2(int val);
void fn3(int val, int val2, int val3);
+ void managerProc8(int v) { _soundManager.proc8(v); }
};
} // End of namespace Titanic
diff --git a/engines/titanic/sound/sound_manager.cpp b/engines/titanic/sound/sound_manager.cpp
index f575411c82..9b78a9e5b6 100644
--- a/engines/titanic/sound/sound_manager.cpp
+++ b/engines/titanic/sound/sound_manager.cpp
@@ -57,7 +57,7 @@ void QSoundManager::proc7() {
warning("TODO");
}
-void QSoundManager::proc8() {
+void QSoundManager::proc8(int v) {
warning("TODO");
}
diff --git a/engines/titanic/sound/sound_manager.h b/engines/titanic/sound/sound_manager.h
index f741f97f7b..d37db60e28 100644
--- a/engines/titanic/sound/sound_manager.h
+++ b/engines/titanic/sound/sound_manager.h
@@ -42,7 +42,7 @@ public:
virtual int proc5() const { return 0; }
virtual void proc6() = 0;
virtual void proc7() = 0;
- virtual void proc8() = 0;
+ virtual void proc8(int v) = 0;
virtual void proc9() {}
virtual void proc10() = 0;
virtual void proc11() = 0;
@@ -105,7 +105,7 @@ public:
virtual int proc5();
virtual void proc6();
virtual void proc7();
- virtual void proc8();
+ virtual void proc8(int v);
virtual void proc9();
virtual void proc10();
virtual void proc11();