aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/titanic/core/game_object.cpp2
-rw-r--r--engines/titanic/core/game_object.h2
-rw-r--r--engines/titanic/game/belbot_get_light.cpp39
-rw-r--r--engines/titanic/game/belbot_get_light.h5
-rw-r--r--engines/titanic/game/bilge_succubus.cpp338
-rw-r--r--engines/titanic/game/bilge_succubus.h20
-rw-r--r--engines/titanic/game/placeholder/bar_shelf_vis_centre.cpp32
-rw-r--r--engines/titanic/game/placeholder/bar_shelf_vis_centre.h8
-rw-r--r--engines/titanic/game/sgt/basin.cpp41
-rw-r--r--engines/titanic/game/sgt/basin.h4
-rw-r--r--engines/titanic/game/sgt/bedfoot.cpp92
-rw-r--r--engines/titanic/game/sgt/bedfoot.h3
-rw-r--r--engines/titanic/game/sgt/bedhead.cpp15
-rw-r--r--engines/titanic/game/sgt/bedhead.h3
-rw-r--r--engines/titanic/messages/bilge_dispensor_event.cpp35
-rw-r--r--engines/titanic/messages/bilge_dispensor_event.h5
-rw-r--r--engines/titanic/npcs/succubus.cpp30
-rw-r--r--engines/titanic/npcs/succubus.h10
18 files changed, 644 insertions, 40 deletions
diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp
index 12d4c5603a..ee378dd428 100644
--- a/engines/titanic/core/game_object.cpp
+++ b/engines/titanic/core/game_object.cpp
@@ -1442,7 +1442,7 @@ void CGameObject::resetMail() {
mailMan->resetValue();
}
-int CGameObject::getNewRandomNumber(int max, int *oldVal) {
+int CGameObject::getRandomNumber(int max, int *oldVal) {
if (oldVal) {
int startingVal = *oldVal;
while (*oldVal == startingVal && max > 0)
diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h
index cdb5f6906a..722b6079af 100644
--- a/engines/titanic/core/game_object.h
+++ b/engines/titanic/core/game_object.h
@@ -531,7 +531,7 @@ protected:
/**
* Gets a new random number
*/
- int getNewRandomNumber(int max, int *oldVal = nullptr);
+ int getRandomNumber(int max, int *oldVal = nullptr);
public:
Rect _bounds;
bool _isMail;
diff --git a/engines/titanic/game/belbot_get_light.cpp b/engines/titanic/game/belbot_get_light.cpp
index 3e678a8a0c..2cc4c3ae19 100644
--- a/engines/titanic/game/belbot_get_light.cpp
+++ b/engines/titanic/game/belbot_get_light.cpp
@@ -24,6 +24,13 @@
namespace Titanic {
+BEGIN_MESSAGE_MAP(CBelbotGetLight, CGameObject)
+ ON_MESSAGE(ActMsg)
+ ON_MESSAGE(MovieEndMsg)
+ ON_MESSAGE(MovieFrameMsg)
+ ON_MESSAGE(EnterViewMsg)
+END_MESSAGE_MAP()
+
void CBelbotGetLight::save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
file->writeQuotedLine(_value, indent);
@@ -36,4 +43,36 @@ void CBelbotGetLight::load(SimpleFile *file) {
CGameObject::load(file);
}
+bool CBelbotGetLight::ActMsg(CActMsg *msg) {
+ if (msg->_action == "BellbotGetLight") {
+ _value = getFullViewName();
+ lockMouse();
+ changeView("1stClassState.Node 11.N", "");
+ }
+
+ return true;
+}
+
+bool CBelbotGetLight::MovieEndMsg(CMovieEndMsg *msg) {
+ sleep(1000);
+ changeView(_value, "");
+ unlockMouse();
+ return true;
+}
+
+bool CBelbotGetLight::MovieFrameMsg(CMovieFrameMsg *msg) {
+ if (getMovieFrame() == 37) {
+ CActMsg actMsg("BellbotGetLight");
+ actMsg.execute("Eye1");
+ }
+
+ return true;
+}
+
+bool CBelbotGetLight::EnterViewMsg(CEnterViewMsg *msg) {
+ playMovie(MOVIE_NOTIFY_OBJECT);
+ movieEvent(37);
+ return true;
+}
+
} // End of namespace Titanic
diff --git a/engines/titanic/game/belbot_get_light.h b/engines/titanic/game/belbot_get_light.h
index a3aa0f737e..1707ad4793 100644
--- a/engines/titanic/game/belbot_get_light.h
+++ b/engines/titanic/game/belbot_get_light.h
@@ -28,6 +28,11 @@
namespace Titanic {
class CBelbotGetLight : public CGameObject {
+ DECLARE_MESSAGE_MAP;
+ bool ActMsg(CActMsg *msg);
+ bool MovieEndMsg(CMovieEndMsg *msg);
+ bool MovieFrameMsg(CMovieFrameMsg *msg);
+ bool EnterViewMsg(CEnterViewMsg *msg);
private:
CString _value;
public:
diff --git a/engines/titanic/game/bilge_succubus.cpp b/engines/titanic/game/bilge_succubus.cpp
index ceee3f7740..0c5ada98f5 100644
--- a/engines/titanic/game/bilge_succubus.cpp
+++ b/engines/titanic/game/bilge_succubus.cpp
@@ -21,31 +21,349 @@
*/
#include "titanic/game/bilge_succubus.h"
+#include "titanic/carry/chicken.h"
+#include "titanic/core/view_item.h"
+#include "titanic/pet_control/pet_control.h"
namespace Titanic {
-CBilgeSuccUBus::CBilgeSuccUBus() : CSuccUBus(), _field1DC(0),
- _field1E0(0), _field1E4(0), _field1E8(0) {
+BEGIN_MESSAGE_MAP(CBilgeSuccUBus, CSuccUBus)
+ ON_MESSAGE(FrameMsg)
+ ON_MESSAGE(PETReceiveMsg)
+ ON_MESSAGE(PETDeliverMsg)
+ ON_MESSAGE(MovieEndMsg)
+ ON_MESSAGE(MouseButtonDownMsg)
+ ON_MESSAGE(SubAcceptCCarryMsg)
+ ON_MESSAGE(EnterViewMsg)
+ ON_MESSAGE(LeaveViewMsg)
+ ON_MESSAGE(TrueTalkGetStateValueMsg)
+ ON_MESSAGE(TurnOn)
+ ON_MESSAGE(TurnOff)
+END_MESSAGE_MAP()
+
+CBilgeSuccUBus::CBilgeSuccUBus() : CSuccUBus(),
+ _bilgeStartFrame1(-1), _bilgeEndFrame1(-1),
+ _bilgeStartFrame2(-1), _bilgeEndFrame2(-1) {
}
void CBilgeSuccUBus::save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
- file->writeNumberLine(_field1DC, indent);
- file->writeNumberLine(_field1E0, indent);
- file->writeNumberLine(_field1E4, indent);
- file->writeNumberLine(_field1E8, indent);
+ file->writeNumberLine(_bilgeStartFrame1, indent);
+ file->writeNumberLine(_bilgeEndFrame1, indent);
+ file->writeNumberLine(_bilgeStartFrame2, indent);
+ file->writeNumberLine(_bilgeEndFrame2, indent);
CSuccUBus::save(file, indent);
}
void CBilgeSuccUBus::load(SimpleFile *file) {
file->readNumber();
- _field1DC = file->readNumber();
- _field1E0 = file->readNumber();
- _field1E4 = file->readNumber();
- _field1E8 = file->readNumber();
+ _bilgeStartFrame1 = file->readNumber();
+ _bilgeEndFrame1 = file->readNumber();
+ _bilgeStartFrame2 = file->readNumber();
+ _bilgeEndFrame2 = file->readNumber();
CSuccUBus::load(file);
}
+bool CBilgeSuccUBus::FrameMsg(CFrameMsg *msg) {
+ return true;
+}
+
+bool CBilgeSuccUBus::PETReceiveMsg(CPETReceiveMsg *msg) {
+ CPetControl *pet = getPetControl();
+
+ if (_v2) {
+ if (_startFrame4 >= 0)
+ playMovie(_startFrame4, _endFrame4, MOVIE_GAMESTATE);
+ if (_startFrame5 >= 0)
+ playMovie(_startFrame5, _endFrame5, MOVIE_GAMESTATE);
+
+ playSound("z#28.wav", 70);
+ } else if (!_enabled) {
+ petDisplayMessage(2, "The Succ-U-Bus is in Standby, or \"Off\" mode at present.");
+ return false;
+ } else if (!pet) {
+ return false;
+ } else {
+ uint roomFlags = pet->getRoomFlags();
+ CGameObject *mailObject = findMailByFlags(
+ _v3 && compareRoomNameTo("Titania") ? 3 : _field140,
+ roomFlags);
+
+ if (mailObject) {
+ _mailP = mailObject;
+ if (_startFrame4 >= 0)
+ playMovie(_startFrame4, _endFrame4, MOVIE_GAMESTATE);
+ } else {
+ petDisplayMessage(2, "There is currently nothing to deliver.");
+ }
+ }
+
+ return true;
+}
+
+bool CBilgeSuccUBus::PETDeliverMsg(CPETDeliverMsg *msg) {
+ CPetControl *pet = getPetControl();
+ if (!_enabled || !pet)
+ return true;
+
+ uint petRoomFlags = pet->getRoomFlags();
+ CGameObject *mailObject = findMail(petRoomFlags);
+
+ if (!mailObject) {
+ petDisplayMessage(2, "There is currently nothing in the tray to send.");
+ return true;
+ }
+
+ _field19C = 0;
+ _mailP = mailObject;
+
+ uint roomFlags = _roomFlags;
+ if (!pet->testRooms5(roomFlags) ||
+ getPassengerClass() > pet->getMailDest(roomFlags)) {
+ roomFlags = pet->getSpecialRoomFlags("BilgeRoom");
+ _field19C = 1;
+ }
+
+ _isChicken = mailObject->getName() == "Chicken";
+ _isFeathers = mailObject->getName() == "Feathers";
+ _field158 = 0;
+
+ if (_v2) {
+ if (_isFeathers) {
+ startTalking(this, 230022);
+ _field158 = 1;
+
+ if (_startFrame3 >= 0)
+ playMovie(_startFrame3, _endFrame3, MOVIE_NOTIFY_OBJECT);
+
+ if (_bilgeStartFrame1 >= 0) {
+ playMovie(_startFrame12, _endFrame12, MOVIE_GAMESTATE);
+ playMovie(_bilgeStartFrame2, _bilgeEndFrame2, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE);
+ playMovie(_bilgeStartFrame1, _bilgeEndFrame1, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE);
+ inc54();
+ }
+ } else {
+ startTalking(this, 230012);
+ _field158 = 2;
+ if (_startFrame3 >= 0)
+ playMovie(_startFrame3, _endFrame3, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE);
+ if (_startFrame4 >= 0)
+ playMovie(_startFrame4, _endFrame4, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE);
+ if (_startFrame5 >= 0)
+ playMovie(_startFrame5, _endFrame5, MOVIE_GAMESTATE);
+ }
+ } else {
+ if (_isFeathers) {
+ startTalking(this, 230022);
+ _field158 = 3;
+
+ if (_startFrame3 >= 0)
+ playMovie(_startFrame3, _endFrame3, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE);
+ if (_startFrame4 >= 0)
+ playMovie(_startFrame4, _endFrame4, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE);
+ if (_startFrame5 >= 0)
+ playMovie(_startFrame5, _endFrame5, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE);
+ } else {
+ removeMail(petRoomFlags, roomFlags);
+ startTalking(this, 230012);
+ if (_startFrame3 >= 0) {
+ _field158 = 4;
+ playMovie(_startFrame3, _endFrame3, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE);
+ }
+ }
+ }
+
+ return true;
+}
+
+bool CBilgeSuccUBus::MovieEndMsg(CMovieEndMsg *msg) {
+ // TODO
+ return true;
+}
+
+bool CBilgeSuccUBus::MouseButtonDownMsg(CMouseButtonDownMsg *msg) {
+ if (_enabled) {
+ switch (getRandomNumber(4)) {
+ case 0:
+ case 4: {
+ _enabled = false;
+ CTurnOff offMsg;
+ offMsg.execute(this);
+ break;
+ }
+
+ case 1:
+ startTalking(this, 230055);
+ break;
+
+ case 2:
+ startTalking(this, 230067);
+ break;
+
+ case 3:
+ startTalking(this, 230045);
+ break;
+
+ default:
+ break;
+ }
+ } else {
+ CTurnOn onMsg;
+ onMsg.execute(this);
+ _enabled = true;
+ }
+
+ return true;
+}
+
+bool CBilgeSuccUBus::SubAcceptCCarryMsg(CSubAcceptCCarryMsg *msg) {
+ CPetControl *pet = getPetControl();
+ if (!msg->_item)
+ return false;
+
+ CCarry *item = dynamic_cast<CCarry *>(msg->_item);
+ if (!_enabled || !pet || !item) {
+ item->petAddToInventory();
+ return true;
+ }
+
+ uint petRoomFlags = pet->getRoomFlags();
+ if (mailExists(petRoomFlags)) {
+ petDisplayMessage(2, "The Succ-U-Bus is a Single Entity Delivery Device.");
+ item->petAddToInventory();
+ return true;
+ }
+
+ petContainerRemove(item);
+ pet->phonographAction("");
+ playSound("z#23.wav");
+
+ CChicken *chicken = dynamic_cast<CChicken *>(item);
+ bool chickenFlag = chicken ? chicken->_string6 == "None" : false;
+
+ if (chickenFlag) {
+ if (_startFrame2 >= 0) {
+ startTalking(this, 70219);
+ playMovie(_startFrame2, _endFrame2, 0);
+ }
+
+ if (_startFrame3 >= 0) {
+ _field158 = 5;
+ playMovie(_startFrame3, _endFrame3, MOVIE_NOTIFY_OBJECT);
+ }
+
+ CViewItem *view = parseView(item->_fullViewName);
+ if (view) {
+ item->setVisible(false);
+ setPosition(item->_origPos);
+ item->moveUnder(view);
+
+ CSUBTransition transMsg;
+ transMsg.execute(this);
+ } else {
+ return false;
+ }
+ } else {
+ item->addMail(petRoomFlags);
+ if (_startFrame2 >= 0)
+ playMovie(_startFrame2, _endFrame2, 0);
+
+ petSetArea(PET_REMOTE);
+ CSUBTransition transMsg;
+ transMsg.execute(this);
+ }
+
+ return true;
+}
+
+bool CBilgeSuccUBus::EnterViewMsg(CEnterViewMsg *msg) {
+ petSetRemoteTarget();
+ _mailP = nullptr;
+
+ if (_startFrame8 >= 0)
+ loadFrame(_startFrame8);
+
+ return true;
+}
+
+bool CBilgeSuccUBus::LeaveViewMsg(CLeaveViewMsg *msg) {
+ petDisplayMessage(2, "");
+ petClear();
+
+ if (_soundHandle != -1) {
+ stopSound(_soundHandle);
+ _soundHandle = -1;
+ }
+
+ if (_enabled) {
+ _enabled = false;
+ if (_startFrame10 >= 0)
+ playSound("z#27.wav");
+ }
+
+ performAction(true);
+ CSUBTransition transMsg;
+ transMsg.execute(this);
+
+ return true;
+}
+
+bool CBilgeSuccUBus::TrueTalkGetStateValueMsg(CTrueTalkGetStateValueMsg *msg) {
+ if (msg->_stateNum == 1)
+ msg->_stateVal = _enabled;
+
+ return true;
+}
+
+bool CBilgeSuccUBus::TurnOn(CTurnOn *msg) {
+ CPetControl *pet = getPetControl();
+
+ if (pet) {
+ if (_startFrame9 >= 0) {
+ playMovie(_startFrame9, _endFrame9, MOVIE_NOTIFY_OBJECT);
+ playSound("z#26.wav");
+ }
+
+ if (mailExists(pet->getRoomFlags()) && _startFrame2 >= 0)
+ playMovie(_startFrame2, _endFrame2, 0);
+
+ _enabled = true;
+ CSUBTransition transMsg;
+ transMsg.execute(this);
+
+ endTalking(this, true);
+ petSetArea(PET_REMOTE);
+ petHighlightGlyph(16);
+ }
+
+ return true;
+}
+
+bool CBilgeSuccUBus::TurnOff(CTurnOff *msg) {
+ CPetControl *pet = getPetControl();
+
+ if (pet && mailExists(pet->getRoomFlags()) && _startFrame12 >= 0)
+ playMovie(_startFrame12, _endFrame12, MOVIE_NOTIFY_OBJECT);
+ else if (_endFrame12 >= 0)
+ playMovie(_endFrame12, _endFrame12, MOVIE_NOTIFY_OBJECT);
+
+ if (_soundHandle != -1) {
+ stopSound(_soundHandle);
+ _soundHandle = -1;
+ }
+
+ if (_startFrame10 >= 0)
+ playMovie(_startFrame10, _endFrame10, MOVIE_NOTIFY_OBJECT);
+
+ _enabled = false;
+ performAction(true);
+
+ CSUBTransition transMsg;
+ transMsg.execute(this);
+
+ return true;
+}
+
} // End of namespace Titanic
diff --git a/engines/titanic/game/bilge_succubus.h b/engines/titanic/game/bilge_succubus.h
index 4b2a626dc2..754949a306 100644
--- a/engines/titanic/game/bilge_succubus.h
+++ b/engines/titanic/game/bilge_succubus.h
@@ -28,11 +28,23 @@
namespace Titanic {
class CBilgeSuccUBus : public CSuccUBus {
+ DECLARE_MESSAGE_MAP;
+ bool FrameMsg(CFrameMsg *msg);
+ bool PETReceiveMsg(CPETReceiveMsg *msg);
+ bool PETDeliverMsg(CPETDeliverMsg *msg);
+ bool MovieEndMsg(CMovieEndMsg *msg);
+ bool MouseButtonDownMsg(CMouseButtonDownMsg *msg);
+ bool SubAcceptCCarryMsg(CSubAcceptCCarryMsg *msg);
+ bool EnterViewMsg(CEnterViewMsg *msg);
+ bool LeaveViewMsg(CLeaveViewMsg *msg);
+ bool TrueTalkGetStateValueMsg(CTrueTalkGetStateValueMsg *msg);
+ bool TurnOn(CTurnOn *msg);
+ bool TurnOff(CTurnOff *msg);
public:
- int _field1DC;
- int _field1E0;
- int _field1E4;
- int _field1E8;
+ int _bilgeStartFrame1;
+ int _bilgeEndFrame1;
+ int _bilgeStartFrame2;
+ int _bilgeEndFrame2;
public:
CLASSDEF;
CBilgeSuccUBus();
diff --git a/engines/titanic/game/placeholder/bar_shelf_vis_centre.cpp b/engines/titanic/game/placeholder/bar_shelf_vis_centre.cpp
index a8a33fe1b1..fc5d680f0c 100644
--- a/engines/titanic/game/placeholder/bar_shelf_vis_centre.cpp
+++ b/engines/titanic/game/placeholder/bar_shelf_vis_centre.cpp
@@ -24,16 +24,44 @@
namespace Titanic {
+BEGIN_MESSAGE_MAP(CBarShelfVisCentre, CPlaceHolderItem)
+ ON_MESSAGE(MouseButtonDownMsg)
+ ON_MESSAGE(TimerMsg)
+ ON_MESSAGE(EnterViewMsg)
+END_MESSAGE_MAP()
+
void CBarShelfVisCentre::save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
- file->writeNumberLine(_value, indent);
+ file->writeNumberLine(_flag, indent);
CPlaceHolderItem::save(file, indent);
}
void CBarShelfVisCentre::load(SimpleFile *file) {
file->readNumber();
- _value = file->readNumber();
+ _flag = file->readNumber();
CPlaceHolderItem::load(file);
}
+bool CBarShelfVisCentre::MouseButtonDownMsg(CMouseButtonDownMsg *msg) {
+ if (!_flag) {
+ CActMsg actMsg("ClickOnVision");
+ actMsg.execute("Barbot");
+ addTimer(3000);
+ _flag = true;
+ }
+
+ return true;
+}
+
+bool CBarShelfVisCentre::TimerMsg(CTimerMsg *msg) {
+ _flag = false;
+ return true;
+}
+
+bool CBarShelfVisCentre::EnterViewMsg(CEnterViewMsg *msg) {
+ _flag = false;
+ return true;
+}
+
+
} // End of namespace Titanic
diff --git a/engines/titanic/game/placeholder/bar_shelf_vis_centre.h b/engines/titanic/game/placeholder/bar_shelf_vis_centre.h
index a53ef2633f..672655d368 100644
--- a/engines/titanic/game/placeholder/bar_shelf_vis_centre.h
+++ b/engines/titanic/game/placeholder/bar_shelf_vis_centre.h
@@ -28,11 +28,15 @@
namespace Titanic {
class CBarShelfVisCentre : public CPlaceHolderItem {
+ DECLARE_MESSAGE_MAP;
+ bool MouseButtonDownMsg(CMouseButtonDownMsg *msg);
+ bool TimerMsg(CTimerMsg *msg);
+ bool EnterViewMsg(CEnterViewMsg *msg);
private:
- int _value;
+ bool _flag;
public:
CLASSDEF;
- CBarShelfVisCentre() : CPlaceHolderItem(), _value(0) {}
+ CBarShelfVisCentre() : CPlaceHolderItem(), _flag(false) {}
/**
* Save the data for the class to file
diff --git a/engines/titanic/game/sgt/basin.cpp b/engines/titanic/game/sgt/basin.cpp
index 1eb1d161c9..3f85edc4ca 100644
--- a/engines/titanic/game/sgt/basin.cpp
+++ b/engines/titanic/game/sgt/basin.cpp
@@ -24,6 +24,12 @@
namespace Titanic {
+BEGIN_MESSAGE_MAP(CBasin, CSGTStateRoom)
+ ON_MESSAGE(TurnOn)
+ ON_MESSAGE(TurnOff)
+ ON_MESSAGE(MovieEndMsg)
+END_MESSAGE_MAP()
+
void CBasin::save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
CSGTStateRoom::save(file, indent);
@@ -34,4 +40,39 @@ void CBasin::load(SimpleFile *file) {
CSGTStateRoom::load(file);
}
+bool CBasin::TurnOn(CTurnOn *msg) {
+ if (_statics->_v10 == "Open" && _statics->_v11 == "Closed"
+ || _statics->_v2 == "Closed") {
+ setVisible(true);
+ _statics->_v11 = "Open";
+ _fieldE0 = 0;
+ _startFrame = 0;
+ _endFrame = 6;
+ playMovie(0, 6, MOVIE_GAMESTATE);
+ playSound("b#13.wav");
+ }
+
+ return true;
+}
+
+bool CBasin::TurnOff(CTurnOff *msg) {
+ if (_statics->_v11 == "Open") {
+ _statics->_v11 = "Closed";
+ _fieldE0 = 1;
+ _startFrame = 8;
+ _endFrame = 14;
+ playMovie(8, 14, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE);
+ playSound("b#13.wav");
+ }
+
+ return true;
+}
+
+bool CBasin::MovieEndMsg(CMovieEndMsg *msg) {
+ if (_statics->_v11 == "Closed")
+ setVisible(false);
+
+ return true;
+}
+
} // End of namespace Titanic
diff --git a/engines/titanic/game/sgt/basin.h b/engines/titanic/game/sgt/basin.h
index e4a36eb841..1fcb469824 100644
--- a/engines/titanic/game/sgt/basin.h
+++ b/engines/titanic/game/sgt/basin.h
@@ -28,6 +28,10 @@
namespace Titanic {
class CBasin : public CSGTStateRoom {
+ DECLARE_MESSAGE_MAP;
+ bool TurnOn(CTurnOn *msg);
+ bool TurnOff(CTurnOff *msg);
+ bool MovieEndMsg(CMovieEndMsg *msg);
public:
CLASSDEF;
diff --git a/engines/titanic/game/sgt/bedfoot.cpp b/engines/titanic/game/sgt/bedfoot.cpp
index 18ea07aca0..b1837b15f6 100644
--- a/engines/titanic/game/sgt/bedfoot.cpp
+++ b/engines/titanic/game/sgt/bedfoot.cpp
@@ -24,6 +24,11 @@
namespace Titanic {
+BEGIN_MESSAGE_MAP(CBedfoot, CSGTStateRoom)
+ ON_MESSAGE(TurnOn)
+ ON_MESSAGE(TurnOff)
+END_MESSAGE_MAP()
+
void CBedfoot::save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
CSGTStateRoom::save(file, indent);
@@ -34,4 +39,91 @@ void CBedfoot::load(SimpleFile *file) {
CSGTStateRoom::load(file);
}
+bool CBedfoot::TurnOn(CTurnOn *msg) {
+ if (_statics->_v2 == "Closed" && _statics->_v11 == "Closed") {
+ _fieldE0 = 0;
+ _startFrame = 0;
+ if (_statics->_v10 == "Open") {
+ _endFrame = 13;
+ _statics->_v2 = "Open";
+ playSound("b#7.wav");
+ } else {
+ _endFrame = 17;
+ _statics->_v2 = "NotOnWashstand";
+ playSound("b#4.wav");
+ }
+
+ playMovie(_startFrame, _endFrame, MOVIE_GAMESTATE);
+ } else if (_statics->_v2 == "RestingUnderTV") {
+ _fieldE0;
+ _startFrame = 8;
+ if (_statics->_v10 == "Open") {
+ _statics->_v2 = "Open";
+ playSound("189_436_bed down 1.wav");
+ } else {
+ _statics->_v2 = "NotOnWashstand";
+ playSound("192_436_bed hits floor.wav");
+ }
+
+ playMovie(_startFrame, _endFrame, MOVIE_GAMESTATE);
+ }
+
+ if (_statics->_v2 == "Open")
+ _statics->_v1 = "Closed";
+ else if (_statics->_v2 == "NotOnWashstand")
+ _statics->_v1 = "ClosedWrong";
+
+ return true;
+}
+
+bool CBedfoot::TurnOff(CTurnOff *msg) {
+ if (_statics->_v1 == "Closed" || _statics->_v1 == "ClosedWrong") {
+ setVisible(true);
+ CVisibleMsg visibleMsg(false);
+ visibleMsg.execute("Bedhead");
+ }
+
+ if (_statics->_v2 == "Open" && _statics->_v1 == "Closed") {
+ _fieldE0 = 0;
+ _startFrame = 20;
+ if (_statics->_v4 == "Closed") {
+ _statics->_v2 = "Closed";
+ _endFrame = 30;
+ } else {
+ _statics->_v2 = "RestingUnderTV";
+ _endFrame = 25;
+ }
+
+ playMovie(_startFrame, _endFrame, MOVIE_GAMESTATE);
+ playSound("b#7.wav");
+
+ } else if (_statics->_v2 == "NotOnWashstand" && _statics->_v1 == "ClosedWrong") {
+ _fieldE0 = 0;
+ _startFrame = 17;
+
+ if (_statics->_v4 == "Closed") {
+ _statics->_v2 = "Closed";
+ _endFrame = 30;
+ } else {
+ _statics->_v2 = "RestingUnderTV";
+ _endFrame = 25;
+ }
+
+ playMovie(_startFrame, _endFrame, MOVIE_GAMESTATE);
+ playSound("b#7.wav");
+
+ } else if (_statics->_v2 == "RestingUTV" && _statics->_v4 == "Closed") {
+ _statics->_v2 = "Closed";
+ _startFrame = 25;
+ _endFrame = 30;
+ playMovie(25, 30, MOVIE_GAMESTATE);
+ playSound("b#7.wav");
+ }
+
+ if (_statics->_v2 == "Closed")
+ _statics->_v1 = "Closed";
+
+ return true;
+}
+
} // End of namespace Titanic
diff --git a/engines/titanic/game/sgt/bedfoot.h b/engines/titanic/game/sgt/bedfoot.h
index df3db42d6d..cc7b82b075 100644
--- a/engines/titanic/game/sgt/bedfoot.h
+++ b/engines/titanic/game/sgt/bedfoot.h
@@ -28,6 +28,9 @@
namespace Titanic {
class CBedfoot : public CSGTStateRoom {
+ DECLARE_MESSAGE_MAP;
+ bool TurnOn(CTurnOn *msg);
+ bool TurnOff(CTurnOff *msg);
public:
CLASSDEF;
diff --git a/engines/titanic/game/sgt/bedhead.cpp b/engines/titanic/game/sgt/bedhead.cpp
index fad7272f3a..6f427ab625 100644
--- a/engines/titanic/game/sgt/bedhead.cpp
+++ b/engines/titanic/game/sgt/bedhead.cpp
@@ -24,6 +24,11 @@
namespace Titanic {
+BEGIN_MESSAGE_MAP(CBedhead, CSGTStateRoom)
+ ON_MESSAGE(TurnOn)
+ ON_MESSAGE(TurnOff)
+END_MESSAGE_MAP()
+
void CBedhead::save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
CSGTStateRoom::save(file, indent);
@@ -34,4 +39,14 @@ void CBedhead::load(SimpleFile *file) {
CSGTStateRoom::load(file);
}
+bool CBedhead::TurnOn(CTurnOn *msg) {
+ // TODO
+ return true;
+}
+
+bool CBedhead::TurnOff(CTurnOff *msg) {
+ // TODO
+ return true;
+}
+
} // End of namespace Titanic
diff --git a/engines/titanic/game/sgt/bedhead.h b/engines/titanic/game/sgt/bedhead.h
index f1ba31786c..665dec021c 100644
--- a/engines/titanic/game/sgt/bedhead.h
+++ b/engines/titanic/game/sgt/bedhead.h
@@ -28,6 +28,9 @@
namespace Titanic {
class CBedhead : public CSGTStateRoom {
+ DECLARE_MESSAGE_MAP;
+ bool TurnOn(CTurnOn *msg);
+ bool TurnOff(CTurnOff *msg);
public:
CLASSDEF;
diff --git a/engines/titanic/messages/bilge_dispensor_event.cpp b/engines/titanic/messages/bilge_dispensor_event.cpp
index 043ffe75d3..584da00a6f 100644
--- a/engines/titanic/messages/bilge_dispensor_event.cpp
+++ b/engines/titanic/messages/bilge_dispensor_event.cpp
@@ -24,6 +24,13 @@
namespace Titanic {
+BEGIN_MESSAGE_MAP(CBilgeDispensorEvent, CAutoSoundEvent)
+ ON_MESSAGE(EnterRoomMsg)
+ ON_MESSAGE(LeaveRoomMsg)
+ ON_MESSAGE(FrameMsg)
+ ON_MESSAGE(StatusChangeMsg)
+END_MESSAGE_MAP()
+
void CBilgeDispensorEvent::save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
CAutoSoundEvent::save(file, indent);
@@ -39,4 +46,32 @@ bool CBilgeDispensorEvent::EnterRoomMsg(CEnterRoomMsg *msg) {
return true;
}
+bool CBilgeDispensorEvent::LeaveRoomMsg(CLeaveRoomMsg *msg) {
+ _value1 = -1;
+ return true;
+}
+
+bool CBilgeDispensorEvent::FrameMsg(CFrameMsg *msg) {
+ if (_value1 >= 0 && (_value1 & 0xffff) == 0x4000) {
+ int volume = 20 + getRandomNumber(30);
+ int val3 = getRandomNumber(20) - 10;
+
+ if (getRandomNumber(2) == 0) {
+ playSound("b#18.wav", volume, val3);
+ }
+ }
+
+ CAutoSoundEvent::FrameMsg(msg);
+ return true;
+}
+
+bool CBilgeDispensorEvent::StatusChangeMsg(CStatusChangeMsg *msg) {
+ if (msg->_newStatus == 1)
+ _value1 = -1;
+ else if (msg->_newStatus == 2)
+ _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 96ef92a54e..61d3116db4 100644
--- a/engines/titanic/messages/bilge_dispensor_event.h
+++ b/engines/titanic/messages/bilge_dispensor_event.h
@@ -29,9 +29,14 @@
namespace Titanic {
class CBilgeDispensorEvent : public CAutoSoundEvent {
+ DECLARE_MESSAGE_MAP;
bool EnterRoomMsg(CEnterRoomMsg *msg);
+ bool LeaveRoomMsg(CLeaveRoomMsg *msg);
+ bool FrameMsg(CFrameMsg *msg);
+ bool StatusChangeMsg(CStatusChangeMsg *msg);
public:
CLASSDEF;
+ CBilgeDispensorEvent() : CAutoSoundEvent() {}
/**
* Save the data for the class to file
diff --git a/engines/titanic/npcs/succubus.cpp b/engines/titanic/npcs/succubus.cpp
index 75afb1b273..9652e9c7ac 100644
--- a/engines/titanic/npcs/succubus.cpp
+++ b/engines/titanic/npcs/succubus.cpp
@@ -69,11 +69,11 @@ CSuccUBus::CSuccUBus() : CTrueTalkNPC() {
_startFrame2 = 40;
_endFrame2 = 68;
_field140 = 1;
- _field144 = 0;
+ _mailP = nullptr;
_startFrame5 = 0;
_endFrame5 = 0;
- _field150 = 0xE0;
- _field154 = 0;
+ _startFrame12 = 224;
+ _endFrame12 = 248;
_field158 = 0;
_field15C = 0;
_string2 = "NULL";
@@ -124,8 +124,8 @@ void CSuccUBus::save(SimpleFile *file, int indent) {
file->writeNumberLine(_v2, indent);
file->writeNumberLine(_startFrame5, indent);
file->writeNumberLine(_endFrame5, indent);
- file->writeNumberLine(_field150, indent);
- file->writeNumberLine(_field154, indent);
+ file->writeNumberLine(_startFrame12, indent);
+ file->writeNumberLine(_endFrame12, indent);
file->writeNumberLine(_field158, indent);
file->writeNumberLine(_field15C, indent);
@@ -188,8 +188,8 @@ void CSuccUBus::load(SimpleFile *file) {
_v2 = file->readNumber();
_startFrame5 = file->readNumber();
_endFrame5 = file->readNumber();
- _field150 = file->readNumber();
- _field154 = file->readNumber();
+ _startFrame12 = file->readNumber();
+ _endFrame12 = file->readNumber();
_field158 = file->readNumber();
_field15C = file->readNumber();
@@ -238,12 +238,12 @@ bool CSuccUBus::MouseButtonDownMsg(CMouseButtonDownMsg *msg) {
CTurnOn onMsg;
onMsg.execute(this);
_enabled = true;
- } else if (getNewRandomNumber(256) < 130) {
+ } else if (getRandomNumber(256) < 130) {
_enabled = false;
CTurnOff offMsg;
offMsg.execute(this);
} else {
- switch (getNewRandomNumber(2)) {
+ switch (getRandomNumber(2)) {
case 0:
startTalking(this, 230055, findView());
break;
@@ -330,7 +330,7 @@ bool CSuccUBus::EnterViewMsg(CEnterViewMsg *msg) {
}
petSetRemoteTarget();
- _field144 = nullptr;
+ _mailP = nullptr;
if (_startFrame8 >= 0)
loadFrame(_startFrame8);
@@ -429,7 +429,7 @@ bool CSuccUBus::PETDeliverMsg(CPETDeliverMsg *msg) {
playMovie(_startFrame3, _endFrame3, 0);
if (_startFrame4 >= 0) {
- _field144 = mailObject;
+ _mailP = mailObject;
playMovie(_startFrame4, _endFrame4, MOVIE_NOTIFY_OBJECT);
}
@@ -559,7 +559,7 @@ bool CSuccUBus::MovieEndMsg(CMovieEndMsg *msg) {
stopSound(_soundHandle);
_soundHandle = -1;
- switch (getNewRandomNumber(_v2 ? 7 : 5, &_field1B0)) {
+ switch (getRandomNumber(_v2 ? 7 : 5, &_field1B0)) {
case 2:
startTalking(this, 230001, findView());
break;
@@ -609,12 +609,12 @@ bool CSuccUBus::MovieEndMsg(CMovieEndMsg *msg) {
}
if (msg->_endFrame == _endFrame4) {
- if (pet && _field144) {
- _field144->setMailId(petRoomFlags);
+ if (pet && _mailP) {
+ _mailP->setMailId(petRoomFlags);
}
_field188 = 1;
- _field144 = 0;
+ _mailP = 0;
if (_field1D8) {
_field1D8 = 0;
dec54();
diff --git a/engines/titanic/npcs/succubus.h b/engines/titanic/npcs/succubus.h
index b8e4c316a9..7ca8037a0a 100644
--- a/engines/titanic/npcs/succubus.h
+++ b/engines/titanic/npcs/succubus.h
@@ -45,13 +45,13 @@ class CSuccUBus : public CTrueTalkNPC {
bool SetChevRoomBits(CSetChevRoomBits *msg);
bool ActMsg(CActMsg *msg);
bool MouseDragStartMsg(CMouseDragStartMsg *msg);
-private:
+protected:
static bool _enabled;
static int _v1;
static int _v2;
static int _v3;
static int _v4;
-private:
+protected:
int _startFrame8;
int _endFrame8;
int _startFrame11;
@@ -67,11 +67,11 @@ private:
int _startFrame2;
int _endFrame2;
int _field140;
- CGameObject *_field144;
+ CGameObject *_mailP;
int _startFrame5;
int _endFrame5;
- int _field150;
- int _field154;
+ int _startFrame12;
+ int _endFrame12;
int _field158;
bool _field15C;
CString _string2;