[Scummvm-git-logs] scummvm master -> 1948b62a80f056050f94c8a56f00de58f42394b2
dreammaster
dreammaster at scummvm.org
Mon Jan 30 02:36:21 CET 2017
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
1948b62a80 TITANIC: Cleanup of music room object classes
Commit: 1948b62a80f056050f94c8a56f00de58f42394b2
https://github.com/scummvm/scummvm/commit/1948b62a80f056050f94c8a56f00de58f42394b2
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2017-01-29T20:36:15-05:00
Commit Message:
TITANIC: Cleanup of music room object classes
Changed paths:
engines/titanic/carry/phonograph_ear.cpp
engines/titanic/carry/phonograph_ear.h
engines/titanic/game/music_console_button.cpp
engines/titanic/sound/music_player.cpp
engines/titanic/sound/music_room.h
diff --git a/engines/titanic/carry/phonograph_ear.cpp b/engines/titanic/carry/phonograph_ear.cpp
index df0445d..48ed85d 100644
--- a/engines/titanic/carry/phonograph_ear.cpp
+++ b/engines/titanic/carry/phonograph_ear.cpp
@@ -32,13 +32,13 @@ END_MESSAGE_MAP()
void CPhonographEar::save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
- file->writeNumberLine(_field140, indent);
+ file->writeNumberLine(_replacementEar, indent);
CEar::save(file, indent);
}
void CPhonographEar::load(SimpleFile *file) {
file->readNumber();
- _field140 = file->readNumber();
+ _replacementEar = file->readNumber();
CEar::load(file);
}
@@ -48,8 +48,9 @@ bool CPhonographEar::CorrectMusicPlayedMsg(CCorrectMusicPlayedMsg *msg) {
}
bool CPhonographEar::PETGainedObjectMsg(CPETGainedObjectMsg *msg) {
- if (_field140) {
- _field140 = false;
+ if (_replacementEar) {
+ // Start a timer to add a replacement ear to the Phonograph
+ _replacementEar = false;
addTimer(1000);
}
diff --git a/engines/titanic/carry/phonograph_ear.h b/engines/titanic/carry/phonograph_ear.h
index b5db015..df0700c 100644
--- a/engines/titanic/carry/phonograph_ear.h
+++ b/engines/titanic/carry/phonograph_ear.h
@@ -33,10 +33,10 @@ class CPhonographEar : public CEar {
bool PETGainedObjectMsg(CPETGainedObjectMsg *msg);
bool TimerMsg(CTimerMsg *msg);
private:
- bool _field140;
+ bool _replacementEar;
public:
CLASSDEF;
- CPhonographEar() : CEar(), _field140(true) {}
+ CPhonographEar() : CEar(), _replacementEar(true) {}
/**
* Save the data for the class to file
diff --git a/engines/titanic/game/music_console_button.cpp b/engines/titanic/game/music_console_button.cpp
index 639aebd..8722028 100644
--- a/engines/titanic/game/music_console_button.cpp
+++ b/engines/titanic/game/music_console_button.cpp
@@ -60,6 +60,7 @@ bool CMusicConsoleButton::MouseButtonDownMsg(CMouseButtonDownMsg *msg) {
if (CMusicRoom::_musicHandler->checkInstrument(SNAKE)
&& CMusicRoom::_musicHandler->checkInstrument(PIANO)
&& CMusicRoom::_musicHandler->checkInstrument(BASS)) {
+ // All three instruments have the correct settings
CCorrectMusicPlayedMsg correctMsg;
correctMsg.execute(findRoom());
}
@@ -70,6 +71,7 @@ bool CMusicConsoleButton::MouseButtonDownMsg(CMouseButtonDownMsg *msg) {
bool CMusicConsoleButton::LeaveViewMsg(CLeaveViewMsg *msg) {
if (_isActive) {
+ // Stop playing the active music
CStopMusicMsg stopMsg(this);
stopMsg.execute(this);
stopMovie();
@@ -83,8 +85,6 @@ bool CMusicConsoleButton::SetMusicControlsMsg(CSetMusicControlsMsg *msg) {
CMusicRoom *musicRoom = getMusicRoom();
CQueryMusicControlSettingMsg queryMsg;
- queryMsg.execute("Bells Mute Control");
- musicRoom->setMuteControl(BELLS, queryMsg._value == 1);
queryMsg.execute("Bells Pitch Control");
musicRoom->setPitchControl(BELLS, queryMsg._value);
queryMsg.execute("Bells Speed Control");
@@ -93,9 +93,9 @@ bool CMusicConsoleButton::SetMusicControlsMsg(CSetMusicControlsMsg *msg) {
musicRoom->setInversionControl(BELLS, queryMsg._value == 1);
queryMsg.execute("Bells Direction Control");
musicRoom->setDirectionControl(BELLS, queryMsg._value == 1);
+ queryMsg.execute("Bells Mute Control");
+ musicRoom->setMuteControl(BELLS, queryMsg._value == 1);
- queryMsg.execute("Snake Mute Control");
- musicRoom->setMuteControl(SNAKE, queryMsg._value == 1);
queryMsg.execute("Snake Pitch Control");
musicRoom->setPitchControl(SNAKE, queryMsg._value);
queryMsg.execute("Snake Speed Control");
@@ -104,9 +104,9 @@ bool CMusicConsoleButton::SetMusicControlsMsg(CSetMusicControlsMsg *msg) {
musicRoom->setInversionControl(SNAKE, queryMsg._value == 1);
queryMsg.execute("Snake Direction Control");
musicRoom->setDirectionControl(SNAKE, queryMsg._value == 1);
+ queryMsg.execute("Snake Mute Control");
+ musicRoom->setMuteControl(SNAKE, queryMsg._value == 1);
- queryMsg.execute("Piano Mute Control");
- musicRoom->setMuteControl(PIANO, queryMsg._value == 1);
queryMsg.execute("Piano Pitch Control");
musicRoom->setPitchControl(PIANO, queryMsg._value);
queryMsg.execute("Piano Speed Control");
@@ -115,9 +115,9 @@ bool CMusicConsoleButton::SetMusicControlsMsg(CSetMusicControlsMsg *msg) {
musicRoom->setInversionControl(PIANO, queryMsg._value == 1);
queryMsg.execute("Piano Direction Control");
musicRoom->setDirectionControl(PIANO, queryMsg._value == 1);
+ queryMsg.execute("Piano Mute Control");
+ musicRoom->setMuteControl(PIANO, queryMsg._value == 1);
- queryMsg.execute("Bass Mute Control");
- musicRoom->setMuteControl(BASS, queryMsg._value == 1);
queryMsg.execute("Bass Pitch Control");
musicRoom->setPitchControl(BASS, queryMsg._value);
queryMsg.execute("Bass Speed Control");
@@ -126,6 +126,8 @@ bool CMusicConsoleButton::SetMusicControlsMsg(CSetMusicControlsMsg *msg) {
musicRoom->setInversionControl(BASS, queryMsg._value == 1);
queryMsg.execute("Bass Direction Control");
musicRoom->setDirectionControl(BASS, queryMsg._value == 1);
+ queryMsg.execute("Bass Mute Control");
+ musicRoom->setMuteControl(BASS, queryMsg._value == 1);
return true;
}
diff --git a/engines/titanic/sound/music_player.cpp b/engines/titanic/sound/music_player.cpp
index 5489418..a6a791f 100644
--- a/engines/titanic/sound/music_player.cpp
+++ b/engines/titanic/sound/music_player.cpp
@@ -110,6 +110,7 @@ bool CMusicPlayer::FrameMsg(CFrameMsg *msg) {
}
bool CMusicPlayer::EnterRoomMsg(CEnterRoomMsg *msg) {
+ // Set up a timer that will create a music handler
addTimer(100);
return true;
}
@@ -171,6 +172,7 @@ bool CMusicPlayer::TimerMsg(CTimerMsg *msg) {
bool CMusicPlayer::LoadSuccessMsg(CLoadSuccessMsg *msg) {
if (_isActive) {
+ // Music is meant to be playing, so restart it
CStopMusicMsg stopMsg;
stopMsg.execute(this);
CStartMusicMsg startMsg;
diff --git a/engines/titanic/sound/music_room.h b/engines/titanic/sound/music_room.h
index da9e363..f39957b 100644
--- a/engines/titanic/sound/music_room.h
+++ b/engines/titanic/sound/music_room.h
@@ -56,27 +56,37 @@ public:
/**
* Sets the speed control for a given instrument
*/
- void setSpeedControl(MusicInstrument instrument, int val) { _instruments[instrument]._speedControl = val; }
+ void setSpeedControl(MusicInstrument instrument, int val) {
+ _instruments[instrument]._speedControl = val;
+ }
/**
* Sets the pitch control for a given instrument
*/
- void setPitchControl(MusicInstrument instrument, int val) { _instruments[instrument]._pitchControl = val; }
+ void setPitchControl(MusicInstrument instrument, int val) {
+ _instruments[instrument]._pitchControl = val;
+ }
/**
* Sets the direction control for a given instrument
*/
- void setDirectionControl(MusicInstrument instrument, bool val) { _instruments[instrument]._directionControl = val; }
+ void setDirectionControl(MusicInstrument instrument, bool val) {
+ _instruments[instrument]._directionControl = val;
+ }
/**
* Sets the inversion control for a given instrument
*/
- void setInversionControl(MusicInstrument instrument, bool val) { _instruments[instrument]._inversionControl = val; }
+ void setInversionControl(MusicInstrument instrument, bool val) {
+ _instruments[instrument]._inversionControl = val;
+ }
/**
* Sets the mute control for a given instrument
*/
- void setMuteControl(MusicInstrument instrument, bool val) { _instruments[instrument]._muteControl = val; }
+ void setMuteControl(MusicInstrument instrument, bool val) {
+ _instruments[instrument]._muteControl = val;
+ }
/**
* Sets up the music controls
More information about the Scummvm-git-logs
mailing list