aboutsummaryrefslogtreecommitdiff
path: root/engines/titanic
diff options
context:
space:
mode:
authorPaul Gilbert2017-10-13 17:51:49 -0400
committerPaul Gilbert2017-10-13 17:51:49 -0400
commit1d8ccbe1eae59811c90d5a6a22870e97272e178d (patch)
treebb9ac838121db6ffd6947df3e5779ca70f3abcea /engines/titanic
parent44aaaf43b8bd3ca32ffde185f4d9f6dd18ab2d5c (diff)
downloadscummvm-rg350-1d8ccbe1eae59811c90d5a6a22870e97272e178d.tar.gz
scummvm-rg350-1d8ccbe1eae59811c90d5a6a22870e97272e178d.tar.bz2
scummvm-rg350-1d8ccbe1eae59811c90d5a6a22870e97272e178d.zip
TITANIC: Cleanup of auto music player classes and messages
Diffstat (limited to 'engines/titanic')
-rw-r--r--engines/titanic/game/bridge_view.cpp2
-rw-r--r--engines/titanic/game/computer_screen.cpp2
-rw-r--r--engines/titanic/game/emma_control.cpp2
-rw-r--r--engines/titanic/messages/messages.h5
-rw-r--r--engines/titanic/sound/auto_music_player.cpp6
-rw-r--r--engines/titanic/sound/auto_music_player_base.cpp20
-rw-r--r--engines/titanic/sound/auto_music_player_base.h2
-rw-r--r--engines/titanic/sound/node_auto_sound_player.cpp4
-rw-r--r--engines/titanic/sound/restricted_auto_music_player.cpp4
-rw-r--r--engines/titanic/sound/seasonal_music_player.cpp10
-rw-r--r--engines/titanic/sound/trigger_auto_music_player.cpp4
-rw-r--r--engines/titanic/sound/view_auto_sound_player.cpp4
12 files changed, 34 insertions, 31 deletions
diff --git a/engines/titanic/game/bridge_view.cpp b/engines/titanic/game/bridge_view.cpp
index 608724c16c..d98cee13c0 100644
--- a/engines/titanic/game/bridge_view.cpp
+++ b/engines/titanic/game/bridge_view.cpp
@@ -77,7 +77,7 @@ bool CBridgeView::ActMsg(CActMsg *msg) {
hideMouse();
CChangeMusicMsg musicMsg;
- musicMsg._flags = 1;
+ musicMsg._action = MUSIC_STOP;
musicMsg.execute("BridgeAutoMusicPlayer");
playSound(TRANSLATE("a#42.wav", "a#35.wav"));
playMovie(MOVIE_NOTIFY_OBJECT);
diff --git a/engines/titanic/game/computer_screen.cpp b/engines/titanic/game/computer_screen.cpp
index dee469af1c..8150448be7 100644
--- a/engines/titanic/game/computer_screen.cpp
+++ b/engines/titanic/game/computer_screen.cpp
@@ -116,7 +116,7 @@ bool CComputerScreen::TimerMsg(CTimerMsg *msg) {
break;
case 2: {
- CChangeMusicMsg musicMsg(CString(), 1);
+ CChangeMusicMsg musicMsg(CString(), MUSIC_STOP);
musicMsg.execute("HomeMusicPlayer");
playSound(TRANSLATE("a#33.wav", "a#28.wav"));
playSound(TRANSLATE("a#31.wav", "a#26.wav"));
diff --git a/engines/titanic/game/emma_control.cpp b/engines/titanic/game/emma_control.cpp
index e3ba7cc42c..46cde9bfcd 100644
--- a/engines/titanic/game/emma_control.cpp
+++ b/engines/titanic/game/emma_control.cpp
@@ -57,7 +57,7 @@ bool CEmmaControl::EnterViewMsg(CEnterViewMsg *msg) {
bool CEmmaControl::StatusChangeMsg(CStatusChangeMsg *msg) {
_flag = !_flag;
setVisible(_flag);
- CChangeMusicMsg changeMsg(_flag ? _visibleSoundName : _hiddenSoundName, 0);
+ CChangeMusicMsg changeMsg(_flag ? _visibleSoundName : _hiddenSoundName, MUSIC_NONE);
changeMsg.execute(findRoom(), CAutoMusicPlayer::_type,
MSGFLAG_SCAN | MSGFLAG_BREAK_IF_HANDLED | MSGFLAG_CLASS_DEF);
return true;
diff --git a/engines/titanic/messages/messages.h b/engines/titanic/messages/messages.h
index 115976a70d..925898acc3 100644
--- a/engines/titanic/messages/messages.h
+++ b/engines/titanic/messages/messages.h
@@ -226,6 +226,9 @@ enum Movement {
MOVE_NONE = 0, MOVE_FORWARDS, MOVE_BACKWARDS, TURN_LEFT, TURN_RIGHT
};
+enum ChangeMusicAction {
+ MUSIC_NONE = 0, MUSIC_STOP = 1, MUSIC_START = 2
+};
class CMovementMsg : public CMessage {
public:
@@ -258,7 +261,7 @@ MESSAGE0(CArmPickedUpFromTableMsg);
MESSAGE0(CBodyInBilgeRoomMsg);
MESSAGE1(CBowlStateChangeMsg, int, state, 0);
MESSAGE2(CCarryObjectArrivedMsg, CString, strValue, "", int, numValue, 0);
-MESSAGE2(CChangeMusicMsg, CString, filename, "", int, flags, 0);
+MESSAGE2(CChangeMusicMsg, CString, filename, "", ChangeMusicAction, action, MUSIC_NONE);
MESSAGE1(CChangeSeasonMsg, CString, season, "Summer");
MESSAGE0(CCheckAllPossibleCodes);
MESSAGE2(CCheckChevCode, int, classNum, 0, uint, chevCode, 0);
diff --git a/engines/titanic/sound/auto_music_player.cpp b/engines/titanic/sound/auto_music_player.cpp
index ce20c33765..d77424c97f 100644
--- a/engines/titanic/sound/auto_music_player.cpp
+++ b/engines/titanic/sound/auto_music_player.cpp
@@ -47,7 +47,7 @@ void CAutoMusicPlayer::load(SimpleFile *file) {
}
bool CAutoMusicPlayer::EnterRoomMsg(CEnterRoomMsg *msg) {
- if (!_isRepeated) {
+ if (!_isEnabled) {
CRoomItem *room = findRoom();
if (msg->_newRoom == room)
addTimer(2000);
@@ -57,11 +57,11 @@ bool CAutoMusicPlayer::EnterRoomMsg(CEnterRoomMsg *msg) {
}
bool CAutoMusicPlayer::LeaveRoomMsg(CLeaveRoomMsg *msg) {
- if (_isRepeated) {
+ if (_isEnabled) {
CRoomItem *room = findRoom();
if (msg->_oldRoom == room) {
CChangeMusicMsg changeMsg;
- changeMsg._flags = 1;
+ changeMsg._action = MUSIC_STOP;
changeMsg.execute(this);
}
}
diff --git a/engines/titanic/sound/auto_music_player_base.cpp b/engines/titanic/sound/auto_music_player_base.cpp
index 96874768de..968344a5b5 100644
--- a/engines/titanic/sound/auto_music_player_base.cpp
+++ b/engines/titanic/sound/auto_music_player_base.cpp
@@ -32,13 +32,13 @@ BEGIN_MESSAGE_MAP(CAutoMusicPlayerBase, CGameObject)
END_MESSAGE_MAP()
CAutoMusicPlayerBase::CAutoMusicPlayerBase() : CGameObject(),
- _initialMute(true), _isRepeated(false), _volumeMode(VOL_NORMAL), _transition(1) {
+ _initialMute(true), _isEnabled(false), _volumeMode(VOL_NORMAL), _transition(1) {
}
void CAutoMusicPlayerBase::save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
file->writeQuotedLine(_filename, indent);
file->writeNumberLine(_initialMute, indent);
- file->writeNumberLine(_isRepeated, indent);
+ file->writeNumberLine(_isEnabled, indent);
file->writeNumberLine(_volumeMode, indent);
file->writeNumberLine(_transition, indent);
@@ -49,7 +49,7 @@ void CAutoMusicPlayerBase::load(SimpleFile *file) {
file->readNumber();
_filename = file->readString();
_initialMute = file->readNumber();
- _isRepeated = file->readNumber();
+ _isEnabled = file->readNumber();
_volumeMode = (VolumeMode)file->readNumber();
_transition = file->readNumber();
@@ -62,14 +62,14 @@ bool CAutoMusicPlayerBase::StatusChangeMsg(CStatusChangeMsg *msg) {
bool CAutoMusicPlayerBase::TimerMsg(CTimerMsg *msg) {
CChangeMusicMsg musicMsg;
- musicMsg._flags = 2;
+ musicMsg._action = MUSIC_START;
musicMsg.execute(this);
return true;
}
bool CAutoMusicPlayerBase::LoadSuccessMsg(CLoadSuccessMsg *msg) {
- if (_isRepeated)
+ if (_isEnabled)
playGlobalSound(_filename, _volumeMode, _initialMute, true, 0,
Audio::Mixer::kMusicSoundType);
@@ -77,23 +77,23 @@ bool CAutoMusicPlayerBase::LoadSuccessMsg(CLoadSuccessMsg *msg) {
}
bool CAutoMusicPlayerBase::ChangeMusicMsg(CChangeMusicMsg *msg) {
- if (_isRepeated && msg->_flags == 1) {
- _isRepeated = false;
+ if (_isEnabled && msg->_action == MUSIC_STOP) {
+ _isEnabled = false;
stopGlobalSound(_transition, -1);
}
if (!msg->_filename.empty()) {
_filename = msg->_filename;
- if (_isRepeated) {
+ if (_isEnabled) {
stopGlobalSound(_transition, -1);
playGlobalSound(_filename, _volumeMode, _initialMute, true, 0,
Audio::Mixer::kMusicSoundType);
}
}
- if (!_isRepeated && msg->_flags == 2) {
- _isRepeated = true;
+ if (!_isEnabled && msg->_action == MUSIC_START) {
+ _isEnabled = true;
playGlobalSound(_filename, _volumeMode, _initialMute, true, 0,
Audio::Mixer::kMusicSoundType);
}
diff --git a/engines/titanic/sound/auto_music_player_base.h b/engines/titanic/sound/auto_music_player_base.h
index 4dd0665488..d0392951bc 100644
--- a/engines/titanic/sound/auto_music_player_base.h
+++ b/engines/titanic/sound/auto_music_player_base.h
@@ -36,7 +36,7 @@ class CAutoMusicPlayerBase : public CGameObject {
protected:
CString _filename;
bool _initialMute;
- bool _isRepeated;
+ bool _isEnabled;
VolumeMode _volumeMode;
int _transition;
public:
diff --git a/engines/titanic/sound/node_auto_sound_player.cpp b/engines/titanic/sound/node_auto_sound_player.cpp
index 40b3d2ea39..60a93d6b69 100644
--- a/engines/titanic/sound/node_auto_sound_player.cpp
+++ b/engines/titanic/sound/node_auto_sound_player.cpp
@@ -53,7 +53,7 @@ bool CNodeAutoSoundPlayer::EnterNodeMsg(CEnterNodeMsg *msg) {
if (_enabled) {
CChangeMusicMsg changeMsg;
- changeMsg._flags = 1;
+ changeMsg._action = MUSIC_STOP;
changeMsg.execute(room, CAutoMusicPlayer::_type,
MSGFLAG_CLASS_DEF | MSGFLAG_BREAK_IF_HANDLED | MSGFLAG_SCAN);
}
@@ -72,7 +72,7 @@ bool CNodeAutoSoundPlayer::LeaveNodeMsg(CLeaveNodeMsg *msg) {
if (_enabled) {
CChangeMusicMsg changeMsg;
- changeMsg._flags = 2;
+ changeMsg._action = MUSIC_START;
changeMsg.execute(room, CAutoMusicPlayer::_type,
MSGFLAG_CLASS_DEF | MSGFLAG_BREAK_IF_HANDLED | MSGFLAG_SCAN);
}
diff --git a/engines/titanic/sound/restricted_auto_music_player.cpp b/engines/titanic/sound/restricted_auto_music_player.cpp
index 6b01052ebd..a75a55bb15 100644
--- a/engines/titanic/sound/restricted_auto_music_player.cpp
+++ b/engines/titanic/sound/restricted_auto_music_player.cpp
@@ -58,7 +58,7 @@ bool CRestrictedAutoMusicPlayer::EnterRoomMsg(CEnterRoomMsg *msg) {
CString roomName = msg->_oldRoom->getName();
if (!_oldRoomName.compareToIgnoreCase(roomName)) {
- _isRepeated = true;
+ _isEnabled = true;
return false;
} else {
return CAutoMusicPlayer::EnterRoomMsg(msg);
@@ -69,7 +69,7 @@ bool CRestrictedAutoMusicPlayer::LeaveRoomMsg(CLeaveRoomMsg *msg) {
CString roomName = msg->_newRoom->getName();
if (petCheckNode(_newNodeName) || !_newRoomName.compareToIgnoreCase(roomName)) {
- _isRepeated = false;
+ _isEnabled = false;
return true;
} else {
return CAutoMusicPlayer::LeaveRoomMsg(msg);
diff --git a/engines/titanic/sound/seasonal_music_player.cpp b/engines/titanic/sound/seasonal_music_player.cpp
index 637a0020ba..ff5e4809f8 100644
--- a/engines/titanic/sound/seasonal_music_player.cpp
+++ b/engines/titanic/sound/seasonal_music_player.cpp
@@ -90,15 +90,15 @@ bool CSeasonalMusicPlayer::ChangeSeasonMsg(CChangeSeasonMsg *msg) {
bool CSeasonalMusicPlayer::ArboretumGateMsg(CArboretumGateMsg *msg) {
CChangeMusicMsg changeMsg;
- changeMsg._flags = msg->_value ? 2 : 1;
+ changeMsg._action = msg->_value ? MUSIC_START : MUSIC_STOP;
changeMsg.execute(this);
return true;
}
bool CSeasonalMusicPlayer::ChangeMusicMsg(CChangeMusicMsg *msg) {
- if (_isRepeated && msg->_flags == 1) {
- _isRepeated = false;
+ if (_isEnabled && msg->_action == MUSIC_STOP) {
+ _isEnabled = false;
stopGlobalSound(_transition, -1);
}
@@ -118,8 +118,8 @@ bool CSeasonalMusicPlayer::ChangeMusicMsg(CChangeMusicMsg *msg) {
}
}
- if (!_isRepeated && msg->_flags == 2) {
- _isRepeated = true;
+ if (!_isEnabled && msg->_action == MUSIC_START) {
+ _isEnabled = true;
loadSound(TRANSLATE("c#64.wav", "c#47.wav"));
loadSound(TRANSLATE("c#63.wav", "c#46.wav"));
loadSound(TRANSLATE("c#65.wav", "c#48.wav"));
diff --git a/engines/titanic/sound/trigger_auto_music_player.cpp b/engines/titanic/sound/trigger_auto_music_player.cpp
index a332570aba..15f1c9f850 100644
--- a/engines/titanic/sound/trigger_auto_music_player.cpp
+++ b/engines/titanic/sound/trigger_auto_music_player.cpp
@@ -47,11 +47,11 @@ bool CTriggerAutoMusicPlayer::TriggerAutoMusicPlayerMsg(CTriggerAutoMusicPlayerM
CRoomItem *room2 = msg->_value == 2 ? locateRoom(_roomName) : findRoom();
CChangeMusicMsg changeMsg;
- changeMsg._flags = 1;
+ changeMsg._action = MUSIC_STOP;
changeMsg.execute(room1, CAutoMusicPlayer::_type,
MSGFLAG_CLASS_DEF | MSGFLAG_BREAK_IF_HANDLED | MSGFLAG_SCAN);
- changeMsg._flags = 2;
+ changeMsg._action = MUSIC_START;
changeMsg.execute(room2, CAutoMusicPlayer::_type,
MSGFLAG_CLASS_DEF | MSGFLAG_BREAK_IF_HANDLED | MSGFLAG_SCAN);
diff --git a/engines/titanic/sound/view_auto_sound_player.cpp b/engines/titanic/sound/view_auto_sound_player.cpp
index 55501fe340..3937a82ad7 100644
--- a/engines/titanic/sound/view_auto_sound_player.cpp
+++ b/engines/titanic/sound/view_auto_sound_player.cpp
@@ -53,7 +53,7 @@ bool CViewAutoSoundPlayer::EnterViewMsg(CEnterViewMsg *msg) {
if (_enabled) {
CChangeMusicMsg changeMsg;
- changeMsg._flags = 1;
+ changeMsg._action = MUSIC_STOP;
changeMsg.execute(room, CAutoMusicPlayer::_type,
MSGFLAG_CLASS_DEF |MSGFLAG_BREAK_IF_HANDLED | MSGFLAG_SCAN);
}
@@ -72,7 +72,7 @@ bool CViewAutoSoundPlayer::LeaveViewMsg(CLeaveViewMsg *msg) {
if (_enabled) {
CChangeMusicMsg changeMsg;
- changeMsg._flags = 2;
+ changeMsg._action = MUSIC_START;
changeMsg.execute(room, CAutoMusicPlayer::_type,
MSGFLAG_CLASS_DEF | MSGFLAG_BREAK_IF_HANDLED | MSGFLAG_SCAN);
}