aboutsummaryrefslogtreecommitdiff
path: root/engines/titanic
diff options
context:
space:
mode:
authorPaul Gilbert2017-01-29 18:58:36 -0500
committerPaul Gilbert2017-01-29 18:58:36 -0500
commit5095f4c00d1b5ffd1dab06f20332500cafc84e74 (patch)
tree9eb53580015a0809d43a3f9dcafe78c940b6f124 /engines/titanic
parente7446adaf2b734350110d84eb43252639d7805e7 (diff)
downloadscummvm-rg350-5095f4c00d1b5ffd1dab06f20332500cafc84e74.tar.gz
scummvm-rg350-5095f4c00d1b5ffd1dab06f20332500cafc84e74.tar.bz2
scummvm-rg350-5095f4c00d1b5ffd1dab06f20332500cafc84e74.zip
TITANIC: Cleanup of music instrument settings code
Diffstat (limited to 'engines/titanic')
-rw-r--r--engines/titanic/gfx/music_control.cpp2
-rw-r--r--engines/titanic/gfx/music_control.h2
-rw-r--r--engines/titanic/sound/music_room.cpp6
-rw-r--r--engines/titanic/sound/music_room.h29
-rw-r--r--engines/titanic/sound/music_room_handler.cpp56
-rw-r--r--engines/titanic/sound/music_room_handler.h49
6 files changed, 92 insertions, 52 deletions
diff --git a/engines/titanic/gfx/music_control.cpp b/engines/titanic/gfx/music_control.cpp
index 26f27666ba..40a9f89789 100644
--- a/engines/titanic/gfx/music_control.cpp
+++ b/engines/titanic/gfx/music_control.cpp
@@ -45,7 +45,7 @@ void CMusicControl::save(SimpleFile *file, int indent) {
void CMusicControl::load(SimpleFile *file) {
file->readNumber();
- _controlArea = (MusicControlArea)file->readNumber();
+ _controlArea = (MusicInstrument)file->readNumber();
_controlVal = file->readNumber();
_controlMax = file->readNumber();
_enabled = file->readNumber();
diff --git a/engines/titanic/gfx/music_control.h b/engines/titanic/gfx/music_control.h
index b33b4ae809..3da063af19 100644
--- a/engines/titanic/gfx/music_control.h
+++ b/engines/titanic/gfx/music_control.h
@@ -33,7 +33,7 @@ class CMusicControl : public CBackground {
bool MouseButtonDownMsg(CMouseButtonDownMsg *msg);
bool MouseDoubleClickMsg(CMouseDoubleClickMsg *msg);
public:
- MusicControlArea _controlArea;
+ MusicInstrument _controlArea;
int _controlVal;
int _controlMax;
bool _enabled;
diff --git a/engines/titanic/sound/music_room.cpp b/engines/titanic/sound/music_room.cpp
index 7f4ffdc228..b682f00c76 100644
--- a/engines/titanic/sound/music_room.cpp
+++ b/engines/titanic/sound/music_room.cpp
@@ -54,6 +54,7 @@ void CMusicRoom::destroyMusicHandler() {
void CMusicRoom::setupMusic(int volume) {
if (_musicHandler) {
+ // Set up the control values that form the correct settings
_musicHandler->setSpeedControl2(BELLS, 0);
_musicHandler->setSpeedControl2(SNAKE, 1);
_musicHandler->setSpeedControl2(PIANO, -1);
@@ -74,8 +75,9 @@ void CMusicRoom::setupMusic(int volume) {
_musicHandler->setDirectionControl2(PIANO, 1);
_musicHandler->setDirectionControl2(BASS, 1);
- for (MusicControlArea idx = BELLS; idx <= BASS;
- idx = (MusicControlArea)((int)idx + 1)) {
+ // 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);
diff --git a/engines/titanic/sound/music_room.h b/engines/titanic/sound/music_room.h
index 95557b6983..0831d7bae7 100644
--- a/engines/titanic/sound/music_room.h
+++ b/engines/titanic/sound/music_room.h
@@ -63,11 +63,30 @@ public:
*/
void destroyMusicHandler();
- void setSpeedControl(MusicControlArea index, int val) { _controls[index]._speedControl = val; }
- void setPitchControl(MusicControlArea index, int val) { _controls[index]._pitchControl = val; }
- void setDirectionControl(MusicControlArea index, int val) { _controls[index]._directionControl = val; }
- void setInversionControl(MusicControlArea index, int val) { _controls[index]._inversionControl = val; }
- void setMuteControl(MusicControlArea index, int val) { _controls[index]._muteControl = val; }
+ /**
+ * Sets the speed control for a given instrument
+ */
+ void setSpeedControl(MusicInstrument instrument, int val) { _controls[instrument]._speedControl = val; }
+
+ /**
+ * Sets the pitch control for a given instrument
+ */
+ void setPitchControl(MusicInstrument instrument, int val) { _controls[instrument]._pitchControl = val; }
+
+ /**
+ * Sets the direction control for a given instrument
+ */
+ void setDirectionControl(MusicInstrument instrument, int val) { _controls[instrument]._directionControl = val; }
+
+ /**
+ * Sets the inversion control for a given instrument
+ */
+ void setInversionControl(MusicInstrument instrument, int val) { _controls[instrument]._inversionControl = val; }
+
+ /**
+ * Sets the mute control for a given instrument
+ */
+ void setMuteControl(MusicInstrument instrument, int val) { _controls[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 9db1bacf96..450cc896d0 100644
--- a/engines/titanic/sound/music_room_handler.cpp
+++ b/engines/titanic/sound/music_room_handler.cpp
@@ -85,54 +85,54 @@ void CMusicRoomHandler::stop() {
}
}
-bool CMusicRoomHandler::checkInstrument(MusicControlArea area) const {
+bool CMusicRoomHandler::checkInstrument(MusicInstrument instrument) const {
// TODO
return false;
}
-void CMusicRoomHandler::setSpeedControl2(MusicControlArea area, int value) {
- if (area >= 0 && area <= 3 && value >= -2 && value <= 2)
- _array2[area]._speedControl = value;
+void CMusicRoomHandler::setSpeedControl2(MusicInstrument instrument, int value) {
+ if (instrument >= BELLS && instrument <= BASS && value >= -2 && value <= 2)
+ _array2[instrument]._speedControl = value;
}
-void CMusicRoomHandler::setPitchControl2(MusicControlArea area, int value) {
- if (area >= 0 && area <= 3 && value >= -2 && value <= 2)
- _array2[area]._pitchControl = value * 3;
+void CMusicRoomHandler::setPitchControl2(MusicInstrument instrument, int value) {
+ if (instrument >= BELLS && instrument <= BASS && value >= -2 && value <= 2)
+ _array2[instrument]._pitchControl = value * 3;
}
-void CMusicRoomHandler::setInversionControl2(MusicControlArea area, int value) {
- if (area >= 0 && area <= 3 && value >= -2 && value <= 2)
- _array2[area]._inversionControl = value;
+void CMusicRoomHandler::setInversionControl2(MusicInstrument instrument, int value) {
+ if (instrument >= BELLS && instrument <= BASS && value >= -2 && value <= 2)
+ _array2[instrument]._inversionControl = value;
}
-void CMusicRoomHandler::setDirectionControl2(MusicControlArea area, int value) {
- if (area >= 0 && area <= 3 && value >= -2 && value <= 2)
- _array2[area]._directionControl = value;
+void CMusicRoomHandler::setDirectionControl2(MusicInstrument instrument, int value) {
+ if (instrument >= BELLS && instrument <= BASS && value >= -2 && value <= 2)
+ _array2[instrument]._directionControl = value;
}
-void CMusicRoomHandler::setPitchControl(MusicControlArea area, int value) {
- if (area >= 0 && area <= 3 && value >= -2 && value <= 2)
- _array1[area]._pitchControl = value;
+void CMusicRoomHandler::setPitchControl(MusicInstrument instrument, int value) {
+ if (instrument >= BELLS && instrument <= BASS && value >= -2 && value <= 2)
+ _array1[instrument]._pitchControl = value;
}
-void CMusicRoomHandler::setSpeedControl(MusicControlArea area, int value) {
- if (area >= 0 && area <= 3 && value >= -2 && value <= 2)
- _array1[area]._speedControl = value;
+void CMusicRoomHandler::setSpeedControl(MusicInstrument instrument, int value) {
+ if (instrument >= BELLS && instrument <= BASS && value >= -2 && value <= 2)
+ _array1[instrument]._speedControl = value;
}
-void CMusicRoomHandler::setDirectionControl(MusicControlArea area, int value) {
- if (area >= 0 && area <= 3 && value >= -2 && value <= 2)
- _array1[area]._directionControl = value;
+void CMusicRoomHandler::setDirectionControl(MusicInstrument instrument, int value) {
+ if (instrument >= BELLS && instrument <= BASS && value >= -2 && value <= 2)
+ _array1[instrument]._directionControl = value;
}
-void CMusicRoomHandler::setInversionControl(MusicControlArea area, int value) {
- if (area >= 0 && area <= 3 && value >= -2 && value <= 2)
- _array1[area]._inversionControl = value;
+void CMusicRoomHandler::setInversionControl(MusicInstrument instrument, int value) {
+ if (instrument >= BELLS && instrument <= BASS && value >= -2 && value <= 2)
+ _array1[instrument]._inversionControl = value;
}
-void CMusicRoomHandler::setMuteControl(MusicControlArea area, int value) {
- if (area >= 0 && area <= 3 && value >= -2 && value <= 2)
- _array1[area]._muteControl = value;
+void CMusicRoomHandler::setMuteControl(MusicInstrument instrument, int value) {
+ if (instrument >= BELLS && instrument <= BASS && value >= -2 && value <= 2)
+ _array1[instrument]._muteControl = value;
}
bool CMusicRoomHandler::isBusy() {
diff --git a/engines/titanic/sound/music_room_handler.h b/engines/titanic/sound/music_room_handler.h
index 395076bd0f..53ed2806f7 100644
--- a/engines/titanic/sound/music_room_handler.h
+++ b/engines/titanic/sound/music_room_handler.h
@@ -31,7 +31,7 @@ namespace Titanic {
class CProjectItem;
class CSoundManager;
-enum MusicControlArea { BELLS = 0, SNAKE = 1, PIANO = 2, BASS = 3 };
+enum MusicInstrument { BELLS = 0, SNAKE = 1, PIANO = 2, BASS = 3 };
class CMusicRoomHandler {
struct Controls {
@@ -95,33 +95,52 @@ public:
/**
* Checks the specified instrument to see if it's settings are "correct"
*/
- bool checkInstrument(MusicControlArea area) const;
+ bool checkInstrument(MusicInstrument instrument) const;
/**
- * Set a setting
+ * Sets the speed control value
*/
- void setSpeedControl2(MusicControlArea area, int value);
+ void setSpeedControl2(MusicInstrument instrument, int value);
/**
- * Set a setting
+ * Sets the pitch control value
*/
- void setPitchControl2(MusicControlArea area, int value);
+ void setPitchControl2(MusicInstrument instrument, int value);
/**
- * Set a setting
+ * Sets the inversion control value
*/
- void setInversionControl2(MusicControlArea area, int value);
+ void setInversionControl2(MusicInstrument instrument, int value);
/**
- * Set a setting
+ * Sets the direction control value
*/
- void setDirectionControl2(MusicControlArea area, int value);
+ void setDirectionControl2(MusicInstrument instrument, int value);
- void setPitchControl(MusicControlArea area, int value);
- void setSpeedControl(MusicControlArea area, int value);
- void setDirectionControl(MusicControlArea area, int value);
- void setInversionControl(MusicControlArea area, int value);
- void setMuteControl(MusicControlArea area, int value);
+ /**
+ * Sets the pitch control value
+ */
+ void setPitchControl(MusicInstrument instrument, int value);
+
+ /**
+ * Sets the speed control value
+ */
+ void setSpeedControl(MusicInstrument instrument, int value);
+
+ /**
+ * Sets the direction control value
+ */
+ void setDirectionControl(MusicInstrument instrument, int value);
+
+ /**
+ * Sets the inversion control value
+ */
+ void setInversionControl(MusicInstrument instrument, int value);
+
+ /**
+ * Sets the mute control value
+ */
+ void setMuteControl(MusicInstrument instrument, int value);
};
} // End of namespace Titanic