aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorPaul Gilbert2016-08-08 18:34:48 -0400
committerPaul Gilbert2016-08-08 18:34:48 -0400
commitacdf655b91826039382144b30178e89e99fe7c7a (patch)
tree1ee5a569ab99b9a594674597368a9250582361ca /engines
parent42c385f26b211230c4dce823d7d34a311aa8853d (diff)
downloadscummvm-rg350-acdf655b91826039382144b30178e89e99fe7c7a.tar.gz
scummvm-rg350-acdf655b91826039382144b30178e89e99fe7c7a.tar.bz2
scummvm-rg350-acdf655b91826039382144b30178e89e99fe7c7a.zip
TITANIC: Implemented CAutoMusicPlayer class
Diffstat (limited to 'engines')
-rw-r--r--engines/titanic/sound/auto_music_player.cpp25
-rw-r--r--engines/titanic/sound/auto_music_player.h6
-rw-r--r--engines/titanic/sound/seasonal_music_player.h2
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 */