aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/titanic/game/bar_bell.cpp5
-rw-r--r--engines/titanic/game/bar_bell.h5
-rw-r--r--engines/titanic/game/bomb.cpp15
-rw-r--r--engines/titanic/game/bomb.h9
-rw-r--r--engines/titanic/game/chicken_cooler.cpp5
-rw-r--r--engines/titanic/game/chicken_cooler.h7
-rw-r--r--engines/titanic/game/end_sequence_control.cpp5
-rw-r--r--engines/titanic/game/end_sequence_control.h5
-rw-r--r--engines/titanic/game/fan_noises.cpp5
-rw-r--r--engines/titanic/game/fan_noises.h7
-rw-r--r--engines/titanic/game/get_lift_eye2.cpp5
-rw-r--r--engines/titanic/game/get_lift_eye2.h6
-rw-r--r--engines/titanic/game/gondolier/gondolier_mixer.cpp8
-rw-r--r--engines/titanic/game/gondolier/gondolier_mixer.h5
-rw-r--r--engines/titanic/messages/bilge_dispensor_event.cpp5
-rw-r--r--engines/titanic/messages/bilge_dispensor_event.h3
-rw-r--r--engines/titanic/messages/messages.cpp2
-rw-r--r--engines/titanic/messages/messages.h42
-rw-r--r--engines/titanic/messages/mouse_messages.h14
-rw-r--r--engines/titanic/moves/enter_bridge.cpp5
-rw-r--r--engines/titanic/moves/enter_bridge.h7
-rw-r--r--engines/titanic/npcs/barbot.cpp5
-rw-r--r--engines/titanic/npcs/barbot.h5
-rw-r--r--engines/titanic/sound/auto_music_player.cpp8
-rw-r--r--engines/titanic/sound/auto_music_player.h5
-rw-r--r--engines/titanic/titanic.cpp3
-rw-r--r--engines/titanic/titanic.h4
27 files changed, 151 insertions, 49 deletions
diff --git a/engines/titanic/game/bar_bell.cpp b/engines/titanic/game/bar_bell.cpp
index 71f0e878df..1639b7da39 100644
--- a/engines/titanic/game/bar_bell.cpp
+++ b/engines/titanic/game/bar_bell.cpp
@@ -50,4 +50,9 @@ void CBarBell::load(SimpleFile *file) {
CGameObject::load(file);
}
+bool CBarBell::handleEvent(const CEnterRoomMsg &msg) {
+ _fieldBC = 0;
+ return true;
+}
+
} // End of namespace Titanic
diff --git a/engines/titanic/game/bar_bell.h b/engines/titanic/game/bar_bell.h
index 279379feaf..432bf3a281 100644
--- a/engines/titanic/game/bar_bell.h
+++ b/engines/titanic/game/bar_bell.h
@@ -24,16 +24,19 @@
#define TITANIC_BAR_BELL_H
#include "titanic/core/game_object.h"
+#include "titanic/messages/messages.h"
namespace Titanic {
-class CBarBell : public CGameObject {
+class CBarBell : public CGameObject, CEnterRoomMsgTarget {
public:
int _fieldBC;
int _fieldC0;
int _fieldC4;
int _fieldC8;
int _fieldCC;
+protected:
+ virtual bool handleEvent(const CEnterRoomMsg &msg);
public:
CLASSDEF
CBarBell();
diff --git a/engines/titanic/game/bomb.cpp b/engines/titanic/game/bomb.cpp
index 108376efb3..429f254d66 100644
--- a/engines/titanic/game/bomb.cpp
+++ b/engines/titanic/game/bomb.cpp
@@ -21,6 +21,7 @@
*/
#include "titanic/game/bomb.h"
+#include "titanic/titanic.h"
namespace Titanic {
@@ -33,7 +34,7 @@ CBomb::CBomb() : CBackground() {
_fieldF4 = 999;
_fieldF8 = 0;
_fieldFC = 0;
- _field100 = 0;
+ _startingTicks = 0;
_field104 = 60;
}
@@ -47,7 +48,7 @@ void CBomb::save(SimpleFile *file, int indent) const {
file->writeNumberLine(_fieldF4, indent);
file->writeNumberLine(_fieldF8, indent);
file->writeNumberLine(_fieldFC, indent);
- file->writeNumberLine(_field100, indent);
+ file->writeNumberLine(_startingTicks, indent);
file->writeNumberLine(_field104, indent);
CBackground::save(file, indent);
@@ -63,10 +64,18 @@ void CBomb::load(SimpleFile *file) {
_fieldF4 = file->readNumber();
_fieldF8 = file->readNumber();
_fieldFC = file->readNumber();
- _field100 = file->readNumber();
+ _startingTicks = file->readNumber();
_field104 = file->readNumber();
CBackground::load(file);
}
+bool CBomb::handleEvent(const CEnterRoomMsg &msg) {
+ _fieldE8 = 12;
+ _fieldEC = 9;
+ _fieldF0 = 0;
+ _startingTicks = g_vm->_ticksCount;
+ return true;
+}
+
} // End of namespace Titanic
diff --git a/engines/titanic/game/bomb.h b/engines/titanic/game/bomb.h
index 2e7ba4658e..4c7c9526ea 100644
--- a/engines/titanic/game/bomb.h
+++ b/engines/titanic/game/bomb.h
@@ -24,11 +24,12 @@
#define TITANIC_BOMB_H
#include "titanic/core/background.h"
+#include "titanic/messages/messages.h"
namespace Titanic {
-class CBomb : public CBackground {
-public:
+class CBomb : public CBackground, CEnterRoomMsgTarget {
+private:
int _fieldE0;
int _fieldE4;
int _fieldE8;
@@ -37,8 +38,10 @@ public:
int _fieldF4;
int _fieldF8;
int _fieldFC;
- int _field100;
+ int _startingTicks;
int _field104;
+protected:
+ virtual bool handleEvent(const CEnterRoomMsg &msg);
public:
CLASSDEF
CBomb();
diff --git a/engines/titanic/game/chicken_cooler.cpp b/engines/titanic/game/chicken_cooler.cpp
index 335ed36fb6..54acc405fd 100644
--- a/engines/titanic/game/chicken_cooler.cpp
+++ b/engines/titanic/game/chicken_cooler.cpp
@@ -40,4 +40,9 @@ void CChickenCooler::load(SimpleFile *file) {
CGameObject::load(file);
}
+bool CChickenCooler::handleEvent(const CEnterRoomMsg &msg) {
+ warning("CChickenCoolor::handlEvent");
+ return true;
+}
+
} // End of namespace Titanic
diff --git a/engines/titanic/game/chicken_cooler.h b/engines/titanic/game/chicken_cooler.h
index 9e150572f4..6f75649957 100644
--- a/engines/titanic/game/chicken_cooler.h
+++ b/engines/titanic/game/chicken_cooler.h
@@ -24,13 +24,16 @@
#define TITANIC_CHICKEN_COOLER_H
#include "titanic/core/game_object.h"
+#include "titanic/messages/messages.h"
namespace Titanic {
-class CChickenCooler : public CGameObject {
-public:
+class CChickenCooler : public CGameObject, CEnterRoomMsgTarget {
+private:
int _fieldBC;
int _fieldC0;
+protected:
+ virtual bool handleEvent(const CEnterRoomMsg &msg);
public:
CLASSDEF
CChickenCooler() : CGameObject(), _fieldBC(0), _fieldC0(0) {}
diff --git a/engines/titanic/game/end_sequence_control.cpp b/engines/titanic/game/end_sequence_control.cpp
index 1432435a28..f930d61787 100644
--- a/engines/titanic/game/end_sequence_control.cpp
+++ b/engines/titanic/game/end_sequence_control.cpp
@@ -34,4 +34,9 @@ void CEndSequenceControl::load(SimpleFile *file) {
CGameObject::load(file);
}
+bool CEndSequenceControl::handleEvent(const CEnterRoomMsg &msg) {
+ warning("TODO: CEndSequenceControl::handleEvent");
+ return true;
+}
+
} // End of namespace Titanic
diff --git a/engines/titanic/game/end_sequence_control.h b/engines/titanic/game/end_sequence_control.h
index 5e2ba30611..fb1fa3a13c 100644
--- a/engines/titanic/game/end_sequence_control.h
+++ b/engines/titanic/game/end_sequence_control.h
@@ -24,10 +24,13 @@
#define TITANIC_END_SEQUENCE_CONTROL_H
#include "titanic/core/game_object.h"
+#include "titanic/messages/messages.h"
namespace Titanic {
-class CEndSequenceControl : public CGameObject {
+class CEndSequenceControl : public CGameObject, CEnterRoomMsgTarget {
+protected:
+ virtual bool handleEvent(const CEnterRoomMsg &msg);
public:
CLASSDEF
diff --git a/engines/titanic/game/fan_noises.cpp b/engines/titanic/game/fan_noises.cpp
index ed77dc609f..6627332465 100644
--- a/engines/titanic/game/fan_noises.cpp
+++ b/engines/titanic/game/fan_noises.cpp
@@ -55,4 +55,9 @@ void CFanNoises::load(SimpleFile *file) {
CGameObject::load(file);
}
+bool CFanNoises::handleEvent(const CEnterRoomMsg &msg) {
+ warning("CFanNoises::handleEvent");
+ return true;
+}
+
} // End of namespace Titanic
diff --git a/engines/titanic/game/fan_noises.h b/engines/titanic/game/fan_noises.h
index ba35edcf76..2cd96a33cb 100644
--- a/engines/titanic/game/fan_noises.h
+++ b/engines/titanic/game/fan_noises.h
@@ -24,11 +24,12 @@
#define TITANIC_FAN_NOISES_H
#include "titanic/core/game_object.h"
+#include "titanic/messages/messages.h"
namespace Titanic {
-class CFanNoises : public CGameObject {
-public:
+class CFanNoises : public CGameObject, CEnterRoomMsgTarget {
+private:
int _fieldBC;
int _fieldC0;
int _fieldC4;
@@ -36,6 +37,8 @@ public:
int _fieldCC;
int _fieldD0;
int _fieldD4;
+protected:
+ virtual bool handleEvent(const CEnterRoomMsg &msg);
public:
CLASSDEF
CFanNoises();
diff --git a/engines/titanic/game/get_lift_eye2.cpp b/engines/titanic/game/get_lift_eye2.cpp
index 472f884d01..bc51f7cabc 100644
--- a/engines/titanic/game/get_lift_eye2.cpp
+++ b/engines/titanic/game/get_lift_eye2.cpp
@@ -46,4 +46,9 @@ void CGetLiftEye2::load(SimpleFile *file) {
CGameObject::load(file);
}
+bool CGetLiftEye2::handleEvent(const CEnterRoomMsg &msg) {
+ warning("CGetLiftEye2::handleEvent");
+ return true;
+}
+
} // End of namespace Titanic
diff --git a/engines/titanic/game/get_lift_eye2.h b/engines/titanic/game/get_lift_eye2.h
index 6782a56f11..d9465b48bc 100644
--- a/engines/titanic/game/get_lift_eye2.h
+++ b/engines/titanic/game/get_lift_eye2.h
@@ -24,12 +24,14 @@
#define TITANIC_GET_LIFT_EYE2_H
#include "titanic/core/game_object.h"
-
+#include "titanic/messages/messages.h"
namespace Titanic {
-class CGetLiftEye2 : public CGameObject {
+class CGetLiftEye2 : public CGameObject, CEnterRoomMsgTarget {
private:
static CString *_v1;
+protected:
+ virtual bool handleEvent(const CEnterRoomMsg &msg);
public:
CLASSDEF
static void init();
diff --git a/engines/titanic/game/gondolier/gondolier_mixer.cpp b/engines/titanic/game/gondolier/gondolier_mixer.cpp
index e81ad34c87..391c513ccc 100644
--- a/engines/titanic/game/gondolier/gondolier_mixer.cpp
+++ b/engines/titanic/game/gondolier/gondolier_mixer.cpp
@@ -56,4 +56,12 @@ void CGondolierMixer::load(SimpleFile *file) {
CGondolierBase::load(file);
}
+bool CGondolierMixer::handleEvent(const CEnterRoomMsg &msg) {
+ CTreeItem *parent = getParent();
+ if (parent == msg._room)
+ msg.execute(parent);
+
+ return true;
+}
+
} // End of namespace Titanic
diff --git a/engines/titanic/game/gondolier/gondolier_mixer.h b/engines/titanic/game/gondolier/gondolier_mixer.h
index 173bcd8ac2..ce8959b77a 100644
--- a/engines/titanic/game/gondolier/gondolier_mixer.h
+++ b/engines/titanic/game/gondolier/gondolier_mixer.h
@@ -24,10 +24,11 @@
#define TITANIC_GONDOLIER_MIXER_H
#include "titanic/game/gondolier/gondolier_base.h"
+#include "titanic/messages/messages.h"
namespace Titanic {
-class CGondolierMixer : public CGondolierBase {
+class CGondolierMixer : public CGondolierBase, CEnterRoomMsgTarget {
private:
int _fieldBC;
int _fieldC0;
@@ -36,6 +37,8 @@ private:
CString _string1;
CString _string2;
int _fieldE4;
+protected:
+ virtual bool handleEvent(const CEnterRoomMsg &msg);
public:
CLASSDEF
CGondolierMixer();
diff --git a/engines/titanic/messages/bilge_dispensor_event.cpp b/engines/titanic/messages/bilge_dispensor_event.cpp
index 9252d123e9..c4c8375f5d 100644
--- a/engines/titanic/messages/bilge_dispensor_event.cpp
+++ b/engines/titanic/messages/bilge_dispensor_event.cpp
@@ -34,4 +34,9 @@ void CBilgeDispensorEvent::load(SimpleFile *file) {
CAutoSoundEvent::load(file);
}
+bool CBilgeDispensorEvent::handleEvent(const CEnterRoomMsg &msg) {
+ _value1 = 0;
+ return true;
+}
+
} // End of namespace Titanic
diff --git a/engines/titanic/messages/bilge_dispensor_event.h b/engines/titanic/messages/bilge_dispensor_event.h
index fb88a6bd32..4334465c02 100644
--- a/engines/titanic/messages/bilge_dispensor_event.h
+++ b/engines/titanic/messages/bilge_dispensor_event.h
@@ -24,10 +24,13 @@
#define TITANIC_BILGE_DISPENSOR_EVENT_H
#include "titanic/messages/auto_sound_event.h"
+#include "titanic/messages/messages.h"
namespace Titanic {
class CBilgeDispensorEvent : public CAutoSoundEvent {
+protected:
+ virtual bool handleEvent(const CEnterRoomMsg &msg);
public:
CLASSDEF
diff --git a/engines/titanic/messages/messages.cpp b/engines/titanic/messages/messages.cpp
index 1e49994915..00debc562c 100644
--- a/engines/titanic/messages/messages.cpp
+++ b/engines/titanic/messages/messages.cpp
@@ -38,7 +38,7 @@ void CMessage::load(SimpleFile *file) {
CSaveableObject::load(file);
}
-bool CMessage::execute(CTreeItem *target, const ClassDef *classDef, int flags) {
+bool CMessage::execute(CTreeItem *target, const ClassDef *classDef, int flags) const {
// If no target was specified, then there's nothing to do
if (!target)
return false;
diff --git a/engines/titanic/messages/messages.h b/engines/titanic/messages/messages.h
index 5331881b85..958275868d 100644
--- a/engines/titanic/messages/messages.h
+++ b/engines/titanic/messages/messages.h
@@ -46,9 +46,9 @@ public:
CMessage();
bool execute(CTreeItem *target, const ClassDef *classDef = nullptr,
- int flags = MSGFLAG_SCAN | MSGFLAG_BREAK_IF_HANDLED);
+ int flags = MSGFLAG_SCAN | MSGFLAG_BREAK_IF_HANDLED) const;
- virtual bool perform(CTreeItem *treeItem) { return false; }
+ virtual bool perform(CTreeItem *treeItem) const { return false; }
/**
* Save the data for the class to file
@@ -64,7 +64,7 @@ public:
MSGTARGET(CEditControlMsg);
class CEditControlMsg : public CMessage {
protected:
- virtual bool handleMessage(CEditControlMsg &msg) { return false; }
+ virtual bool handleMessage(const CEditControlMsg &msg) { return false; }
public:
int _field4;
int _field8;
@@ -77,7 +77,7 @@ public:
CEditControlMsg() : _field4(0), _field8(0), _field18(0),
_field1C(0), _field20(0) {}
- virtual bool perform(CTreeItem *treeItem) {
+ virtual bool perform(CTreeItem *treeItem) const {
CEditControlMsg *dest = dynamic_cast<CEditControlMsg *>(treeItem);
return dest != nullptr && dest->handleMessage(*this);
}
@@ -86,7 +86,7 @@ public:
MSGTARGET(CLightsMsg);
class CLightsMsg : public CMessage {
protected:
- virtual bool handleMessage(CLightsMsg &msg) { return false; }
+ virtual bool handleMessage(const CLightsMsg &msg) { return false; }
public:
int _field4;
int _field8;
@@ -97,7 +97,7 @@ public:
CLightsMsg() : CMessage(), _field4(0), _field8(0),
_fieldC(0), _field10(0) {}
- virtual bool perform(CTreeItem *treeItem) {
+ virtual bool perform(CTreeItem *treeItem) const {
CLightsMsg *dest = dynamic_cast<CLightsMsg *>(treeItem);
return dest != nullptr && dest->handleMessage(*this);
}
@@ -106,7 +106,7 @@ public:
MSGTARGET(CIsHookedOnMsg);
class CIsHookedOnMsg : public CMessage {
protected:
- virtual bool handleMessage(CIsHookedOnMsg &msg) { return false; }
+ virtual bool handleMessage(const CIsHookedOnMsg &msg) { return false; }
public:
int _field4;
int _field8;
@@ -119,7 +119,7 @@ public:
CIsHookedOnMsg() : CMessage(), _field4(0), _field8(0),
_field18(0), _field1C(0), _field20(0) {}
- virtual bool perform(CTreeItem *treeItem) {
+ virtual bool perform(CTreeItem *treeItem) const {
CIsHookedOnMsg *dest = dynamic_cast<CIsHookedOnMsg *>(treeItem);
return dest != nullptr && dest->handleMessage(*this);
}
@@ -128,7 +128,7 @@ public:
MSGTARGET(CSubAcceptCCarryMsg);
class CSubAcceptCCarryMsg : public CMessage {
protected:
- virtual bool handleMessage(CSubAcceptCCarryMsg &msg) { return false; }
+ virtual bool handleMessage(const CSubAcceptCCarryMsg &msg) { return false; }
public:
CString _string1;
int _value1, _value2, _value3;
@@ -136,7 +136,7 @@ public:
CLASSDEF
CSubAcceptCCarryMsg() : _value1(0), _value2(0), _value3(0) {}
- virtual bool perform(CTreeItem *treeItem) {
+ virtual bool perform(CTreeItem *treeItem) const {
CSubAcceptCCarryMsg *dest = dynamic_cast<CSubAcceptCCarryMsg *>(treeItem);
return dest != nullptr && dest->handleMessage(*this);
}
@@ -145,7 +145,7 @@ public:
MSGTARGET(CTransportMsg);
class CTransportMsg : public CMessage {
protected:
- virtual bool handleMessage(CTransportMsg &msg) { return false; }
+ virtual bool handleMessage(const CTransportMsg &msg) { return false; }
public:
CString _string;
int _value1, _value2;
@@ -153,7 +153,7 @@ public:
CLASSDEF
CTransportMsg() : _value1(0), _value2(0) {}
- virtual bool perform(CTreeItem *treeItem) {
+ virtual bool perform(CTreeItem *treeItem) const {
CTransportMsg *dest = dynamic_cast<CTransportMsg *>(treeItem);
return dest != nullptr && dest->handleMessage(*this);
}
@@ -163,18 +163,18 @@ public:
class NAME: public CMessage { \
public: NAME() : CMessage() {} \
CLASSDEF \
- virtual bool handleMessage(NAME &msg) { return false; } \
- virtual bool perform(CTreeItem *treeItem) { \
+ virtual bool handleMessage(const NAME &msg) { return false; } \
+ virtual bool perform(CTreeItem *treeItem) const { \
NAME *dest = dynamic_cast<NAME *>(treeItem); \
return dest != nullptr && dest->handleMessage(*this); \
} }
#define MESSAGE1(NAME, F1, N1, V1) MSGTARGET(NAME); \
class NAME: public CMessage { \
- public: F1 _N1; \
- NAME() : CMessage(), _N1(V1) {} \
- NAME(F1 N1) : CMessage(), _N1(N1) {} \
+ public: F1 _##N1; \
+ NAME() : CMessage(), _##N1(V1) {} \
+ NAME(F1 N1) : CMessage(), _##N1(N1) {} \
CLASSDEF \
- virtual bool handleMessage(NAME &msg) { return false; } \
+ virtual bool handleMessage(const NAME &msg) { return false; } \
virtual bool perform(CTreeItem *treeItem) { \
NAME *dest = dynamic_cast<NAME *>(treeItem); \
return dest != nullptr && dest->handleMessage(*this); \
@@ -185,7 +185,7 @@ public:
NAME() : CMessage(), _N1(V1), _N2(V2) {} \
NAME(F1 N1, F2 N2) : CMessage(), _N1(N1), _N2(N2) {} \
CLASSDEF \
- virtual bool handleMessage(NAME &msg) { return false; } \
+ virtual bool handleMessage(const NAME &msg) { return false; } \
virtual bool perform(CTreeItem *treeItem) { \
NAME *dest = dynamic_cast<NAME *>(treeItem); \
return dest != nullptr && dest->handleMessage(*this); \
@@ -196,7 +196,7 @@ public:
NAME() : CMessage(), _N1(V1), _N2(V2), _N3(V3) {} \
NAME(F1 N1, F2 N2, F3 N3) : CMessage(), _N1(N1), _N2(N2), _N3(N3) {} \
CLASSDEF \
- virtual bool handleMessage(NAME &msg) { return false; } \
+ virtual bool handleMessage(const NAME &msg) { return false; } \
virtual bool perform(CTreeItem *treeItem) { \
NAME *dest = dynamic_cast<NAME *>(treeItem); \
return dest != nullptr && dest->handleMessage(*this); \
@@ -207,7 +207,7 @@ public:
NAME() : CMessage(), _N1(V1), _N2(V2), _N3(V3), _N4(V4) {} \
NAME(F1 N1, F2 N2, F3 N3, F4 N4) : CMessage(), _N1(N1), _N2(N2), _N3(N3), _N4(N4) {} \
CLASSDEF \
- virtual bool handleMessage(NAME &msg) { return false; } \
+ virtual bool handleMessage(const NAME &msg) { return false; } \
virtual bool perform(CTreeItem *treeItem) { \
NAME *dest = dynamic_cast<NAME *>(treeItem); \
return dest != nullptr && dest->handleMessage(*this); \
diff --git a/engines/titanic/messages/mouse_messages.h b/engines/titanic/messages/mouse_messages.h
index 79c45afcfa..0386eb6bd9 100644
--- a/engines/titanic/messages/mouse_messages.h
+++ b/engines/titanic/messages/mouse_messages.h
@@ -41,7 +41,7 @@ class CMouseMoveMsg : public CMouseMsg {
public:
CLASSDEF
- virtual bool handleMessage(CMouseMoveMsg &msg) { return false; }
+ virtual bool handleMessage(const CMouseMoveMsg &msg) { return false; }
virtual bool perform(CTreeItem *treeItem) {
CMouseMoveMsg *dest = dynamic_cast<CMouseMoveMsg *>(treeItem);
return dest != nullptr && dest->handleMessage(*this);
@@ -61,7 +61,7 @@ class CMouseButtonDownMsg : public CMouseButtonMsg {
public:
CLASSDEF
- virtual bool handleMessage(CMouseButtonDownMsg &msg) { return false; }
+ virtual bool handleMessage(const CMouseButtonDownMsg &msg) { return false; }
virtual bool perform(CTreeItem *treeItem) {
CMouseButtonDownMsg *dest = dynamic_cast<CMouseButtonDownMsg *>(treeItem);
return dest != nullptr && dest->handleMessage(*this);
@@ -73,7 +73,7 @@ class CMouseButtonUpMsg : public CMouseButtonMsg {
public:
CLASSDEF
- virtual bool handleMessage(CMouseButtonUpMsg &msg) { return false; }
+ virtual bool handleMessage(const CMouseButtonUpMsg &msg) { return false; }
virtual bool perform(CTreeItem *treeItem) {
CMouseButtonUpMsg *dest = dynamic_cast<CMouseButtonUpMsg *>(treeItem);
return dest != nullptr && dest->handleMessage(*this);
@@ -85,7 +85,7 @@ class CMouseButtonDoubleClickMsg : public CMouseButtonMsg {
public:
CLASSDEF
- virtual bool handleMessage(CMouseButtonDoubleClickMsg &msg) { return false; }
+ virtual bool handleMessage(const CMouseButtonDoubleClickMsg &msg) { return false; }
virtual bool perform(CTreeItem *treeItem) {
CMouseButtonDoubleClickMsg *dest = dynamic_cast<CMouseButtonDoubleClickMsg *>(treeItem);
return dest != nullptr && dest->handleMessage(*this);
@@ -101,7 +101,7 @@ class CMouseDragMoveMsg : public CMouseDragMsg {
public:
CLASSDEF
- virtual bool handleMessage(CMouseDragMoveMsg &msg) { return false; }
+ virtual bool handleMessage(const CMouseDragMoveMsg &msg) { return false; }
virtual bool perform(CTreeItem *treeItem) {
CMouseDragMoveMsg *dest = dynamic_cast<CMouseDragMoveMsg *>(treeItem);
return dest != nullptr && dest->handleMessage(*this);
@@ -117,7 +117,7 @@ public:
CLASSDEF
CMouseDragStartMsg() : CMouseDragMsg(), _field10(0), _field14(0) {}
- virtual bool handleMessage(CMouseDragStartMsg &msg) { return false; }
+ virtual bool handleMessage(const CMouseDragStartMsg &msg) { return false; }
virtual bool perform(CTreeItem *treeItem) {
CMouseDragStartMsg *dest = dynamic_cast<CMouseDragStartMsg *>(treeItem);
return dest != nullptr && dest->handleMessage(*this);
@@ -132,7 +132,7 @@ public:
CLASSDEF
CMouseDragEndMsg() : CMouseDragMsg(), _field10(0) {}
- virtual bool handleMessage(CMouseDragEndMsg &msg) { return false; }
+ virtual bool handleMessage(const CMouseDragEndMsg &msg) { return false; }
virtual bool perform(CTreeItem *treeItem) {
CMouseDragEndMsg *dest = dynamic_cast<CMouseDragEndMsg *>(treeItem);
return dest != nullptr && dest->handleMessage(*this);
diff --git a/engines/titanic/moves/enter_bridge.cpp b/engines/titanic/moves/enter_bridge.cpp
index a1e0b7e489..6f8ba4cd41 100644
--- a/engines/titanic/moves/enter_bridge.cpp
+++ b/engines/titanic/moves/enter_bridge.cpp
@@ -36,4 +36,9 @@ void CEnterBridge::load(SimpleFile *file) {
CGameObject::load(file);
}
+bool CEnterBridge::handleEvent(const CEnterRoomMsg &msg) {
+ warning("CEnterBridge::handlEvent");
+ return true;
+}
+
} // End of namespace Titanic
diff --git a/engines/titanic/moves/enter_bridge.h b/engines/titanic/moves/enter_bridge.h
index 6a6e7161dd..3685bed8a1 100644
--- a/engines/titanic/moves/enter_bridge.h
+++ b/engines/titanic/moves/enter_bridge.h
@@ -24,12 +24,15 @@
#define TITANIC_ENTER_BRIDGE_H
#include "titanic/core/game_object.h"
+#include "titanic/messages/messages.h"
namespace Titanic {
-class CEnterBridge : public CGameObject {
-public:
+class CEnterBridge : public CGameObject, CEnterRoomMsgTarget {
+private:
int _value;
+protected:
+ virtual bool handleEvent(const CEnterRoomMsg &msg);
public:
CLASSDEF
CEnterBridge() : CGameObject(), _value(1) {}
diff --git a/engines/titanic/npcs/barbot.cpp b/engines/titanic/npcs/barbot.cpp
index a460bdb672..c9a96b989b 100644
--- a/engines/titanic/npcs/barbot.cpp
+++ b/engines/titanic/npcs/barbot.cpp
@@ -233,4 +233,9 @@ void CBarbot::load(SimpleFile *file) {
CTrueTalkNPC::load(file);
}
+bool CBarbot::handleEvent(const CEnterRoomMsg &msg) {
+ warning("TODO: Barbot::CEnterRoomMsg");
+ return true;
+}
+
} // End of namespace Titanic
diff --git a/engines/titanic/npcs/barbot.h b/engines/titanic/npcs/barbot.h
index 7e2d323d46..160edd63d9 100644
--- a/engines/titanic/npcs/barbot.h
+++ b/engines/titanic/npcs/barbot.h
@@ -24,10 +24,11 @@
#define TITANIC_BARBOT_H
#include "titanic/npcs/true_talk_npc.h"
+#include "titanic/messages/messages.h"
namespace Titanic {
-class CBarbot : public CTrueTalkNPC {
+class CBarbot : public CTrueTalkNPC, CEnterRoomMsgTarget {
private:
static int _v0;
private:
@@ -172,6 +173,8 @@ private:
int _field338;
int _field33C;
int _field340;
+protected:
+ virtual bool handleEvent(const CEnterRoomMsg &msg);
public:
CLASSDEF
CBarbot();
diff --git a/engines/titanic/sound/auto_music_player.cpp b/engines/titanic/sound/auto_music_player.cpp
index 2040bfc20a..97c59d075d 100644
--- a/engines/titanic/sound/auto_music_player.cpp
+++ b/engines/titanic/sound/auto_music_player.cpp
@@ -41,4 +41,12 @@ void CAutoMusicPlayer::load(SimpleFile *file) {
CAutoMusicPlayerBase::load(file);
}
+bool CAutoMusicPlayer::handleEvent(const CEnterRoomMsg &msg) {
+ if (!_fieldCC) {
+ warning("TODO");
+ }
+
+ return true;
+}
+
} // End of namespace Titanic
diff --git a/engines/titanic/sound/auto_music_player.h b/engines/titanic/sound/auto_music_player.h
index cec8117dd9..6fdf3766c6 100644
--- a/engines/titanic/sound/auto_music_player.h
+++ b/engines/titanic/sound/auto_music_player.h
@@ -24,12 +24,15 @@
#define TITANIC_AUTO_MUSIC_PLAYER_H
#include "titanic/sound/auto_music_player_base.h"
+#include "titanic/messages/messages.h"
namespace Titanic {
-class CAutoMusicPlayer : public CAutoMusicPlayerBase {
+class CAutoMusicPlayer : public CAutoMusicPlayerBase, CEnterRoomMsgTarget {
private:
CString _string2;
+protected:
+ virtual bool handleEvent(const CEnterRoomMsg &msg);
public:
CLASSDEF
CAutoMusicPlayer();
diff --git a/engines/titanic/titanic.cpp b/engines/titanic/titanic.cpp
index a9d0cc9421..e7bbd84c34 100644
--- a/engines/titanic/titanic.cpp
+++ b/engines/titanic/titanic.cpp
@@ -44,7 +44,8 @@ namespace Titanic {
TitanicEngine *g_vm;
TitanicEngine::TitanicEngine(OSystem *syst, const TitanicGameDescription *gameDesc)
- : _gameDescription(gameDesc), Engine(syst) {
+ : _gameDescription(gameDesc), Engine(syst), _randomSource("Titanic"),
+ _ticksCount(0), _frameCounter(0) {
g_vm = this;
_window = nullptr;
_screenManager = nullptr;
diff --git a/engines/titanic/titanic.h b/engines/titanic/titanic.h
index 112d6d63c1..c5c642629f 100644
--- a/engines/titanic/titanic.h
+++ b/engines/titanic/titanic.h
@@ -24,6 +24,7 @@
#define TITANIC_TITANIC_H
#include "common/scummsys.h"
+#include "common/random.h"
#include "common/system.h"
#include "common/serializer.h"
#include "engines/advancedDetector.h"
@@ -98,6 +99,9 @@ public:
CFilesManager _filesManager;
OSScreenManager *_screenManager;
CMainGameWindow *_window;
+ Common::RandomSource _randomSource;
+ uint _frameCounter;
+ uint _ticksCount;
public:
TitanicEngine(OSystem *syst, const TitanicGameDescription *gameDesc);
virtual ~TitanicEngine();