aboutsummaryrefslogtreecommitdiff
path: root/engines/titanic
diff options
context:
space:
mode:
authorPaul Gilbert2017-01-29 19:27:11 -0500
committerPaul Gilbert2017-01-29 19:27:11 -0500
commit6af5b08014e6573ccb9735ce3e4e2da2c141c857 (patch)
tree41b05ce04050dae74ad8d53ac3ab0b7ef0127c6a /engines/titanic
parent5095f4c00d1b5ffd1dab06f20332500cafc84e74 (diff)
downloadscummvm-rg350-6af5b08014e6573ccb9735ce3e4e2da2c141c857.tar.gz
scummvm-rg350-6af5b08014e6573ccb9735ce3e4e2da2c141c857.tar.bz2
scummvm-rg350-6af5b08014e6573ccb9735ce3e4e2da2c141c857.zip
TITANIC: Fix all music instrument properties that are bool
Diffstat (limited to 'engines/titanic')
-rw-r--r--engines/titanic/carry/phonograph_cylinder.cpp12
-rw-r--r--engines/titanic/carry/phonograph_cylinder.h16
-rw-r--r--engines/titanic/game/music_console_button.cpp24
-rw-r--r--engines/titanic/sound/music_room.cpp29
-rw-r--r--engines/titanic/sound/music_room.h22
-rw-r--r--engines/titanic/sound/music_room_handler.cpp17
-rw-r--r--engines/titanic/sound/music_room_handler.h33
7 files changed, 73 insertions, 80 deletions
diff --git a/engines/titanic/carry/phonograph_cylinder.cpp b/engines/titanic/carry/phonograph_cylinder.cpp
index 777aa8be5b..67ea301681 100644
--- a/engines/titanic/carry/phonograph_cylinder.cpp
+++ b/engines/titanic/carry/phonograph_cylinder.cpp
@@ -35,15 +35,15 @@ BEGIN_MESSAGE_MAP(CPhonographCylinder, CCarry)
END_MESSAGE_MAP()
CPhonographCylinder::CPhonographCylinder() : CCarry(),
- _bellsMuteControl(false), _bellsPitchControl(false),
- _bellsSpeedControl(false), _bellsDirectionControl(false),
+ _bellsMuteControl(false), _bellsPitchControl(0),
+ _bellsSpeedControl(0), _bellsDirectionControl(false),
_bellsInversionControl(false), _snakeMuteControl(false),
- _snakeSpeedControl(false), _snakePitchControl(false),
+ _snakeSpeedControl(0), _snakePitchControl(0),
_snakeInversionControl(false), _snakeDirectionControl(false),
- _pianoMuteControl(false), _pianoSpeedControl(false),
- _pianoPitchControl(false), _pianoInversionControl(false),
+ _pianoMuteControl(false), _pianoSpeedControl(0),
+ _pianoPitchControl(0), _pianoInversionControl(false),
_pianoDirectionControl(false), _bassMuteControl(false),
- _bassSpeedControl(false), _bassPitchControl(false),
+ _bassSpeedControl(0), _bassPitchControl(0),
_bassInversionControl(false) {
}
diff --git a/engines/titanic/carry/phonograph_cylinder.h b/engines/titanic/carry/phonograph_cylinder.h
index bbb1524cb5..086dedd2fe 100644
--- a/engines/titanic/carry/phonograph_cylinder.h
+++ b/engines/titanic/carry/phonograph_cylinder.h
@@ -36,24 +36,24 @@ class CPhonographCylinder : public CCarry {
bool ErasePhonographCylinderMsg(CErasePhonographCylinderMsg *msg);
private:
CString _itemName;
+ int _bellsPitchControl;
+ int _bellsSpeedControl;
bool _bellsMuteControl;
- bool _bellsPitchControl;
- bool _bellsSpeedControl;
bool _bellsDirectionControl;
bool _bellsInversionControl;
+ int _snakeSpeedControl;
+ int _snakePitchControl;
bool _snakeMuteControl;
- bool _snakeSpeedControl;
- bool _snakePitchControl;
bool _snakeInversionControl;
bool _snakeDirectionControl;
+ int _pianoSpeedControl;
+ int _pianoPitchControl;
bool _pianoMuteControl;
- bool _pianoSpeedControl;
- bool _pianoPitchControl;
bool _pianoInversionControl;
bool _pianoDirectionControl;
+ int _bassSpeedControl;
+ int _bassPitchControl;
bool _bassMuteControl;
- bool _bassSpeedControl;
- bool _bassPitchControl;
bool _bassInversionControl;
bool _bassDirectionControl;
public:
diff --git a/engines/titanic/game/music_console_button.cpp b/engines/titanic/game/music_console_button.cpp
index 7a1aed0067..639aebd9c9 100644
--- a/engines/titanic/game/music_console_button.cpp
+++ b/engines/titanic/game/music_console_button.cpp
@@ -84,48 +84,48 @@ bool CMusicConsoleButton::SetMusicControlsMsg(CSetMusicControlsMsg *msg) {
CQueryMusicControlSettingMsg queryMsg;
queryMsg.execute("Bells Mute Control");
- musicRoom->setMuteControl(BELLS, queryMsg._value == 1 ? 1 : 0);
+ musicRoom->setMuteControl(BELLS, queryMsg._value == 1);
queryMsg.execute("Bells Pitch Control");
musicRoom->setPitchControl(BELLS, queryMsg._value);
queryMsg.execute("Bells Speed Control");
musicRoom->setSpeedControl(BELLS, queryMsg._value);
queryMsg.execute("Bells Inversion Control");
- musicRoom->setInversionControl(BELLS, queryMsg._value == 0 ? 1 : 0);
+ musicRoom->setInversionControl(BELLS, queryMsg._value == 1);
queryMsg.execute("Bells Direction Control");
- musicRoom->setDirectionControl(BELLS, queryMsg._value == 0 ? 1 : 0);
+ musicRoom->setDirectionControl(BELLS, queryMsg._value == 1);
queryMsg.execute("Snake Mute Control");
- musicRoom->setMuteControl(SNAKE, queryMsg._value == 1 ? 1 : 0);
+ musicRoom->setMuteControl(SNAKE, queryMsg._value == 1);
queryMsg.execute("Snake Pitch Control");
musicRoom->setPitchControl(SNAKE, queryMsg._value);
queryMsg.execute("Snake Speed Control");
musicRoom->setSpeedControl(SNAKE, queryMsg._value);
queryMsg.execute("Snake Inversion Control");
- musicRoom->setInversionControl(SNAKE, queryMsg._value == 0 ? 1 : 0);
+ musicRoom->setInversionControl(SNAKE, queryMsg._value == 1);
queryMsg.execute("Snake Direction Control");
- musicRoom->setDirectionControl(SNAKE, queryMsg._value == 0 ? 1 : 0);
+ musicRoom->setDirectionControl(SNAKE, queryMsg._value == 1);
queryMsg.execute("Piano Mute Control");
- musicRoom->setMuteControl(PIANO, queryMsg._value == 1 ? 1 : 0);
+ musicRoom->setMuteControl(PIANO, queryMsg._value == 1);
queryMsg.execute("Piano Pitch Control");
musicRoom->setPitchControl(PIANO, queryMsg._value);
queryMsg.execute("Piano Speed Control");
musicRoom->setSpeedControl(PIANO, queryMsg._value);
queryMsg.execute("Piano Inversion Control");
- musicRoom->setInversionControl(PIANO, queryMsg._value == 0 ? 1 : 0);
+ musicRoom->setInversionControl(PIANO, queryMsg._value == 1);
queryMsg.execute("Piano Direction Control");
- musicRoom->setDirectionControl(PIANO, queryMsg._value == 0 ? 1 : 0);
+ musicRoom->setDirectionControl(PIANO, queryMsg._value == 1);
queryMsg.execute("Bass Mute Control");
- musicRoom->setMuteControl(BASS, queryMsg._value == 1 ? 1 : 0);
+ musicRoom->setMuteControl(BASS, queryMsg._value == 1);
queryMsg.execute("Bass Pitch Control");
musicRoom->setPitchControl(BASS, queryMsg._value);
queryMsg.execute("Bass Speed Control");
musicRoom->setSpeedControl(BASS, queryMsg._value);
queryMsg.execute("Bass Inversion Control");
- musicRoom->setInversionControl(BASS, queryMsg._value == 0 ? 1 : 0);
+ musicRoom->setInversionControl(BASS, queryMsg._value == 1);
queryMsg.execute("Bass Direction Control");
- musicRoom->setDirectionControl(BASS, queryMsg._value == 0 ? 1 : 0);
+ musicRoom->setDirectionControl(BASS, queryMsg._value == 1);
return true;
}
diff --git a/engines/titanic/sound/music_room.cpp b/engines/titanic/sound/music_room.cpp
index b682f00c76..9db8900d54 100644
--- a/engines/titanic/sound/music_room.cpp
+++ b/engines/titanic/sound/music_room.cpp
@@ -32,7 +32,6 @@ CMusicRoomHandler *CMusicRoom::_musicHandler;
CMusicRoom::CMusicRoom(CGameManager *gameManager) :
_gameManager(gameManager) {
_sound = &_gameManager->_sound;
- _controls.resize(4);
}
CMusicRoom::~CMusicRoom() {
@@ -65,25 +64,25 @@ void CMusicRoom::setupMusic(int volume) {
_musicHandler->setPitchControl2(PIANO, 0);
_musicHandler->setPitchControl2(BELLS, 1);
- _musicHandler->setInversionControl2(BELLS, 1);
- _musicHandler->setInversionControl2(SNAKE, 0);
- _musicHandler->setInversionControl2(PIANO, 1);
- _musicHandler->setInversionControl2(BASS, 0);
+ _musicHandler->setInversionControl2(BELLS, true);
+ _musicHandler->setInversionControl2(SNAKE, false);
+ _musicHandler->setInversionControl2(PIANO, true);
+ _musicHandler->setInversionControl2(BASS, false);
- _musicHandler->setDirectionControl2(BELLS, 0);
- _musicHandler->setDirectionControl2(SNAKE, 0);
- _musicHandler->setDirectionControl2(PIANO, 1);
- _musicHandler->setDirectionControl2(BASS, 1);
+ _musicHandler->setDirectionControl2(BELLS, false);
+ _musicHandler->setDirectionControl2(SNAKE, false);
+ _musicHandler->setDirectionControl2(PIANO, true);
+ _musicHandler->setDirectionControl2(BASS, true);
// Set up the current control values
for (MusicInstrument idx = BELLS; idx <= BASS;
idx = (MusicInstrument)((int)idx + 1)) {
- Controls &controls = _controls[idx];
- _musicHandler->setSpeedControl(idx, controls._speedControl);
- _musicHandler->setPitchControl(idx, controls._pitchControl);
- _musicHandler->setDirectionControl(idx, controls._directionControl);
- _musicHandler->setInversionControl(idx, controls._inversionControl);
- _musicHandler->setMuteControl(idx, controls._muteControl);
+ MusicRoomInstrument &instr = _instruments[idx];
+ _musicHandler->setSpeedControl(idx, instr._speedControl);
+ _musicHandler->setPitchControl(idx, instr._pitchControl);
+ _musicHandler->setDirectionControl(idx, instr._directionControl);
+ _musicHandler->setInversionControl(idx, instr._inversionControl);
+ _musicHandler->setMuteControl(idx, instr._muteControl);
}
_musicHandler->createWaveFile(volume);
diff --git a/engines/titanic/sound/music_room.h b/engines/titanic/sound/music_room.h
index 0831d7bae7..da9e363850 100644
--- a/engines/titanic/sound/music_room.h
+++ b/engines/titanic/sound/music_room.h
@@ -32,18 +32,8 @@ class CGameManager;
class CSound;
class CMusicRoom {
- struct Controls {
- int _speedControl;
- int _pitchControl;
- int _directionControl;
- int _inversionControl;
- int _muteControl;
-
- Controls() : _speedControl(0), _pitchControl(0), _directionControl(0),
- _inversionControl(0), _muteControl(0) {}
- };
private:
- Common::Array<Controls> _controls;
+ MusicRoomInstrument _instruments[4];
public:
static CMusicRoomHandler *_musicHandler;
public:
@@ -66,27 +56,27 @@ public:
/**
* Sets the speed control for a given instrument
*/
- void setSpeedControl(MusicInstrument instrument, int val) { _controls[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) { _controls[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, int val) { _controls[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, int val) { _controls[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, int val) { _controls[instrument]._muteControl = val; }
+ void setMuteControl(MusicInstrument instrument, bool val) { _instruments[instrument]._muteControl = val; }
/**
* Sets up the music controls
diff --git a/engines/titanic/sound/music_room_handler.cpp b/engines/titanic/sound/music_room_handler.cpp
index 450cc896d0..78c5e37e09 100644
--- a/engines/titanic/sound/music_room_handler.cpp
+++ b/engines/titanic/sound/music_room_handler.cpp
@@ -86,8 +86,11 @@ void CMusicRoomHandler::stop() {
}
bool CMusicRoomHandler::checkInstrument(MusicInstrument instrument) const {
- // TODO
- return false;
+ return (_array1[instrument]._speedControl + _array2[instrument]._speedControl) == 0
+ && (_array1[instrument]._pitchControl + _array2[instrument]._pitchControl) == 0
+ && _array1[instrument]._directionControl == _array2[instrument]._directionControl
+ && _array1[instrument]._inversionControl == _array2[instrument]._inversionControl
+ && _array1[instrument]._muteControl == _array2[instrument]._muteControl;
}
void CMusicRoomHandler::setSpeedControl2(MusicInstrument instrument, int value) {
@@ -100,12 +103,12 @@ void CMusicRoomHandler::setPitchControl2(MusicInstrument instrument, int value)
_array2[instrument]._pitchControl = value * 3;
}
-void CMusicRoomHandler::setInversionControl2(MusicInstrument instrument, int value) {
+void CMusicRoomHandler::setInversionControl2(MusicInstrument instrument, bool value) {
if (instrument >= BELLS && instrument <= BASS && value >= -2 && value <= 2)
_array2[instrument]._inversionControl = value;
}
-void CMusicRoomHandler::setDirectionControl2(MusicInstrument instrument, int value) {
+void CMusicRoomHandler::setDirectionControl2(MusicInstrument instrument, bool value) {
if (instrument >= BELLS && instrument <= BASS && value >= -2 && value <= 2)
_array2[instrument]._directionControl = value;
}
@@ -120,17 +123,17 @@ void CMusicRoomHandler::setSpeedControl(MusicInstrument instrument, int value) {
_array1[instrument]._speedControl = value;
}
-void CMusicRoomHandler::setDirectionControl(MusicInstrument instrument, int value) {
+void CMusicRoomHandler::setDirectionControl(MusicInstrument instrument, bool value) {
if (instrument >= BELLS && instrument <= BASS && value >= -2 && value <= 2)
_array1[instrument]._directionControl = value;
}
-void CMusicRoomHandler::setInversionControl(MusicInstrument instrument, int value) {
+void CMusicRoomHandler::setInversionControl(MusicInstrument instrument, bool value) {
if (instrument >= BELLS && instrument <= BASS && value >= -2 && value <= 2)
_array1[instrument]._inversionControl = value;
}
-void CMusicRoomHandler::setMuteControl(MusicInstrument instrument, int value) {
+void CMusicRoomHandler::setMuteControl(MusicInstrument instrument, bool value) {
if (instrument >= BELLS && instrument <= BASS && value >= -2 && value <= 2)
_array1[instrument]._muteControl = value;
}
diff --git a/engines/titanic/sound/music_room_handler.h b/engines/titanic/sound/music_room_handler.h
index 53ed2806f7..49b9ec836c 100644
--- a/engines/titanic/sound/music_room_handler.h
+++ b/engines/titanic/sound/music_room_handler.h
@@ -33,16 +33,17 @@ class CSoundManager;
enum MusicInstrument { BELLS = 0, SNAKE = 1, PIANO = 2, BASS = 3 };
+struct MusicRoomInstrument {
+ int _pitchControl;
+ int _speedControl;
+ bool _directionControl;
+ bool _inversionControl;
+ bool _muteControl;
+ MusicRoomInstrument() : _pitchControl(0), _speedControl(0), _directionControl(false),
+ _inversionControl(false), _muteControl(false) {}
+};
+
class CMusicRoomHandler {
- struct Controls {
- int _pitchControl;
- int _speedControl;
- int _directionControl;
- int _inversionControl;
- int _muteControl;
- Controls() : _pitchControl(0), _speedControl(0), _directionControl(0),
- _inversionControl(0), _muteControl(0) {}
- };
struct Array5Entry {
int _v1;
int _v2;
@@ -52,8 +53,8 @@ private:
CProjectItem *_project;
CSoundManager *_soundManager;
CMusicWave *_musicWaves[4];
- Controls _array1[4];
- Controls _array2[4];
+ MusicRoomInstrument _array1[4];
+ MusicRoomInstrument _array2[4];
Array5Entry _array5[4];
bool _stopWaves;
CWaveFile *_waveFile;
@@ -110,12 +111,12 @@ public:
/**
* Sets the inversion control value
*/
- void setInversionControl2(MusicInstrument instrument, int value);
+ void setInversionControl2(MusicInstrument instrument, bool value);
/**
* Sets the direction control value
*/
- void setDirectionControl2(MusicInstrument instrument, int value);
+ void setDirectionControl2(MusicInstrument instrument, bool value);
/**
* Sets the pitch control value
@@ -130,17 +131,17 @@ public:
/**
* Sets the direction control value
*/
- void setDirectionControl(MusicInstrument instrument, int value);
+ void setDirectionControl(MusicInstrument instrument, bool value);
/**
* Sets the inversion control value
*/
- void setInversionControl(MusicInstrument instrument, int value);
+ void setInversionControl(MusicInstrument instrument, bool value);
/**
* Sets the mute control value
*/
- void setMuteControl(MusicInstrument instrument, int value);
+ void setMuteControl(MusicInstrument instrument, bool value);
};
} // End of namespace Titanic