diff options
author | Paul Gilbert | 2016-08-16 21:04:19 -0400 |
---|---|---|
committer | Paul Gilbert | 2016-08-16 21:04:19 -0400 |
commit | 4c7985c3c9cb1e8023c6d1be5b5ed09fbfba2011 (patch) | |
tree | 92c4b2f298aaa4a4783de1395e13ae5890cc0477 /engines/titanic/game/transport/pellerator.cpp | |
parent | 80fd795b80d9e9f5f6ca444b844d867f2172d74e (diff) | |
download | scummvm-rg350-4c7985c3c9cb1e8023c6d1be5b5ed09fbfba2011.tar.gz scummvm-rg350-4c7985c3c9cb1e8023c6d1be5b5ed09fbfba2011.tar.bz2 scummvm-rg350-4c7985c3c9cb1e8023c6d1be5b5ed09fbfba2011.zip |
TITANIC: Implemented various pellerator classes
Diffstat (limited to 'engines/titanic/game/transport/pellerator.cpp')
-rw-r--r-- | engines/titanic/game/transport/pellerator.cpp | 97 |
1 files changed, 93 insertions, 4 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; } |