diff options
Diffstat (limited to 'engines/titanic')
-rw-r--r-- | engines/titanic/core/saveable_object.cpp | 2 | ||||
-rw-r--r-- | engines/titanic/game/broken_pell_base.cpp | 2 | ||||
-rw-r--r-- | engines/titanic/game/broken_pell_base.h | 4 | ||||
-rw-r--r-- | engines/titanic/game/broken_pellerator.cpp | 107 | ||||
-rw-r--r-- | engines/titanic/game/broken_pellerator.h | 5 | ||||
-rw-r--r-- | engines/titanic/game/broken_pellerator_froz.cpp | 103 | ||||
-rw-r--r-- | engines/titanic/game/broken_pellerator_froz.h | 5 | ||||
-rw-r--r-- | engines/titanic/game/transport/pellerator.cpp | 97 | ||||
-rw-r--r-- | engines/titanic/game/transport/pellerator.h | 8 | ||||
-rw-r--r-- | engines/titanic/module.mk | 2 | ||||
-rw-r--r-- | engines/titanic/moves/call_pellerator.cpp (renamed from engines/titanic/game/call_pellerator.cpp) | 47 | ||||
-rw-r--r-- | engines/titanic/moves/call_pellerator.h (renamed from engines/titanic/game/call_pellerator.h) | 6 | ||||
-rw-r--r-- | engines/titanic/moves/exit_pellerator.cpp | 86 | ||||
-rw-r--r-- | engines/titanic/moves/exit_pellerator.h | 6 |
14 files changed, 465 insertions, 15 deletions
diff --git a/engines/titanic/core/saveable_object.cpp b/engines/titanic/core/saveable_object.cpp index 2d44126363..5fc2d7e738 100644 --- a/engines/titanic/core/saveable_object.cpp +++ b/engines/titanic/core/saveable_object.cpp @@ -103,7 +103,6 @@ #include "titanic/game/broken_pellerator.h" #include "titanic/game/broken_pellerator_froz.h" #include "titanic/game/cage.h" -#include "titanic/game/call_pellerator.h" #include "titanic/game/captains_wheel.h" #include "titanic/game/cdrom.h" #include "titanic/game/cdrom_computer.h" @@ -333,6 +332,7 @@ #include "titanic/messages/pet_messages.h" #include "titanic/messages/service_elevator_door.h" +#include "titanic/moves/call_pellerator.h" #include "titanic/moves/enter_bomb_room.h" #include "titanic/moves/enter_bridge.h" #include "titanic/moves/enter_exit_first_class_state.h" diff --git a/engines/titanic/game/broken_pell_base.cpp b/engines/titanic/game/broken_pell_base.cpp index 59e2b9bca1..02c2d873ac 100644 --- a/engines/titanic/game/broken_pell_base.cpp +++ b/engines/titanic/game/broken_pell_base.cpp @@ -26,7 +26,7 @@ namespace Titanic { EMPTY_MESSAGE_MAP(CBrokenPellBase, CBackground); -int CBrokenPellBase::_v1; +bool CBrokenPellBase::_v1; int CBrokenPellBase::_v2; void CBrokenPellBase::save(SimpleFile *file, int indent) { diff --git a/engines/titanic/game/broken_pell_base.h b/engines/titanic/game/broken_pell_base.h index f63cd0112b..4ca7eddd20 100644 --- a/engines/titanic/game/broken_pell_base.h +++ b/engines/titanic/game/broken_pell_base.h @@ -29,8 +29,8 @@ namespace Titanic { class CBrokenPellBase : public CBackground { DECLARE_MESSAGE_MAP; -private: - static int _v1; +protected: + static bool _v1; static int _v2; int _fieldE0; diff --git a/engines/titanic/game/broken_pellerator.cpp b/engines/titanic/game/broken_pellerator.cpp index d3b204b1e5..8fb7244b7e 100644 --- a/engines/titanic/game/broken_pellerator.cpp +++ b/engines/titanic/game/broken_pellerator.cpp @@ -21,9 +21,17 @@ */ #include "titanic/game/broken_pellerator.h" +#include "titanic/core/view_item.h" namespace Titanic { +BEGIN_MESSAGE_MAP(CBrokenPellerator, CBrokenPellBase) + ON_MESSAGE(MouseButtonDownMsg) + ON_MESSAGE(LeaveViewMsg) + ON_MESSAGE(ActMsg) + ON_MESSAGE(MovieEndMsg) +END_MESSAGE_MAP() + void CBrokenPellerator::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeQuotedLine(_string2, indent); @@ -44,4 +52,103 @@ void CBrokenPellerator::load(SimpleFile *file) { CBrokenPellBase::load(file); } +bool CBrokenPellerator::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { + if (_v1) { + changeView(_v2 ? _string5 : _string4); + } else { + if (_v2) { + playMovie(28, 43, 0); + } else { + playMovie(0, 14, MOVIE_NOTIFY_OBJECT); + } + + _v1 = true; + } + + return true; +} + +bool CBrokenPellerator::LeaveViewMsg(CLeaveViewMsg *msg) { + CString name = msg->_newView->getNodeViewName(); + if (name == "Node 3.S" || name == "Node 3.N") { + _v1 = false; + loadFrame(0); + } + + return true; +} + +bool CBrokenPellerator::ActMsg(CActMsg *msg) { + if (msg->_action == "PlayerGetsHose") { + _v2 = 1; + loadFrame(43); + + CStatusChangeMsg statusMsg; + statusMsg.execute("PickupHose"); + } else { + _fieldE0 = 0; + bool closeFlag = msg->_action == "Close"; + if (msg->_action == "CloseLeft") { + closeFlag = true; + _fieldE0 = 1; + } + if (msg->_action == "CloseRight") { + closeFlag = true; + _fieldE0 = 2; + } + + if (closeFlag) { + if (_v1) { + _v1 = false; + if (_v2) + playMovie(43, 57, MOVIE_NOTIFY_OBJECT); + else + playMovie(14, 28, MOVIE_NOTIFY_OBJECT); + } else { + switch (_fieldE0) { + case 1: + changeView(_string2); + break; + case 2: + changeView(_string3); + break; + default: + break; + } + + _fieldE0 = 0; + } + } + } + + return true; +} + +bool CBrokenPellerator::MovieEndMsg(CMovieEndMsg *msg) { + if (msg->_endFrame == 14) { + CStatusChangeMsg statusMsg; + statusMsg._newStatus = 1; + statusMsg.execute("PickUpHose"); + } + + if (msg->_endFrame == 28) { + CStatusChangeMsg statusMsg; + statusMsg._newStatus = 0; + statusMsg.execute("PickUpHose"); + } + + switch (_fieldE0) { + case 1: + changeView(_string2); + break; + case 2: + changeView(_string3); + break; + default: + break; + } + + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/game/broken_pellerator.h b/engines/titanic/game/broken_pellerator.h index 6fbde91053..3b8c3ba587 100644 --- a/engines/titanic/game/broken_pellerator.h +++ b/engines/titanic/game/broken_pellerator.h @@ -28,6 +28,11 @@ namespace Titanic { class CBrokenPellerator : public CBrokenPellBase { + DECLARE_MESSAGE_MAP; + bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); + bool LeaveViewMsg(CLeaveViewMsg *msg); + bool ActMsg(CActMsg *msg); + bool MovieEndMsg(CMovieEndMsg *msg); private: CString _string2; CString _string3; diff --git a/engines/titanic/game/broken_pellerator_froz.cpp b/engines/titanic/game/broken_pellerator_froz.cpp index 4b21ea93d0..690ab76820 100644 --- a/engines/titanic/game/broken_pellerator_froz.cpp +++ b/engines/titanic/game/broken_pellerator_froz.cpp @@ -21,9 +21,17 @@ */ #include "titanic/game/broken_pellerator_froz.h" +#include "titanic/core/view_item.h" namespace Titanic { +BEGIN_MESSAGE_MAP(CBrokenPelleratorFroz, CBrokenPellBase) + ON_MESSAGE(MouseButtonDownMsg) + ON_MESSAGE(LeaveViewMsg) + ON_MESSAGE(ActMsg) + ON_MESSAGE(MovieEndMsg) +END_MESSAGE_MAP() + void CBrokenPelleratorFroz::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeQuotedLine(_string2, indent); @@ -44,4 +52,99 @@ void CBrokenPelleratorFroz::load(SimpleFile *file) { CBrokenPellBase::load(file); } +bool CBrokenPelleratorFroz::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { + if (_v1) { + changeView(_v2 ? _string5 : _string4); + } else { + _v1 = true; + if (_v2) { + playMovie(0, 13, 0); + } else { + playMovie(43, 55, MOVIE_NOTIFY_OBJECT); + } + } + + return true; +} + +bool CBrokenPelleratorFroz::LeaveViewMsg(CLeaveViewMsg *msg) { + CString name = msg->_newView->getNodeViewName(); + + if (name == "Node 3.S" || name == "Node 3.E") { + _v1 = false; + loadFrame(0); + } + + return true; +} + +bool CBrokenPelleratorFroz::ActMsg(CActMsg *msg) { + if (msg->_action == "PlayerGetsHose") { + _v2 = 1; + CStatusChangeMsg statusMsg; + statusMsg._newStatus = 0; + statusMsg.execute("FPickUpHose"); + } else { + _fieldE0 = 0; + bool closeFlag = msg->_action == "Close"; + if (msg->_action == "CloseLeft") { + closeFlag = true; + _fieldE0 = 1; + } + if (msg->_action == "CloseRight") { + closeFlag = true; + _fieldE0 = 2; + } + + if (closeFlag) { + if (_v1) { + _v1 = false; + if (_v2) + playMovie(29, 42, MOVIE_NOTIFY_OBJECT); + else + playMovie(72, 84, MOVIE_NOTIFY_OBJECT); + } else { + switch (_fieldE0) { + case 1: + changeView(_string2); + break; + case 2: + changeView(_string3); + break; + default: + break; + } + + _fieldE0 = 0; + } + } + } + + return true; +} + +bool CBrokenPelleratorFroz::MovieEndMsg(CMovieEndMsg *msg) { + if (msg->_endFrame == 55) { + CStatusChangeMsg statusMsg; + statusMsg._newStatus = 1; + statusMsg.execute("FPickUpHose"); + } + + if (msg->_endFrame == 84) { + CStatusChangeMsg statusMsg; + statusMsg._newStatus = 0; + statusMsg.execute("FPickUpHose"); + } + + if (_fieldE0 == 1) { + changeView(_string2); + _fieldE0 = 0; + } else if (_fieldE0 == 2) { + changeView(_string3); + _fieldE0 = 0; + } + + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/game/broken_pellerator_froz.h b/engines/titanic/game/broken_pellerator_froz.h index 1df6d2d0b2..ccdae6ffa8 100644 --- a/engines/titanic/game/broken_pellerator_froz.h +++ b/engines/titanic/game/broken_pellerator_froz.h @@ -28,6 +28,11 @@ namespace Titanic { class CBrokenPelleratorFroz : public CBrokenPellBase { + DECLARE_MESSAGE_MAP; + bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); + bool LeaveViewMsg(CLeaveViewMsg *msg); + bool ActMsg(CActMsg *msg); + bool MovieEndMsg(CMovieEndMsg *msg); private: CString _string2; CString _string3; diff --git a/engines/titanic/game/transport/pellerator.cpp b/engines/titanic/game/transport/pellerator.cpp index e789c20a3d..343ce29b3d 100644 --- a/engines/titanic/game/transport/pellerator.cpp +++ b/engines/titanic/game/transport/pellerator.cpp @@ -21,19 +21,32 @@ */ #include "titanic/game/transport/pellerator.h" +#include "titanic/core/room_item.h" namespace Titanic { +static const char *const WAVE_NAMES[10] = { + "z#465.wav", "z#456.wav", "z#455.wav", "z#453.wav", + "z#452.wav", "NoStandingInFunnyWays", "z#450.wav", + "z#449.wav", "z#435.wav", "z#434.wav" +}; + BEGIN_MESSAGE_MAP(CPellerator, CTransport) + ON_MESSAGE(StatusChangeMsg) ON_MESSAGE(EnterRoomMsg) + ON_MESSAGE(MovieEndMsg) + ON_MESSAGE(TimerMsg) END_MESSAGE_MAP() -int CPellerator::_v1; +int CPellerator::_soundHandle; int CPellerator::_v2; +CPellerator::CPellerator() : CTransport() { +} + void CPellerator::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); - file->writeNumberLine(_v1, indent); + file->writeNumberLine(_soundHandle, indent); file->writeNumberLine(_v2, indent); CTransport::save(file, indent); @@ -41,14 +54,90 @@ void CPellerator::save(SimpleFile *file, int indent) { void CPellerator::load(SimpleFile *file) { file->readNumber(); - _v1 = file->readNumber(); + _soundHandle = file->readNumber(); _v2 = file->readNumber(); CTransport::load(file); } +bool CPellerator::StatusChangeMsg(CStatusChangeMsg *msg) { + warning("CPellerator::StatusChangeMsg"); + return true; +} + bool CPellerator::EnterRoomMsg(CEnterRoomMsg *msg) { - warning("CPellerator::handleEvent"); + if (isEquals("PelleratorObject")) { + for (int idx = 0; idx < 10; ++idx) + loadSound(WAVE_NAMES[idx]); + addTimer(10000); + } + + CString name = msg->_oldRoom ? msg->_oldRoom->getName() : ""; + int oldVal = _v2; + + if (name.empty()) { + _v2 = 4; + oldVal = 4; + } else if (name == "PromenadeDeck") { + _v2 = 0; + } else if (name == "MusicRoomLobby") { + _v2 = 1; + } else if (name == "Bar") { + _v2 = 2; + } else if (name == "TopOfWell") { + _v2 = 4; + } else if (name == "1stClassRestaurant") { + _v2 = 5; + } else if (name == "Arboretum" || name == "FrozenArboretum") { + _v2 = 6; + } + + if (_v2 != oldVal) { + CStatusChangeMsg statusMsg; + statusMsg._newStatus = _v2; + statusMsg.execute("ExitPellerator"); + } + + loadFrame(264); + return true; +} + +bool CPellerator::MovieEndMsg(CMovieEndMsg *msg) { + setVisible(false); + stopGlobalSound(true, -1); + + switch (_v2) { + case 0: + _soundHandle = queueSound("z#429.wav", _soundHandle); + break; + case 1: + _soundHandle = queueSound("z#430.wav", _soundHandle); + break; + case 2: + _soundHandle = queueSound("z#431.wav", _soundHandle); + break; + case 4: + _soundHandle = queueSound("z#428.wav", _soundHandle); + break; + case 5: + _soundHandle = queueSound("z#433.wav", _soundHandle); + break; + case 6: + _soundHandle = queueSound("z#432.wav", _soundHandle); + break; + default: + break; + } + + return true; +} + +bool CPellerator::TimerMsg(CTimerMsg *msg) { + if (compareRoomNameTo("Pellerator")) { + _soundHandle = queueSound(WAVE_NAMES[getRandomNumber(9)], _soundHandle); + addTimer(20000 + getRandomNumber(10000)); + } + return true; } diff --git a/engines/titanic/game/transport/pellerator.h b/engines/titanic/game/transport/pellerator.h index fa400a49cd..ad93ba036a 100644 --- a/engines/titanic/game/transport/pellerator.h +++ b/engines/titanic/game/transport/pellerator.h @@ -30,12 +30,16 @@ namespace Titanic { class CPellerator : public CTransport { DECLARE_MESSAGE_MAP; + bool StatusChangeMsg(CStatusChangeMsg *msg); bool EnterRoomMsg(CEnterRoomMsg *msg); -private: - static int _v1; + bool MovieEndMsg(CMovieEndMsg *msg); + bool TimerMsg(CTimerMsg *msg); +public: + static int _soundHandle; static int _v2; public: CLASSDEF; + CPellerator(); /** * Save the data for the class to file diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index 34d93b6411..a3afc7e4a4 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -94,7 +94,6 @@ MODULE_OBJS := \ game/broken_pell_base.o \ game/broken_pellerator.o \ game/broken_pellerator_froz.o \ - game/call_pellerator.o \ game/cage.o \ game/captains_wheel.o \ game/cdrom.o \ @@ -317,6 +316,7 @@ MODULE_OBJS := \ messages/messages.o \ messages/mouse_messages.o \ messages/service_elevator_door.o \ + moves/call_pellerator.o \ moves/enter_bomb_room.o \ moves/enter_bridge.o \ moves/enter_exit_first_class_state.o \ diff --git a/engines/titanic/game/call_pellerator.cpp b/engines/titanic/moves/call_pellerator.cpp index 0ea48131b1..0dd8195277 100644 --- a/engines/titanic/game/call_pellerator.cpp +++ b/engines/titanic/moves/call_pellerator.cpp @@ -20,10 +20,17 @@ * */ -#include "titanic/game/call_pellerator.h" +#include "titanic/moves/call_pellerator.h" namespace Titanic { +BEGIN_MESSAGE_MAP(CCallPellerator, CGameObject) + ON_MESSAGE(EnterViewMsg) + ON_MESSAGE(LeaveViewMsg) + ON_MESSAGE(PETActivateMsg) + ON_MESSAGE(MouseButtonDownMsg) +END_MESSAGE_MAP() + void CCallPellerator::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CGameObject::save(file, indent); @@ -34,4 +41,42 @@ void CCallPellerator::load(SimpleFile *file) { CGameObject::load(file); } +bool CCallPellerator::EnterViewMsg(CEnterViewMsg *msg) { + petSetArea(PET_REMOTE); + petHighlightGlyph(1); + CString name = getFullViewName(); + + if (name == "TopOfWell.Node 6.S") { + petDisplayMessage(2, "You are standing outside the Pellerator."); + } + + petSetRemoteTarget(); + return true; +} + +bool CCallPellerator::LeaveViewMsg(CLeaveViewMsg *msg) { + petClear(); + return true; +} + +bool CCallPellerator::PETActivateMsg(CPETActivateMsg *msg) { + CString name = getFullViewName(); + + if (msg->_name == "Pellerator") { + if (petDoorOrBellbotPresent()) { + petDisplayMessage("I'm sorry, you cannot enter this pellerator at present as a bot is in the way."); + } else if (name == "Bar.Node 1.S") { + changeView("Pellerator.Node 1.S"); + } else { + changeView("Pellerator.Node 1.N"); + } + } + + return true; +} + +bool CCallPellerator::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/game/call_pellerator.h b/engines/titanic/moves/call_pellerator.h index 7da4b40794..3a1ef3823a 100644 --- a/engines/titanic/game/call_pellerator.h +++ b/engines/titanic/moves/call_pellerator.h @@ -24,10 +24,16 @@ #define TITANIC_CALL_PELLERATOR_H #include "titanic/core/game_object.h" +#include "titanic/messages/pet_messages.h" namespace Titanic { class CCallPellerator : public CGameObject { + DECLARE_MESSAGE_MAP; + bool EnterViewMsg(CEnterViewMsg *msg); + bool LeaveViewMsg(CLeaveViewMsg *msg); + bool PETActivateMsg(CPETActivateMsg *msg); + bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); public: CLASSDEF; diff --git a/engines/titanic/moves/exit_pellerator.cpp b/engines/titanic/moves/exit_pellerator.cpp index 68a2a8da91..12ca2c1e3c 100644 --- a/engines/titanic/moves/exit_pellerator.cpp +++ b/engines/titanic/moves/exit_pellerator.cpp @@ -21,9 +21,16 @@ */ #include "titanic/moves/exit_pellerator.h" +#include "titanic/game/transport/pellerator.h" namespace Titanic { +BEGIN_MESSAGE_MAP(CExitPellerator, CGameObject) + ON_MESSAGE(MouseButtonDownMsg) + ON_MESSAGE(StatusChangeMsg) + ON_MESSAGE(ChangeSeasonMsg) +END_MESSAGE_MAP() + CExitPelleratorStatics *CExitPellerator::_statics; void CExitPellerator::init() { @@ -38,7 +45,7 @@ void CExitPellerator::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeQuotedLine(_statics->_v1, indent); file->writeNumberLine(_statics->_v2, indent); - file->writeNumberLine(_statics->_v3, indent); + file->writeNumberLine(_statics->_isWinter, indent); CGameObject::save(file, indent); } @@ -47,9 +54,84 @@ void CExitPellerator::load(SimpleFile *file) { file->readNumber(); _statics->_v1 = file->readString(); _statics->_v2 = file->readNumber(); - _statics->_v3 = file->readNumber(); + _statics->_isWinter = file->readNumber(); CGameObject::load(file); } +bool CExitPellerator::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { + CString name = getName(); + + if (name == "ExitPellerator") { + if (_statics->_v2 != 2) { + switch (getRandomNumber(2)) { + case 0: + CPellerator::_soundHandle = queueSound("z#457.wav", CPellerator::_soundHandle); + break; + case 1: + CPellerator::_soundHandle = queueSound("z#458.wav", CPellerator::_soundHandle); + break; + default: + CPellerator::_soundHandle = queueSound("z#464.wav", CPellerator::_soundHandle); + break; + } + } + + switch (_statics->_v2) { + case 0: + changeView("PromenadeDeck.Node 1.W"); + break; + case 1: + changeView("MusicRoomLobby.Node 1.S"); + break; + case 4: + changeView("TopOfWell.Node 6.N"); + break; + case 5: + changeView("1stClassRestaurant.Lobby Node.E"); + break; + case 6: + changeView(_statics->_isWinter ? "FrozenArboretum.Node 4.S" : "Arboretum.Node 4.W"); + break; + default: + petDisplayMessage(2, "Please exit from the other side."); + CPellerator::_soundHandle = queueSound("z#438.wav", CPellerator::_soundHandle); + + } + } else if (name == "ExitPellerator2") { + if (_statics->_v2 == 2) { + switch (getRandomNumber(2)) { + case 0: + CPellerator::_soundHandle = queueSound("z#457.wav", CPellerator::_soundHandle); + break; + case 1: + CPellerator::_soundHandle = queueSound("z#458.wav", CPellerator::_soundHandle); + break; + default: + CPellerator::_soundHandle = queueSound("z#464.wav", CPellerator::_soundHandle); + break; + } + } + + if (_statics->_v2 == 2) { + changeView("Bar.Node 1.N"); + } else { + petDisplayMessage(2, "Please exit from the other side."); + CPellerator::_soundHandle = queueSound("z#438.wav", CPellerator::_soundHandle); + } + } + + return true; +} + +bool CExitPellerator::StatusChangeMsg(CStatusChangeMsg *msg) { + _statics->_v2 = msg->_newStatus; + return true; +} + +bool CExitPellerator::ChangeSeasonMsg(CChangeSeasonMsg *msg) { + _statics->_isWinter = msg->_season == "Winter"; + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/moves/exit_pellerator.h b/engines/titanic/moves/exit_pellerator.h index 280d1e9a6c..8819d64355 100644 --- a/engines/titanic/moves/exit_pellerator.h +++ b/engines/titanic/moves/exit_pellerator.h @@ -30,10 +30,14 @@ namespace Titanic { struct CExitPelleratorStatics { CString _v1; int _v2; - int _v3; + bool _isWinter; }; class CExitPellerator : public CGameObject { + DECLARE_MESSAGE_MAP; + bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); + bool StatusChangeMsg(CStatusChangeMsg *msg); + bool ChangeSeasonMsg(CChangeSeasonMsg *msg); private: static CExitPelleratorStatics *_statics; public: |