diff options
author | Paul Gilbert | 2016-08-12 23:53:18 -0400 |
---|---|---|
committer | Paul Gilbert | 2016-08-12 23:53:18 -0400 |
commit | 6a9923ec07d019cbbf8c35e36030391dac256e79 (patch) | |
tree | 0779d0d2489a9f6fda7f9c3e17484213d53d752e /engines/titanic/game/bar_bell.cpp | |
parent | 4f8c31ecf7c8ac71e1be65771ce508fb11c62749 (diff) | |
download | scummvm-rg350-6a9923ec07d019cbbf8c35e36030391dac256e79.tar.gz scummvm-rg350-6a9923ec07d019cbbf8c35e36030391dac256e79.tar.bz2 scummvm-rg350-6a9923ec07d019cbbf8c35e36030391dac256e79.zip |
TITANIC: Implemented some game object classes
Diffstat (limited to 'engines/titanic/game/bar_bell.cpp')
-rw-r--r-- | engines/titanic/game/bar_bell.cpp | 83 |
1 files changed, 78 insertions, 5 deletions
diff --git a/engines/titanic/game/bar_bell.cpp b/engines/titanic/game/bar_bell.cpp index b33ee1c26c..207644a00e 100644 --- a/engines/titanic/game/bar_bell.cpp +++ b/engines/titanic/game/bar_bell.cpp @@ -24,15 +24,22 @@ namespace Titanic { +BEGIN_MESSAGE_MAP(CBarBell, CGameObject) + ON_MESSAGE(EnterRoomMsg) + ON_MESSAGE(MouseButtonDownMsg) + ON_MESSAGE(MouseButtonUpMsg) + ON_MESSAGE(ActMsg) +END_MESSAGE_MAP() + CBarBell::CBarBell() : CGameObject(), _fieldBC(0), - _fieldC0(65), _fieldC4(0), _fieldC8(0), _fieldCC(0) { + _volume(65), _soundVal3(0), _fieldC8(0), _fieldCC(0) { } void CBarBell::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_fieldBC, indent); - file->writeNumberLine(_fieldC0, indent); - file->writeNumberLine(_fieldC4, indent); + file->writeNumberLine(_volume, indent); + file->writeNumberLine(_soundVal3, indent); file->writeNumberLine(_fieldC8, indent); file->writeNumberLine(_fieldCC, indent); @@ -42,8 +49,8 @@ void CBarBell::save(SimpleFile *file, int indent) { void CBarBell::load(SimpleFile *file) { file->readNumber(); _fieldBC = file->readNumber(); - _fieldC0 = file->readNumber(); - _fieldC4 = file->readNumber(); + _volume = file->readNumber(); + _soundVal3 = file->readNumber(); _fieldC8 = file->readNumber(); _fieldCC = file->readNumber(); @@ -55,4 +62,70 @@ bool CBarBell::EnterRoomMsg(CEnterRoomMsg *msg) { return true; } +bool CBarBell::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { + if ((_fieldC8 % 3) == 2) { + switch (_fieldBC) { + case 0: + case 1: + case 5: + playSound("c#54.wav", _volume, _soundVal3); + break; + + case 2: + playSound("c#52.wav", _volume, _soundVal3); + break; + + case 3: + playSound("c#53.wav", _volume, _soundVal3); + break; + + case 4: + playSound("c#55.wav", _volume, _soundVal3); + break; + + default: + playSound("c#51.wav", _volume, _soundVal3); + break; + } + } else if (_fieldBC >= 5) { + if (_fieldBC == 6) { + CActMsg actMsg("BellRing3"); + actMsg.execute("Barbot"); + } + + playSound("c#51.wav", _volume, _soundVal3); + } else { + if (_fieldBC == 3) { + CActMsg actMsg("BellRing1"); + actMsg.execute("Barbot"); + } else if (_fieldBC == 4) { + CActMsg actMsg("BellRing2"); + actMsg.execute("Barbot"); + } + + playSound("c#54.wav", _volume, _soundVal3); + } + + return true; +} + +bool CBarBell::MouseButtonUpMsg(CMouseButtonUpMsg *msg) { + if (!_fieldBC) { + CTurnOn onMsg; + onMsg.execute("Barbot"); + } + + ++_fieldBC; + return 2; +} + +bool CBarBell::ActMsg(CActMsg *msg) { + if (msg->_action == "ResetCount") { + _fieldBC = 0; + ++_fieldC8; + } + + return true; +} + } // End of namespace Titanic |