diff options
author | Paul Gilbert | 2016-08-17 19:43:24 -0400 |
---|---|---|
committer | Paul Gilbert | 2016-08-17 19:43:24 -0400 |
commit | 41dab514e1f7dc4bbf9ff9bab21c5dc5cad7812f (patch) | |
tree | b0b41bfc6d5d5a61ac8e5ed9c341ed309f9a5f0a /engines/titanic/game | |
parent | c628f7224f336e353d56990977d3683d905877ab (diff) | |
download | scummvm-rg350-41dab514e1f7dc4bbf9ff9bab21c5dc5cad7812f.tar.gz scummvm-rg350-41dab514e1f7dc4bbf9ff9bab21c5dc5cad7812f.tar.bz2 scummvm-rg350-41dab514e1f7dc4bbf9ff9bab21c5dc5cad7812f.zip |
TITANIC: Implemented CCaptainsWheel class
Diffstat (limited to 'engines/titanic/game')
-rw-r--r-- | engines/titanic/game/captains_wheel.cpp | 153 | ||||
-rw-r--r-- | engines/titanic/game/captains_wheel.h | 7 |
2 files changed, 160 insertions, 0 deletions
diff --git a/engines/titanic/game/captains_wheel.cpp b/engines/titanic/game/captains_wheel.cpp index c84c9194ce..79908b561d 100644 --- a/engines/titanic/game/captains_wheel.cpp +++ b/engines/titanic/game/captains_wheel.cpp @@ -24,6 +24,15 @@ namespace Titanic { +BEGIN_MESSAGE_MAP(CCaptainsWheel, CBackground) + ON_MESSAGE(MouseButtonDownMsg) + ON_MESSAGE(LeaveViewMsg) + ON_MESSAGE(ActMsg) + ON_MESSAGE(TurnOff) + ON_MESSAGE(TurnOn) + ON_MESSAGE(MovieEndMsg) +END_MESSAGE_MAP() + CCaptainsWheel::CCaptainsWheel() : CBackground(), _fieldE0(0), _fieldE4(0), _fieldE8(0), _fieldEC(0), _fieldF0(0), _fieldF4(0) { @@ -53,4 +62,148 @@ void CCaptainsWheel::load(SimpleFile *file) { CBackground::load(file); } +bool CCaptainsWheel::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { + if (_fieldE0) { + _fieldE0 = false; + CTurnOff offMsg; + offMsg.execute(this); + playMovie(162, 168, 0); + } else { + playMovie(0, 8, MOVIE_NOTIFY_OBJECT); + } + + return true; +} + +bool CCaptainsWheel::LeaveViewMsg(CLeaveViewMsg *msg) { + if (_fieldE0) { + _fieldE0 = false; + CTurnOff offMsg; + offMsg.execute(this); + playMovie(162, 168, MOVIE_GAMESTATE); + } + + return true; +} + +bool CCaptainsWheel::ActMsg(CActMsg *msg) { + if (msg->_action == "Spin") { + if (_fieldE0) { + CTurnOn onMsg; + onMsg.execute("RatchetySound"); + playMovie(8, 142, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + } + } else if (msg->_action == "Honk") { + if (_fieldE0) { + playMovie(150, 160, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + } + } else if (msg->_action == "Go") { + if (!_fieldE0) { + inc54(); + _fieldE0 = false; + _fieldE4 = 1; + + CTurnOff offMsg; + offMsg.execute(this); + playMovie(162, 168, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + } + } else if (msg->_action == "Cruise") { + if (_fieldE0) { + inc54(); + _fieldE0 = false; + _fieldE4 = 2; + + CTurnOff offMsg; + offMsg.execute(this); + playMovie(162, 168, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + } + } else if (msg->_action == "SetDestin") { + playSound("a#44.wav"); + CSetVolumeMsg volumeMsg; + volumeMsg._volume = 25; + volumeMsg.execute("EngineSounds"); + CTurnOn onMsg; + onMsg.execute("EngineSounds"); + _fieldF0 = 1; + } else if (msg->_action == "ClearDestin") { + _fieldF0 = 0; + } + + return true; +} + +bool CCaptainsWheel::TurnOff(CTurnOff *msg) { + CSignalObject signalMsg; + signalMsg._numValue = 0; + + static const char *const NAMES[8] = { + "WheelSpin", "SeagullHorn", "WheelStopButt", "StopHotSpot", + "WheelCruiseButt", "CruiseHotSpot", "WheelGoButt","GoHotSpot" + }; + for (int idx = 0; idx < 8; ++idx) + signalMsg.execute(NAMES[idx]); + + return true; +} + +bool CCaptainsWheel::TurnOn(CTurnOn *msg) { + CSignalObject signalMsg; + signalMsg._numValue = 1; + signalMsg.execute("WheelSpin"); + signalMsg.execute("SeagullHorn"); + + if (_fieldE0) { + signalMsg.execute("WheelStopButt"); + signalMsg.execute("StopHotSpot"); + } + + if (_fieldEC) { + signalMsg.execute("WheelCruiseButt"); + signalMsg.execute("CruiseHotSpot"); + } + + if (_fieldF0) { + signalMsg.execute("WheelGoButt"); + signalMsg.execute("GoHotSpot"); + } + + return true; +} + +bool CCaptainsWheel::MovieEndMsg(CMovieEndMsg *msg) { + if (msg->_endFrame == 8) { + _fieldE0 = true; + CTurnOn onMsg; + onMsg.execute(this); + } + + if (msg->_endFrame == 142) { + CTurnOff offMsg; + offMsg.execute("RatchetySound"); + } + + if (msg->_endFrame == 168) { + switch (_fieldE4) { + case 1: { + CActMsg actMsg(starFn2() ? "GoEnd" : "Go"); + actMsg.execute("GoSequence"); + break; + } + + case 2: { + CActMsg actMsg("Cruise"); + actMsg.execute("CruiseSequence"); + break; + } + + default: + break; + } + + _fieldE4 = 0; + } + + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/game/captains_wheel.h b/engines/titanic/game/captains_wheel.h index 549dcbe685..3aca45c21f 100644 --- a/engines/titanic/game/captains_wheel.h +++ b/engines/titanic/game/captains_wheel.h @@ -28,6 +28,13 @@ namespace Titanic { class CCaptainsWheel : public CBackground { + DECLARE_MESSAGE_MAP; + bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); + bool LeaveViewMsg(CLeaveViewMsg *msg); + bool ActMsg(CActMsg *msg); + bool TurnOff(CTurnOff *msg); + bool TurnOn(CTurnOn *msg); + bool MovieEndMsg(CMovieEndMsg *msg); public: int _fieldE0; int _fieldE4; |