aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/titanic/carry/bridge_piece.cpp4
-rw-r--r--engines/titanic/carry/speech_centre.cpp42
-rw-r--r--engines/titanic/carry/speech_centre.h9
-rw-r--r--engines/titanic/game/ship_setting.cpp90
-rw-r--r--engines/titanic/game/ship_setting.h10
-rw-r--r--engines/titanic/game/ship_setting_button.cpp58
-rw-r--r--engines/titanic/game/ship_setting_button.h11
-rw-r--r--engines/titanic/game/show_cell_points.cpp37
-rw-r--r--engines/titanic/game/show_cell_points.h9
-rw-r--r--engines/titanic/game/speech_dispensor.cpp105
-rw-r--r--engines/titanic/game/speech_dispensor.h15
-rw-r--r--engines/titanic/game/starling_puret.cpp44
-rw-r--r--engines/titanic/game/starling_puret.h8
-rw-r--r--engines/titanic/game/stop_phonograph_button.cpp19
-rw-r--r--engines/titanic/game/stop_phonograph_button.h2
-rw-r--r--engines/titanic/game/sub_glass.cpp75
-rw-r--r--engines/titanic/game/sub_glass.h16
-rw-r--r--engines/titanic/game/sub_wrapper.cpp44
-rw-r--r--engines/titanic/game/sub_wrapper.h7
-rw-r--r--engines/titanic/game/sweet_bowl.cpp30
-rw-r--r--engines/titanic/game/sweet_bowl.h4
-rw-r--r--engines/titanic/gfx/slider_button.cpp43
-rw-r--r--engines/titanic/gfx/slider_button.h6
-rw-r--r--engines/titanic/gfx/status_change_button.cpp11
-rw-r--r--engines/titanic/gfx/status_change_button.h2
-rw-r--r--engines/titanic/messages/messages.h2
-rw-r--r--engines/titanic/pet_control/pet_control.cpp8
-rw-r--r--engines/titanic/pet_control/pet_control.h6
-rw-r--r--engines/titanic/pet_control/pet_conversations.h20
29 files changed, 651 insertions, 86 deletions
diff --git a/engines/titanic/carry/bridge_piece.cpp b/engines/titanic/carry/bridge_piece.cpp
index fc845feff0..6a22df3243 100644
--- a/engines/titanic/carry/bridge_piece.cpp
+++ b/engines/titanic/carry/bridge_piece.cpp
@@ -55,14 +55,14 @@ bool CBridgePiece::UseWithOtherMsg(CUseWithOtherMsg *msg) {
CShipSetting *shipSetting = static_cast<CShipSetting *>(msg->_other);
if (!shipSetting) {
return CCarry::UseWithOtherMsg(msg);
- } else if (shipSetting->_string4 == "NULL") {
+ } else if (shipSetting->_itemName != "NULL") {
petAddToInventory();
return true;
} else {
setVisible(false);
playSound("z#54.wav", 100, 0, 0);
setPosition(shipSetting->_pos1);
- shipSetting->_string4 = getName();
+ shipSetting->_itemName = getName();
petMoveToHiddenRoom();
CAddHeadPieceMsg headpieceMsg(shipSetting->getName() == _string6 ?
diff --git a/engines/titanic/carry/speech_centre.cpp b/engines/titanic/carry/speech_centre.cpp
index b8076aee76..29ced484a5 100644
--- a/engines/titanic/carry/speech_centre.cpp
+++ b/engines/titanic/carry/speech_centre.cpp
@@ -24,10 +24,17 @@
namespace Titanic {
+BEGIN_MESSAGE_MAP(CSpeechCentre, CBrain)
+ ON_MESSAGE(PuzzleSolvedMsg)
+ ON_MESSAGE(ChangeSeasonMsg)
+ ON_MESSAGE(SpeechFallsFromTreeMsg)
+ ON_MESSAGE(FrameMsg)
+END_MESSAGE_MAP()
+
void CSpeechCentre::save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
file->writeNumberLine(_field13C, indent);
- file->writeQuotedLine(_string1, indent);
+ file->writeQuotedLine(_season, indent);
file->writeNumberLine(_field14C, indent);
CBrain::save(file, indent);
@@ -36,10 +43,41 @@ void CSpeechCentre::save(SimpleFile *file, int indent) {
void CSpeechCentre::load(SimpleFile *file) {
file->readNumber();
_field13C = file->readNumber();
- _string1 = file->readString();
+ _season = file->readString();
_field14C = file->readNumber();
CBrain::load(file);
}
+bool CSpeechCentre::PuzzleSolvedMsg(CPuzzleSolvedMsg *msg) {
+ if (_field13C == 1 && _season == "Autumn")
+ _fieldE0 = true;
+ return true;
+}
+
+bool CSpeechCentre::ChangeSeasonMsg(CChangeSeasonMsg *msg) {
+ _season = msg->_season;
+ return true;
+}
+
+bool CSpeechCentre::SpeechFallsFromTreeMsg(CSpeechFallsFromTreeMsg *msg) {
+ setVisible(true);
+ dragMove(msg->_pos);
+ _field14C = true;
+ return true;
+}
+
+bool CSpeechCentre::FrameMsg(CFrameMsg *msg) {
+ if (_field14C) {
+ if (_bounds.top > 200)
+ _field14C = false;
+
+ makeDirty();
+ _bounds.top += 3;
+ makeDirty();
+ }
+
+ return true;
+}
+
} // End of namespace Titanic
diff --git a/engines/titanic/carry/speech_centre.h b/engines/titanic/carry/speech_centre.h
index 50f47e9c8a..806e22247b 100644
--- a/engines/titanic/carry/speech_centre.h
+++ b/engines/titanic/carry/speech_centre.h
@@ -28,13 +28,18 @@
namespace Titanic {
class CSpeechCentre : public CBrain {
+ DECLARE_MESSAGE_MAP;
+ bool PuzzleSolvedMsg(CPuzzleSolvedMsg *msg);
+ bool ChangeSeasonMsg(CChangeSeasonMsg *msg);
+ bool SpeechFallsFromTreeMsg(CSpeechFallsFromTreeMsg *msg);
+ bool FrameMsg(CFrameMsg *msg);
private:
int _field13C;
- CString _string1;
+ CString _season;
int _field14C;
public:
CLASSDEF;
- CSpeechCentre() : CBrain(), _string1("Summer"),
+ CSpeechCentre() : CBrain(), _season("Summer"),
_field13C(1), _field14C(0) {}
/**
diff --git a/engines/titanic/game/ship_setting.cpp b/engines/titanic/game/ship_setting.cpp
index 462f396501..93800e899b 100644
--- a/engines/titanic/game/ship_setting.cpp
+++ b/engines/titanic/game/ship_setting.cpp
@@ -21,35 +21,109 @@
*/
#include "titanic/game/ship_setting.h"
+#include "titanic/core/project_item.h"
namespace Titanic {
+BEGIN_MESSAGE_MAP(CShipSetting, CBackground)
+ ON_MESSAGE(AddHeadPieceMsg)
+ ON_MESSAGE(SetFrameMsg)
+ ON_MESSAGE(EnterRoomMsg)
+ ON_MESSAGE(MouseDragStartMsg)
+END_MESSAGE_MAP()
+
CShipSetting::CShipSetting() : CBackground(),
- _string4("NULL"), _string5("NULL") {
+ _itemName("NULL"), _frameTarget("NULL") {
}
void CShipSetting::save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
- file->writeQuotedLine(_string3, indent);
+ file->writeQuotedLine(_target, indent);
file->writePoint(_pos1, indent);
- file->writeQuotedLine(_string4, indent);
- file->writeQuotedLine(_string5, indent);
+ file->writeQuotedLine(_itemName, indent);
+ file->writeQuotedLine(_frameTarget, indent);
CBackground::save(file, indent);
}
void CShipSetting::load(SimpleFile *file) {
file->readNumber();
- _string3 = file->readString();
+ _target = file->readString();
_pos1 = file->readPoint();
- _string4 = file->readString();
- _string5 = file->readString();
+ _itemName = file->readString();
+ _frameTarget = file->readString();
CBackground::load(file);
}
+bool CShipSetting::AddHeadPieceMsg(CAddHeadPieceMsg *msg) {
+ _cursorId = CURSOR_HAND;
+
+ if (msg->_value == "Enable") {
+ CTurnOn onMsg;
+ onMsg.execute(_target);
+
+ if (isEquals("ChickenSetting")) {
+ CActMsg actMsg("DecreaseQuantity");
+ actMsg.execute("ChickenDispenser");
+ }
+ } else {
+ CTurnOff offMsg;
+ offMsg.execute(_target);
+ }
+
+ return true;
+}
+
+bool CShipSetting::SetFrameMsg(CSetFrameMsg *msg) {
+ msg->execute(_frameTarget);
+ return true;
+}
+
bool CShipSetting::EnterRoomMsg(CEnterRoomMsg *msg) {
- warning("CShipSetting::handleEvent");
+ CSetFrameMsg frameMsg;
+
+ if (_itemName == "ChickenBridge")
+ frameMsg._frameNumber = 1;
+ else if (_itemName == "FanBridge")
+ frameMsg._frameNumber = 2;
+ else if (_itemName == "SeasonBridge")
+ frameMsg._frameNumber = 3;
+ else if (_itemName == "BeamBridge")
+ frameMsg._frameNumber = 4;
+
+ frameMsg.execute(this);
+ return true;
+}
+
+bool CShipSetting::MouseDragStartMsg(CMouseDragStartMsg *msg) {
+ if (!checkStartDragging(msg))
+ return false;
+ if (_itemName == "NULL")
+ return true;
+
+ CTurnOff offMsg;
+ offMsg.execute(_target);
+
+ if (isEquals("ChickenSetting") || _itemName == "ChickenBridge") {
+ CActMsg actMsg("IncreaseQuantity");
+ actMsg.execute("ChickenDispenser");
+ }
+
+ if (_itemName != "NULL") {
+ CPassOnDragStartMsg passMsg(msg->_mousePos, 1);
+ passMsg.execute(_itemName);
+
+ msg->_dragItem = getRoot()->findByName(_itemName);
+
+ CVisibleMsg visibleMsg(true);
+ visibleMsg.execute(_itemName);
+ }
+
+ CSetFrameMsg frameMsg(0);
+ frameMsg.execute(_frameTarget);
+ _itemName = "NULL";
+ _cursorId = CURSOR_ARROW;
return true;
}
diff --git a/engines/titanic/game/ship_setting.h b/engines/titanic/game/ship_setting.h
index 4fcc10a424..198d97d250 100644
--- a/engines/titanic/game/ship_setting.h
+++ b/engines/titanic/game/ship_setting.h
@@ -29,12 +29,16 @@
namespace Titanic {
class CShipSetting : public CBackground {
+ DECLARE_MESSAGE_MAP;
+ bool AddHeadPieceMsg(CAddHeadPieceMsg *msg);
+ bool SetFrameMsg(CSetFrameMsg *msg);
bool EnterRoomMsg(CEnterRoomMsg *msg);
+ bool MouseDragStartMsg(CMouseDragStartMsg *msg);
public:
- CString _string3;
+ CString _target;
Point _pos1;
- CString _string4;
- CString _string5;
+ CString _itemName;
+ CString _frameTarget;
public:
CLASSDEF;
CShipSetting();
diff --git a/engines/titanic/game/ship_setting_button.cpp b/engines/titanic/game/ship_setting_button.cpp
index 7dc2cabac0..d485e06668 100644
--- a/engines/titanic/game/ship_setting_button.cpp
+++ b/engines/titanic/game/ship_setting_button.cpp
@@ -24,25 +24,69 @@
namespace Titanic {
-CShipSettingButton::CShipSettingButton() : CGameObject(), _fieldC8(0), _fieldCC(0) {
+BEGIN_MESSAGE_MAP(CShipSettingButton, CGameObject)
+ ON_MESSAGE(TurnOn)
+ ON_MESSAGE(TurnOff)
+ ON_MESSAGE(MouseButtonDownMsg)
+ ON_MESSAGE(EnterViewMsg)
+END_MESSAGE_MAP()
+
+CShipSettingButton::CShipSettingButton() : CGameObject(), _pressed(false), _enabled(false) {
}
void CShipSettingButton::save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
- file->writeQuotedLine(_string1, indent);
- file->writeNumberLine(_fieldC8, indent);
- file->writeNumberLine(_fieldCC, indent);
+ file->writeQuotedLine(_target, indent);
+ file->writeNumberLine(_pressed, indent);
+ file->writeNumberLine(_enabled, indent);
CGameObject::save(file, indent);
}
void CShipSettingButton::load(SimpleFile *file) {
file->readNumber();
- _string1 = file->readString();
- _fieldC8 = file->readNumber();
- _fieldCC = file->readNumber();
+ _target = file->readString();
+ _pressed = file->readNumber();
+ _enabled = file->readNumber();
CGameObject::load(file);
}
+bool CShipSettingButton::TurnOn(CTurnOn *msg) {
+ _pressed = true;
+ return true;
+}
+
+bool CShipSettingButton::TurnOff(CTurnOff *msg) {
+ _pressed = false;
+ return true;
+}
+
+bool CShipSettingButton::MouseButtonDownMsg(CMouseButtonDownMsg *msg) {
+ if (_pressed) {
+ if (_enabled)
+ playMovie(8, 16, 0);
+ else
+ playMovie(0, 8, 0);
+
+ _enabled = !_enabled;
+ CActMsg actMsg(_enabled ? "EnableObject" : "DisableObject");
+ actMsg.execute(_target);
+ } else {
+ if (_enabled) {
+ playMovie(8, 16, 0);
+ playMovie(0, 8, 0);
+ } else {
+ playMovie(0, 16, 0);
+ }
+ }
+
+ return true;
+}
+
+bool CShipSettingButton::EnterViewMsg(CEnterViewMsg *msg) {
+ loadFrame(_enabled ? 8 : 16);
+ return true;
+}
+
} // End of namespace Titanic
diff --git a/engines/titanic/game/ship_setting_button.h b/engines/titanic/game/ship_setting_button.h
index e152e8e2c3..e5457fa532 100644
--- a/engines/titanic/game/ship_setting_button.h
+++ b/engines/titanic/game/ship_setting_button.h
@@ -28,10 +28,15 @@
namespace Titanic {
class CShipSettingButton : public CGameObject {
+ DECLARE_MESSAGE_MAP;
+ bool TurnOn(CTurnOn *msg);
+ bool TurnOff(CTurnOff *msg);
+ bool MouseButtonDownMsg(CMouseButtonDownMsg *msg);
+ bool EnterViewMsg(CEnterViewMsg *msg);
private:
- CString _string1;
- int _fieldC8;
- int _fieldCC;
+ CString _target;
+ bool _pressed;
+ bool _enabled;
public:
CLASSDEF;
CShipSettingButton();
diff --git a/engines/titanic/game/show_cell_points.cpp b/engines/titanic/game/show_cell_points.cpp
index 7d54401a02..985cb93734 100644
--- a/engines/titanic/game/show_cell_points.cpp
+++ b/engines/titanic/game/show_cell_points.cpp
@@ -21,21 +21,50 @@
*/
#include "titanic/game/show_cell_points.h"
+#include "titanic/pet_control/pet_control.h"
namespace Titanic {
+BEGIN_MESSAGE_MAP(CShowCellpoints, CGameObject)
+ ON_MESSAGE(EnterViewMsg)
+ ON_MESSAGE(LeaveViewMsg)
+END_MESSAGE_MAP()
+
void CShowCellpoints::save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
- file->writeQuotedLine(_strValue, indent);
- file->writeNumberLine(_numValue, indent);
+ file->writeQuotedLine(_npcName, indent);
+ file->writeNumberLine(_flag, indent);
CGameObject::save(file, indent);
}
void CShowCellpoints::load(SimpleFile *file) {
file->readNumber();
- _strValue = file->readString();
- _numValue = file->readNumber();
+ _npcName = file->readString();
+ _flag = file->readNumber();
CGameObject::load(file);
}
+bool CShowCellpoints::EnterViewMsg(CEnterViewMsg *msg) {
+ CPetControl *pet = getPetControl();
+ if (pet) {
+ petSetArea(PET_CONVERSATION);
+ pet->setActiveNPC(_npcName);
+ pet->incAreaLocks();
+ _flag = true;
+ }
+
+ return true;
+}
+
+bool CShowCellpoints::LeaveViewMsg(CLeaveViewMsg *msg) {
+ CPetControl *pet = getPetControl();
+ if (pet && _flag) {
+ pet->resetDials0();
+ pet->decAreaLocks();
+ _flag = false;
+ }
+
+ return true;
+}
+
} // End of namespace Titanic
diff --git a/engines/titanic/game/show_cell_points.h b/engines/titanic/game/show_cell_points.h
index 9de2e06dca..205547d7c2 100644
--- a/engines/titanic/game/show_cell_points.h
+++ b/engines/titanic/game/show_cell_points.h
@@ -28,12 +28,15 @@
namespace Titanic {
class CShowCellpoints : public CGameObject {
+ DECLARE_MESSAGE_MAP;
+ bool EnterViewMsg(CEnterViewMsg *msg);
+ bool LeaveViewMsg(CLeaveViewMsg *msg);
public:
- CString _strValue;
- int _numValue;
+ CString _npcName;
+ bool _flag;
public:
CLASSDEF;
- CShowCellpoints() : CGameObject(), _numValue(0) {}
+ CShowCellpoints() : CGameObject(), _flag(false) {}
/**
* Save the data for the class to file
diff --git a/engines/titanic/game/speech_dispensor.cpp b/engines/titanic/game/speech_dispensor.cpp
index f9cc019672..029e4219f1 100644
--- a/engines/titanic/game/speech_dispensor.cpp
+++ b/engines/titanic/game/speech_dispensor.cpp
@@ -24,15 +24,26 @@
namespace Titanic {
+BEGIN_MESSAGE_MAP(CSpeechDispensor, CBackground)
+ ON_MESSAGE(FrameMsg)
+ ON_MESSAGE(MouseButtonUpMsg)
+ ON_MESSAGE(StatusChangeMsg)
+ ON_MESSAGE(ChangeSeasonMsg)
+END_MESSAGE_MAP()
+
+CSpeechDispensor::CSpeechDispensor() : CBackground(), _dragItem(nullptr),
+ _fieldE0(0), _state(0), _fieldEC(0), _fieldF8(0), _seasonNum(SEASON_SUMMER) {
+}
+
void CSpeechDispensor::save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
file->writeNumberLine(_fieldE0, indent);
- file->writeNumberLine(_fieldE4, indent);
+ file->writeNumberLine(_state, indent);
file->writeNumberLine(_fieldEC, indent);
- file->writeNumberLine(_fieldF0, indent);
- file->writeNumberLine(_fieldF4, indent);
+ file->writeNumberLine(_itemPos.x, indent);
+ file->writeNumberLine(_itemPos.y, indent);
file->writeNumberLine(_fieldF8, indent);
- file->writeNumberLine(_fieldFC, indent);
+ file->writeNumberLine(_seasonNum, indent);
CBackground::save(file, indent);
}
@@ -40,14 +51,92 @@ void CSpeechDispensor::save(SimpleFile *file, int indent) {
void CSpeechDispensor::load(SimpleFile *file) {
file->readNumber();
_fieldE0 = file->readNumber();
- _fieldE4 = file->readNumber();
+ _state = file->readNumber();
_fieldEC = file->readNumber();
- _fieldF0 = file->readNumber();
- _fieldF4 = file->readNumber();
+ _itemPos.x = file->readNumber();
+ _itemPos.y = file->readNumber();
_fieldF8 = file->readNumber();
- _fieldFC = file->readNumber();
+ _seasonNum = (Season)file->readNumber();
CBackground::load(file);
}
+bool CSpeechDispensor::FrameMsg(CFrameMsg *msg) {
+ if (_fieldEC || _seasonNum == 0 || _seasonNum == 3)
+ return true;
+
+ CGameObject *dragObject = getDraggingObject();
+ if (!_dragItem && dragObject && getView() == findView()) {
+ if (dragObject->isEquals("Perch")) {
+ petDisplayMessage(1, "This stick is too short to reach the branches.");
+ return true;
+ }
+
+ if (dragObject->isEquals("LongStick"))
+ _dragItem = dragObject;
+ }
+
+ if (_dragItem) {
+ Point pt(_itemPos.x + _dragItem->_bounds.left,
+ _itemPos.y + _dragItem->_bounds.top);
+ bool flag = checkPoint(pt, true);
+
+ switch (_state) {
+ case 0:
+ playSound("z#93.wav");
+ if (_seasonNum == SEASON_WINTER) {
+ petDisplayMessage(1, "You cannot get this, it is frozen to the branch.");
+ _fieldE0 = false;
+ _state = 1;
+ } else {
+ if (++_fieldE0 >= 5) {
+ CActMsg actMsg("PlayerGetsSpeechCentre");
+ actMsg.execute("SeasonalAdjust");
+ CSpeechFallsFromTreeMsg fallMsg(pt);
+ fallMsg.execute("SpeechCentre");
+
+ _fieldEC = true;
+ _fieldE0 = false;
+ }
+
+ _state = 1;
+ }
+ break;
+
+ case 2:
+ _state = 0;
+ ++_fieldE0;
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ return true;
+}
+
+bool CSpeechDispensor::MouseButtonUpMsg(CMouseButtonUpMsg *msg) {
+ if (!_fieldEC) {
+ playSound("z#93.wav");
+ if (_fieldF8) {
+ petDisplayMessage(1, "Sadly, this is out of your reach.");
+ } else {
+ petDisplayMessage(1, "You can't pick this up on account of it being stuck to the branch.");
+ }
+ }
+
+ return true;
+}
+
+bool CSpeechDispensor::StatusChangeMsg(CStatusChangeMsg *msg) {
+ _fieldF8 = msg->_newStatus == 1;
+ return true;
+}
+
+bool CSpeechDispensor::ChangeSeasonMsg(CChangeSeasonMsg *msg) {
+ _seasonNum = (Season)(((int)_seasonNum + 1) % 4);
+ return true;
+}
+
} // End of namespace Titanic
diff --git a/engines/titanic/game/speech_dispensor.h b/engines/titanic/game/speech_dispensor.h
index 3b877e8d99..038cc024cc 100644
--- a/engines/titanic/game/speech_dispensor.h
+++ b/engines/titanic/game/speech_dispensor.h
@@ -28,17 +28,22 @@
namespace Titanic {
class CSpeechDispensor : public CBackground {
+ DECLARE_MESSAGE_MAP;
+ bool FrameMsg(CFrameMsg *msg);
+ bool MouseButtonUpMsg(CMouseButtonUpMsg *msg);
+ bool StatusChangeMsg(CStatusChangeMsg *msg);
+ bool ChangeSeasonMsg(CChangeSeasonMsg *msg);
private:
int _fieldE0;
- int _fieldE4;
- int _fieldE8;
+ int _state;
+ CGameObject *_dragItem;
int _fieldEC;
- int _fieldF0;
- int _fieldF4;
+ Point _itemPos;
int _fieldF8;
- int _fieldFC;
+ Season _seasonNum;
public:
CLASSDEF;
+ CSpeechDispensor();
/**
* Save the data for the class to file
diff --git a/engines/titanic/game/starling_puret.cpp b/engines/titanic/game/starling_puret.cpp
index 359ad774df..2f1909d963 100644
--- a/engines/titanic/game/starling_puret.cpp
+++ b/engines/titanic/game/starling_puret.cpp
@@ -24,16 +24,56 @@
namespace Titanic {
+BEGIN_MESSAGE_MAP(CStarlingPuret, CGameObject)
+ ON_MESSAGE(StatusChangeMsg)
+ ON_MESSAGE(EnterViewMsg)
+ ON_MESSAGE(MovieEndMsg)
+END_MESSAGE_MAP()
+
void CStarlingPuret::save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
- file->writeNumberLine(_value, indent);
+ file->writeNumberLine(_flag, indent);
CGameObject::save(file, indent);
}
void CStarlingPuret::load(SimpleFile *file) {
file->readNumber();
- _value = file->readNumber();
+ _flag = file->readNumber();
CGameObject::load(file);
}
+bool CStarlingPuret::StatusChangeMsg(CStatusChangeMsg *msg) {
+ _flag = msg->_newStatus == 1;
+ if (_flag) {
+ CStatusChangeMsg changeMsg;
+ changeMsg._newStatus = 1;
+ changeMsg.execute("StarlingLoop01");
+ }
+
+ return true;
+}
+
+bool CStarlingPuret::EnterViewMsg(CEnterViewMsg *msg) {
+ if (_flag) {
+ CStatusChangeMsg changeMsg;
+ changeMsg._newStatus = 1;
+ changeMsg.execute("PromDeckStarlings");
+
+ playMovie(MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE);
+ CSignalObject signalMsg;
+ signalMsg._numValue = 4;
+ signalMsg.execute("PromDeckStarlings");
+ _flag = false;
+ }
+
+ return true;
+}
+
+bool CStarlingPuret::MovieEndMsg(CMovieEndMsg *msg) {
+ CActMsg actMsg("StarlingsDead");
+ actMsg.execute("FanController");
+ actMsg.execute("BirdSauceDisp");
+ return true;
+}
+
} // End of namespace Titanic
diff --git a/engines/titanic/game/starling_puret.h b/engines/titanic/game/starling_puret.h
index fcd3319958..62a6173093 100644
--- a/engines/titanic/game/starling_puret.h
+++ b/engines/titanic/game/starling_puret.h
@@ -28,11 +28,15 @@
namespace Titanic {
class CStarlingPuret : public CGameObject {
+ DECLARE_MESSAGE_MAP;
+ bool StatusChangeMsg(CStatusChangeMsg *msg);
+ bool EnterViewMsg(CEnterViewMsg *msg);
+ bool MovieEndMsg(CMovieEndMsg *msg);
private:
- int _value;
+ bool _flag;
public:
CLASSDEF;
- CStarlingPuret() : CGameObject(), _value(0) {}
+ CStarlingPuret() : CGameObject(), _flag(false) {}
/**
* Save the data for the class to file
diff --git a/engines/titanic/game/stop_phonograph_button.cpp b/engines/titanic/game/stop_phonograph_button.cpp
index d18f4713ac..75e0ca9337 100644
--- a/engines/titanic/game/stop_phonograph_button.cpp
+++ b/engines/titanic/game/stop_phonograph_button.cpp
@@ -24,6 +24,10 @@
namespace Titanic {
+BEGIN_MESSAGE_MAP(CStopPhonographButton, CBackground)
+ ON_MESSAGE(MouseButtonDownMsg)
+END_MESSAGE_MAP()
+
void CStopPhonographButton::save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
CBackground::save(file, indent);
@@ -34,4 +38,19 @@ void CStopPhonographButton::load(SimpleFile *file) {
CBackground::load(file);
}
+bool CStopPhonographButton::MouseButtonDownMsg(CMouseButtonDownMsg *msg) {
+ CQueryPhonographState queryMsg;
+ queryMsg.execute(getParent());
+
+ if (!queryMsg._value) {
+ playMovie(0, 1, 0);
+ playMovie(1, 0, 0);
+
+ CPhonographStopMsg stopMsg;
+ stopMsg.execute(getParent());
+ }
+
+ return true;
+}
+
} // End of namespace Titanic
diff --git a/engines/titanic/game/stop_phonograph_button.h b/engines/titanic/game/stop_phonograph_button.h
index b469375e20..d416c4f8fe 100644
--- a/engines/titanic/game/stop_phonograph_button.h
+++ b/engines/titanic/game/stop_phonograph_button.h
@@ -28,6 +28,8 @@
namespace Titanic {
class CStopPhonographButton : public CBackground {
+ DECLARE_MESSAGE_MAP;
+ bool MouseButtonDownMsg(CMouseButtonDownMsg *msg);
public:
CLASSDEF;
diff --git a/engines/titanic/game/sub_glass.cpp b/engines/titanic/game/sub_glass.cpp
index f1349f06ea..041f49097d 100644
--- a/engines/titanic/game/sub_glass.cpp
+++ b/engines/titanic/game/sub_glass.cpp
@@ -24,17 +24,25 @@
namespace Titanic {
-CSUBGlass::CSUBGlass() : _fieldBC(0), _fieldC0(0), _fieldC4(1), _fieldC8(0) {
+BEGIN_MESSAGE_MAP(CSUBGlass, CGameObject)
+ ON_MESSAGE(MouseButtonDownMsg)
+ ON_MESSAGE(MouseButtonUpMsg)
+ ON_MESSAGE(MovieEndMsg)
+ ON_MESSAGE(SignalObject)
+ ON_MESSAGE(LeaveViewMsg)
+END_MESSAGE_MAP()
+
+CSUBGlass::CSUBGlass() : _fieldBC(0), _startFrame(0), _endFrame(1), _signalStartFrame(0) {
}
void CSUBGlass::save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
file->writeNumberLine(_fieldBC, indent);
- file->writeNumberLine(_fieldC0, indent);
- file->writeNumberLine(_fieldC4, indent);
- file->writeNumberLine(_fieldC8, indent);
- file->writeNumberLine(_fieldCC, indent);
- file->writeQuotedLine(_string, indent);
+ file->writeNumberLine(_startFrame, indent);
+ file->writeNumberLine(_endFrame, indent);
+ file->writeNumberLine(_signalStartFrame, indent);
+ file->writeNumberLine(_signalEndFrame, indent);
+ file->writeQuotedLine(_target, indent);
CGameObject::save(file, indent);
}
@@ -42,13 +50,58 @@ void CSUBGlass::save(SimpleFile *file, int indent) {
void CSUBGlass::load(SimpleFile *file) {
file->readNumber();
_fieldBC = file->readNumber();
- _fieldC0 = file->readNumber();
- _fieldC4 = file->readNumber();
- _fieldC8 = file->readNumber();
- _fieldCC = file->readNumber();
- _string = file->readString();
+ _startFrame = file->readNumber();
+ _endFrame = file->readNumber();
+ _signalStartFrame = file->readNumber();
+ _signalEndFrame = file->readNumber();
+ _target = file->readString();
CGameObject::load(file);
}
+bool CSUBGlass::MouseButtonDownMsg(CMouseButtonDownMsg *msg) {
+ return true;
+}
+
+bool CSUBGlass::MouseButtonUpMsg(CMouseButtonUpMsg *msg) {
+ if (!_fieldBC && _startFrame >= 0) {
+ _fieldBC = true;
+ playMovie(_startFrame, _endFrame, MOVIE_NOTIFY_OBJECT);
+ playSound("z#30.wav");
+ }
+
+ return true;
+}
+
+bool CSUBGlass::MovieEndMsg(CMovieEndMsg *msg) {
+ if (msg->_endFrame == _endFrame) {
+ _fieldBC = true;
+ CSignalObject signalMsg(getName(), 1);
+ signalMsg.execute(_target);
+ }
+
+ return true;
+}
+
+bool CSUBGlass::SignalObject(CSignalObject *msg) {
+ if (msg->_numValue == 1) {
+ setVisible(true);
+
+ if (_signalStartFrame >= 0) {
+ playMovie(_signalStartFrame, _signalEndFrame, MOVIE_GAMESTATE);
+ playSound("z#30.wav");
+ _fieldBC = false;
+ }
+ }
+
+ return true;
+}
+
+bool CSUBGlass::LeaveViewMsg(CLeaveViewMsg *msg) {
+ _fieldBC = false;
+ setVisible(true);
+ loadFrame(0);
+ return true;
+}
+
} // End of namespace Titanic
diff --git a/engines/titanic/game/sub_glass.h b/engines/titanic/game/sub_glass.h
index aab5c8400e..22d16ff4d5 100644
--- a/engines/titanic/game/sub_glass.h
+++ b/engines/titanic/game/sub_glass.h
@@ -28,13 +28,19 @@
namespace Titanic {
class CSUBGlass : public CGameObject {
+ DECLARE_MESSAGE_MAP;
+ bool MouseButtonDownMsg(CMouseButtonDownMsg *msg);
+ bool MouseButtonUpMsg(CMouseButtonUpMsg *msg);
+ bool MovieEndMsg(CMovieEndMsg *msg);
+ bool SignalObject(CSignalObject *msg);
+ bool LeaveViewMsg(CLeaveViewMsg *msg);
private:
int _fieldBC;
- int _fieldC0;
- int _fieldC4;
- int _fieldC8;
- int _fieldCC;
- CString _string;
+ int _startFrame;
+ int _endFrame;
+ int _signalStartFrame;
+ int _signalEndFrame;
+ CString _target;
public:
CLASSDEF;
CSUBGlass();
diff --git a/engines/titanic/game/sub_wrapper.cpp b/engines/titanic/game/sub_wrapper.cpp
index dcc489316b..4080487d6d 100644
--- a/engines/titanic/game/sub_wrapper.cpp
+++ b/engines/titanic/game/sub_wrapper.cpp
@@ -24,16 +24,56 @@
namespace Titanic {
+BEGIN_MESSAGE_MAP(CSUBWrapper, CGameObject)
+ ON_MESSAGE(MovieEndMsg)
+ ON_MESSAGE(SignalObject)
+END_MESSAGE_MAP()
+
void CSUBWrapper::save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
- file->writeNumberLine(_value, indent);
+ file->writeNumberLine(_flag, indent);
CGameObject::save(file, indent);
}
void CSUBWrapper::load(SimpleFile *file) {
file->readNumber();
- _value = file->readNumber();
+ _flag = file->readNumber();
CGameObject::load(file);
}
+bool CSUBWrapper::MovieEndMsg(CMovieEndMsg *msg) {
+ if (_flag) {
+ stopMovie();
+ setVisible(false);
+ _flag = false;
+ }
+
+ return true;
+}
+
+bool CSUBWrapper::SignalObject(CSignalObject *msg) {
+ switch (msg->_numValue) {
+ case 1:
+ if (!_flag) {
+ loadFrame(0);
+ setVisible(true);
+ playMovie(MOVIE_NOTIFY_OBJECT);
+ _flag = true;
+ }
+ break;
+
+ case 2:
+ if (!_flag) {
+ setVisible(true);
+ _flag = true;
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ return true;
+}
+
} // End of namespace Titanic
diff --git a/engines/titanic/game/sub_wrapper.h b/engines/titanic/game/sub_wrapper.h
index 81f8fdc941..1094a2e677 100644
--- a/engines/titanic/game/sub_wrapper.h
+++ b/engines/titanic/game/sub_wrapper.h
@@ -28,11 +28,14 @@
namespace Titanic {
class CSUBWrapper : public CGameObject {
+ DECLARE_MESSAGE_MAP;
+ bool MovieEndMsg(CMovieEndMsg *msg);
+ bool SignalObject(CSignalObject *msg);
public:
- int _value;
+ bool _flag;
public:
CLASSDEF;
- CSUBWrapper() : CGameObject(), _value(0) {}
+ CSUBWrapper() : CGameObject(), _flag(false) {}
/**
* Save the data for the class to file
diff --git a/engines/titanic/game/sweet_bowl.cpp b/engines/titanic/game/sweet_bowl.cpp
index e14f900e77..d0a2525bc4 100644
--- a/engines/titanic/game/sweet_bowl.cpp
+++ b/engines/titanic/game/sweet_bowl.cpp
@@ -24,6 +24,12 @@
namespace Titanic {
+BEGIN_MESSAGE_MAP(CSweetBowl, CGameObject)
+ ON_MESSAGE(MovieEndMsg)
+ ON_MESSAGE(EnterViewMsg)
+ ON_MESSAGE(ActMsg)
+END_MESSAGE_MAP()
+
void CSweetBowl::save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
CGameObject::save(file, indent);
@@ -34,4 +40,28 @@ void CSweetBowl::load(SimpleFile *file) {
CGameObject::load(file);
}
+bool CSweetBowl::MovieEndMsg(CMovieEndMsg *msg) {
+ setVisible(false);
+ return true;
+}
+
+bool CSweetBowl::EnterViewMsg(CEnterViewMsg *msg) {
+ setVisible(false);
+ loadSound("b#43.wav");
+ playSound("b#42.wav");
+ return true;
+}
+
+bool CSweetBowl::ActMsg(CActMsg *msg) {
+ if (msg->_action == "Jiggle") {
+ setVisible(true);
+ playMovie(MOVIE_GAMESTATE | MOVIE_NOTIFY_OBJECT);
+ playSound(getRandomNumber(1) == 1 ? "b#42.wav" : "b#43.wav");
+ }
+
+ petDisplayMessage(isEquals("BowlNutsRustler") ?
+ "A bowl of pistachio nuts." : "Not a bowl of pistachio nuts.");
+ return true;
+}
+
} // End of namespace Titanic
diff --git a/engines/titanic/game/sweet_bowl.h b/engines/titanic/game/sweet_bowl.h
index cf3d0023a4..53433c8c08 100644
--- a/engines/titanic/game/sweet_bowl.h
+++ b/engines/titanic/game/sweet_bowl.h
@@ -28,6 +28,10 @@
namespace Titanic {
class CSweetBowl : public CGameObject {
+ DECLARE_MESSAGE_MAP;
+ bool MovieEndMsg(CMovieEndMsg *msg);
+ bool EnterViewMsg(CEnterViewMsg *msg);
+ bool ActMsg(CActMsg *msg);
public:
CLASSDEF;
diff --git a/engines/titanic/gfx/slider_button.cpp b/engines/titanic/gfx/slider_button.cpp
index 0633158e97..b3dbbed08f 100644
--- a/engines/titanic/gfx/slider_button.cpp
+++ b/engines/titanic/gfx/slider_button.cpp
@@ -24,6 +24,14 @@
namespace Titanic {
+BEGIN_MESSAGE_MAP(CSliderButton, CSTButton)
+ ON_MESSAGE(MouseButtonUpMsg)
+ ON_MESSAGE(MouseButtonDownMsg)
+ ON_MESSAGE(MouseDragMoveMsg)
+ ON_MESSAGE(StatusChangeMsg)
+ ON_MESSAGE(EnterViewMsg)
+END_MESSAGE_MAP()
+
CSliderButton::CSliderButton() : CSTButton(), _field114(0),
_field118(0), _field11C(0) {
}
@@ -48,4 +56,39 @@ void CSliderButton::load(SimpleFile *file) {
CSTButton::load(file);
}
+bool CSliderButton::MouseButtonUpMsg(CMouseButtonUpMsg *msg) {
+ _pos1 = msg->_mousePos;
+ CStatusChangeMsg changeMsg;
+ changeMsg.execute(this);
+ return true;
+}
+
+bool CSliderButton::MouseButtonDownMsg(CMouseButtonDownMsg *msg) {
+ _pos1 = msg->_mousePos;
+ return true;
+}
+
+bool CSliderButton::MouseDragMoveMsg(CMouseDragMoveMsg *msg) {
+ _pos1 = msg->_mousePos;
+ if (_field118) {
+ CStatusChangeMsg changeMsg;
+ changeMsg.execute(this);
+ }
+
+ return true;
+}
+
+bool CSliderButton::StatusChangeMsg(CStatusChangeMsg *msg) {
+ CStatusChangeMsg changeMsg;
+ changeMsg._oldStatus = _currentStatus;
+ _currentStatus = (_pos1.y - _bounds.top) / _field11C;
+ changeMsg._newStatus = _currentStatus;
+ changeMsg.execute(_actionTarget);
+ return true;
+}
+
+bool CSliderButton::EnterViewMsg(CEnterViewMsg *msg) {
+ return true;
+}
+
} // End of namespace Titanic
diff --git a/engines/titanic/gfx/slider_button.h b/engines/titanic/gfx/slider_button.h
index 398290bb05..18ebbae3db 100644
--- a/engines/titanic/gfx/slider_button.h
+++ b/engines/titanic/gfx/slider_button.h
@@ -28,6 +28,12 @@
namespace Titanic {
class CSliderButton : public CSTButton {
+ DECLARE_MESSAGE_MAP;
+ bool MouseButtonUpMsg(CMouseButtonUpMsg *msg);
+ bool MouseButtonDownMsg(CMouseButtonDownMsg *msg);
+ bool MouseDragMoveMsg(CMouseDragMoveMsg *msg);
+ bool StatusChangeMsg(CStatusChangeMsg *msg);
+ bool EnterViewMsg(CEnterViewMsg *msg);
private:
int _field114;
int _field118;
diff --git a/engines/titanic/gfx/status_change_button.cpp b/engines/titanic/gfx/status_change_button.cpp
index 6644247ff2..e38f1ee07e 100644
--- a/engines/titanic/gfx/status_change_button.cpp
+++ b/engines/titanic/gfx/status_change_button.cpp
@@ -24,6 +24,10 @@
namespace Titanic {
+BEGIN_MESSAGE_MAP(CStatusChangeButton, CSTButton)
+ ON_MESSAGE(MouseButtonDownMsg)
+END_MESSAGE_MAP()
+
CStatusChangeButton::CStatusChangeButton() : CSTButton() {
}
@@ -37,4 +41,11 @@ void CStatusChangeButton::load(SimpleFile *file) {
CSTButton::load(file);
}
+bool CStatusChangeButton::MouseButtonDownMsg(CMouseButtonDownMsg *msg) {
+ CStatusChangeMsg changeMsg;
+ changeMsg._newStatus = _statusInc;
+ changeMsg.execute(_actionTarget);
+ return true;
+}
+
} // End of namespace Titanic
diff --git a/engines/titanic/gfx/status_change_button.h b/engines/titanic/gfx/status_change_button.h
index 9e410c66f2..9d187493a7 100644
--- a/engines/titanic/gfx/status_change_button.h
+++ b/engines/titanic/gfx/status_change_button.h
@@ -28,6 +28,8 @@
namespace Titanic {
class CStatusChangeButton : public CSTButton {
+ DECLARE_MESSAGE_MAP;
+ bool MouseButtonDownMsg(CMouseButtonDownMsg *msg);
public:
CLASSDEF;
CStatusChangeButton();
diff --git a/engines/titanic/messages/messages.h b/engines/titanic/messages/messages.h
index 5ca0c516e4..a65e63ee24 100644
--- a/engines/titanic/messages/messages.h
+++ b/engines/titanic/messages/messages.h
@@ -303,7 +303,7 @@ MESSAGE2(CSetVolumeMsg, int, volume, 70, int, secondsTransition, 0);
MESSAGE2(CShipSettingMsg, int, value, 0, CString, name, "");
MESSAGE1(CShowTextMsg, CString, value, "NO TEXT INCLUDED!!!");
MESSAGE2(CSignalObject, CString, strValue, "", int, numValue, 0);
-MESSAGE2(CSpeechFallsFromTreeMsg, int, value1, 0, int, value2, 0);
+MESSAGE1(CSpeechFallsFromTreeMsg, Point, pos, Point());
MESSAGE1(CStartMusicMsg, CMusicPlayer *, musicPlayer, (CMusicPlayer *)nullptr);
MESSAGE3(CStatusChangeMsg, int, oldStatus, 0, int, newStatus, 0, bool, success, false);
MESSAGE1(CStopMusicMsg, CMusicPlayer *, musicPlayer, (CMusicPlayer *)nullptr);
diff --git a/engines/titanic/pet_control/pet_control.cpp b/engines/titanic/pet_control/pet_control.cpp
index b32a7907a4..d7016da02e 100644
--- a/engines/titanic/pet_control/pet_control.cpp
+++ b/engines/titanic/pet_control/pet_control.cpp
@@ -194,6 +194,10 @@ void CPetControl::setActiveNPC(CTrueTalkNPC *npc) {
}
}
+void CPetControl::setActiveNPC(const CString &name) {
+ _conversations.setActiveNPC(name);
+}
+
void CPetControl::refreshNPC() {
_conversations.setNPC(_activeNPCName);
}
@@ -660,6 +664,10 @@ void CPetControl::convResetDials(int flag) {
_conversations.resetDials(_activeNPCName);
}
+void CPetControl::resetDials0() {
+ _conversations.resetDials0();
+}
+
int CPetControl::getMailDest(const CRoomFlags &roomFlags) const {
if (!roomFlags.isSuccUBusRoomFlags())
return roomFlags.getPassengerClassNum();
diff --git a/engines/titanic/pet_control/pet_control.h b/engines/titanic/pet_control/pet_control.h
index a86d110458..439a94e2d3 100644
--- a/engines/titanic/pet_control/pet_control.h
+++ b/engines/titanic/pet_control/pet_control.h
@@ -358,9 +358,7 @@ public:
/**
* Sets the active NPC
*/
- void setActiveNPC(const CString &name) {
- _conversations.setActiveNPC(name);
- }
+ void setActiveNPC(const CString &name);
/**
* Sets the actie NPC
@@ -387,7 +385,7 @@ public:
/**
* Resets the conversation dials back to 0 position
*/
- void resetDials0() { _conversations.resetDials0(); }
+ void resetDials0();
/**
* Resets the dial display in the conversation tab to reflect new values
diff --git a/engines/titanic/pet_control/pet_conversations.h b/engines/titanic/pet_control/pet_conversations.h
index 9e8b093d62..3333bdc523 100644
--- a/engines/titanic/pet_control/pet_conversations.h
+++ b/engines/titanic/pet_control/pet_conversations.h
@@ -100,16 +100,6 @@ private:
void summonBot(const CString &name);
/**
- * Starts the NPC timer
- */
- void startNPCTimer();
-
- /**
- * Stops the NPC timer
- */
- void stopNPCTimer();
-
- /**
* Get the TrueTalk script associated with a given NPC
*/
TTnpcScript *getNPCScript(const CString &name) const;
@@ -260,6 +250,16 @@ public:
* Adds a line to the log
*/
void addLine(const CString &line);
+
+ /**
+ * Starts the NPC timer
+ */
+ void startNPCTimer();
+
+ /**
+ * Stops the NPC timer
+ */
+ void stopNPCTimer();
};
} // End of namespace Titanic