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 | |
parent | 4f8c31ecf7c8ac71e1be65771ce508fb11c62749 (diff) | |
download | scummvm-rg350-6a9923ec07d019cbbf8c35e36030391dac256e79.tar.gz scummvm-rg350-6a9923ec07d019cbbf8c35e36030391dac256e79.tar.bz2 scummvm-rg350-6a9923ec07d019cbbf8c35e36030391dac256e79.zip |
TITANIC: Implemented some game object classes
-rw-r--r-- | engines/titanic/carry/auditory_centre.cpp | 10 | ||||
-rw-r--r-- | engines/titanic/carry/auditory_centre.h | 2 | ||||
-rw-r--r-- | engines/titanic/game/annoy_barbot.cpp | 13 | ||||
-rw-r--r-- | engines/titanic/game/annoy_barbot.h | 2 | ||||
-rw-r--r-- | engines/titanic/game/auto_animate.cpp | 30 | ||||
-rw-r--r-- | engines/titanic/game/auto_animate.h | 8 | ||||
-rw-r--r-- | engines/titanic/game/bar_bell.cpp | 83 | ||||
-rw-r--r-- | engines/titanic/game/bar_bell.h | 8 | ||||
-rw-r--r-- | engines/titanic/messages/auto_sound_event.cpp | 13 | ||||
-rw-r--r-- | engines/titanic/messages/auto_sound_event.h | 2 |
10 files changed, 155 insertions, 16 deletions
diff --git a/engines/titanic/carry/auditory_centre.cpp b/engines/titanic/carry/auditory_centre.cpp index d88989a801..0bda975a36 100644 --- a/engines/titanic/carry/auditory_centre.cpp +++ b/engines/titanic/carry/auditory_centre.cpp @@ -24,6 +24,10 @@ namespace Titanic { +BEGIN_MESSAGE_MAP(CAuditoryCentre, CBrain) + ON_MESSAGE(PuzzleSolvedMsg) +END_MESSAGE_MAP() + void CAuditoryCentre::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CBrain::save(file, indent); @@ -34,4 +38,10 @@ void CAuditoryCentre::load(SimpleFile *file) { CBrain::load(file); } +bool CAuditoryCentre::PuzzleSolvedMsg(CPuzzleSolvedMsg *msg) { + _fieldE0 = 1; + setVisible(true); + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/carry/auditory_centre.h b/engines/titanic/carry/auditory_centre.h index 743f8f2498..6f24e86208 100644 --- a/engines/titanic/carry/auditory_centre.h +++ b/engines/titanic/carry/auditory_centre.h @@ -28,6 +28,8 @@ namespace Titanic { class CAuditoryCentre : public CBrain { + DECLARE_MESSAGE_MAP; + bool PuzzleSolvedMsg(CPuzzleSolvedMsg *msg); public: CLASSDEF; diff --git a/engines/titanic/game/annoy_barbot.cpp b/engines/titanic/game/annoy_barbot.cpp index d69d9fff3c..8b22f9c13a 100644 --- a/engines/titanic/game/annoy_barbot.cpp +++ b/engines/titanic/game/annoy_barbot.cpp @@ -26,6 +26,10 @@ namespace Titanic { int CAnnoyBarbot::_v1; +BEGIN_MESSAGE_MAP(CAnnoyBarbot, CGameObject) + ON_MESSAGE(MouseButtonDownMsg) +END_MESSAGE_MAP() + void CAnnoyBarbot::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_v1, indent); @@ -38,4 +42,13 @@ void CAnnoyBarbot::load(SimpleFile *file) { CGameObject::load(file); } +bool CAnnoyBarbot::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { + if ((++_v1 % 3) == 1) { + CActMsg actMsg("GoRingBell"); + actMsg.execute("Barbot"); + } + + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/game/annoy_barbot.h b/engines/titanic/game/annoy_barbot.h index 955a82bdf8..0ccfe43794 100644 --- a/engines/titanic/game/annoy_barbot.h +++ b/engines/titanic/game/annoy_barbot.h @@ -28,6 +28,8 @@ namespace Titanic { class CAnnoyBarbot : public CGameObject { + DECLARE_MESSAGE_MAP; + bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); private: static int _v1; public: diff --git a/engines/titanic/game/auto_animate.cpp b/engines/titanic/game/auto_animate.cpp index 172b8c44df..16e6e56747 100644 --- a/engines/titanic/game/auto_animate.cpp +++ b/engines/titanic/game/auto_animate.cpp @@ -24,24 +24,44 @@ namespace Titanic { +BEGIN_MESSAGE_MAP(CAutoAnimate, CBackground) + ON_MESSAGE(EnterViewMsg) + ON_MESSAGE(InitializeAnimMsg) +END_MESSAGE_MAP() + void CAutoAnimate::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); - file->writeNumberLine(_fieldE0, indent); + file->writeNumberLine(_enabled, indent); file->writeNumberLine(_fieldE4, indent); - file->writeNumberLine(_fieldE8, indent); + file->writeNumberLine(_repeat, indent); CBackground::save(file, indent); } void CAutoAnimate::load(SimpleFile *file) { file->readNumber(); - _fieldE0 = file->readNumber(); + _enabled = file->readNumber(); _fieldE4 = file->readNumber(); - _fieldE8 = file->readNumber(); + _repeat = file->readNumber(); CBackground::load(file); } bool CAutoAnimate::EnterViewMsg(CEnterViewMsg *msg) { - warning("CAutoAnimate::handleEvent"); + if (_enabled) { + uint flags = _repeat ? MOVIE_REPEAT : 0; + if (_startFrame != _endFrame) + playMovie(_startFrame, _endFrame, flags); + else + playMovie(flags); + + if (!_fieldE4) + _enabled = false; + } + + return true; +} + +bool CAutoAnimate::InitializeAnimMsg(CInitializeAnimMsg *msg) { + _enabled = true; return true; } diff --git a/engines/titanic/game/auto_animate.h b/engines/titanic/game/auto_animate.h index 7bca808bfb..735aba922e 100644 --- a/engines/titanic/game/auto_animate.h +++ b/engines/titanic/game/auto_animate.h @@ -29,14 +29,16 @@ namespace Titanic { class CAutoAnimate : public CBackground { + DECLARE_MESSAGE_MAP; bool EnterViewMsg(CEnterViewMsg *msg); + bool InitializeAnimMsg(CInitializeAnimMsg *msg); private: - int _fieldE0; + bool _enabled; int _fieldE4; - int _fieldE8; + bool _repeat; public: CLASSDEF; - CAutoAnimate() : CBackground(), _fieldE0(1), _fieldE4(1), _fieldE8(0) {} + CAutoAnimate() : CBackground(), _enabled(true), _fieldE4(1), _repeat(false) {} /** * Save the data for the class to file 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 diff --git a/engines/titanic/game/bar_bell.h b/engines/titanic/game/bar_bell.h index 5d1d2c54e0..b50fe505ba 100644 --- a/engines/titanic/game/bar_bell.h +++ b/engines/titanic/game/bar_bell.h @@ -29,11 +29,15 @@ namespace Titanic { class CBarBell : public CGameObject { + DECLARE_MESSAGE_MAP; bool EnterRoomMsg(CEnterRoomMsg *msg); + bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); + bool MouseButtonUpMsg(CMouseButtonUpMsg *msg); + bool ActMsg(CActMsg *msg); public: int _fieldBC; - int _fieldC0; - int _fieldC4; + int _volume; + int _soundVal3; int _fieldC8; int _fieldCC; public: diff --git a/engines/titanic/messages/auto_sound_event.cpp b/engines/titanic/messages/auto_sound_event.cpp index baa11c7d41..bc2cd7d074 100644 --- a/engines/titanic/messages/auto_sound_event.cpp +++ b/engines/titanic/messages/auto_sound_event.cpp @@ -24,7 +24,11 @@ namespace Titanic { -CAutoSoundEvent::CAutoSoundEvent() : CGameObject(), _value1(0), _value2(70) { +BEGIN_MESSAGE_MAP(CAutoSoundEvent, CGameObject) + ON_MESSAGE(FrameMsg) +END_MESSAGE_MAP() + +CAutoSoundEvent::CAutoSoundEvent() : CGameObject(), _value1(0), _value2(0xFFFFFF) { } void CAutoSoundEvent::save(SimpleFile *file, int indent) { @@ -43,4 +47,11 @@ void CAutoSoundEvent::load(SimpleFile *file) { CGameObject::load(file); } +bool CAutoSoundEvent::FrameMsg(CFrameMsg *msg) { + if (_value1 >= 0) + _value1 = (_value1 + 1) & _value2; + + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/messages/auto_sound_event.h b/engines/titanic/messages/auto_sound_event.h index eb1c11c4ff..d88976708e 100644 --- a/engines/titanic/messages/auto_sound_event.h +++ b/engines/titanic/messages/auto_sound_event.h @@ -28,6 +28,8 @@ namespace Titanic { class CAutoSoundEvent : public CGameObject { + DECLARE_MESSAGE_MAP; + bool FrameMsg(CFrameMsg *msg); public: int _value1; int _value2; |