diff options
author | Paul Gilbert | 2016-08-27 12:45:36 -0400 |
---|---|---|
committer | Paul Gilbert | 2016-08-27 12:45:36 -0400 |
commit | 5ea32efbb0ecb3e6b8336ad3c2edd3905ea5b89a (patch) | |
tree | 7f5e6d224f8d14a1ef8f69a83c91b498ec80add3 /engines/titanic/game/port_hole.cpp | |
parent | c1b6fc3824018118618685fcbfcabe413e865531 (diff) | |
download | scummvm-rg350-5ea32efbb0ecb3e6b8336ad3c2edd3905ea5b89a.tar.gz scummvm-rg350-5ea32efbb0ecb3e6b8336ad3c2edd3905ea5b89a.tar.bz2 scummvm-rg350-5ea32efbb0ecb3e6b8336ad3c2edd3905ea5b89a.zip |
TITANIC: Implemented more game classes
Diffstat (limited to 'engines/titanic/game/port_hole.cpp')
-rw-r--r-- | engines/titanic/game/port_hole.cpp | 62 |
1 files changed, 54 insertions, 8 deletions
diff --git a/engines/titanic/game/port_hole.cpp b/engines/titanic/game/port_hole.cpp index f3c447f443..25807b1b1d 100644 --- a/engines/titanic/game/port_hole.cpp +++ b/engines/titanic/game/port_hole.cpp @@ -24,26 +24,72 @@ namespace Titanic { -CPortHole::CPortHole() : CGameObject(), _fieldBC(0), - _string1("b#47.wav"), _string2("b#46.wav") { +BEGIN_MESSAGE_MAP(CPortHole, CGameObject) + ON_MESSAGE(ActMsg) + ON_MESSAGE(MovieEndMsg) + ON_MESSAGE(LeaveViewMsg) + ON_MESSAGE(EnterViewMsg) +END_MESSAGE_MAP() + +CPortHole::CPortHole() : CGameObject(), _open(false), + _closeSoundName("b#47.wav"), _openSoundName("b#46.wav") { } void CPortHole::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); - file->writeNumberLine(_fieldBC, indent); - file->writeQuotedLine(_string1, indent); - file->writeQuotedLine(_string2, indent); + file->writeNumberLine(_open, indent); + file->writeQuotedLine(_closeSoundName, indent); + file->writeQuotedLine(_openSoundName, indent); CGameObject::save(file, indent); } void CPortHole::load(SimpleFile *file) { file->readNumber(); - _fieldBC = file->readNumber(); - _string1 = file->readString(); - _string2 = file->readString(); + _open = file->readNumber(); + _closeSoundName = file->readString(); + _openSoundName = file->readString(); CGameObject::load(file); } +bool CPortHole::ActMsg(CActMsg *msg) { + if (msg->_action == "TogglePortHole") { + if (_open) { + playMovie(14, 26, MOVIE_NOTIFY_OBJECT); + playSound(_closeSoundName); + _open = false; + } else { + setVisible(true); + playMovie(1, 13, 0); + playSound(_openSoundName); + _open = true; + } + } + + return true; +} + +bool CPortHole::MovieEndMsg(CMovieEndMsg *msg) { + _open = false; + setVisible(false); + return true; +} + +bool CPortHole::LeaveViewMsg(CLeaveViewMsg *msg) { + if (_open) { + playSound(_closeSoundName); + playMovie(14, 26, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + _open = false; + } + + return true; +} + +bool CPortHole::EnterViewMsg(CEnterViewMsg *msg) { + setVisible(false); + _open = false; + return true; +} + } // End of namespace Titanic |