diff options
Diffstat (limited to 'engines/titanic/game/transport')
-rw-r--r-- | engines/titanic/game/transport/pellerator.cpp | 97 | ||||
-rw-r--r-- | engines/titanic/game/transport/pellerator.h | 8 |
2 files changed, 99 insertions, 6 deletions
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 |