diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/titanic/sound/auto_music_player.cpp | 25 | ||||
-rw-r--r-- | engines/titanic/sound/auto_music_player.h | 6 | ||||
-rw-r--r-- | engines/titanic/sound/seasonal_music_player.h | 2 |
3 files changed, 28 insertions, 5 deletions
diff --git a/engines/titanic/sound/auto_music_player.cpp b/engines/titanic/sound/auto_music_player.cpp index f06999e35e..ce20c33765 100644 --- a/engines/titanic/sound/auto_music_player.cpp +++ b/engines/titanic/sound/auto_music_player.cpp @@ -24,19 +24,24 @@ namespace Titanic { +BEGIN_MESSAGE_MAP(CAutoMusicPlayer, CAutoMusicPlayerBase) + ON_MESSAGE(EnterRoomMsg) + ON_MESSAGE(LeaveRoomMsg) +END_MESSAGE_MAP() + CAutoMusicPlayer::CAutoMusicPlayer() : CAutoMusicPlayerBase() { } void CAutoMusicPlayer::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); - file->writeQuotedLine(_string2, indent); + file->writeQuotedLine(_leaveRoomSound, indent); CAutoMusicPlayerBase::save(file, indent); } void CAutoMusicPlayer::load(SimpleFile *file) { file->readNumber(); - _string2 = file->readString(); + _leaveRoomSound = file->readString(); CAutoMusicPlayerBase::load(file); } @@ -51,4 +56,20 @@ bool CAutoMusicPlayer::EnterRoomMsg(CEnterRoomMsg *msg) { return true; } +bool CAutoMusicPlayer::LeaveRoomMsg(CLeaveRoomMsg *msg) { + if (_isRepeated) { + CRoomItem *room = findRoom(); + if (msg->_oldRoom == room) { + CChangeMusicMsg changeMsg; + changeMsg._flags = 1; + changeMsg.execute(this); + } + } + + if (!_leaveRoomSound.empty()) + playSound(_leaveRoomSound); + + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/sound/auto_music_player.h b/engines/titanic/sound/auto_music_player.h index e9e9763116..722aa9cd7f 100644 --- a/engines/titanic/sound/auto_music_player.h +++ b/engines/titanic/sound/auto_music_player.h @@ -29,9 +29,11 @@ namespace Titanic { class CAutoMusicPlayer : public CAutoMusicPlayerBase { + DECLARE_MESSAGE_MAP; bool EnterRoomMsg(CEnterRoomMsg *msg); + bool LeaveRoomMsg(CLeaveRoomMsg *msg); private: - CString _string2; + CString _leaveRoomSound; public: CLASSDEF; CAutoMusicPlayer(); @@ -49,4 +51,4 @@ public: } // End of namespace Titanic -#endif /* TITANIC_LINK_ITEM_H */ +#endif /* TITANIC_AUTO_MUSIC_PLAYER_H */ diff --git a/engines/titanic/sound/seasonal_music_player.h b/engines/titanic/sound/seasonal_music_player.h index c5259e2715..d6a79d73da 100644 --- a/engines/titanic/sound/seasonal_music_player.h +++ b/engines/titanic/sound/seasonal_music_player.h @@ -58,4 +58,4 @@ public: } // End of namespace Titanic -#endif /* TITANIC_LINK_ITEM_H */ +#endif /* TITANIC_SEASONAL_MUSIC_PLAYER_H */ |